:root {
  --bg: #0b0a12;
  --bg2: #14121e;
  --ink: #f3ead6;
  --ink-dim: #b9ae96;
  --ink-faint: #7d735f;
  --gold: #e0b04a;
  --gold-deep: #8a6420;
  --line: rgba(224, 176, 74, .22);
  --card: rgba(20, 17, 28, .78);
  --a1: #6b4a2a;       /* Hausfarbe 1 */
  --a2: #e0b04a;       /* Hausfarbe 2 */
  --glow: #ffcf7a;
  --serif: "Palatino Linotype", "Book Antiqua", Palatino, Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --radius: 16px;
  color-scheme: dark;
}
body[data-house="gryffindor"] { --a1: #8e1b1b; --a2: #e0b04a; --glow: #ffb35c; }
body[data-house="slytherin"]  { --a1: #1f5f3a; --a2: #c9d2ce; --glow: #6fe0a5; }
body[data-house="ravenclaw"]  { --a1: #22337a; --a2: #c9a26a; --glow: #a8c8ff; }
body[data-house="hufflepuff"] { --a1: #c99a22; --a2: #2a221c; --glow: #ffd77a; }

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100vh; background: var(--bg); color: var(--ink);
  font-family: var(--serif); font-size: 17px; line-height: 1.55;
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; cursor: pointer; }
input, textarea { font: inherit; color: var(--ink); }
[hidden] { display: none !important; }

.sky {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(1200px 600px at 50% -10%, color-mix(in srgb, var(--a1) 45%, transparent), transparent 70%),
    radial-gradient(900px 500px at 100% 100%, rgba(80, 60, 140, .18), transparent 70%),
    linear-gradient(#0b0a12, #07060c);
  transition: background 1s;
}

/* ------------------------------------------------------------------ Kopf */
.topbar {
  position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 18px;
  padding: 10px 22px; background: rgba(11, 10, 18, .82); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; font-size: 22px; letter-spacing: .04em; color: var(--ink); font-weight: 700; }
.brand:hover { text-decoration: none; }
.brand-mark { color: var(--gold); filter: drop-shadow(0 0 8px var(--gold)); }
.brand-accent { color: var(--gold); }
.nav { display: flex; align-items: center; gap: 6px; flex: 1; flex-wrap: wrap; }
.nav a { color: var(--ink-dim); padding: 6px 12px; border-radius: 999px; font-size: 15px; }
.nav a:hover, .nav a.active { color: var(--ink); background: rgba(255, 255, 255, .06); text-decoration: none; }
.nav-houses { display: flex; gap: 4px; margin-left: 6px; }
.nav-houses a { padding: 3px; border-radius: 10px; line-height: 0; opacity: .8; }
.nav-houses a.active, .nav-houses a:hover { opacity: 1; background: rgba(255, 255, 255, .08); }
.account-btn {
  border: 1px solid var(--line); background: rgba(255, 255, 255, .04); border-radius: 999px;
  padding: 7px 16px; font-size: 15px; display: flex; align-items: center; gap: 8px; white-space: nowrap;
}
.account-btn:hover { border-color: var(--gold); }
.account-btn .pts { color: var(--gold); font-variant-numeric: tabular-nums; }

.view { max-width: 1280px; margin: 0 auto; padding: 28px 22px 40px; outline: none; animation: fadeIn .45s ease; }
.view.wide { max-width: none; padding: 0 0 40px; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.footer { color: var(--ink-faint); font-size: 13px; text-align: center; padding: 30px 20px 40px; max-width: 900px; margin: 0 auto; font-family: var(--sans); }

/* ------------------------------------------------------------------ Bausteine */
h1, h2, h3 { font-weight: 700; line-height: 1.15; margin: 0 0 .4em; letter-spacing: .01em; }
h1 { font-size: clamp(34px, 5vw, 60px); }
h2 { font-size: clamp(24px, 3vw, 34px); }
h3 { font-size: 20px; }
.eyebrow { text-transform: uppercase; letter-spacing: .22em; font-size: 12px; color: var(--gold); font-family: var(--sans); font-weight: 600; }
.muted { color: var(--ink-dim); }
.faint { color: var(--ink-faint); font-size: 14px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  border-radius: 999px; padding: 12px 26px; font-size: 17px; border: 1px solid transparent;
  background: linear-gradient(180deg, #f4d27a, #c8952e); color: #24170a; font-weight: 700;
  box-shadow: 0 6px 24px rgba(224, 176, 74, .25), inset 0 1px 0 rgba(255, 255, 255, .5);
  transition: transform .15s, box-shadow .2s, filter .2s;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 10px 34px rgba(224, 176, 74, .4); text-decoration: none; filter: brightness(1.05); }
.btn:active { transform: translateY(1px); }
.btn.ghost { background: rgba(255, 255, 255, .04); color: var(--ink); border-color: var(--line); box-shadow: none; font-weight: 600; }
.btn.ghost:hover { border-color: var(--gold); }
.btn.small { padding: 7px 16px; font-size: 15px; }
.btn[disabled] { opacity: .5; cursor: default; transform: none; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; backdrop-filter: blur(6px); }
.input {
  width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line);
  background: rgba(0, 0, 0, .35); outline: none; transition: border-color .2s, box-shadow .2s;
}
.input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(224, 176, 74, .18); }
textarea.input { min-height: 110px; resize: vertical; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.grid { display: grid; gap: 18px; }

/* ------------------------------------------------------------------ Startseite */
.hero { position: relative; border-radius: 0 0 28px 28px; overflow: hidden; min-height: min(78vh, 760px); display: grid; align-items: end; }
.hero .scene-svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(11, 10, 18, 0) 30%, rgba(11, 10, 18, .55) 55%, rgba(11, 10, 18, .94) 92%), linear-gradient(90deg, rgba(11, 10, 18, .6), transparent 60%); }
.hero-content { position: relative; z-index: 2; padding: 0 clamp(20px, 5vw, 70px) 56px; max-width: 820px; }
.hero h1 { text-shadow: 0 4px 30px rgba(0, 0, 0, .8); }
.hero h1 .glint {
  background: linear-gradient(90deg, #f4d27a, #fff6d8 40%, #c8952e 60%, #f4d27a); background-size: 200% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent; animation: glint 6s linear infinite;
}
@keyframes glint { to { background-position: -200% 0; } }
.hero p { font-size: 20px; color: var(--ink); text-shadow: 0 2px 12px rgba(0, 0, 0, .9); max-width: 640px; }
.home-sections { max-width: 1280px; margin: 0 auto; padding: 36px 22px 0; display: grid; gap: 34px; }

.houses-grid { grid-template-columns: repeat(4, 1fr); }
.house-card {
  position: relative; overflow: hidden; border-radius: var(--radius); border: 1px solid var(--line);
  min-height: 300px; display: flex; flex-direction: column; justify-content: flex-end; color: var(--ink);
  transition: transform .25s, box-shadow .25s, border-color .25s; isolation: isolate;
}
.house-card:hover { transform: translateY(-4px); text-decoration: none; box-shadow: 0 18px 50px rgba(0, 0, 0, .5); border-color: var(--hc2); }
.house-card .scene-svg { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -2; transition: transform 6s ease; }
.house-card:hover .scene-svg { transform: scale(1.06); }
.house-card::before { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(180deg, transparent 20%, rgba(8, 7, 12, .95) 88%); }
.house-card .hc-body { padding: 18px; }
.house-card .crest { filter: drop-shadow(0 6px 14px rgba(0, 0, 0, .6)); margin-bottom: 6px; }
.house-card h3 { margin: 0; font-size: 24px; }
.house-card .traits { font-size: 14px; color: var(--ink-dim); font-family: var(--sans); }
.house-card .mine-badge { position: absolute; top: 12px; right: 12px; background: var(--hc1); color: #fff; font-size: 12px; font-family: var(--sans); padding: 4px 10px; border-radius: 999px; border: 1px solid var(--hc2); }

/* Stundengläser */
.cup { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; align-items: end; }
.hourglass { text-align: center; }
.hg-tube {
  position: relative; height: 220px; width: 76px; margin: 0 auto 10px; border-radius: 38px / 22px;
  background: linear-gradient(90deg, rgba(255, 255, 255, .08), rgba(255, 255, 255, .02) 40%, rgba(255, 255, 255, .1));
  border: 2px solid rgba(255, 255, 255, .18); overflow: hidden; box-shadow: inset 0 0 22px rgba(0, 0, 0, .6);
}
.hg-tube::before, .hg-tube::after { content: ""; position: absolute; left: -6px; right: -6px; height: 14px; background: linear-gradient(#f4d27a, #8a6420); border-radius: 6px; z-index: 3; }
.hg-tube::before { top: 0; } .hg-tube::after { bottom: 0; }
.hg-fill {
  position: absolute; left: 0; right: 0; bottom: 0; height: 0%;
  background-image: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, .7) 0 2px, transparent 3px), radial-gradient(circle at 70% 60%, rgba(255, 255, 255, .5) 0 2px, transparent 3px), linear-gradient(180deg, var(--gem-l), var(--gem));
  background-size: 14px 14px, 18px 18px, 100% 100%;
  transition: height 1.6s cubic-bezier(.2, .8, .2, 1); box-shadow: 0 0 30px var(--gem);
}
.hg-pts { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.hg-name { font-size: 15px; color: var(--ink-dim); }
.top-list { list-style: none; margin: 0; padding: 0; counter-reset: top; font-family: var(--sans); font-size: 15px; }
.top-list li { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid rgba(255, 255, 255, .05); counter-increment: top; }
.top-list li::before { content: counter(top); width: 22px; color: var(--ink-faint); text-align: right; }
.top-list .dot { width: 10px; height: 10px; border-radius: 50%; }
.top-list .pts { margin-left: auto; color: var(--gold); font-variant-numeric: tabular-nums; }
.cup-wrap { grid-template-columns: 2fr 1fr; align-items: start; }

/* ------------------------------------------------------------------ Einteilung */
.sorting { display: grid; grid-template-columns: 340px 1fr; gap: 34px; align-items: center; min-height: 70vh; }
.hat-stage { text-align: center; position: relative; }
.hat-stage .hat-svg { filter: drop-shadow(0 20px 30px rgba(0, 0, 0, .7)); animation: hatFloat 5s ease-in-out infinite; }
.hat-stage.thinking .hat-svg { animation: hatThink .5s ease-in-out infinite alternate; }
@keyframes hatFloat { 50% { transform: translateY(-10px) rotate(-2deg); } }
@keyframes hatThink { from { transform: rotate(-5deg) scale(1.02); } to { transform: rotate(5deg) scale(.98); } }
.hat-svg .hat-mouth { transform-box: fill-box; transform-origin: center; animation: talk .9s ease-in-out infinite; }
@keyframes talk { 50% { transform: scaleY(1.8); } }
.bubble {
  position: relative; margin: 18px auto 0; background: #f3ead6; color: #2a1d10; border-radius: 18px; padding: 14px 18px;
  font-style: italic; max-width: 320px; box-shadow: 0 10px 30px rgba(0, 0, 0, .4); min-height: 3.2em;
}
.bubble::before { content: ""; position: absolute; top: -12px; left: 50%; margin-left: -12px; border: 12px solid transparent; border-top: 0; border-bottom-color: #f3ead6; }
.q-card { padding: 30px; }
.q-progress { height: 6px; border-radius: 3px; background: rgba(255, 255, 255, .08); overflow: hidden; margin-bottom: 22px; }
.q-progress > div { height: 100%; background: linear-gradient(90deg, var(--gold-deep), var(--gold)); transition: width .4s; }
.q-num { font-family: var(--sans); font-size: 13px; letter-spacing: .15em; color: var(--ink-faint); text-transform: uppercase; }
.q-text { font-size: clamp(22px, 2.6vw, 30px); margin: 6px 0 22px; }
.q-options { display: grid; gap: 12px; }
.q-opt {
  text-align: left; padding: 15px 20px; border-radius: 14px; border: 1px solid var(--line);
  background: rgba(255, 255, 255, .03); font-size: 18px; transition: background .2s, border-color .2s, transform .15s;
  display: flex; gap: 14px; align-items: center;
}
.q-opt:hover { background: rgba(224, 176, 74, .1); border-color: var(--gold); transform: translateX(4px); }
.q-opt .k { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--line); font-family: var(--sans); font-size: 13px; color: var(--gold); }
.q-opt.chosen { background: rgba(224, 176, 74, .18); border-color: var(--gold); }
.q-nav { display: flex; justify-content: space-between; margin-top: 20px; }

.reveal { text-align: center; padding: 30px 0 10px; position: relative; }
.reveal .house-big { font-size: clamp(54px, 9vw, 120px); font-weight: 700; letter-spacing: .04em; margin: 10px 0; color: var(--a2); text-shadow: 0 0 40px var(--glow), 0 6px 0 rgba(0, 0, 0, .4); animation: boom 1.2s cubic-bezier(.2, 1.4, .3, 1); }
body[data-house="hufflepuff"] .reveal .house-big { color: #ffd34d; }
@keyframes boom { 0% { transform: scale(.3); opacity: 0; filter: blur(12px); } 60% { opacity: 1; filter: none; } 100% { transform: none; } }
.burst { position: absolute; left: 50%; top: 150px; width: 1px; height: 1px; pointer-events: none; }
.burst i { position: absolute; width: 8px; height: 8px; border-radius: 50%; background: var(--glow); box-shadow: 0 0 12px var(--glow); animation: burst 1.6s ease-out forwards; }
@keyframes burst { from { transform: translate(0, 0) scale(1); opacity: 1; } to { transform: translate(var(--dx), var(--dy)) scale(.2); opacity: 0; } }
.pct-bars { max-width: 560px; margin: 24px auto; display: grid; gap: 10px; text-align: left; font-family: var(--sans); font-size: 15px; }
.pct-row { display: grid; grid-template-columns: 110px 1fr 46px; gap: 12px; align-items: center; }
.pct-track { height: 12px; border-radius: 6px; background: rgba(255, 255, 255, .07); overflow: hidden; }
.pct-track > div { height: 100%; border-radius: 6px; width: 0; transition: width 1.4s cubic-bezier(.2, .8, .2, 1); }
.wand-card { max-width: 560px; margin: 0 auto 26px; text-align: left; display: flex; gap: 18px; align-items: center; }
.wand-ico { font-size: 40px; transform: rotate(-30deg); }

/* ------------------------------------------------------------------ Hauseite */
.house-head { display: grid; grid-template-columns: auto 1fr; gap: 26px; align-items: center; margin-bottom: 26px; }
.house-head .crest { filter: drop-shadow(0 10px 30px color-mix(in srgb, var(--glow) 40%, transparent)); }
.house-head h1 { margin: 0; }
.facts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 20px 0 30px; }
.fact { padding: 14px 16px; border-radius: 14px; background: rgba(255, 255, 255, .03); border: 1px solid var(--line); }
.fact .k { font-family: var(--sans); font-size: 12px; text-transform: uppercase; letter-spacing: .14em; color: var(--ink-faint); }
.fact .v { font-size: 18px; }
.welcome { font-size: 19px; font-style: italic; border-left: 3px solid var(--a1); padding: 4px 0 4px 18px; margin: 0 0 30px; max-width: 860px; }
.rooms-grid { grid-template-columns: repeat(3, 1fr); }
.room-card { position: relative; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); aspect-ratio: 16 / 10; display: block; color: var(--ink); isolation: isolate; transition: transform .25s, border-color .25s; }
.room-card:hover { transform: translateY(-3px); border-color: var(--a2); text-decoration: none; }
.room-card .scene-svg { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -2; }
.room-card::before { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(180deg, transparent 35%, rgba(8, 7, 12, .92)); }
.room-card .rc-body { position: absolute; left: 16px; right: 16px; bottom: 14px; }
.room-card h3 { margin: 0; }
.room-card .rc-sub { font-size: 14px; color: var(--ink-dim); font-family: var(--sans); }
.room-card .rc-prog { position: absolute; top: 12px; right: 12px; font-family: var(--sans); font-size: 12px; background: rgba(0, 0, 0, .6); padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); }
.room-card.locked .scene-svg { filter: blur(6px) brightness(.45) grayscale(.4); }
.room-card.locked .lock { position: absolute; inset: 0; display: grid; place-items: center; font-size: 46px; z-index: 1; text-shadow: 0 4px 20px #000; }

/* ------------------------------------------------------------------ Raum */
.room-view { padding: 14px 18px 0; }
.room-top { max-width: 1500px; margin: 0 auto 12px; display: flex; align-items: end; gap: 16px; flex-wrap: wrap; }
.room-top .titles { flex: 1; min-width: 240px; }
.room-top h1 { font-size: clamp(26px, 3vw, 38px); margin: 0; }
.stage {
  position: relative; margin: 0 auto; width: min(100%, calc((100vh - 190px) * 16 / 9)); aspect-ratio: 16 / 9;
  border-radius: 20px; overflow: hidden; border: 1px solid var(--line); box-shadow: 0 30px 80px rgba(0, 0, 0, .6), 0 0 0 1px rgba(0, 0, 0, .5);
  min-width: 300px;
}
.stage .scene-svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.stage.entering .scene-svg { animation: enter 1.1s cubic-bezier(.2, .8, .2, 1); }
@keyframes enter { from { transform: scale(1.12); filter: blur(10px) brightness(.3); } to { transform: none; filter: none; } }
.hotspot {
  position: absolute; transform: translate(-50%, -50%); width: 44px; height: 44px; border-radius: 50%;
  border: 0; background: transparent; padding: 0; z-index: 5;
}
.hotspot::before {
  content: ""; position: absolute; inset: 9px; border-radius: 50%;
  background: radial-gradient(circle, #fff 0 22%, var(--glow) 40%, transparent 72%);
  box-shadow: 0 0 18px var(--glow), 0 0 40px var(--glow); animation: pulse 2.4s ease-in-out infinite;
}
.hotspot::after { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--glow); opacity: .0; animation: ring 2.4s ease-out infinite; }
.hotspot[data-type="puzzle"]::before { background: radial-gradient(circle, #fff 0 22%, #ffd34d 40%, transparent 72%); box-shadow: 0 0 22px #ffd34d, 0 0 50px #ffb000; }
.hotspot[data-type="memory"]::before { background: radial-gradient(circle, #fff 0 25%, #bcd6ff 45%, transparent 72%); box-shadow: 0 0 22px #bcd6ff, 0 0 50px #8ab4ff; }
.hotspot.done::before { animation: none; opacity: .55; }
.hotspot.done .tick { display: grid; }
.hotspot .tick { display: none; position: absolute; right: -2px; top: -2px; width: 18px; height: 18px; border-radius: 50%; place-items: center; font-size: 11px; background: #2e8b57; color: #fff; font-family: var(--sans); }
.hotspot .tick.wrong { background: #8b2e2e; }
.hotspot .lbl {
  position: absolute; left: 50%; bottom: calc(100% + 4px); transform: translateX(-50%) translateY(4px);
  white-space: nowrap; background: rgba(8, 7, 12, .9); border: 1px solid var(--line); padding: 5px 11px; border-radius: 999px;
  font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
}
.hotspot:hover .lbl, .hotspot:focus-visible .lbl, .stage.show-labels .hotspot .lbl { opacity: 1; transform: translateX(-50%); }
.hotspot:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
@keyframes pulse { 50% { transform: scale(1.25); opacity: .75; } }
@keyframes ring { 0% { transform: scale(.6); opacity: .8; } 100% { transform: scale(1.8); opacity: 0; } }
.room-nav { max-width: 1500px; margin: 14px auto 0; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.room-tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.room-tabs a { padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line); color: var(--ink-dim); font-size: 15px; }
.room-tabs a.active { color: var(--ink); border-color: var(--a2); background: color-mix(in srgb, var(--a1) 40%, transparent); }
.room-tabs a.locked { opacity: .5; }

/* SVG-Animationen */
.scene-svg .flame { transform-box: fill-box; transform-origin: 50% 100%; animation: flicker 1.1s ease-in-out infinite alternate; }
.scene-svg .flame.fb { animation-duration: .8s; }
.scene-svg .flame.fc { animation-duration: 1.4s; }
@keyframes flicker { 0% { transform: scale(1, 1) skewX(0); } 30% { transform: scale(.94, 1.08) skewX(3deg); } 60% { transform: scale(1.04, .92) skewX(-3deg); } 100% { transform: scale(.97, 1.05) skewX(1deg); } }
.scene-svg .glowpulse { animation: glowpulse 3s ease-in-out infinite; }
@keyframes glowpulse { 50% { opacity: .65; } }
.scene-svg .float { animation: floaty 6s ease-in-out infinite; }
@keyframes floaty { 50% { transform: translateY(-14px); } }
.scene-svg .twinkle { animation: twinkle 3.5s ease-in-out infinite; }
@keyframes twinkle { 50% { opacity: .15; } }
.scene-svg .mote { animation: mote 14s linear infinite; }
@keyframes mote { 0% { transform: translate(0, 0); } 50% { transform: translate(30px, -40px); } 100% { transform: translate(0, 0); } }
.scene-svg .bubble { animation: bubble 9s linear infinite; }
@keyframes bubble { 0% { transform: translateY(0); opacity: 0; } 10% { opacity: 1; } 100% { transform: translateY(-420px) translateX(20px); opacity: 0; } }
.scene-svg .sway { transform-box: fill-box; transform-origin: 50% 100%; animation: sway 5s ease-in-out infinite alternate; }
@keyframes sway { from { transform: rotate(-4deg); } to { transform: rotate(4deg); } }
.scene-svg .sway-slow { transform-box: fill-box; transform-origin: 50% 0; animation: swaySlow 7s ease-in-out infinite alternate; }
@keyframes swaySlow { from { transform: rotate(-1.2deg); } to { transform: rotate(1.2deg); } }
.scene-svg .ghost { animation: ghost 8s ease-in-out infinite; }
@keyframes ghost { 0%, 100% { transform: translate(0, 0); opacity: .9; } 50% { transform: translate(-30px, -18px); opacity: .55; } }
.scene-svg .swirl { animation: spin 9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.scene-svg .spark { animation: spark 4s ease-out infinite; }
@keyframes spark { 0% { transform: translateY(0); opacity: 0; } 20% { opacity: 1; } 100% { transform: translateY(-120px); opacity: 0; } }
.scene-svg .ray { animation: ray 8s ease-in-out infinite; }
@keyframes ray { 50% { opacity: .15; } }
.scene-svg .tentacle { animation: tentacle 12s ease-in-out infinite; transform-box: fill-box; transform-origin: 100% 0; }
@keyframes tentacle { 0%, 100% { transform: translateX(110%); } 35%, 65% { transform: translateX(0) rotate(-3deg); } }
.scene-svg .fish { animation: fish 20s linear infinite; }
@keyframes fish { from { transform: translateX(300px); } to { transform: translateX(-300px); } }
.scene-svg .drip { animation: drip 4s ease-in-out infinite; }
@keyframes drip { 50% { opacity: .3; } }
.scene-svg .snake-hint { stroke-dasharray: 400; stroke-dashoffset: 400; opacity: .5; animation: snake 6s ease-in-out infinite; }
@keyframes snake { 50% { stroke-dashoffset: 0; } 100% { stroke-dashoffset: -400; } }

/* ------------------------------------------------------------------ Panel */
.panel-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, .55); z-index: 60; animation: fadeIn .2s; }
.panel {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(520px, 100%); z-index: 61;
  background: linear-gradient(180deg, #17141f, #0f0d16); border-left: 1px solid var(--line);
  transform: translateX(105%); transition: transform .35s cubic-bezier(.2, .8, .2, 1); overflow-y: auto;
  box-shadow: -30px 0 80px rgba(0, 0, 0, .6);
}
.panel.open { transform: none; }
.panel-close { position: absolute; top: 14px; right: 14px; width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); background: rgba(255, 255, 255, .04); z-index: 2; }
.panel-close:hover { border-color: var(--gold); }
.panel-body { padding: 30px 28px 40px; }
.panel-body h2 { padding-right: 40px; }
.panel-body .lead { font-size: 18px; }
.opts { display: grid; gap: 10px; margin: 18px 0; }
.opt { text-align: left; padding: 13px 16px; border-radius: 12px; border: 1px solid var(--line); background: rgba(255, 255, 255, .03); transition: all .2s; }
.opt:hover:not([disabled]) { border-color: var(--gold); background: rgba(224, 176, 74, .08); }
.opt[disabled] { cursor: default; }
.opt.right { border-color: #3fa86a; background: rgba(63, 168, 106, .18); }
.opt.wrong { border-color: #b84a4a; background: rgba(184, 74, 74, .18); }
.result { padding: 12px 16px; border-radius: 12px; font-family: var(--sans); font-size: 15px; }
.result.ok { background: rgba(63, 168, 106, .15); border: 1px solid rgba(63, 168, 106, .5); }
.result.bad { background: rgba(184, 74, 74, .12); border: 1px solid rgba(184, 74, 74, .45); }
.result.info { background: rgba(255, 255, 255, .04); border: 1px solid var(--line); }
.memories { display: grid; gap: 12px; margin-top: 18px; }
.memory {
  position: relative; padding: 14px 16px; border-radius: 14px; background: linear-gradient(135deg, rgba(188, 214, 255, .1), rgba(188, 214, 255, .03));
  border: 1px solid rgba(188, 214, 255, .25); white-space: pre-wrap; word-wrap: break-word;
}
.memory .meta { font-family: var(--sans); font-size: 12px; color: var(--ink-faint); margin-top: 8px; display: flex; gap: 8px; align-items: center; }
.memory .del { margin-left: auto; border: 0; background: none; color: var(--ink-faint); font-size: 12px; }
.memory .del:hover { color: #e06a6a; }
.barrels-wrap { position: relative; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); margin: 16px 0; }
.barrels-svg { display: block; width: 100%; height: auto; }
.barrels-svg .barrel { cursor: pointer; transition: transform .08s; transform-box: fill-box; transform-origin: center; }
.barrels-svg .barrel:hover { filter: brightness(1.25); }
.barrels-svg .barrel.tap { transform: scale(.94); }
.vinegar { position: absolute; inset: 0; background: radial-gradient(circle at 50% 30%, rgba(200, 220, 120, .85), rgba(140, 160, 60, .4) 60%, transparent); animation: vinegar 1.2s ease-out forwards; pointer-events: none; }
@keyframes vinegar { from { opacity: 1; transform: translateY(-40px) scale(.6); } to { opacity: 0; transform: translateY(30px) scale(1.4); } }
.taps { font-size: 26px; letter-spacing: 6px; min-height: 38px; color: var(--gold); text-align: center; }
.opened { text-align: center; font-size: 60px; animation: boom .8s cubic-bezier(.2, 1.4, .3, 1); }
.riddle { font-size: 20px; font-style: italic; padding: 16px 18px; border-radius: 14px; background: rgba(201, 162, 106, .1); border: 1px solid rgba(201, 162, 106, .35); margin: 14px 0; }

.tabs { display: flex; gap: 6px; margin-bottom: 20px; border-bottom: 1px solid var(--line); }
.tabs button { background: none; border: 0; padding: 10px 16px; color: var(--ink-dim); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button.active { color: var(--ink); border-bottom-color: var(--gold); }
.form { display: grid; gap: 12px; }
.form label { font-family: var(--sans); font-size: 14px; color: var(--ink-dim); display: grid; gap: 6px; }
.err { color: #f08a8a; font-family: var(--sans); font-size: 14px; min-height: 1.2em; }

/* ------------------------------------------------------------------ Toasts */
.toasts { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); z-index: 80; display: grid; gap: 10px; justify-items: center; pointer-events: none; }
.toast { background: rgba(14, 12, 20, .95); border: 1px solid var(--gold); padding: 11px 20px; border-radius: 999px; box-shadow: 0 10px 40px rgba(0, 0, 0, .5); animation: toastIn .35s cubic-bezier(.2, 1.4, .3, 1); font-family: var(--sans); font-size: 15px; }
.toast.pts { font-size: 18px; color: var(--gold); font-family: var(--serif); font-weight: 700; }
@keyframes toastIn { from { opacity: 0; transform: translateY(16px) scale(.9); } }

/* ------------------------------------------------------------------ Responsiv */
@media (max-width: 1000px) {
  .houses-grid { grid-template-columns: repeat(2, 1fr); }
  .rooms-grid { grid-template-columns: 1fr 1fr; }
  .facts { grid-template-columns: 1fr 1fr; }
  .sorting { grid-template-columns: 1fr; gap: 10px; }
  .hat-stage .hat-svg { width: 150px; height: auto; }
  .cup-wrap { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  body { font-size: 16px; }
  .topbar { padding: 8px 12px; gap: 10px; flex-wrap: wrap; }
  .nav { order: 3; flex-basis: 100%; }
  .brand { font-size: 19px; }
  .houses-grid, .rooms-grid { grid-template-columns: 1fr; }
  .cup { gap: 8px; } .hg-tube { width: 54px; height: 170px; }
  .stage { border-radius: 12px; }
  .hotspot { width: 36px; height: 36px; }
  .panel { top: auto; height: 86vh; width: 100%; border-left: 0; border-top: 1px solid var(--line); border-radius: 22px 22px 0 0; transform: translateY(105%); }
  .house-head { grid-template-columns: 1fr; }
  .q-card { padding: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001s !important; animation-iteration-count: 1 !important; transition-duration: .001s !important; }
}
