/* Case Files unlock site. One stylesheet, light and dark, no external fonts. */
:root {
  --bg: #f6f4ee; --paper: #ffffff; --ink: #161616; --muted: #5d5d5d; --rule: #d9d6cd;
  --accent: #8a1c1c; --accent-ink: #ffffff; --key: #ebe8e0; --key-ink: #161616; --ok: #1f7a3a; --bad: #b3261e;
  --radius: 12px; --max: 42rem;
  font-family: ui-serif, Georgia, "Times New Roman", serif;
}
:root[data-theme="dark"] {
  --bg: #121214; --paper: #1c1c20; --ink: #ededed; --muted: #a5a5ad; --rule: #34343a;
  --accent: #d9453c; --key: #2a2a30; --key-ink: #ededed; --ok: #5ccb7a; --bad: #ff6b60;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121214; --paper: #1c1c20; --ink: #ededed; --muted: #a5a5ad; --rule: #34343a;
    --accent: #d9453c; --key: #2a2a30; --key-ink: #ededed; --ok: #5ccb7a; --bad: #ff6b60;
  }
}
body.line-genz { --accent: #2f6bff; font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; }
body.line-kids { --accent: #ff6b6b; --bg: #e9f4ff; font-family: ui-rounded, ui-sans-serif, system-ui, sans-serif; font-size: 1.15rem; }
:root[data-theme="dark"] body.line-kids { --bg: #121214; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) body.line-kids { --bg: #121214; } }

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { line-height: 1.5; -webkit-text-size-adjust: 100%; }
.app { max-width: var(--max); margin: 0 auto; padding: 16px; }
header.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 0 12px; }
header.top a { color: var(--ink); text-decoration: none; font-weight: 700; letter-spacing: 0.04em; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
h1 { font-size: clamp(1.6rem, 5vw, 2.3rem); line-height: 1.1; margin: 0.2em 0 0.3em; }
h2 { font-size: 1.25rem; margin: 1.4em 0 0.4em; }
h3 { font-size: 1.05rem; margin: 1.2em 0 0.3em; }
p { margin: 0.5em 0; }
ul { padding-left: 1.2em; }
.card { background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius); padding: 18px; margin: 14px 0; }
.label { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }

/* theme toggle, plain button */
button { font: inherit; cursor: pointer; }
.toggle { background: transparent; color: var(--muted); border: 1px solid var(--rule); border-radius: 999px; padding: 4px 12px; font-size: 0.85rem; }

/* code display */
.slots { display: flex; gap: 10px; justify-content: center; margin: 14px 0; }
.slot { width: 3rem; height: 3.6rem; border: 2px solid var(--rule); border-radius: 10px; display: grid; place-items: center; font-size: 1.8rem; background: var(--paper); font-family: ui-monospace, Menlo, monospace; }
.slot.filled { border-color: var(--ink); }
.status { min-height: 1.6em; text-align: center; margin: 6px 0; }
.status.bad { color: var(--bad); }
.status.ok { color: var(--ok); }

/* keypads */
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; max-width: 18rem; margin: 10px auto; }
.keypad.symbols { grid-template-columns: repeat(auto-fit, minmax(4.2rem, 1fr)); max-width: 24rem; }
.key { background: var(--key); color: var(--key-ink); border: 0; border-radius: 12px; height: 3.6rem; font-size: 1.5rem; font-family: ui-monospace, Menlo, monospace; }
.keypad.symbols .key { font-size: 2rem; height: 4.2rem; font-family: inherit; }
.keypad.symbols .key.act, .keypad.symbols .key.go { font-size: 1.1rem; grid-column: span 2; }
.key.act { background: transparent; border: 1px solid var(--rule); font-size: 1rem; font-family: inherit; }
.key.go { background: var(--accent); color: var(--accent-ink); font-family: inherit; font-size: 1.05rem; font-weight: 700; }
.key:disabled { opacity: 0.45; cursor: not-allowed; }
.key:active:not(:disabled) { transform: scale(0.97); }

/* ending */
.ending { white-space: normal; }
.ending p { margin: 0.8em 0; font-size: 1.05rem; }
details { margin-top: 16px; }
summary { cursor: pointer; font-weight: 700; }
.hidden { display: none !important; }

/* kids gate */
.gate { position: relative; height: 180px; margin: 10px auto; max-width: 320px; border-radius: 14px; overflow: hidden; background: linear-gradient(#9fd3ff, #e9f4ff); }
.gate .door { position: absolute; top: 0; bottom: 0; width: 50%; background: #c99a5b; border: 4px solid #8a6a3d; transition: transform 1.4s ease-in-out; }
.gate .door.left { left: 0; border-radius: 80px 0 0 0; transform-origin: left; }
.gate .door.right { right: 0; border-radius: 0 80px 0 0; transform-origin: right; }
.gate.open .door.left { transform: translateX(-100%); }
.gate.open .door.right { transform: translateX(100%); }
.gate .sun { position: absolute; left: 50%; top: 45%; width: 70px; height: 70px; margin: -35px 0 0 -35px; border-radius: 50%; background: #ffd93d; box-shadow: 0 0 40px 10px #ffe9a0; }

/* picker */
.list { list-style: none; padding: 0; margin: 0; }
.list li a { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 14px 16px; margin: 8px 0; background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius); color: var(--ink); text-decoration: none; }
.list li a:hover { border-color: var(--accent); }
.pill { font-size: 0.75rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
footer { margin: 30px 0 10px; color: var(--muted); font-size: 0.8rem; }
@media (prefers-reduced-motion: reduce) { .gate .door { transition: none; } }

/* ---- phase 2: checkpoints, colour step, the envelope moment, share card ---- */
.checkpoint .entry { border-style: dashed; }
.entry.done .keypad, .entry.done .colours { display: none; }
.slot.colour { width: 5.2rem; font-size: 0.95rem; font-family: inherit; }
.colours { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 6px auto 4px; max-width: 24rem; }
.swatch { color: #fff; border: 0; border-radius: 999px; padding: 10px 16px; font-weight: 700; text-transform: lowercase; }
.swatch:disabled { opacity: 0.45; }
audio { width: 100%; margin: 6px 0 10px; }
a.button { display: inline-block; background: var(--accent); color: var(--accent-ink); text-decoration: none; padding: 10px 16px; border-radius: 10px; font-weight: 700; }

.envelope { position: relative; width: min(78vw, 300px); aspect-ratio: 3 / 2; margin: calc(min(78vw, 300px) * 0.45) auto 26px; perspective: 900px; }
.envelope .back { position: absolute; inset: 0; background: #d8c7a3; border-radius: 6px; }
.envelope .letter { position: absolute; left: 8%; right: 8%; top: 10%; bottom: 8%; background: #fffdf6; border-radius: 4px; display: grid; place-items: center; transition: transform 0.9s ease 0.55s; box-shadow: 0 1px 4px rgba(0,0,0,0.15); }
.envelope .letter span { font: 800 1.1rem ui-sans-serif, system-ui, sans-serif; letter-spacing: 0.08em; color: #8a1c1c; border: 3px solid #8a1c1c; padding: 4px 10px; transform: rotate(-6deg); }
.envelope .front { position: absolute; inset: 0; background: linear-gradient(to top right, #e9dcbc 50%, transparent 50%) left / 50% 100% no-repeat, linear-gradient(to top left, #e9dcbc 50%, transparent 50%) right / 50% 100% no-repeat; border-radius: 6px; }
.envelope .flap { position: absolute; left: 0; right: 0; top: 0; height: 58%; background: linear-gradient(to bottom, #cdb98f, #c2ad80); clip-path: polygon(0 0, 100% 0, 50% 100%); transform-origin: top; transition: transform 0.6s ease; z-index: 3; }
.envelope.open .flap { transform: rotateX(180deg); z-index: 0; }
.envelope.open .letter { transform: translateY(-55%); z-index: 2; }
.reveal { animation: rise 0.6s ease 1.3s both; }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .envelope .flap, .envelope .letter { transition: none; }
  .reveal { animation: none; }
}
.key.go.wide { display: block; width: 100%; max-width: 18rem; margin: 12px auto 0; height: 3.2rem; }
.card.message { border-color: var(--accent); background: var(--paper); font-size: 1.1rem; }
