/* The web app at area13.app/play/: home, Night Signal, Flight Path. */
.loading { font-family: var(--mono); text-align: center; padding: 30vh 20px; color: var(--muted); }
.muted { color: var(--muted); }
.beam { color: var(--beam); }
.rust { color: var(--rust) !important; }
.small { font-size: 0.85rem; }
.centered { text-align: center; }
.brandline { margin: 0; font-family: var(--display); }
.brandline span { color: var(--orange); }

/* ── Home ── */
.wordmark { font-family: var(--signature); font-weight: 400; line-height: 0.95; margin: 0.12em 0 0.15em; color: var(--bone); text-shadow: 4px 4px 0 rgba(0, 0, 0, 0.7); }
.wordmark span { color: var(--ember); border-bottom: 0.07em solid var(--orange); }
.wordmark--small { font-size: clamp(3rem, 12vw, 5rem); }
.home-hero__copy { display: flex; flex-direction: column; align-items: flex-start; }
.home-hero__tagline { margin: 0 0 12px; font-weight: 500; color: rgba(245, 239, 227, 0.88); font-size: clamp(0.95rem, 2.6vw, 1.15rem); }
.home { max-width: 1000px; margin: 0 auto; padding: 30px 20px 32px; }
.home__briefing { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.home .cards { gap: 28px; }
.game-card { flex-direction: column; text-decoration: none; overflow: visible; transition: transform 0.12s ease-out, box-shadow 0.12s ease-out; }
.game-card:active { transform: translate(4px, 4px); box-shadow: 3px 3px 0 var(--line); }
.game-card__top { display: flex; gap: 16px; align-items: flex-start; }
.game-card__top .card__pitch { margin-bottom: 0; }
.game-card__foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; border-top: 1px solid rgba(7, 7, 11, 0.14); padding-top: 14px; }
.game-card__status { margin: 0; font-family: var(--mono); font-weight: 700; font-size: 0.72rem; letter-spacing: 0.06em; color: var(--rust); }
.game-card.is-done { background: var(--bone2); }
.game-card.is-done .game-card__top { opacity: 0.65; filter: saturate(0.2); }
@media (prefers-contrast: more) { .game-card.is-done .game-card__top { opacity: 0.9; } }
.game-card .tape { top: 42%; }
.home__footer { display: flex; gap: 12px; align-items: center; justify-content: center; margin-top: 40px; }
.home__footer p { margin: 0; }
.home__footer a { color: var(--bone); }

/* ── Game screens ── */
.game { min-height: 100svh; display: flex; flex-direction: column; }
.game__header { display: flex; align-items: center; gap: 6px; padding: 8px 10px; padding-top: max(8px, env(safe-area-inset-top)); max-width: 1000px; width: 100%; margin: 0 auto; }
.game__title { flex: 1; min-width: 0; padding-left: 2px; }
.game__title .eyebrow { font-size: 0.6rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.game__name { margin: 0; font-family: var(--signature); font-size: 1.65rem; line-height: 1; color: var(--bone); text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.7); white-space: nowrap; }
.game__name span { color: var(--ember); border-bottom: 3px solid var(--orange); }
.game__buttons { display: flex; gap: 4px; }
.game__play { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 16px 16px 12px; }

/* ── Night Signal ── */
.ns-stage { position: relative; }
.ns-board { --tile: min(62px, calc((100vw - 64px) / 5), calc((100svh - 400px) / 6)); display: grid; gap: max(7px, calc(var(--tile) * 0.1)); }
@media (min-width: 700px) and (min-height: 760px) { .ns-board { --tile: min(96px, calc((100svh - 440px) / 6)); } }
.ns-row { display: grid; grid-template-columns: repeat(5, var(--tile)); gap: inherit; }
.ns-row.is-shaking { animation: shake 0.42s linear; }
@keyframes shake { 20%, 60% { transform: translateX(-9px); } 40%, 80% { transform: translateX(9px); } }
.tile {
  position: relative; width: var(--tile); height: var(--tile); display: grid; place-items: center;
  font-family: var(--display); font-size: calc(var(--tile) * 0.46); color: var(--bone);
  background: rgba(16, 13, 24, 0.55); border: 2px solid rgba(245, 239, 227, 0.09);
}
.tile.is-active { background: var(--ink2); border-color: rgba(245, 239, 227, 0.24); }
.tile.is-filled { background: var(--ink2); border: 3px solid rgba(245, 239, 227, 0.85); }
.tile.is-exact { background: var(--orange); color: var(--ink); border: 3px solid var(--line); }
.tile.is-present { background: var(--beam); color: var(--ink); border: 3px solid var(--line); }
.tile.is-absent { background: var(--absent); color: var(--used); border: 3px solid rgba(245, 239, 227, 0.14); }
.tile__symbol { position: absolute; right: 3px; bottom: 1px; font-size: max(9px, calc(var(--tile) * 0.2)); font-family: system-ui, sans-serif; font-weight: 900; }
.tile.is-flipping { animation: flip 0.34s ease-in-out; }
@keyframes flip { 50% { transform: rotateX(88deg); } }
.tile.is-jumping { animation: jump 0.6s cubic-bezier(0.3, 1.6, 0.5, 1) both; }
@keyframes jump { 30% { transform: translateY(calc(var(--tile) * -0.32)); } }
.ns-toast {
  position: absolute; left: 50%; top: -6px; transform: translate(-50%, -100%) rotate(-1.5deg); z-index: 3; opacity: 0; pointer-events: none;
  background: var(--bone); color: var(--ink); border: 3px solid var(--line); padding: 8px 14px; font-weight: 700; white-space: nowrap;
}
.ns-toast.is-shown { animation: toast 2.2s ease forwards; }
@keyframes toast { 0% { opacity: 0; transform: translate(-50%, -80%) rotate(-1.5deg); } 10%, 80% { opacity: 1; transform: translate(-50%, -100%) rotate(-1.5deg); } 100% { opacity: 0; } }
.ns-status { min-height: 46px; display: grid; place-items: center; }
.ns-feedback { margin: 0; font-family: var(--mono); font-weight: 700; font-size: 0.72rem; letter-spacing: 0.14em; color: var(--ember); text-align: center; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; }
.legend__item { display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono); font-weight: 700; font-size: 0.66rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.legend__chip { width: 16px; height: 16px; display: grid; place-items: center; font-size: 10px; font-weight: 900; border: 1.5px solid var(--line); }
.legend__chip.is-exact { background: var(--orange); color: var(--ink); }
.legend__chip.is-present { background: var(--beam); color: var(--ink); }
.legend__chip.is-absent { background: var(--absent); color: var(--used); border-color: rgba(245, 239, 227, 0.3); }
.keyboard {
  background: var(--night); padding: 22px 8px max(10px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 7px; align-items: center;
  clip-path: polygon(0 18px, 8% 18px, 9.7% 4px, 18% 4px, 19.5% 18px, 30% 18px, 31% 9px, 41% 9px, 42% 18px, 54% 18px, 55.5% 2px, 64% 2px, 65.5% 18px, 76% 18px, 77% 10px, 87% 10px, 88% 18px, 100% 18px, 100% 100%, 0 100%);
}
.kb-row { display: flex; gap: 5px; width: 100%; max-width: 500px; justify-content: center; }
.kb-row:nth-child(2) { padding: 0 16px; }
.key {
  flex: 1; min-width: 0; height: 48px; display: grid; place-items: center; position: relative; cursor: pointer;
  font-family: var(--display); font-size: 0.95rem; color: var(--ink); background: var(--bone);
  border: 2.5px solid var(--line); box-shadow: 3px 3px 0 var(--line); padding: 0; transition: transform 0.08s ease-out, box-shadow 0.08s ease-out;
}
@media (max-height: 700px) { .key { height: 42px; } }
.key:active { transform: translate(3px, 3px); box-shadow: none; }
.key--wide { flex: 1.5; font-size: 0.62rem; background: var(--bone2); }
.key svg { width: 20px; height: 20px; }
.key.is-exact { background: var(--orange); }
.key.is-present { background: var(--beam); }
.key.is-absent { background: var(--absent); color: var(--used); border-color: rgba(245, 239, 227, 0.1); box-shadow: none; }
.key__symbol { position: absolute; right: 3px; bottom: 0; font-size: 9px; font-family: system-ui, sans-serif; font-weight: 900; }
.keyboard.is-done .key { opacity: 0.55; pointer-events: none; }

/* ── Panels ── */
.panel__subtitle { font-family: var(--display); font-weight: 400; font-size: 1.05rem; margin: 0 0 6px; color: var(--ink); text-transform: uppercase; }
.panel__row { display: flex; gap: 14px; align-items: center; }
.panel__row a, .panel a { color: var(--rust); font-weight: 700; }
.panel__note { display: flex; gap: 10px; align-items: center; color: var(--ink) !important; font-weight: 500; }
.panel__note .icon { color: var(--rust); flex: none; }
.settings { padding: 8px 22px; transform: rotate(-1deg); }
.setting { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; }
.setting + .setting { border-top: 1px solid rgba(7, 7, 11, 0.14); }
.setting label { display: flex; flex-direction: column; gap: 2px; cursor: pointer; }
.setting__label { font-weight: 700; color: var(--ink); }
.setting__help { font-size: 0.9rem; color: rgba(7, 7, 11, 0.78); }
.setting input { appearance: none; flex: none; width: 52px; height: 32px; border-radius: 16px; background: #c9c3b8; position: relative; cursor: pointer; transition: background 0.2s; margin: 0; }
.setting input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); transition: transform 0.2s; }
.setting input:checked { background: var(--orange); }
.setting input:checked::after { transform: translateX(20px); }
.examples { padding: 22px; display: grid; gap: 24px; transform: rotate(-1deg); }
.example__tiles { display: flex; gap: 7px; margin-bottom: 10px; }
.example p { margin: 0; font-size: 1rem; line-height: 1.45; }
.example b { font-family: var(--display); font-weight: 400; color: var(--ink); }
.examples { padding: 24px 26px; }
.paper-tile { flex: none; width: var(--size); height: var(--size); display: grid; place-items: center; font-family: var(--display); font-size: calc(var(--size) * 0.46); color: var(--ink); background: #fff; border: 3px solid var(--line); box-shadow: 3px 3px 0 var(--line); }
.paper-tile.is-exact { background: var(--orange); }
.paper-tile.is-present { background: var(--beam); }
.paper-tile.is-absent { background: var(--absent); color: rgba(245, 239, 227, 0.6); }
.answer { display: flex; gap: 8px; justify-content: center; }
.note { padding: 22px; transform: rotate(-1.2deg); }
.note__text { color: var(--ink) !important; margin-top: 8px !important; }
.next { text-align: center; display: grid; gap: 4px; justify-items: center; }
.countdown { margin: 0; font-family: var(--display); font-size: 1.6rem; color: var(--ink); font-variant-numeric: tabular-nums; }
.btn--wide { width: 100%; }
.bars { display: grid; gap: 10px; }
.bar { display: flex; align-items: center; gap: 10px; }
.bar__n { width: 16px; font-family: var(--display); color: var(--ink); }
.bar__fill { height: 28px; display: flex; align-items: center; justify-content: flex-end; padding: 0 8px; font-family: var(--display); font-size: 0.78rem; color: var(--ink); background: var(--bone2); border: 3px solid var(--line); box-shadow: 3px 3px 0 var(--line); }
.bar__fill.is-filled { background: var(--orange); }

/* ── Flight Path ── */
.fp-play { gap: 18px; }
.fp-instruments { display: flex; justify-content: space-between; align-items: flex-end; width: min(100%, var(--board, 560px)); }
.fp-instruments p { margin: 0; }
.fp-instrument--right { text-align: right; }
.fp-instrument__value { font-family: var(--display); font-size: 1.65rem; color: var(--bone); font-variant-numeric: tabular-nums; }
.fp-stage { display: grid; place-items: center; }
.fp-board { position: relative; background: var(--line); outline: 2.5px solid rgba(245, 239, 227, 0.35); box-shadow: 6px 6px 0 rgba(253, 81, 1, 0.85); touch-action: none; user-select: none; -webkit-user-select: none; cursor: pointer; }
.fp-cell { position: absolute; background: var(--ink2); box-shadow: inset 0 0 0 1.5px rgba(245, 239, 227, 0.4); }
.fp-cell.is-visited { background: rgba(253, 81, 1, 0.16); box-shadow: none; }
.fp-cell.is-visited.is-alt { background: rgba(253, 81, 1, 0.26); }
.fp-board.is-celebrating .fp-cell { background: rgba(253, 81, 1, 0.42); --bg-delay: var(--step-delay, 0s); }
.fp-route { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.fp-route polyline { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.fp-route__glow { stroke: var(--orange); filter: drop-shadow(0 0 6px rgba(253, 81, 1, 0.8)); }
.fp-route__core { stroke: var(--ember); }
.fp-board.is-celebrating .fp-route__core { stroke: var(--beam); }
.fp-beacon {
  position: absolute; display: grid; place-items: center; border-radius: 50%; pointer-events: none;
  font-family: var(--display); color: var(--ink); background: var(--bone); border: max(2px, 0.09em) solid var(--line); box-shadow: 0.07em 0.07em 0 var(--line);
}
.fp-beacon.is-reached { background: var(--orange); }
.fp-beacon.is-next::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 3px solid var(--beam); animation: ping 1.1s ease-out infinite; }
@keyframes ping { from { transform: scale(1.05); opacity: 0.95; } to { transform: scale(1.5); opacity: 0; } }
.fp-saucer { position: absolute; left: 0; top: 0; pointer-events: none; filter: drop-shadow(1.5px 1.5px 0 rgba(0, 0, 0, 0.6)); z-index: 2; }
.fp-saucer svg { width: 100%; height: 100%; display: block; }
.fp-controls { display: flex; align-items: center; gap: 14px; width: min(100%, 560px); justify-content: center; }
.fp-hint { flex: 1; margin: 0; font-family: var(--mono); font-weight: 700; font-size: 0.68rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ember); }
.key--control { flex: none; width: 52px; height: 46px; }
.key--control:disabled { background: rgba(233, 223, 201, 0.4); cursor: default; }

/* The finale: everything lifts into the saucer, which then leaves; "ROUTE CLEARED" stamps down. */
.fp-piece { --move-delay: calc(var(--lift-delay, 0s) * 0.4); transition: transform 0.7s ease-in var(--move-delay), opacity 0.7s ease-in var(--move-delay); }
.fp-cell.fp-piece { transition: background 0.3s ease-out var(--bg-delay, 0s), transform 0.7s ease-in var(--move-delay), opacity 0.7s ease-in var(--move-delay); }
.fp-board[data-abduction="lift"] .fp-piece, .fp-board[data-abduction="gone"] .fp-piece {
  transform: translate(var(--dx), var(--dy)) scale(0.08) rotate(200deg); opacity: 0; --move-delay: var(--lift-delay, 0s);
}
.fp-board[data-abduction="lift"] .fp-route, .fp-board[data-abduction="gone"] .fp-route { transform: translateY(var(--dy)) scale(0.04); transform-origin: 50% 0; }
.fp-finale { position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity 0.5s; z-index: 3; }
.fp-board:is([data-abduction="beam"], [data-abduction="lift"], [data-abduction="gone"]) .fp-finale { opacity: 1; }
.fp-finale__beam {
  position: absolute; left: -4%; right: -4%; top: var(--top); bottom: 0;
  clip-path: polygon(42% 0, 58% 0, 100% 100%, 0 100%);
  background: linear-gradient(to bottom, rgba(255, 194, 75, 0.6), rgba(255, 194, 75, 0.12));
  transition: opacity 0.4s;
}
.fp-finale__beam::before { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(to bottom, rgba(245, 239, 227, 0.22) 0 2px, transparent 2px 18px); animation: bh-rain 0.9s linear infinite reverse; }
.fp-board[data-abduction="gone"] .fp-finale__beam { opacity: 0; }
.fp-finale__ship { position: absolute; transform: translateY(-40px); opacity: 0; transition: transform 0.5s ease-out, opacity 0.4s; }
.fp-finale__ship svg { width: 100%; height: 100%; }
.fp-board:is([data-abduction="beam"], [data-abduction="lift"]) .fp-finale__ship { transform: none; opacity: 1; }
.fp-board[data-abduction="gone"] .fp-finale__ship { transform: translate(60px, -140vh) scale(0.6); opacity: 1; transition: transform 0.6s ease-in; }
.fp-finale__stamp {
  position: absolute; left: 50%; top: 50%; padding: 10px 16px; font-family: var(--display); letter-spacing: 0.04em; color: var(--ink); white-space: nowrap;
  background: var(--beam); border: 3px solid var(--line); box-shadow: 5px 5px 0 var(--line);
  transform: translate(-50%, -50%) rotate(-6deg) scale(1.8); opacity: 0; transition: transform 0.45s cubic-bezier(0.3, 1.4, 0.5, 1), opacity 0.3s;
}
.fp-board[data-abduction="gone"] .fp-finale__stamp { transform: translate(-50%, -50%) rotate(-6deg) scale(1); opacity: 1; }
.mini { padding: 18px; background: var(--ink); display: grid; place-items: center; transform: rotate(-1deg); margin: 0 auto; }
.rules { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.rule { display: flex; gap: 12px; align-items: flex-start; color: rgba(7, 7, 11, 0.86); font-size: 1.04rem; line-height: 1.5; }
.rule .icon { color: var(--orange); flex: none; margin-top: 2px; }
.flight-result { padding: 18px; display: flex; gap: 18px; align-items: center; transform: rotate(-1deg); }
.flight-result p { margin: 0; }
.flight-result__time { font-family: var(--display); font-size: 2.6rem; color: var(--orange); line-height: 1.1; font-variant-numeric: tabular-nums; }
.flight-result__meta { font-family: var(--mono); font-weight: 700; font-size: 0.68rem; letter-spacing: 0.08em; text-transform: uppercase; color: rgba(7, 7, 11, 0.7) !important; }
