/* ATOM Christmas Plaza prototype (Direction C: Voxel plaza) 0.5.2: layout and UI over the 3D canvas.
   Flat cube look: solid colours, square corners, hard offset shadows. No blur, no glow, no gradients. */
:root {
  --navy: #0a0d45;
  --ink: #05062b;
  --snow: #f2f6ff;
  --shade: #aab7e6;
  --stone: #3a45a8;
  --lime: #abff35;
  --red: #d8412f;
  --red-dark: #a82b20;
  --yellow: #ffd23f;
  --pine: #1f7a4d;
  --f-ui: 'Noto Sans Myanmar', 'Myanmar Text', 'Myanmar Sangam MN', Padauk, system-ui, sans-serif;
  --f-num: 'Trebuchet MS', Verdana, 'Noto Sans Myanmar', system-ui, sans-serif;
  --safe-t: 0px;
  --safe-b: 0px;
}
@supports (top: env(safe-area-inset-top)) {
  :root { --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px); }
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; overflow: hidden; overscroll-behavior: none; }
body {
  background: var(--ink); color: var(--navy); font-family: var(--f-ui);
  display: grid; place-items: center;
  -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%; text-size-adjust: 100%;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
[hidden] { display: none !important; }
button { -webkit-appearance: none; appearance: none; }

/* the game column */
.frame {
  position: relative; overflow: hidden; background: var(--navy);
  width: 100vw; height: 100%; height: 100dvh;
  touch-action: none;
}
@media (min-aspect-ratio: 10/16) and (min-width: 500px) {
  /* computers, tablets: a phone-shaped column in the middle */
  .frame { width: 56.25vh; width: min(100vw, calc(100dvh * 9 / 16)); }
}
#world { position: absolute; top: 0; left: 0; width: 100%; height: 100%; display: block; background: var(--navy); touch-action: none; }

/* nicknames above the cats */
.names { position: absolute; top: 0; left: 0; width: 0; height: 0; pointer-events: none; }
.name {
  position: absolute; top: 0; left: 0; white-space: nowrap; will-change: transform;
  padding: 0 4px; background: var(--ink); color: var(--snow);
  font-size: 10px; font-weight: 600; line-height: 1.65;
}
.name.pop { z-index: 3; } /* a name with an emote mark lies on top of the other names */
.name.me { padding: 0 7px; background: var(--lime); color: var(--navy); font-size: 12.5px; font-weight: 800; box-shadow: 2px 2px 0 var(--ink); z-index: 4; } /* the player's own name lies on top of all the others and their marks */
/* the marker under the player's own name: a small stepped arrow pointing at the cat */
.name.me::before, .name.me::after { content: ''; position: absolute; left: 50%; background: var(--lime); }
.name.me::before { top: 100%; width: 10px; height: 4px; margin-left: -5px; box-shadow: 2px 2px 0 var(--ink); }
.name.me::after { top: calc(100% + 4px); width: 4px; height: 4px; margin-left: -2px; box-shadow: 2px 2px 0 var(--ink); }
/* the emote mark that pops above a name */
.mark { position: absolute; left: 50%; bottom: calc(100% + 4px); width: 26px; height: 26px; margin-left: -13px; padding: 3px; background: var(--snow); border: 2px solid var(--navy); box-shadow: 2px 2px 0 var(--ink); display: none; }
.mark svg { display: block; width: 100%; height: 100%; }
.name.pop .mark { display: block; animation: pop .9s steps(6) both; }
@keyframes pop { 0% { transform: translateY(8px) scale(.4); } 18% { transform: translateY(-5px) scale(1.15); } 34%, 100% { transform: translateY(0) scale(1); } }

/* counters */
.hud { position: absolute; top: 0; left: 0; right: 0; height: 0; pointer-events: none; }
.chips { position: absolute; top: calc(10px + var(--safe-t)); left: 10px; right: 13px; display: flex; gap: 7px; }
.chip {
  display: flex; align-items: center; gap: 5px; height: 32px; padding: 0 8px;
  background: var(--snow); color: var(--navy); border: 2px solid var(--navy); box-shadow: 3px 3px 0 var(--ink);
  font-family: var(--f-num); font-weight: 700; font-size: 15px; line-height: 1;
}
.chip-here { margin-left: auto; background: var(--lime); }
.chip-here small { font-size: 10px; font-weight: 700; letter-spacing: .3px; }
/* four counters in one row on a phone: a little tighter, and tighter still on the narrowest screens (room for 10/10, 10/10 and a three-figure number) */
@media (max-width: 439px) { .chips { gap: 5px; } .chip { padding: 0 5px; gap: 4px; font-size: 14px; } .chip .ico { width: 16px; height: 16px; } }
@media (max-width: 379px) { .chips { right: 11px; } .chip { padding: 0 4px; gap: 3px; } .chip-word { font-size: 10.5px; } }
@media (max-width: 339px) { .chip { font-size: 12px; padding: 0 3px; } .chip .ico { width: 13px; height: 13px; } .chip-word { display: none; } } /* very narrow phones: the tree picture alone stands for "everyone" */
.chip-word { font-family: var(--f-ui); font-size: 11px; font-weight: 700; line-height: 1.7; }
.ico { width: 18px; height: 18px; flex: none; display: block; }
.chip.bump { animation: bump .3s steps(3); }
@keyframes bump { 50% { transform: translateY(-4px); } }

.goal, .toast {
  position: absolute; top: calc(52px + var(--safe-t)); left: 50%; transform: translateX(-50%);
  width: max-content; max-width: calc(100% - 20px); margin: 0; padding: 2px 12px;
  font-size: 13px; font-weight: 700; line-height: 1.75; text-align: center;
}
.goal { background: var(--ink); color: var(--snow); border-left: 5px solid var(--lime); }
.hud.toasting .goal { visibility: hidden; } /* a toast takes the goal line's place for a moment */
.toast { background: var(--yellow); color: var(--navy); box-shadow: 3px 3px 0 var(--ink); animation: toast 1.8s steps(12) forwards; }
@keyframes toast { 0% { opacity: 0; transform: translate(-50%, 6px); } 10%, 82% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; transform: translate(-50%, 0); } }

/* the live line: one line that says what somebody just did. The goal line above has a lime stripe; this one has a
   square lime tag (LIVE, and "sample" in this prototype), so the two are told apart at a glance */
.live {
  position: absolute; top: calc(88px + var(--safe-t)); left: 10px; right: 13px; height: 30px;
  display: flex; align-items: stretch; background: var(--ink); box-shadow: 3px 3px 0 rgba(5, 6, 43, .55);
}
.live-tag { flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center; width: 44px; background: var(--lime); color: var(--navy); font-family: var(--f-num); line-height: 1; }
.live-tag b { font-size: 11px; font-weight: 700; letter-spacing: .6px; }
.live-tag small { margin-top: 2px; font-size: 9px; font-weight: 700; }
/* the line is as tall as the whole strip, so tall Burmese letters are never cut */
.live-text { flex: 1; min-width: 0; margin: 0; padding: 0 7px; color: var(--snow); font-size: 12.5px; font-weight: 600; line-height: 30px; white-space: nowrap; overflow: hidden; }
.live-text.in { animation: livein .3s steps(4); }
@keyframes livein { from { transform: translateY(8px); opacity: .35; } to { transform: none; opacity: 1; } } /* a new line steps in; the strip is never blank */
/* the zone line (0.4.0): the name of the zone the player is in, small and plain, under the live line */
.zone { position: absolute; top: calc(122px + var(--safe-t)); left: 10px; max-width: calc(100% - 23px); margin: 0; padding: 0 8px; background: var(--ink); color: var(--snow); font-size: 11.5px; font-weight: 700; line-height: 22px; white-space: nowrap; overflow: hidden; }
/* the coin counter (0.5.0): the same plain strip as the zone line, on the same row at the right; the "+2" after a grant
   is lime. Shown only while the room server is live (plaza.js). A plain look for now: the design comes later */
.coins { position: absolute; top: calc(122px + var(--safe-t)); right: 13px; margin: 0; padding: 0 8px; background: var(--ink); color: var(--snow); font-size: 11.5px; font-weight: 700; line-height: 22px; white-space: nowrap; }
.coins b { font-family: var(--f-num); font-size: 12.5px; }
.coin-add { margin-left: 6px; color: var(--lime); font-family: var(--f-num); font-size: 12.5px; }

/* joystick: a square base and a square knob */
.stick { position: absolute; width: 104px; height: 104px; margin: -52px 0 0 -52px; border: 3px solid rgba(242, 246, 255, .55); background: rgba(242, 246, 255, .1); pointer-events: none; }
.stick i { position: absolute; left: 50%; top: 50%; width: 44px; height: 44px; margin: -22px 0 0 -22px; background: var(--snow); border: 3px solid var(--navy); box-shadow: 3px 3px 0 var(--ink); }

/* controls */
.pad { position: absolute; left: 0; right: 0; bottom: 0; height: 0; }
.emote {
  position: absolute; bottom: calc(20px + var(--safe-b)); width: 52px; height: 52px; padding: 9px;
  background: var(--snow); border: 3px solid var(--navy); border-radius: 0; box-shadow: 4px 4px 0 var(--ink); cursor: pointer; touch-action: none;
}
.emote svg { display: block; width: 100%; height: 100%; pointer-events: none; }
#btn-wave { left: 12px; }
#btn-cheer { left: 76px; }
.emote.down, .action.down { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--ink); }
.action {
  position: absolute; right: 16px; bottom: calc(20px + var(--safe-b)); height: 56px;
  min-width: 132px; max-width: calc(100% - 160px); padding: 0 16px;
  background: var(--lime); color: var(--navy); border: 3px solid var(--navy); border-radius: 0; box-shadow: 4px 4px 0 var(--ink);
  font-family: var(--f-ui); font-weight: 800; font-size: 17px; line-height: 1.6; white-space: nowrap; cursor: pointer; touch-action: none;
}
@media (max-width: 379px) { .action { font-size: 15px; padding: 0 10px; min-width: 120px; } }

/* speech / info panel. z-index 5 (0.5.2): it lies over every name (3 and 4 above), so a name tag never covers its words */
.panel {
  position: absolute; left: 10px; right: 14px; bottom: calc(14px + var(--safe-b)); padding: 8px 12px 12px; z-index: 5;
  background: var(--snow); color: var(--navy); border: 3px solid var(--navy); box-shadow: 5px 5px 0 var(--ink);
}
.panel-head { display: flex; align-items: center; justify-content: space-between; }
.panel-who { margin: 0; font-size: 14px; font-weight: 800; color: var(--red-dark); line-height: 1.7; }
.btn-close {
  flex: none; margin-left: 10px; min-height: 44px; min-width: 84px; padding: 4px 14px; border: 2px solid var(--navy); border-radius: 0; background: var(--snow);
  font-family: var(--f-ui); font-weight: 700; font-size: 14px; line-height: 1.7; color: var(--navy); cursor: pointer;
}
.panel-text { margin: 4px 0 0; font-size: 15px; font-weight: 600; line-height: 1.8; }
.panel-more { display: block; overflow-wrap: anywhere; } /* a second line of plain text (0.4.0: the next Live, as written in config/live.json) */
.nw { white-space: nowrap; } /* one Burmese word: lines break only at the spaces between words */
.panel-choices:empty { display: none; }
/* a panel with choices (wish, photo) stands above the row of buttons: no choice lies where the thumb has just pressed the action button */
.panel.pick { bottom: calc(92px + var(--safe-b)); }
.panel-choices .btn { display: block; width: 100%; min-height: 46px; margin-top: 8px; padding: 8px 14px; text-align: left; font-size: 15px; background: var(--navy); color: var(--snow); box-shadow: 3px 3px 0 var(--shade); }
/* shorter screens: the panel with choices sits at the bottom and is tighter, so the plaza above it keeps the tree in view
   (a second tap is kept off the choices by a short wait in plaza.js) */
@media (max-height: 820px) {
  .panel.pick { bottom: calc(14px + var(--safe-b)); padding-top: 6px; padding-bottom: 10px; }
  .panel.pick .panel-text { margin-top: 0; }
  .panel-choices .btn { min-height: 44px; margin-top: 6px; padding: 6px 12px; }
}
/* short screens (a small phone, or a phone inside an app's browser): the wish panel drops its title and puts the question beside the close button */
@media (max-height: 700px) {
  .panel.tight .panel-who { display: none; }
  .panel.tight .panel-head { float: right; }
  .panel.tight .panel-text { margin: 0; line-height: 44px; }
  .panel.tight .panel-choices { clear: both; }
}
@media (max-width: 339px) { .panel-choices .btn { font-size: 14px; padding-left: 10px; padding-right: 10px; } } /* the longest wish stays on one line on the narrowest phones */
/* while a choice is made on a short screen the goal line and the live line step aside, so they do not lie on the tree (plaza.js: panel) */
.frame.quiet .goal, .frame.quiet .live, .frame.quiet .toast, .frame.quiet .zone, .frame.quiet .coins { visibility: hidden; }

/* buttons on the title, end screen and panel */
.btn {
  position: relative; display: inline-block; border: 0; border-radius: 0; padding: 10px 20px; cursor: pointer; text-decoration: none;
  font-family: var(--f-ui); font-weight: 700; font-size: 16px; line-height: 1.6;
}
.btn-go { background: var(--red); color: var(--snow); border: 3px solid var(--navy); box-shadow: 4px 4px 0 var(--navy); }
.btn-go:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--navy); }
.btn-go[disabled] { background: var(--shade); color: var(--navy); box-shadow: none; cursor: default; }
.btn-ghost { background: var(--snow); color: var(--navy); border: 2px solid var(--navy); }

/* title and finish: a flat card over the dimmed plaza */
.screen {
  position: absolute; top: 0; left: 0; right: 0; bottom: 0; display: grid; place-items: center; overflow-y: auto;
  padding: calc(14px + var(--safe-t)) 14px calc(14px + var(--safe-b)); background: rgba(10, 13, 69, .78); touch-action: pan-y;
}
#screen-title { background: rgba(10, 13, 69, .5); } /* the plaza and its crowd stay visible behind the title card */
.card {
  width: 100%; max-width: 340px; padding: 16px 14px 12px; text-align: center;
  display: flex; flex-direction: column; align-items: center;
  background: var(--snow); color: var(--navy); border: 3px solid var(--navy); box-shadow: 6px 6px 0 var(--ink);
}
.kicker { margin: 0; padding: 1px 12px; background: var(--navy); color: var(--lime); font-family: var(--f-num); font-size: 13px; font-weight: 700; letter-spacing: .5px; line-height: 1.7; }
h1 { margin: 4px 0 0; font-size: 28px; font-weight: 800; line-height: 1.6; color: var(--navy); }
.end-h { font-size: 18px; font-size: min(18px, 4.7vw); }
.sub { margin: 0; font-family: var(--f-num); font-weight: 700; font-size: 15px; color: var(--red-dark); }
.choose { margin: 10px 0 5px; font-size: 14px; font-weight: 700; line-height: 1.7; }
.cats { display: grid; grid-template-columns: repeat(4, 1fr); grid-gap: 8px; width: 100%; min-height: 78px; }
.cats > i { height: 78px; border: 2px dashed rgba(10, 13, 69, .35); }
.cat { padding: 5px 4px 2px; border: 2px solid var(--navy); border-radius: 0; background: #dfe7ff; cursor: pointer; }
.cat img { display: block; width: 100%; height: 66px; object-fit: contain; pointer-events: none; -webkit-user-drag: none; }
.cat-name { display: block; font-family: var(--f-num); font-size: 11px; font-weight: 700; line-height: 1.5; white-space: nowrap; color: var(--navy); pointer-events: none; } /* the cat's name under its picture (0.4.0) */
.cat[aria-pressed=true], .nick[aria-pressed=true] { background: var(--lime); box-shadow: 3px 3px 0 var(--navy); transform: translate(-1px, -2px); }
.nicks { display: grid; grid-template-columns: repeat(3, 1fr); grid-gap: 7px; width: 100%; }
.nick { min-height: 44px; padding: 4px 2px; border: 2px solid var(--navy); border-radius: 0; background: #dfe7ff; color: var(--navy); cursor: pointer; font-family: var(--f-ui); font-size: 14px; font-weight: 700; line-height: 1.7; }
.cat[disabled] { background: none; border-style: dashed; border-color: rgba(10, 13, 69, .35); cursor: default; min-height: 78px; }
#btn-start { margin-top: 14px; min-width: 200px; font-size: 18px; }
.slow-link { display: inline-block; margin-top: 8px; padding: 9px 12px; min-height: 44px; font-size: 14px; font-weight: 700; line-height: 1.7; color: var(--navy); text-decoration: underline; }
/* tall phones: the title card sits at the bottom and the plaza (lifted by plaza.js) shows above it */
@media (min-height: 760px) { #screen-title { align-items: end; } }
.proto { margin: 12px 0 0; font-family: var(--f-num); font-size: 11px; line-height: 1.4; color: rgba(10, 13, 69, .65); }
.proto-2 { margin-top: 2px; }
.end-img { display: block; width: 72%; max-width: 250px; max-width: min(250px, calc((100vh - 400px) * .8)); max-width: min(250px, calc((100dvh - 400px) * .8)); height: auto; margin-top: 8px; border: 3px solid var(--navy); box-shadow: 4px 4px 0 var(--shade); -webkit-touch-callout: default; }
.hint { margin: 6px 0 0; font-size: 12.5px; font-weight: 600; line-height: 1.7; color: rgba(10, 13, 69, .8); }
.tags { margin: 10px 0 0; font-family: var(--f-num); font-weight: 700; font-size: 13px; color: var(--pine); }
.end-actions { display: flex; flex-wrap: wrap; width: calc(100% + 8px); margin: 10px -4px 0; }
.end-actions .btn { flex: 1 1 auto; margin: 0 4px 9px; min-height: 44px; }
.end-actions .btn-go { flex-basis: 100%; }
.end-actions .btn-ghost { padding: 8px 8px; font-size: 15px; }

/* message when 3D (WebGL) is not available */
.nogl { background: var(--navy); }
.nogl-text { margin: 12px 0 0; font-size: 16px; font-weight: 600; line-height: 1.8; }
.nogl-en { margin: 4px 0 14px; font-family: var(--f-num); font-size: 13px; line-height: 1.5; color: rgba(10, 13, 69, .7); }
.nogl .btn { min-width: 200px; margin-bottom: 6px; }

/* a phone held sideways is too short for the plaza: ask to turn it upright */
.rotate { display: none; }
@media (orientation: landscape) and (max-height: 480px) {
  .rotate {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 50; padding: 16px;
    background: var(--navy); color: var(--snow); text-align: center;
  }
  .rotate svg { width: 44px; height: 44px; }
  .rotate p { margin: 8px 0 0; font-size: 16px; font-weight: 700; line-height: 1.8; }
}

@media (prefers-reduced-motion: reduce) {
  .toast, .chip.bump, .live-text.in, .name.pop .mark { animation: none; }
}
