:root {
  --bg: #0f1f17;
  --bg2: #163024;
  --card: #1c3a2c;
  --ink: #f4efe6;
  --muted: #b7c4ba;
  --gold: #e2b857;
  --gold2: #f0d78c;
  --rose: #d97b7b;
  --ok: #6fcf97;
  --line: rgba(244,239,230,.12);
  --shadow: 0 12px 40px rgba(0,0,0,.35);
  --radius: 18px;
  --font: "Segoe UI", system-ui, -apple-system, Roboto, Ubuntu, Cantarell, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink); font-family: var(--font); }
body {
  min-height: 100dvh;
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(226,184,87,.18), transparent 50%),
    radial-gradient(900px 500px at 100% 0%, rgba(111,207,151,.12), transparent 45%),
    var(--bg);
}
a { color: var(--gold2); }
.wrap { width: min(720px, 100% - 2rem); margin: 0 auto; padding: 1.25rem 0 3rem; }
.brand { display: flex; align-items: center; gap: .75rem; margin-bottom: 1.25rem; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 12px;
  background: linear-gradient(145deg, var(--gold), #a67c2d);
  display: grid; place-items: center; font-weight: 800; color: #1a1205; box-shadow: var(--shadow);
}
.brand h1 { font-size: 1.15rem; margin: 0; letter-spacing: .02em; }
.brand p { margin: 0; color: var(--muted); font-size: .85rem; }
.card {
  background: linear-gradient(180deg, rgba(255,255,255,.03), transparent), var(--card);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem;
  box-shadow: var(--shadow); margin-bottom: 1rem;
}
.hero h2 { margin: 0 0 .5rem; font-size: clamp(1.5rem, 4vw, 2rem); line-height: 1.2; }
.hero p { margin: 0; color: var(--muted); line-height: 1.5; }
.row { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1rem; }
label { display: block; font-size: .85rem; color: var(--muted); margin: .75rem 0 .35rem; }
input[type=text], input[type=search], select, textarea {
  width: 100%; border-radius: 12px; border: 1px solid var(--line);
  background: var(--bg2); color: var(--ink); padding: .8rem .9rem; font: inherit;
}
textarea { min-height: 110px; resize: vertical; }
.btn {
  appearance: none; border: 0; border-radius: 999px; padding: .85rem 1.2rem;
  font: inherit; font-weight: 700; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
}
.btn-primary { background: linear-gradient(135deg, var(--gold), #c9972f); color: #1a1205; }
.btn-ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn-danger { background: rgba(217,123,123,.15); color: #ffc9c9; border: 1px solid rgba(217,123,123,.35); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.notice {
  background: rgba(226,184,87,.1); border: 1px solid rgba(226,184,87,.25);
  color: var(--gold2); border-radius: 12px; padding: .75rem .9rem; font-size: .9rem; margin: .75rem 0;
}
.warn {
  background: rgba(217,123,123,.1); border: 1px solid rgba(217,123,123,.3);
  color: #ffc9c9; border-radius: 12px; padding: .75rem .9rem; font-size: .9rem; margin: .75rem 0;
}
.ok { color: var(--ok); font-size: .9rem; }
.err { color: #ffb4b4; font-size: .9rem; }
.counter {
  display: inline-flex; align-items: baseline; gap: .35rem;
  background: rgba(0,0,0,.25); border-radius: 999px; padding: .45rem .85rem;
  border: 1px solid var(--line); font-weight: 800;
}
.counter span { color: var(--gold); font-size: 1.25rem; }
.grid-doors {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: .55rem; margin-top: 1rem;
}
@media (min-width: 560px) { .grid-doors { grid-template-columns: repeat(6, 1fr); } }
.door {
  aspect-ratio: 1; border-radius: 14px; border: 1px solid var(--line);
  background: var(--bg2); color: var(--ink); font-weight: 800; font-size: 1.05rem;
  cursor: pointer; position: relative; overflow: hidden;
  display: grid; place-items: center; transition: transform .15s ease, border-color .15s;
}
.door:hover, .door:focus-visible { transform: translateY(-2px); border-color: var(--gold); outline: none; }
.door.filled::after {
  content: ""; position: absolute; inset: auto 8px 8px auto; width: 8px; height: 8px;
  border-radius: 50%; background: var(--gold);
}
.door.open { background: linear-gradient(160deg, #2a523d, #1a3328); border-color: rgba(111,207,151,.4); }
.door.locked { opacity: .85; }
.door.empty-open { border-style: dashed; }
.hp { position: absolute; left: -9999px; opacity: 0; height: 0; width: 0; overflow: hidden; }
.wrappers { display: grid; grid-template-columns: repeat(4, 1fr); gap: .4rem; }
.wrap-opt {
  border: 1px solid var(--line); border-radius: 12px; padding: .55rem .2rem; text-align: center;
  background: var(--bg2); cursor: pointer; font-size: 1.25rem;
}
.wrap-opt.active { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold); }
.footer { color: var(--muted); font-size: .8rem; margin-top: 2rem; line-height: 1.5; }
.footer a { color: var(--muted); }
.modal-bg {
  position: fixed; inset: 0; background: rgba(0,0,0,.55); display: grid; place-items: end center;
  padding: 1rem; z-index: 40;
}
.modal {
  width: min(560px, 100%); background: var(--card); border: 1px solid var(--line);
  border-radius: 20px 20px 16px 16px; padding: 1.1rem; box-shadow: var(--shadow);
  max-height: min(90dvh, 720px); overflow: auto;
}
.secret-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: #0b1611; border-radius: 12px; padding: .9rem; word-break: break-all;
  border: 1px dashed rgba(226,184,87,.35); color: var(--gold2);
}
.msg {
  border: 1px solid var(--line); border-radius: 14px; padding: .9rem; margin: .6rem 0; background: rgba(0,0,0,.18);
}
.msg .who { font-weight: 700; color: var(--gold2); }
.msg .meta { color: var(--muted); font-size: .8rem; }
.chip { display: inline-block; padding: .15rem .5rem; border-radius: 999px; background: rgba(255,255,255,.06); font-size: .75rem; margin-left: .35rem; }
.story-frame {
  width: min(360px, 100%); aspect-ratio: 9/16; margin: 1rem auto; border-radius: 16px;
  border: 1px solid var(--line); background: #000; overflow: hidden;
}
.story-frame canvas { width: 100%; height: 100%; display: block; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
.checkline { display: flex; gap: .5rem; align-items: flex-start; margin: .75rem 0; font-size: .9rem; color: var(--muted); }
.checkline input { margin-top: .2rem; }
.lang { margin-left: auto; }
.lang select { width: auto; padding: .4rem .6rem; }
@media (prefers-reduced-motion: reduce) {
  .door { transition: none; }
}

/* Bingo 5×5 */
.grid-bingo {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: .4rem;
  margin-top: 1rem;
}
.cell {
  aspect-ratio: 1;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg2);
  color: var(--ink);
  font-size: clamp(.65rem, 2.4vw, .85rem);
  padding: .35rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1.2;
  position: relative;
  overflow: hidden;
}
.cell.free { background: linear-gradient(145deg, #e2b857, #c9972f); color: #1a1205; font-weight: 800; cursor: default; }
.cell.filled { background: #1a3344; border-color: rgba(126,200,227,.45); }
.cell.crossed { opacity: .55; }
.cell.crossed::after {
  content: "✕";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 2rem;
  color: #7ec8e3;
  font-weight: 900;
  pointer-events: none;
}
.cell.pending-mark::before {
  content: "";
  position: absolute;
  top: 6px; right: 6px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--gold);
}
.cell.empty { border-style: dashed; }
.bingo-banner {
  display: none;
  text-align: center;
  font-size: clamp(2rem, 8vw, 3.5rem);
  font-weight: 900;
  color: #e2b857;
  animation: pop .6s ease;
  margin: 1rem 0;
}
.bingo-banner.show { display: block; }
@keyframes pop {
  0% { transform: scale(.5); opacity: 0; }
  60% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1); }
}
:root {
  --bg: #0c1822;
  --bg2: #132433;
  --card: #173044;
  --gold: #7ec8e3;
  --gold2: #a8dff0;
}
