/* Shared surface for phone, tablet and desktop. The tiled wall continues to the edges. */
:root {
  --cabinet: min(100vw, 490px);
  --game-width: var(--cabinet);
  --porcelain: #fff4d4;
  --ticket: #f5e5bd;
  --grout: #173d39;
  --signal: #ff835b;
  --brass: #e8b757;
  --paper: #fff6db;
  --deep: #173d36;
  --ink: #233b32;
  --muted: #546354;
  --coral: #a5321d;
  --coral-bright: #ff8055;
  --shadow: 0 3px 0 #102f29;
}
@media (orientation: portrait) and (max-width: 650px) {
  :root {
    --cabinet: 100vw;
  }
}
html,
body {
  min-height: 100%;
  background-color: var(--grout);
}
body {
  width: 100%;
  max-width: none;
  margin: 0;
  min-height: 100dvh;
  box-shadow: none;
  background-image: linear-gradient(180deg, #22554d 0, #254f47 80%, #20453e 100%);
}
html {
  background-image: none;
}
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, #113a343d 1px, #83ba9a30 2px, transparent 3px),
    linear-gradient(0deg, #113a344d 1px, #9ecea932 2px, transparent 3px),
    radial-gradient(ellipse at 50% 0%, #65815f9c, transparent 71%);
  background-size:
    32px 32px,
    32px 32px,
    100% 100%;
}
#app,
.masthead {
  position: relative;
}
#app {
  width: var(--cabinet);
  margin: 0 auto;
  min-height: calc(100dvh - 51px);
  padding: 13px max(12px, env(safe-area-inset-right)) max(26px, env(safe-area-inset-bottom))
    max(12px, env(safe-area-inset-left));
}
.masthead {
  width: 100%;
  border: 0;
  box-shadow: inset 0 -1px #86b19757;
  background: #153b36e8;
  color: #fff1cd;
}
.mast-inner {
  max-width: var(--cabinet);
  margin: auto;
  padding: max(3px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 3px
    max(12px, env(safe-area-inset-left));
  min-height: 49px;
}
.wordmark {
  letter-spacing: -1px;
  font-size: 16px;
  gap: 8px;
}
.wc-symbol {
  transform: none;
  background: var(--brass);
  border-color: #ffe0a0;
  border-radius: 3px;
  padding: 4px 7px;
  box-shadow: 1px 2px #0c2d26;
}
.nav-button {
  padding: 3px 4px;
  font-weight: 800;
}
.arcade-mark {
  width: 28px;
  height: 24px;
  flex: none;
  image-rendering: pixelated;
}
.game-board {
  overflow: hidden;
  border: 1px solid var(--ink);
  border-radius: 5px;
}
.lobby-marquee {
  margin-inline: calc(-1 * var(--gutter-left)) calc(-1 * var(--gutter-right));
}
.cover-frame { margin: 0; overflow: hidden; background: #375849; }
.lobby-cover {
  display: block;
  width: 100%;
  height: clamp(150px, 25svh + env(safe-area-inset-top), 310px);
  object-fit: cover;
  object-position: center 36%;
  border-bottom: 2px solid var(--ink);
}
.title-plaque {
  position: relative;
  padding: 16px var(--gutter-right) 0 var(--gutter-left);
}
.title-tab {
  position: absolute;
  top: -13px;
  padding: 2px 8px;
  font: 800 13px / 19px var(--mono);
  color: var(--ink);
  background: #f3c556;
  border: 1px solid var(--ink);
  transform: rotate(-2deg);
}
.title-plaque h1 {
  font: 950 clamp(33px, 9vw, 47px) / 1.13 var(--sans);
  letter-spacing: -.07em;
}
.title-plaque p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.launch-pad {
  margin: 14px 0 8px;
}
.launch-main {
  width: 100%;
  display: grid;
  grid-template-columns: 42px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 9px 16px 10px;
  border: 2px solid #542f28;
  border-radius: 9px;
  color: #382b21;
  text-align: left;
  background: linear-gradient(180deg, #ffae7a 0, #ff8b60 12%, #fb724e 93%, #db5940);
  box-shadow:
    inset 0 2px #ffd2a3,
    0 4px 0 #713d2c,
    0 7px 13px #102e2938;
}
.launch-main .arcade-mark {
  width: 42px;
  height: 36px;
}
.launch-main b {
  display: block;
  font-size: 22px;
  line-height: 1.1;
  letter-spacing: -0.045em;
}
.launch-main small {
  display: block;
  font-size: 12px;
  font-weight: 700;
  margin-top: 2px;
  color: #583422;
}
.launch-main i {
  font: 900 20px var(--mono);
}
.mode-choices,
.lobby-tools {
  display: flex;
  gap: 8px;
}
.mode-choices {
  flex-direction: column;
  margin-top: 12px;
}
.mode-choices button {
  display: grid;
  grid-template-columns: 42px 1fr 18px;
  align-items: center;
  gap: 12px;
  padding: 6px 14px 6px 8px;
  text-align: left;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid #a99f82;
  border-radius: 5px;
}
.mode-choices .arcade-mark {
  width: 42px; height: 38px; padding: 6px;
  background: #d1dfbd; border-radius: 3px;
}
.mode-choices button:last-child .arcade-mark { background: #ead0a4; }
.mode-choices b, .mode-choices small { display: block; }
.mode-choices b { font-size: 16px; }
.mode-choices small { font-size: 12px; color: var(--muted); }
.mode-choices i { font: 700 24px var(--sans); color: var(--teal); }
.lobby-tools button, .rescue-link {
  min-height: 44px;
  border: 0;
  background: transparent;
  color: var(--teal);
  font-size: 13px;
  font-weight: 700;
}
.lobby-tools button {
  display: flex; align-items: center; justify-content: center; gap: 5px; flex: 1;
}
.rescue-link { display: block; margin-left: auto; }
.pass-summary {
  display: grid;
  grid-template-columns: 35px 1fr auto;
  align-items: center;
  gap: 8px;
  margin: 4px 0 11px;
  padding: 7px 9px;
  background: #1d4540df;
  color: #fff0ce;
  border: 1px solid #87a888;
  border-radius: 6px;
}
.pass-summary canvas {
  width: 32px;
  height: 41px;
  align-self: end;
}
.pass-summary > div {
  min-width: 0;
}
.pass-summary #identity-label,
.pass-summary small {
  display: block;
  overflow-wrap: anywhere;
}
.pass-summary #identity-label {
  font-size: 14px;
}
.pass-summary small {
  color: #c4d7bc;
  font-size: 11px;
}
.pass-login,
.room-exit,
.invite-link {
  border: 1px solid #9bba9a;
  border-radius: 5px;
  color: #fff2ce;
  background: #25594e;
  font-size: 13px;
  font-weight: 850;
  padding: 6px 10px;
}
.lobby-tools {
  margin-top: 12px;
}
.lobby-tools button {
  border-top: 1px solid #c5bba3;
}
.friend-ticket,
.room-pass,
.rank-card,
.recap,
.hud {
  position: relative;
  border-radius: 9px;
  border: 1px solid #918669;
  border-top: 3px solid #fdf1c9;
  background: linear-gradient(135deg, #fff6da, #f2dfae);
  box-shadow:
    0 3px 0 #172d26,
    0 6px 18px #18372c29;
}
.friend-ticket,
.room-pass {
  padding: 15px;
}
.ticket-heading {
  display: flex;
  gap: 9px;
  align-items: center;
  margin-bottom: 12px;
}
.ticket-heading .arcade-mark {
  width: 35px;
  height: 30px;
}
.ticket-heading h2 {
  font-size: 21px;
}
.ticket-heading p {
  font-size: 12px;
  color: var(--muted);
}
.tabs {
  border-radius: 7px;
  background: #e5d9b3;
  border-color: #a89f7d;
}
.tabs button {
  border-radius: 4px;
}
.field input {
  border-radius: 5px;
  border-color: #8b9079;
  box-shadow: inset 0 2px #524a3310;
}
.secondary,
.primary,
.outline,
.door-choice,
.say-buttons button,
.predict-buttons button {
  border-radius: 6px;
}
.primary {
  background: linear-gradient(#ff9b70, #f57550);
  box-shadow:
    inset 0 1px #ffcd98,
    0 3px 0 #694630;
}
.secondary {
  background: linear-gradient(#f7d288, #e6b458);
  box-shadow:
    inset 0 1px #ffe5a0,
    0 3px 0 #776644;
}
.room-top {
  margin: 5px 0 13px;
}
.view-label {
  color: #ffda85;
}
.room-exit {
  align-self: center;
  font-size: 12px;
  white-space: nowrap;
}
.code-tag {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 12px 11px;
  border-radius: 6px;
  border: 1px solid #355c48;
  color: #ffebbc;
  background: linear-gradient(130deg, #296452, #204a3f);
}
.code-tag[hidden] {
  display: none;
}
.code-tag span {
  display: block;
  color: #cbdcbf;
  font-size: 12px;
  font-weight: 800;
}
.code-tag strong {
  display: block;
  font: bold clamp(26px, 8vw, 38px) / 1.1 var(--mono);
  letter-spacing: 2px;
  color: #ffe2a0;
}
.code-tag button {
  border-color: #99b9a1;
  color: #ffefc8;
}
.invite-link {
  width: 100%;
  background: #dce8ca;
  color: #294c3f;
  border-color: #789280;
  margin: 8px 0;
}
.invite-link span {
  float: right;
}
.players {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 5px;
}
.playerbox {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: 4px 8px;
  background: #fff8df;
  border: 1px solid #bfb18a;
  border-radius: 5px;
}
.playerbox.mine {
  border-color: #376a53;
  background: #e1edcd;
}
.playerbox.empty {
  background: transparent;
  border: 1px dashed #ada389;
}
.roster-portrait {
  width: 39px;
  align-self: stretch;
  display: grid;
  place-items: end center;
  background: #dbe0b9;
  border-radius: 4px;
}
.playerbox .roster-portrait canvas {
  width: 32px;
  height: 41px;
}
.playerbox .player-info {
  display: block;
  min-width: 0;
}
.player-info small {
  display: block;
}
.playerbox .empty-avatar {
  background: #e3d5af;
  border: 0;
  border-radius: 4px;
  display: grid;
  place-items: center;
}
.match-top {
  padding: 0 2px 7px;
  margin-bottom: 0;
  gap: 8px;
  align-items: center;
}
.match-top .round-badge {
  display: flex;
  align-items: center;
  background: none;
  padding: 0;
  border: 0;
  color: #fff1c8;
}
.round-badge b {
  color: #ffd37f;
}
.round-badge span {
  font-size: 12px;
}
.match-top .timer {
  margin-left: auto;
  font-size: 14px;
  color: #ffe9b4;
}
.match-top button {
  color: #fce6bc;
  border: 1px solid #809f80;
  min-height: 40px;
}
.board-head {
  padding: 7px 10px;
  background: linear-gradient(#347166, #28594f);
  border-bottom: 1px solid #819a78;
  color: #fff0c6;
}
.board-head small {
  color: #f3da9b;
}
.queue-card {
  background: #e9dfb9;
  border-right: 1px dashed #aaa183;
  padding: 6px 5px;
}
.queue-card.mine {
  background: #f4cf8b;
}
.queue-card.claimed {
  background: #cfd1b7;
}
.queue-card b {
  font-size: 12px;
}
.queue-card .qtext {
  line-height: 1.3;
}
.hud {
  gap: 7px;
  padding: 11px;
}
.hud-title {
  border-bottom: 1px dashed #a69a7b;
  padding-bottom: 6px;
}
.hud-title h2 {
  font-size: 16px;
}
.hud-title span {
  background: #d8e5bd;
  padding: 3px 7px;
  border-radius: 4px;
  font-weight: 800;
}
.meter {
  border: 1.5px solid #50664f;
  height: 16px;
  border-radius: 4px;
  background: #dadab9;
}
.meter .fill {
  background: repeating-linear-gradient(90deg, #83ac70 0 11px, #668954 11px 13px);
}
.meter.warn .fill {
  background: repeating-linear-gradient(90deg, #de7851 0 11px, #ae573d 11px 13px);
}
.meter-top strong {
  font-size: 19px;
}
.meter-legend {
  padding-top: 2px;
}
.door-choice,
.say-buttons button,
.predict-buttons button {
  background: #f9edc8;
  border: 1px solid #899578;
}
.door-choice.selected {
  background: #32634e;
  color: #fff4d7;
}
.door-choice.selected:disabled {
  background: #32634e;
  color: #fff4d7;
}
.door-tags .tag,
.tag.dryer,
.urgent-bubble {
  border-radius: 5px;
  padding: 3px 5px;
  border-color: #4d583d;
}
.hud .chapter {
  color: #46614a;
}
.coach-strip {
  color: #203e32;
  background: #ffdb8d;
  border: 2px solid #6d623e;
  border-radius: 7px;
  padding: 8px 10px;
  margin-bottom: 9px;
}
.coach-strip strong {
  display: block;
  font-size: 15px;
}
.coach-strip p {
  font-size: 13px;
}
.lesson-target {
  outline: 3px solid #ffb73f !important;
  outline-offset: -3px;
  box-shadow: 0 0 0 2px #805322 !important;
}
.door-hotspots .lesson-target {
  background: #ffc15920;
}
.probe-verdict {
  font-size: 13px;
  background: #dce5ca;
  border-left: 4px solid #75926b;
  padding: 6px 9px;
  font-weight: 750;
  color: #324e38;
}
.probe-verdict[data-tone='miss'] {
  background: #f4d9ba;
  border-color: #b67449;
  color: #6b3e29;
}
.probe-verdict[data-tone='win'] {
  background: #ffda93;
  border-color: #b98134;
  color: #513c1e;
}
.probe-verdict:empty,
.coach-strip:empty {
  display: none;
}
.clue-box {
  background: #f1e5c0;
  border: 1px dashed #a79e7d;
  border-radius: 5px;
  padding: 6px 8px;
}
.clue-item {
  background: transparent;
}
.tag.speech {
  background: #efd1cd;
}
#kit-area:empty {
  display: none;
}
.result-slip {
  display: flex;
  gap: 10px;
  align-items: center;
  background: linear-gradient(110deg, #2b6253, #224a41);
  color: #fff2c8;
  padding: 7px 10px;
  margin: 3px 0 9px;
  border: 1px solid #8aa58a;
  border-radius: 7px;
}
.result-slip canvas {
  width: 40px;
  height: 51px;
}
.result-identity { flex: 1; min-width: 0; }
.result-identity span { font-size: 13px; overflow-wrap: anywhere; }
.result-identity h1 { margin-top: 2px; font-size: clamp(20px, 6vw, 30px); }
.result-score {
  align-self: stretch;
  display: flex;
  align-items: center;
  padding-left: 12px;
  border-left: 1px dashed #b4b998;
  font: 800 27px var(--mono);
  color: #ffdb8f;
}
.result-score small { font: 700 13px var(--sans); }
.ending {
  border: 1px solid #56624c;
  border-radius: 5px;
  overflow: hidden;
}
.ending figcaption {
  color: #403f2b;
  background: #f0d49b;
}
.rank-card,
.recap {
  padding: 13px;
}
.rank-card h2,
.recap h2 {
  font-size: 18px;
}
.rank-row.mine {
  border-radius: 4px;
}
#res-ready + .room-results-exit {
  width: 100%;
  margin-top: 7px;
}
.room-results-exit {
  border: 1px solid #91896b;
  background: #e9dfba;
  border-radius: 5px;
  font-weight: 800;
}
.practice-note {
  color: #efe7c8;
  margin-bottom: 8px;
}
dialog {
  width: min(calc(var(--cabinet) - 22px), 460px);
  max-height: calc(
    var(--visual-height, 100dvh) - max(24px, env(safe-area-inset-top)) - env(safe-area-inset-bottom)
  );
  border-radius: 11px;
  border: 2px solid #26493a;
  border-top: 6px solid #4b7963;
  background: linear-gradient(135deg, #fff7dd, #f3e1b5);
  box-shadow:
    0 6px 0 #13362b,
    0 16px 55px #102a24aa;
  overscroll-behavior: contain;
  scroll-padding-block: 12px;
}
dialog::backdrop {
  background: #0d3029ad;
  backdrop-filter: blur(2px);
}
#modal-inner {
  padding: 15px;
}
.dialog-head {
  border-bottom: 1px dashed #9e987d;
  padding-bottom: 9px;
}
.dialog-head h2 {
  color: #214e3c;
  font-size: 23px;
}
.x-button {
  height: 44px;
  width: 44px;
  border-radius: 6px;
  background: #f0e2bb;
  border: 1px solid #90967b;
}
.account-ticket,
.profile-id,
.wardrobe-stage,
.demo-chip {
  border-radius: 6px;
}
.settings-note,
.help-text {
  line-height: 1.45;
}
.notice {
  z-index: 10;
}
.toast {
  bottom: max(12px, env(safe-area-inset-bottom));
  background: #203d31;
  color: #fff6dc;
  border-radius: 6px;
}
#app > section.panel {
  margin-top: 5px;
}
@media (min-width: 800px) {
  #app {
    padding-inline: 15px;
  }
  body::before {
    background-size:
      46px 46px,
      46px 46px,
      100% 100%;
  }
}
@media (max-height: 600px) {
  dialog {
    max-height: calc(var(--visual-height, 100dvh) - 12px);
  }
}
@media (prefers-reduced-motion: no-preference) {
  .lesson-target {
    animation: cue-ring 1.2s ease-in-out infinite alternate;
  }
  @keyframes cue-ring {
    to {
      outline-color: #ffecc0;
    }
  }
}
.probe-price {
  float: right;
  padding: 2px 5px;
  font: 800 12px var(--sans);
  color: #58372b;
  border: 1px solid #ac583d;
  border-radius: 3px;
}
.rank-card > h2 {
  margin-top: 14px;
}
dialog[open] {
  top: calc(var(--visual-top, 0px) + var(--visual-height, 100dvh) / 2);
  bottom: auto;
  transform: translateY(-50%);
  margin-block: 0;
}
body {
  background-size: 100% 100%;
  background-attachment: fixed;
}
.pass-summary #identity-perks {
  color: #d0dec3;
}
#app[data-phase='home'][data-friend='true'] > :not(.friend-ticket) {
  display: none;
}
body[data-phase='home'][data-guest='true'] #account {
  display: none;
}
.friend-ticket[hidden] {
  display: none;
}
.back-door {
  border: 0;
  background: transparent;
  color: #345a44;
  font-size: 13px;
  font-weight: 800;
  padding: 0 2px;
  margin-bottom: 5px;
}
.arena-window {
  position: relative;
  overflow: hidden;
  aspect-ratio: 256 / 160;
}
.arena-window .stage {
  position: absolute;
  inset: auto 0 0;
}
@media (orientation: portrait) and (max-height: 790px) {
  #app[data-phase='playing'],
  #app[data-phase='pick'] {
    padding-top: 6px;
  }
  #app[data-phase='playing'] {
    padding-bottom: calc(74px + env(safe-area-inset-bottom));
  }
  .arena-window {
    aspect-ratio: 256 / 138;
  }
  .dryer {
    top: 17%;
  }
  .match-top {
    padding-bottom: 4px;
  }
  .coach-strip {
    padding: 5px 8px;
    margin-bottom: 6px;
  }
  .coach-strip p {
    font-size: 12px;
    line-height: 1.4;
  }
  .playing-controls .probe-dock {
    position: fixed;
    z-index: 4;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: var(--cabinet);
    border-top: 2px solid #153b30;
    background: #214d42;
    padding: 5px max(11px, env(safe-area-inset-right)) max(7px, env(safe-area-inset-bottom))
      max(11px, env(safe-area-inset-left));
  }
  body[data-phase='playing'] .toast {
    bottom: calc(62px + env(safe-area-inset-bottom));
  }
}

body {
  --gutter-left: max(16px, env(safe-area-inset-left));
  --gutter-right: max(16px, env(safe-area-inset-right));
  display: flex;
  flex-direction: column;
  background: #263e36;
}
#app, .mast-inner {
  width: var(--cabinet);
  background-color: #f1ead8;
}
#app {
  flex: 1;
  min-height: 0;
  padding: max(8px, env(safe-area-inset-top)) var(--gutter-right) 12px var(--gutter-left);
  background-image: radial-gradient(circle, #d1c5aa 1px, transparent 1.5px),
    radial-gradient(circle, #d1c5aa 1px, transparent 1.5px);
  background-size: 7px 20px;
  background-position: left top, right top;
  background-repeat: repeat-y;
}
#app[data-phase='home'][data-friend='false'] { padding-top: 0; }
.masthead { background: transparent; box-shadow: none; }
.mast-inner {
  padding: 3px var(--gutter-right) max(3px, env(safe-area-inset-bottom)) var(--gutter-left);
  border-top: 1px solid #bdb49c;
  color: var(--ink);
}
.nav-button { color: var(--ink); min-width: 44px; }
.nav-button .icon-book, .icon-book::before, .icon-sliders { border-color: #526f56; }
.icon-sliders::before, .icon-sliders::after { background: #526f56; }
.room-top, .match-top,
.match-top .round-badge, .match-top .timer { color: var(--ink); }
.match-top .round-badge b, .view-label, .practice-note { color: #53623d; }
.match-top button { color: var(--ink); min-height: 44px; }
.room-top {
  padding-block: 3px 8px;
  border-bottom: 1px solid #bcb097;
}
.players { gap: 0; border-block: 1px solid #bcb097; }
.playerbox, .playerbox.empty { border: 0; border-bottom: 1px dashed #bcb097; border-radius: 0; }
.playerbox:last-child { border-bottom: 0; }
.result-slip { border-left: 5px solid #e9b752; }
@media (orientation: portrait) and (max-height: 790px) {
  #app[data-phase='playing'], #app[data-phase='pick'] { padding-top: max(5px, env(safe-area-inset-top)); }
  body[data-phase='playing'] .masthead { margin-bottom: calc(64px + env(safe-area-inset-bottom)); }
}

.auth-tabs { border: 0; border-bottom: 1px solid #b4a98c; border-radius: 0; background: none; }
.auth-tabs button, .auth-tabs button.active {
  border: 0; border-radius: 0; box-shadow: none; background: none; color: var(--ink);
}
.auth-tabs button.active { box-shadow: inset 0 -3px var(--teal); }
@media (max-width: 650px) {
  dialog[data-view='account'][open] {
    top: calc(var(--visual-top, 0px) + max(8px, env(safe-area-inset-top)));
    transform: none;
  }
}
