:root {
  --bg: #0b0c10;
  --bg-2: #12141d;
  --card: #1a1d2a;
  --card-2: #262b3d;
  --line: #2c3146;
  --text: #ece8df;
  --muted: #b3b8c8;
  --gold: #e6c168;
  --gold-2: #d4a843;
  --gold-soft: rgba(212, 168, 67, .14);
  --crimson: #e0577a;
  --crimson-2: #be3455;
  --emerald: #5fd3a5;
  --amber-bg: rgba(245, 180, 60, .1);
  --amber-line: rgba(245, 180, 60, .35);
  --amber-text: #f6d79a;
  --radius: 16px;
  --serif: "Cormorant Garamond", Georgia, serif;
  --sans: "Plus Jakarta Sans", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--bg);
  background-image:
    radial-gradient(circle at 15% 10%, rgba(212, 168, 67, .08), transparent 40%),
    radial-gradient(circle at 85% 85%, rgba(190, 52, 85, .07), transparent 40%);
  background-attachment: fixed;
  color: var(--text);
  font: 400 16px/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--gold-2); color: var(--bg); }
h1, h2, h3 { font-family: var(--serif); font-weight: 700; line-height: 1.15; margin: 0; color: #fff; }
p { margin: 0; }
a { color: var(--gold); }
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.tiny { font-size: 14px; color: var(--muted); }
.small-caps { font-size: 14px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 16px; }

.ic { width: 18px; height: 18px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }
.ic-gold { color: var(--gold); width: 24px; height: 24px; }
.ic-crimson { color: var(--crimson); width: 24px; height: 24px; }
.ic-emerald { color: var(--emerald); width: 24px; height: 24px; }

/* Top code bar */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap;
  padding: 8px 16px;
  background: rgba(18, 20, 29, .92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(212, 168, 67, .3);
  font-size: 15px;
}
.topbar-text { color: var(--muted); display: inline-flex; gap: 6px; align-items: center; }
.code-chip, .code-big {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px dashed var(--gold); background: var(--gold-soft); color: var(--gold);
  font-family: var(--mono); font-weight: 600; letter-spacing: .08em;
  border-radius: 999px; padding: 6px 14px; font-size: 15px;
  transition: background .2s;
}
.code-chip:hover, .code-big:hover { background: rgba(212, 168, 67, .26); }
.code-chip.copied, .code-big.copied { border-style: solid; color: #fff; }

/* Hero */
.hero { text-align: center; padding-top: 36px; padding-bottom: 24px; }
.eyebrow {
  display: inline-block; padding: 5px 14px; border-radius: 999px;
  background: var(--gold-soft); border: 1px solid rgba(212, 168, 67, .3);
  color: var(--gold); font-size: 14px; letter-spacing: .08em; text-transform: uppercase;
}
.hero h1 { font-size: clamp(38px, 7vw, 64px); margin: 16px 0 12px; }
.hero h1 em { color: var(--gold); font-weight: 600; }
.lead { color: var(--muted); max-width: 640px; margin: 0 auto; font-size: 17px; }

.doors { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; max-width: 900px; margin: 28px auto 0; }
.door {
  display: flex; align-items: center; gap: 12px; text-align: left;
  padding: 16px 18px; border-radius: 14px;
  background: rgba(18, 20, 29, .7); border: 1px solid var(--line);
  transition: border-color .2s, background .2s, transform .2s;
}
.door:hover { border-color: #3d4360; }
.door strong { display: block; font-family: var(--serif); font-size: 21px; line-height: 1.2; color: #fff; }
.door small { display: block; font-size: 14px; color: var(--muted); }
.door[aria-selected="true"] { background: var(--card); border-color: var(--gold-2); box-shadow: 0 8px 30px -12px rgba(212, 168, 67, .45); }

main { padding-bottom: 48px; }
.view { animation: rise .45s cubic-bezier(.16, 1, .3, 1); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.panel, .vip-card {
  background: rgba(26, 29, 42, .78);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(212, 168, 67, .18);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: 0 30px 60px -30px rgba(0, 0, 0, .7);
}
.panel-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.panel-head h2 { font-size: clamp(28px, 4vw, 36px); margin: 4px 0 6px; }
.kicker { font-size: 14px; letter-spacing: .12em; text-transform: uppercase; font-weight: 600; display: inline-flex; gap: 6px; align-items: center; }
.kicker-gold { color: var(--gold); }
.kicker-crimson { color: var(--crimson); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: 12px; padding: 12px 18px; font-weight: 700; font-size: 15px;
  border: 1px solid transparent; text-decoration: none; transition: background .2s, transform .15s, box-shadow .2s;
  min-height: 46px;
}
.btn:active { transform: scale(.98); }
.btn-gold { background: var(--gold-2); color: var(--bg); }
.btn-gold:hover { background: var(--gold); box-shadow: 0 0 25px -5px rgba(212, 168, 67, .5); }
.btn-ghost { background: var(--card-2); color: var(--gold); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--gold-2); }
.btn-crimson { background: var(--card-2); color: var(--text); border-color: var(--line); width: 100%; }
.btn-crimson:hover:not(:disabled) { background: var(--crimson-2); color: #fff; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-outline { background: transparent; color: var(--gold); border-color: rgba(212, 168, 67, .4); }
.btn-outline:hover { background: var(--gold-soft); }

/* Mirror */
.mirror-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; margin-top: 24px; }
.scene {
  position: relative; margin: 0; min-height: 380px; border-radius: 14px; overflow: hidden;
  border: 1px solid rgba(212, 168, 67, .2);
  display: flex; flex-direction: column; justify-content: flex-end;
  background: var(--scene-bg, linear-gradient(160deg, #262b3d, #0b0c10));
}
.scene::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(circle at 70% 25%, rgba(255, 230, 170, .22), transparent 45%);
}
.scene img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .85; transition: transform .8s; }
.scene:hover img { transform: scale(1.04); }
.scene::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, #0b0c10 8%, rgba(11, 12, 16, .45) 50%, transparent); }
.scene figcaption { position: relative; z-index: 2; padding: 22px; }
.scene-meta { display: flex; justify-content: space-between; gap: 8px; color: var(--gold); font-size: 14px; margin-bottom: 6px; }
.pill { padding: 2px 10px; border-radius: 999px; background: rgba(18, 20, 29, .9); border: 1px solid rgba(212, 168, 67, .3); }
.scene h3 { font-size: clamp(26px, 3.4vw, 32px); }
.scene p { color: #d6d9e3; font-style: italic; margin-top: 6px; font-size: 16px; }

.journal { background: rgba(18, 20, 29, .9); border: 1px solid var(--line); border-radius: 14px; padding: 24px; display: flex; flex-direction: column; gap: 14px; }
.journal blockquote {
  margin: 0; padding: 4px 0 4px 16px; border-left: 2px solid var(--gold-2);
  font-family: var(--serif); font-style: italic; font-size: clamp(22px, 2.6vw, 26px); line-height: 1.4; color: #f4f1ea;
}
.field-label { font-size: 14px; color: var(--muted); }
textarea {
  width: 100%; resize: vertical; min-height: 110px;
  background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 12px;
  padding: 14px; font: 16px/1.55 var(--sans);
}
textarea:focus, input:focus { outline: none; border-color: var(--gold-2); }
textarea::placeholder, input::placeholder { color: #727892; }
.journal-actions { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; padding-top: 14px; border-top: 1px solid var(--line); margin-top: auto; }
.world-link { color: var(--muted); font-size: 15px; text-underline-offset: 4px; }
.world-link:hover { color: var(--gold); }
.world-link strong { color: var(--gold); font-weight: 600; }

.log { margin-top: 28px; padding-top: 22px; border-top: 1px solid var(--line); }
.log-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.log-head h3 { font-size: 22px; color: var(--gold); }
.link-danger { background: none; border: none; color: var(--muted); font-size: 14px; text-decoration: underline; text-underline-offset: 3px; padding: 6px; }
.link-danger:hover { color: #f08ca5; }
.log-list { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.log-item { background: rgba(11, 12, 16, .8); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.log-item-head { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; color: var(--gold); margin-bottom: 4px; }
.log-item-head span:last-child { color: var(--muted); }
.log-item p { font-size: 15px; color: #d6d9e3; white-space: pre-wrap; overflow-wrap: anywhere; }

/* Detective */
.score-box { text-align: right; flex-shrink: 0; }
.score-box strong { font-family: var(--serif); font-size: 40px; color: var(--gold); margin-right: 4px; }
.score-box .small-caps { display: block; }
.case-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 22px 0 18px; }
.case-tab {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 10px; font-family: var(--mono); font-size: 14px; font-weight: 600;
  background: var(--bg-2); border: 1px solid var(--line); color: var(--muted);
}
.case-tab[aria-selected="true"] { background: var(--crimson-2); border-color: var(--crimson-2); color: #fff; }
.case-tab .ic { width: 16px; height: 16px; color: var(--gold); }
.case-tab[aria-selected="true"] .ic { color: #fff; }
.case-tab.locked { border-style: dashed; }

.dossier { background: var(--bg); border: 1px solid var(--line); border-radius: 14px; padding: 22px; display: grid; gap: 12px; }
.case-scene { position: relative; width: 100%; height: 0; padding-bottom: 56.25%; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: var(--card-2); }
.case-scene img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.case-scene::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(11, 12, 16, .55), transparent 45%); }
.case-scene.sealed img { filter: grayscale(.6) brightness(.55); }
.dossier-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 14px; }
.file-code { font-family: var(--mono); padding: 3px 10px; border-radius: 6px; background: rgba(190, 52, 85, .18); color: var(--crimson); border: 1px solid rgba(190, 52, 85, .4); }
.status { font-family: var(--mono); color: var(--muted); }
.status b.open { color: #f5c46a; }
.status b.solved { color: var(--emerald); }
.dossier h3 { font-size: clamp(26px, 3.4vw, 30px); }
.dossier > p { color: #d6d9e3; }
.fact { display: flex; gap: 10px; align-items: flex-start; padding: 14px 16px; border-radius: 10px; background: var(--amber-bg); border: 1px solid var(--amber-line); color: var(--amber-text); font-size: 16px; }
.fact .ic { color: #f5c46a; margin-top: 3px; }
.fact b { font-family: var(--mono); font-size: 14px; letter-spacing: .06em; display: block; color: #f5c46a; }
.hint-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.hint-text { padding: 12px 16px; border-radius: 10px; background: rgba(95, 211, 165, .08); border: 1px solid rgba(95, 211, 165, .3); color: #c4f0dc; font-size: 16px; }
.attempts { font-size: 14px; color: var(--muted); }

.suspects { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 16px; }
.suspect { background: rgba(18, 20, 29, .9); border: 1px solid var(--line); border-radius: 14px; padding: 18px; display: flex; flex-direction: column; gap: 12px; transition: border-color .2s; }
.suspect:hover { border-color: rgba(212, 168, 67, .4); }
.suspect .role { font-family: var(--mono); font-size: 14px; text-transform: uppercase; color: var(--muted); }
.suspect h4 { font-family: var(--serif); font-size: 23px; color: #fff; margin: 0; line-height: 1.2; }
.suspect blockquote { margin: 0; flex: 1; padding: 14px; border-radius: 10px; background: rgba(11, 12, 16, .7); border: 1px solid var(--line); font-style: italic; color: #e2e4ec; font-size: 16px; }
.suspect.cleared { opacity: .6; border-color: rgba(95, 211, 165, .35); }
.suspect.liar { border-color: var(--crimson-2); box-shadow: 0 0 0 1px var(--crimson-2) inset; }

.verdict { margin-top: 16px; padding: 18px 20px; border-radius: 14px; display: grid; gap: 10px; animation: rise .4s ease; }
.verdict-title { display: flex; gap: 8px; align-items: center; font-weight: 700; font-size: 15px; letter-spacing: .06em; text-transform: uppercase; }
.verdict.good { background: rgba(16, 80, 58, .35); border: 1px solid rgba(95, 211, 165, .45); color: #d9f7ea; }
.verdict.good .verdict-title { color: var(--emerald); }
.verdict.bad { background: rgba(110, 24, 46, .35); border: 1px solid rgba(240, 120, 150, .4); color: #fbdbe4; }
.verdict.bad .verdict-title { color: #f590a9; }
.verdict-actions { display: flex; flex-wrap: wrap; gap: 10px; padding-top: 4px; }

.locked-case { text-align: center; padding: 34px 22px; border: 1px dashed rgba(212, 168, 67, .45); border-radius: 14px; background: linear-gradient(160deg, rgba(38, 43, 61, .6), rgba(11, 12, 16, .8)); display: grid; gap: 12px; justify-items: center; }
.locked-case .lock-ic { width: 44px; height: 44px; color: var(--gold); }
.locked-case h3 { font-size: 30px; }
.locked-case p { max-width: 560px; color: #d6d9e3; }

/* Final rank */
.final { margin-top: 24px; padding: 26px; border-radius: 16px; border: 1px solid var(--gold-2); background: radial-gradient(circle at 50% 0%, rgba(212, 168, 67, .16), transparent 60%), var(--bg-2); display: grid; gap: 16px; text-align: center; justify-items: center; }
.final .rank { font-family: var(--serif); font-size: clamp(34px, 6vw, 46px); color: var(--gold); line-height: 1.1; }
.final .rank-note { color: #d6d9e3; max-width: 560px; }
.name-row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; width: 100%; max-width: 520px; }
.name-row input { flex: 1; min-width: 200px; min-height: 46px; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font: 16px var(--sans); }
.cert-preview { width: min(320px, 100%); border-radius: 10px; border: 1px solid var(--line); }
.review-ask { width: 100%; max-width: 620px; padding: 18px; border-radius: 14px; background: rgba(26, 29, 42, .9); border: 1px solid var(--line); display: grid; gap: 10px; justify-items: center; }
.review-ask p { color: #d6d9e3; }

/* Library */
.vip-card { display: flex; align-items: center; justify-content: space-between; gap: 24px; border-color: rgba(212, 168, 67, .45); background: linear-gradient(110deg, #12141d, #1a1d2a 50%, #12141d); }
.vip-card h2 { font-size: clamp(28px, 4vw, 36px); margin: 6px 0 8px; }
.vip-code { text-align: center; flex-shrink: 0; display: grid; gap: 8px; justify-items: center; background: rgba(11, 12, 16, .9); border: 1px solid rgba(212, 168, 67, .4); border-radius: 14px; padding: 18px 22px; }
.code-big { font-size: 22px; padding: 12px 22px; border-radius: 12px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 24px 0 16px; }
.filters button { padding: 9px 14px; border-radius: 10px; font-size: 15px; font-weight: 600; background: var(--bg-2); border: 1px solid var(--line); color: var(--muted); }
.filters button[aria-pressed="true"] { background: var(--gold-2); color: var(--bg); border-color: var(--gold-2); }
.library-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.product { background: rgba(26, 29, 42, .78); border: 1px solid rgba(212, 168, 67, .18); border-radius: 14px; padding: 20px; display: flex; flex-direction: column; gap: 10px; transition: border-color .2s, transform .2s; }
.product:hover { border-color: rgba(212, 168, 67, .5); transform: translateY(-2px); }
.product .badge { align-self: flex-start; padding: 3px 10px; border-radius: 999px; background: var(--gold-soft); border: 1px solid rgba(212, 168, 67, .3); color: var(--gold); font-size: 14px; font-weight: 600; }
.product h3 { font-size: 25px; }
.product p { color: var(--muted); font-size: 15px; flex: 1; }
.product .btn { margin-top: 6px; }

.footer { text-align: center; padding-top: 24px; padding-bottom: 32px; border-top: 1px solid #1c1f2c; color: var(--muted); font-size: 15px; display: grid; gap: 8px; }
.footer strong { color: var(--gold); }
.footer a { display: inline-flex; gap: 4px; align-items: center; }

.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 60; max-width: calc(100% - 32px); padding: 12px 18px; border-radius: 12px; background: var(--card); border: 1px solid rgba(212, 168, 67, .45); color: var(--text); font-size: 15px; box-shadow: 0 20px 40px -10px rgba(0, 0, 0, .7); }

/* Responsive */
@media (max-width: 900px) {
  .library-grid { grid-template-columns: 1fr 1fr; }
  .suspects { grid-template-columns: 1fr; }
  .mirror-grid { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
  .doors { grid-template-columns: 1fr; }
  .panel, .vip-card { padding: 20px 16px; }
  .panel-head { flex-direction: column; align-items: stretch; }
  .panel-head .btn { width: 100%; }
  .score-box { text-align: left; }
  .scene { min-height: 300px; }
  .log-list, .library-grid { grid-template-columns: 1fr; }
  .vip-card { flex-direction: column; align-items: stretch; }
  .journal { padding: 18px 16px; }
  .hero { padding-top: 24px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
.topbar .offer { color: var(--gold); font-weight: 700; }

/* Expandable photos */
.scene, .case-scene, .product-media, .cert-preview { cursor: zoom-in; }
.case-scene::before, .product-media::before {
  content: "⤢"; position: absolute; top: 10px; right: 10px; z-index: 3;
  width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%;
  background: rgba(11, 12, 16, .75); border: 1px solid rgba(212, 168, 67, .45); color: var(--gold); font-size: 18px;
}
.scene .zoom-hint { position: absolute; top: 10px; right: 10px; z-index: 3; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: rgba(11, 12, 16, .75); border: 1px solid rgba(212, 168, 67, .45); color: var(--gold); font-size: 18px; }
.case-scene.square { padding-bottom: 99.7%; }
.lightbox { position: fixed; inset: 0; z-index: 80; background: rgba(5, 6, 9, .94); display: grid; place-items: center; padding: 56px 12px 16px; cursor: zoom-out; animation: rise .25s ease; }
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; box-shadow: 0 30px 80px rgba(0, 0, 0, .7); }
.lightbox-close { position: absolute; top: 10px; right: 12px; width: 44px; height: 44px; border-radius: 50%; border: 1px solid rgba(212, 168, 67, .5); background: var(--card); color: var(--gold); font-size: 28px; line-height: 1; }

/* Library media + featured product */
.product-media { position: relative; width: 100%; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: var(--card-2); margin-bottom: 4px; }
.product-media img { display: block; width: 100%; height: auto; }
.product.featured { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: center; border-color: rgba(212, 168, 67, .55); background: radial-gradient(circle at 80% 0%, rgba(190, 52, 85, .18), transparent 55%), rgba(26, 29, 42, .9); }
.featured-body { display: flex; flex-direction: column; gap: 12px; }
.featured-body h3 { font-size: clamp(28px, 3.6vw, 36px); }
.featured-body .hook { font-family: var(--serif); font-style: italic; font-size: 22px; color: var(--gold); flex: none; }
.featured-body p { flex: none; }
.points { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.points li { display: flex; gap: 8px; align-items: flex-start; color: #d6d9e3; font-size: 15px; }
.points .ic { color: var(--emerald); margin-top: 3px; }
.locked-case .case-scene { max-width: 560px; }
@media (max-width: 900px) { .product.featured { grid-template-columns: 1fr; } }
.product.shop-card { grid-column: 1 / -1; text-align: center; align-items: center; border-style: dashed; border-color: rgba(212, 168, 67, .5); background: radial-gradient(circle at 50% 0%, rgba(212, 168, 67, .14), transparent 60%), rgba(26, 29, 42, .85); }
.product.shop-card .badge { align-self: center; }
.product.shop-card p { max-width: 620px; }

/* Difficulty */
.case-tab .lvl { color: var(--gold); font-size: 14px; letter-spacing: 1px; }
.case-tab[aria-selected="true"] .lvl { color: #ffe6a8; }
.level-tag { font-family: var(--mono); font-size: 14px; padding: 3px 10px; border-radius: 6px; background: var(--gold-soft); color: var(--gold); border: 1px solid rgba(212, 168, 67, .35); }
.dossier .fact + .fact { margin-top: -2px; }

/* Install */
.install-btn { margin: 18px auto 0; }
.install-help { max-width: 460px; margin: 10px auto 0; font-size: 15px; color: var(--muted); }
