/* VAULT: one stylesheet for every page. Dark by default (the game's look), readable in daylight. */
:root {
  --bg: #0b0d10;
  --panel: #14181d;
  --panel-2: #1b2027;
  --line: #2a313a;
  --text: #eef1f4;
  --muted: #9aa5b1;
  --accent: #f5b301;       /* vault gold */
  --accent-ink: #1a1300;
  --good: #3ccf91;
  --bad: #ff5d5d;
  --warn: #ffb547;
  --vault: #222831;        /* VAULT's bubbles */
  --you: #2b3a55;          /* the player's bubbles */
  --radius: 14px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.45 var(--font); }
body { min-height: 100dvh; }
a { color: var(--accent); }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); }
.hidden { display: none !important; }
.wrap { max-width: 720px; margin: 0 auto; padding: 0 16px; }

/* ---- header ---- */
.top { position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.top .wrap { display: flex; align-items: center; gap: 12px; padding-top: 10px; padding-bottom: 10px; }
.lock { width: 40px; height: 40px; flex: none; }
.brand { font-weight: 800; letter-spacing: .08em; }
.prize { margin-left: auto; text-align: right; line-height: 1.15; }
.prize b { color: var(--accent); font-size: 1.15rem; }
.prize small { display: block; color: var(--muted); font-size: .78rem; }

/* ---- tabs ---- */
.tabs { display: flex; gap: 8px; padding-top: 10px; }
.tab { flex: 1; padding: 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); font-weight: 600; min-height: 44px; }
.tab[aria-selected="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

/* ---- chat ---- */
.chat { display: flex; flex-direction: column; gap: 10px; padding: 16px 0 140px; }
.msg { max-width: 86%; padding: 10px 14px; border-radius: 16px; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.vault { background: var(--vault); border-bottom-left-radius: 4px; align-self: flex-start; }
.msg.you { background: var(--you); border-bottom-right-radius: 4px; align-self: flex-end; }
.msg .who { display: block; font-size: .72rem; color: var(--muted); margin-bottom: 2px; letter-spacing: .06em; text-transform: uppercase; }
.msg.system { align-self: center; background: transparent; color: var(--muted); font-size: .88rem; text-align: center; }
.badge { display: inline-block; margin-top: 6px; padding: 2px 8px; border-radius: 99px; font-size: .74rem; background: var(--panel-2); color: var(--muted); }
.badge.catch { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); }
.typing span { display: inline-block; width: 7px; height: 7px; margin-right: 4px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: .2s; }
.typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

.composer { position: fixed; left: 0; right: 0; bottom: 0; background: var(--bg); border-top: 1px solid var(--line); padding: 10px 0 calc(10px + env(safe-area-inset-bottom)); }
.composer .row { display: flex; gap: 8px; align-items: flex-end; }
.composer textarea { flex: 1; min-height: 48px; max-height: 140px; resize: none; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--panel); }
.composer button { min-width: 72px; min-height: 48px; border: 0; border-radius: 14px; background: var(--accent); color: var(--accent-ink); font-weight: 800; }
.composer button:disabled { opacity: .45; cursor: not-allowed; }
.composer .meta { display: flex; justify-content: space-between; font-size: .8rem; color: var(--muted); margin-top: 6px; }
#turnstile { margin-top: 6px; }

.banner { margin: 16px 0 0; padding: 16px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--panel); }
.banner h2 { margin: 0 0 6px; font-size: 1.15rem; }
.banner.win { border-color: var(--good); background: color-mix(in srgb, var(--good) 12%, var(--panel)); }
.banner.stop { border-color: var(--warn); }
.code { display: flex; gap: 8px; align-items: center; margin-top: 10px; }
.code output { flex: 1; font: 700 1.2rem var(--mono); letter-spacing: .08em; padding: 10px 12px; border-radius: 10px; background: var(--bg); border: 1px dashed var(--good); overflow-wrap: anywhere; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 8px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel-2); font-weight: 600; text-decoration: none; color: var(--text); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.small { min-height: 34px; padding: 4px 10px; font-size: .85rem; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

/* ---- board ---- */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 16px 0; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.stat b { display: block; font-size: clamp(1.4rem, 6vw, 2.4rem); font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat span { color: var(--muted); font-size: .8rem; }
.stat.hero b { color: var(--accent); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin: 12px 0; }
.card h2 { font-size: 1rem; margin: 0 0 10px; }
.card h2 small { color: var(--muted); font-weight: 400; }
.meter { display: flex; gap: 6px; }
.meter i { flex: 1 1 0; min-width: 0; max-width: 40px; height: 40px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel-2); display: grid; place-items: center; font-style: normal; color: var(--muted); }
.meter i.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.bars { display: grid; gap: 8px; }
.bar { display: grid; grid-template-columns: minmax(110px, 38%) 1fr 44px; align-items: center; gap: 8px; font-size: .88rem; }
.bar .track { height: 14px; background: var(--panel-2); border-radius: 99px; overflow: hidden; }
.bar .fill { height: 100%; background: var(--accent); border-radius: 99px; transition: width .6s cubic-bezier(.2,.7,.2,1); }
.bar b { text-align: right; font-variant-numeric: tabular-nums; }
.spark { width: 100%; height: 90px; display: block; }
.spark .col { fill: var(--accent); }
.spark .axis { stroke: var(--line); }
.spark text { fill: var(--muted); font-size: 10px; }
.top10 { width: 100%; border-collapse: collapse; font-size: .9rem; }
.top10 td { padding: 8px 6px; border-top: 1px solid var(--line); vertical-align: top; }
.top10 td.rank { width: 32px; color: var(--accent); font-weight: 800; }
.top10 td.score { width: 48px; text-align: right; font-variant-numeric: tabular-nums; }
.top10 .handle { font-weight: 700; }
.top10 .attempt { display: block; color: var(--text); margin-top: 2px; overflow-wrap: anywhere; }
.top10 .reply { display: block; color: var(--muted); font-size: .82rem; margin-top: 2px; overflow-wrap: anywhere; }
.wall { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.fail { background: var(--panel-2); border-radius: 12px; padding: 10px 12px; font-size: .88rem; }
.fail .who { color: var(--muted); font-size: .75rem; }
.fail .them { margin: 4px 0; overflow-wrap: anywhere; }
.fail .roast { color: var(--accent); overflow-wrap: anywhere; }
.state-pill { display: inline-block; padding: 3px 10px; border-radius: 99px; font-size: .78rem; font-weight: 700; background: var(--panel-2); }
.state-pill.open { background: color-mix(in srgb, var(--good) 22%, transparent); color: var(--good); }
.state-pill.cracked { background: color-mix(in srgb, var(--bad) 22%, transparent); color: var(--bad); }
.foot { text-align: center; color: var(--muted); font-size: .82rem; padding: 24px 0 40px; }

/* ---- admin ---- */
.admin table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.admin th, .admin td { text-align: left; padding: 6px; border-top: 1px solid var(--line); vertical-align: top; }
.admin th { color: var(--muted); font-weight: 600; }
.admin .scroll { overflow-x: auto; }
.admin input, .admin select, .admin textarea { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 8px; min-height: 40px; }
.admin form, .admin .row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.admin .kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.admin .kv div { background: var(--panel-2); border-radius: 10px; padding: 8px 10px; }
.admin .kv b { display: block; font-size: 1.2rem; font-variant-numeric: tabular-nums; }
.tag { display: inline-block; padding: 1px 7px; border-radius: 99px; font-size: .75rem; background: var(--panel-2); }
.tag.cracked { background: var(--good); color: #002414; }
.tag.late { background: var(--warn); color: #2a1a00; }
.tag.rejected { background: var(--bad); color: #2a0000; }
pre.out { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--bg); padding: 10px; border-radius: 8px; max-height: 260px; overflow: auto; font-size: .8rem; }

/* ---- prose pages ---- */
.prose { padding-top: 16px; padding-bottom: 48px; }
.prose h1 { font-size: 1.6rem; margin: 18px 0 6px; }
.prose h2 { font-size: 1.1rem; margin: 22px 0 6px; }
.prose li { margin: 4px 0; }

@media (max-width: 420px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stats .stat:last-child { grid-column: span 2; }
  .bar { grid-template-columns: 1fr 1fr 40px; }
}

/* Big-screen layout for screen recording the board. */
@media (min-width: 1000px) {
  .board-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 14px; }
  .wrap.wide { max-width: 1180px; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---- sign-up form ---- */
.field { display: block; width: 100%; margin: 6px 0 4px; padding: 12px 14px; min-height: 48px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel-2); }
.small { font-size: .82rem; margin: 0 0 14px; }
.check { display: flex; gap: 10px; align-items: flex-start; margin: 10px 0 14px; font-size: .9rem; }
.check input { width: 22px; height: 22px; flex: none; margin-top: 2px; }
#joinForm .btn { width: 100%; margin-top: 10px; }

/* ---- help (i) and hints ---- */
.info-btn { flex: none; width: 34px; height: 34px; border-radius: 50%; border: 1.5px solid var(--accent); background: transparent; color: var(--accent); font: 700 16px/1 Georgia, serif; font-style: italic; position: relative; }
.info-btn.has-hint::after { content: ""; position: absolute; top: -2px; right: -2px; width: 10px; height: 10px; border-radius: 50%; background: var(--good); border: 2px solid var(--bg); }
.modal { position: fixed; inset: 0; z-index: 30; background: rgba(0, 0, 0, .78); display: grid; place-items: center; padding: 16px; overflow-y: auto; }
.modal-card { width: 100%; max-width: 520px; max-height: calc(100dvh - 32px); overflow-y: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 18px 18px 14px; }
.modal-card h2 { margin: 0 0 8px; font-size: 1.2rem; }
.modal-card h3 { margin: 16px 0 4px; font-size: 1rem; }
.hint { border: 1px solid var(--good); background: color-mix(in srgb, var(--good) 10%, var(--panel)); border-radius: 12px; padding: 10px 12px; margin: 10px 0; }
.hint p { margin: 4px 0 0; }
.tricks { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 8px; }
.tricks li { background: var(--panel-2); border-radius: 10px; padding: 8px 10px; }
.tricks span { display: block; color: var(--muted); font-size: .88rem; margin-top: 2px; }
.small-list { margin: 4px 0 0; padding-left: 18px; font-size: .9rem; }

/* ---- home: big Play button ---- */
.play-wrap { display: grid; justify-items: center; gap: 10px; margin: 26px 0 22px; }
.play-btn { display: inline-flex; align-items: center; justify-content: center; gap: 12px; min-width: min(320px, 100%); min-height: 76px; padding: 18px 34px; border-radius: 999px;
  background: var(--accent); color: var(--accent-ink); font: 800 1.45rem/1 var(--font); letter-spacing: .02em; text-decoration: none;
  box-shadow: 0 10px 30px -8px color-mix(in srgb, var(--accent) 70%, transparent);
  animation: play-pop .55s cubic-bezier(.2, 1.4, .4, 1) .15s both, play-glow 2.4s ease-in-out 1s infinite; }
.play-btn:hover, .play-btn:focus-visible { transform: translateY(-2px) scale(1.03); }
.play-btn:active { transform: scale(.97); }
.play-btn:focus-visible { outline: 3px solid var(--text); outline-offset: 4px; }
.play-sub { margin: 0; font-size: .9rem; animation: play-fade .4s ease-out .5s both; }
@keyframes play-pop { 0% { opacity: 0; transform: scale(.6); } 100% { opacity: 1; transform: scale(1); } }
@keyframes play-glow { 0%, 100% { box-shadow: 0 10px 30px -8px color-mix(in srgb, var(--accent) 70%, transparent), 0 0 0 0 color-mix(in srgb, var(--accent) 45%, transparent); }
  50% { box-shadow: 0 10px 30px -8px color-mix(in srgb, var(--accent) 70%, transparent), 0 0 0 14px color-mix(in srgb, var(--accent) 0%, transparent); } }
@keyframes play-fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
