@font-face {
  font-family: "Pixelify Sans";
  src: url("/play/assets/pixelify-sans-latin.woff2") format("woff2");
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
}

.play-page {
  --night: #10241f;
  --deep-green: #182f29;
  --track: #35564a;
  --snow-white: #fff9e7;
  --warm-light: #ffd36f;
  --frosted-mint: #b9e3d0;
  --display-font: "Pixelify Sans", ui-monospace, "Courier New", monospace;
  --meter-font: ui-monospace, "Cascadia Mono", Consolas, monospace;
  min-height: 100svh;
  color: var(--snow-white);
  background: radial-gradient(ellipse at 52% 8%, #24463a, var(--night) 64%);
}

.play-shell {
  width: min(100% - 32px, 800px);
  margin-inline: auto;
}

.play-shell.game {
  width: min(100% - 32px, clamp(420px, calc((100svh - 135px) * 1.7778), 800px));
}

.play-top {
  border-bottom: 1px solid #37534a;
  background: #142922;
}

.play-top .play-shell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  gap: 8px;
}

.play-top span.brand-mark { background: #31554a; color: var(--warm-light); }
.play-top .button.plain { color: var(--frosted-mint); }
.play-top .button.plain:hover { background: #274339; }

.play-title {
  padding-block: 6px 7px;
  color: var(--snow-white);
  font: 600 clamp(1.65rem, 4.1vw, 2.4rem)/1 var(--display-font);
  text-wrap: balance;
}

.play-page .game-window {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  aspect-ratio: 16 / 9;
  margin-bottom: 12px;
  color: var(--snow-white);
  border: 1px solid #57766a;
  border-radius: 20px;
  background: #182942;
  box-shadow: 0 22px 60px #071412ad;
}

.play-page .game-strip {
  min-height: 38px;
  padding-block: 6px;
  color: var(--snow-white);
  border-bottom: 1px solid #556754;
  background: var(--deep-green);
}

.play-page .game-strip .label,
.play-page .question-meta,
.round-points,
.play-page #score {
  font-family: var(--meter-font);
  font-variant-numeric: tabular-nums;
}

.play-page .game-strip .label { white-space: nowrap; }
.play-page #score { color: var(--warm-light); }
.play-page .play-score svg { color: var(--frosted-mint); }
.play-page #stop-dots span { background: #486057; }
.play-page #stop-dots span[data-state="lit"] { background: var(--warm-light); box-shadow: 0 0 10px #ffcc5a80; }
.play-page #stop-dots span[data-state="passed"] { background: #a78d95; }
.play-page #stop-dots span[data-state="current"] { box-shadow: inset 0 0 0 1px var(--frosted-mint); }

.play-stage { position: relative; isolation: isolate; min-height: 0; }
.play-page .village {
  position: absolute;
  inset: 0;
  aspect-ratio: auto;
  pointer-events: none;
  background: #182942 url("/scenes/station.webp") center / cover no-repeat;
}
.play-page .village canvas { object-fit: cover; }

.play-stage-content {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  padding: clamp(8px, 2.7vw, 24px);
  overflow: auto;
  overscroll-behavior: contain;
}

.play-page .village canvas { visibility: hidden; }
.play-page .village[data-rendered="true"] canvas { visibility: visible; }

.play-page .start-layer {
  position: static;
  flex: none;
  align-items: start;
  margin-block: auto;
  padding: 0;
}

.boarding-card,
.play-page .game-panel {
  border: 1px solid #b9e3d04d;
  border-radius: 15px;
  background: #142a27f5;
  box-shadow: 0 12px 36px #09151980;
  color: var(--snow-white);
}
.boarding-card {
  position: relative;
  width: min(100%, 468px);
  padding: clamp(10px, 3.5vw, 28px);
  animation: boarding-card-in 330ms cubic-bezier(.22,.74,.24,1) both;
}

.boarding-card h2 {
  color: var(--warm-light);
  font: 600 clamp(1.5rem, 5vw, 3.6rem)/.98 var(--display-font);
}

.boarding-card p { margin: 6px 0 14px; color: #e0e9d9; font-family: var(--meter-font); font-size: .83rem; }
.boarding-card .action-group { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.boarding-card .button { min-width: 0; font-size: .9rem; }
.boarding-card .button:disabled { opacity: .7; cursor: wait; }
.boarding-card .boarding-settings { display: none; }

.play-options { margin-top: 13px; padding-top: 10px; border-top: 1px solid #b9e3d04d; }
.play-settings { display: flex; align-items: end; flex-wrap: wrap; gap: 10px 22px; }
.play-settings fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.play-settings legend, .play-length { font-weight: 700; font-size: .89rem; }
.play-settings .action-group { grid-template-columns: repeat(2, minmax(94px, 1fr)); }
.play-settings .button[aria-pressed="true"] { color: white; background: #245448; }
.play-length { display: grid; gap: 2px; }
.play-length select { min-height: 44px; padding: 6px 26px 6px 10px; border: 1px solid #91a99b; border-radius: 9px; color: var(--ink); background: #fffdf5; font: inherit; }
.play-options p { margin: 7px 0 0; color: #d9e8df; font: .84rem/1.4 var(--meter-font); text-align: justify; text-align-last: start; }
.play-options #boarding-status:empty, #report-status:empty, #next-status:empty { display: none; }

.scene-effects {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.scene-effects::before {
  position: absolute;
  inset: 0;
  content: "";
  opacity: 0;
}

.game[data-screen="question"] .scene-effects::before {
  background: linear-gradient(110deg, transparent 15%, #c2ead028 52%, transparent 86%);
  animation: platform-sweep 460ms cubic-bezier(.2,.7,.24,1) both;
}

.game[data-result="match"] .scene-effects::before {
  background: radial-gradient(ellipse at 58% 68%, #ffd37370, transparent 58%);
  animation: window-light 700ms ease-out both;
}

.game[data-result="timeout"] .scene-effects::before {
  box-shadow: inset 0 0 50px 14px #352a4180;
  animation: window-light 520ms ease-out both;
}

.game[data-result="match"] .play-score strong {
  animation: meter-rise 310ms cubic-bezier(.17,.8,.26,1) both;
}

.play-page .game-panel { flex: none; width: min(100%, 620px); min-width: 0; margin-block: auto; }
.game[data-screen="results"] .game-panel { margin-block-start: 0; }
.game:is([data-screen="question"], [data-screen="round"]) .game-panel { padding: 12px clamp(12px, 2.5vw, 20px); }
.play-page .game-panel p { color: #d9e8df; text-align: justify; text-align-last: start; }
.play-page .game-panel h2 {
  color: var(--snow-white);
  font: 600 clamp(1.45rem, 3.9vw, 2.55rem)/1.03 var(--display-font);
  letter-spacing: -.015em;
}

.clue-card { animation: clue-arrive 260ms cubic-bezier(.2,.7,.24,1) both; }
.play-page .clue-card h2 { font-size: clamp(1.35rem, 3.3vw, 2.15rem); margin-bottom: 8px; }
.play-page .question-meta { color: var(--frosted-mint); font-size: .83rem; }
.play-page .timer-label { color: var(--frosted-mint); }
.play-page .timer-label strong { min-width: 3ch; text-align: end; }
.play-page .time-track { height: 5px; margin-block: 5px 8px; background: #d7dfcf; }
.play-page .time-track span { background: #4e866e; transition: transform 100ms linear, background-color 160ms ease; }
.play-page .game-panel[data-urgent="true"] .timer-label { color: #ffc5cd; }
.play-page .game-panel[data-urgent="true"] .time-track span { background: #bc4d54; }
.play-page .game-panel[data-urgent="true"] #time-label { animation: meter-rise 300ms ease-out both; }

.play-page .answer-form input {
  min-height: 48px;
  border-color: #91a99b;
  color: #19332a;
  background: #fffdf5;
  font-family: var(--meter-font);
  font-size: clamp(1rem, 3.1vw, 1.22rem);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.play-page .answer-form input[aria-invalid="true"] { border-color: #a33848; box-shadow: inset 0 0 0 1px #a3384826; }
.play-page #answer-form { grid-template-columns: minmax(0, 1fr) auto; }
.answer-controls { display: grid; grid-template-columns: repeat(2, minmax(94px, 1fr)); gap: 8px; }
.answer-controls .button { min-height: 48px; }
.play-page #answer-form .button:disabled { opacity: .72; cursor: wait; }
.play-page .question-actions { justify-content: end; margin-top: 4px; }
.play-page #answer-feedback { min-width: 0; margin-top: 6px; font-size: .88rem; overflow-wrap: anywhere; }
.play-page #answer-feedback:empty { margin-top: 0; }
.play-page #answer-feedback[data-state="retry"] { color: #ffc5cd; }
.play-page .game-panel .button.plain,
.play-page .review-list small { color: var(--frosted-mint); }
.play-page .game-panel .button.plain:hover { background: #b9e3d023; }
.play-page .big-score, .play-page .review-number { color: var(--warm-light); }

.play-page .round-detail {
  display: grid;
  gap: 8px;
  justify-content: stretch;
  animation: clue-arrive 250ms cubic-bezier(.2,.7,.24,1) both;
}

.answer-reveal {
  display: grid;
  align-items: center;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: clamp(8px, 2vw, 16px);
  padding-bottom: 8px;
  border-bottom: 1px dashed #a9baaa;
}

.answer-reveal h2 { margin: 3px 0 0; overflow-wrap: anywhere; }
.reveal-icon {
  display: grid;
  width: clamp(32px, 6vw, 50px);
  aspect-ratio: 1;
  place-items: center;
  color: #47685b;
  border-radius: 12px;
  background: #dbeddf;
}
.game[data-result="timeout"] .reveal-icon { color: #9d3c4a; background: #f1dbdb; }
.game[data-result="match"] .reveal-icon { color: #765018; background: #fbdf9a; }

.round-points {
  padding: 5px 8px;
  border: 1px solid #b7c8b8;
  border-radius: 9px;
  color: #2e5144;
  background: #edf3e5;
  white-space: nowrap;
}
.round-points strong { font-size: clamp(1.1rem, 3vw, 1.7rem); }
.round-points span { font-size: .78rem; }
.round-points[data-tier="2"],
.round-points[data-tier="3"] { color: #614610; border-color: #dab66a; background: #ffe4a4; }
.round-points[data-tier] { animation: meter-rise 320ms cubic-bezier(.17,.8,.26,1) both; }

.play-page .round-detail > .button,
.play-page .round-actions { justify-self: end; }
.play-page .round-actions { width: min(100%, 360px); }
.play-page .result-top { animation: clue-arrive 280ms cubic-bezier(.2,.7,.24,1) both; }

@keyframes boarding-card-in {
  from { opacity: 0; transform: translateY(9px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes clue-arrive {
  from { opacity: .58; transform: translateY(7px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes platform-sweep {
  from { opacity: .8; transform: translateX(-70%); }
  to { opacity: 0; transform: translateX(72%); }
}
@keyframes window-light {
  from { opacity: .9; }
  to { opacity: 0; }
}
@keyframes meter-rise {
  from { transform: translateY(4px); }
  55% { transform: translateY(-2px); }
  to { transform: translateY(0); }
}

@media (max-width: 540px) {
  .play-shell, .play-shell.game { width: calc(100% - 24px); }
  .play-page .game-window { border-radius: 15px; }
  .boarding-card p { margin-block: 4px 8px; }
  .boarding-card .button { padding-inline: 6px; font-size: .83rem; }
  .play-page .answer-form { grid-template-columns: minmax(0, 1fr) auto; }
  .play-page .answer-form .button { padding-inline: 9px; }
  .play-page .round-actions { justify-self: stretch; }
}
@media (max-width: 480px) {
  .play-page #answer-form { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 400px) {
  .boarding-card { padding: 8px; }
  .boarding-card p { font-size: .75rem; line-height: 1.25; }
  .boarding-card .button { flex-direction: column; gap: 2px; padding: 4px 2px; font-size: .8rem; }
}
.play-embed .play-shell.game { width: 100%; }
.play-embed .game-window {
  height: 100dvh;
  aspect-ratio: auto;
  margin: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
.play-partner .game-window { grid-template-rows: auto auto minmax(0, 1fr); }
.partner-banner {
  background: #8e233b;
  border-bottom: 1px solid #ffcd79;
  color: #fff7e6;
}
.partner-banner a {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 7px;
  min-height: 44px;
  padding-inline: 4px;
  color: inherit;
  font: 600 clamp(.68rem, 3vw, .85rem)/1.2 system-ui, sans-serif;
  text-decoration: none;
}
.partner-banner a:focus-visible { outline: 2px solid #fff7e6; outline-offset: -3px; }
.partner-banner a:hover strong { text-decoration: underline; }
.partner-banner img { flex: none; }
@media (max-height: 270px) {
  .play-partner .game-strip { min-height: 25px; padding-block: 2px; }
  .play-partner .play-stage-content { padding: 4px; }
  .play-partner .boarding-card { padding-block: 5px; }
  .play-partner .boarding-card h2 { font-size: 1.25rem; }
  .play-partner #boarding-rules { margin-block: 3px; }
}
@media (max-width: 599px) {
  .play-page .play-stage-content { padding: 8px; }
  .play-embed .game:is([data-screen="question"], [data-screen="round"]) .game-panel { padding: 8px 10px; }
  .play-embed .clue-card h2 { font-size: clamp(1.12rem, 4vw, 1.4rem); }
  .play-embed #answer-form { grid-template-columns: minmax(0, 1fr) auto; gap: 6px; }
  .play-embed .answer-controls { grid-template-columns: repeat(2, minmax(72px, 1fr)); gap: 6px; }
  .play-embed .answer-controls .button { gap: 4px; padding-inline: 4px; font-size: .8rem; }
  .play-embed .answer-controls svg { width: 15px; height: 15px; }
}
@media (max-width: 480px) {
  .play-embed #answer-form { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 540px), (max-height: 280px) {
  .boarding-card :is(h2, #boarding-rules) { padding-inline-end: 44px; }
  .boarding-card .boarding-settings { position: absolute; inset: 6px 6px auto auto; display: inline-flex; color: var(--frosted-mint); }
  .boarding-card .boarding-settings:hover { background: #b9e3d023; }
}
@media (prefers-reduced-motion: reduce) {
  .play-page *,
  .play-page *::before {
    animation: none !important;
    transition: none !important;
  }
}
