:root {
  --bg: #120f1a;
  --stone: #2a2438;
  --ink: #f3e9d2;
  --dim: #b7ab93;
  --gold: #f0b429;
  --purple: #9b5cff;
  --green: #7fe08a;
  --red: #ff6b6b;
  --card: #1d1828;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--ink); font-family: Georgia, "Times New Roman", serif; }
body { background: radial-gradient(ellipse at top, #241d34 0%, var(--bg) 60%); overflow-x: hidden; }
button { font: inherit; cursor: pointer; }
#app { max-width: 1000px; margin: 0 auto; padding: 16px; min-height: 100vh; display: flex; flex-direction: column; }
.screen { display: none; flex: 1; flex-direction: column; align-items: center; text-align: center; }
.screen.active { display: flex; }

h1 { font-size: clamp(40px, 9vw, 76px); margin: 10vh 0 0; letter-spacing: 2px; color: var(--gold); text-shadow: 0 0 24px rgba(240, 180, 41, 0.35), 0 3px 0 #6b4a00; }
h2 { font-size: clamp(24px, 5vw, 34px); margin: 24px 0 12px; color: var(--gold); }
.tagline { font-size: clamp(16px, 2.6vw, 21px); color: var(--dim); margin: 12px 0 28px; line-height: 1.5; }
.menu { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin: 8px 0; }
.big { background: linear-gradient(#5d33b3, #3d1f80); color: #fff; border: 2px solid #a884ff; border-radius: 12px; padding: 14px 32px; font-size: 20px; box-shadow: 0 0 18px rgba(155, 92, 255, 0.4); }
.big:hover:not(:disabled) { filter: brightness(1.15); }
.big:disabled { opacity: 0.5; cursor: default; }
.plain { background: transparent; color: var(--dim); border: 1px solid #4a4160; border-radius: 10px; padding: 12px 20px; font-size: 17px; }
.plain:hover { color: var(--ink); border-color: var(--dim); }
.small { color: var(--dim); font-size: 14px; }
.foot { color: #6f6885; font-size: 13px; margin-top: auto; padding-top: 24px; }
.panel { text-align: left; background: var(--card); border: 1px solid #3a3150; border-radius: 12px; padding: 12px 24px; margin: 12px 0; max-width: 640px; }
.panel ol { padding-left: 22px; line-height: 1.55; }
.panel li { margin: 6px 0; }

#sound-btn { position: fixed; top: 12px; right: 12px; z-index: 50; display: flex; align-items: center; gap: 6px; background: rgba(29, 24, 40, 0.9); color: var(--ink); border: 1px solid #4a4160; border-radius: 999px; padding: 8px 12px; font-size: 14px; }
#sound-btn svg { width: 22px; height: 22px; }
#sound-btn .on { display: none; }
#sound-btn.is-on .on { display: block; }
#sound-btn.is-on .off { display: none; }

.hunters { display: flex; flex-wrap: wrap; gap: 18px; justify-content: center; margin: 12px 0 20px; }
.hunter-card { width: 240px; background: var(--card); border: 3px solid #3a3150; border-radius: 16px; padding: 14px 12px 16px; color: var(--ink); transition: transform 0.12s, border-color 0.12s; }
.hunter-card:hover { transform: translateY(-3px); border-color: #6f5aa8; }
.hunter-card.selected { border-color: var(--gold); box-shadow: 0 0 22px rgba(240, 180, 41, 0.35); }
.hunter-card canvas { width: 160px; height: 160px; display: block; margin: 0 auto 8px; }
.hunter-card .name { font-size: 24px; color: var(--gold); }
.hunter-card .power { font-size: 16px; margin-top: 4px; }
.hunter-card .hint { font-size: 13px; color: var(--dim); margin-top: 6px; line-height: 1.4; min-height: 3.4em; }

.hud { display: flex; align-items: center; justify-content: space-between; gap: 16px; width: 100%; margin-top: 44px; }
.hud-hunter { display: flex; align-items: center; gap: 10px; min-width: 0; }
#hud-face { width: 88px; height: 88px; flex: none; }
.bubble { position: relative; background: #f6efdc; color: #2a2438; border-radius: 14px; padding: 10px 14px; font-size: 16px; max-width: 320px; text-align: left; line-height: 1.3; }
.bubble::before { content: ""; position: absolute; left: -10px; top: 50%; margin-top: -8px; border: 8px solid transparent; border-right-color: #f6efdc; border-left: 0; }
.hud-stats { display: grid; grid-template-columns: auto auto; gap: 4px 18px; align-items: center; font-size: 17px; text-align: left; }
.stat b { color: var(--gold); font-size: 20px; }
.torch { grid-column: 1 / -1; height: 10px; background: #2a2438; border-radius: 6px; overflow: hidden; border: 1px solid #4a4160; }
.torch-fill { height: 100%; width: 100%; background: linear-gradient(90deg, #ff7a18, #ffd166); transition: width 0.3s; }

#hall-wrap { position: relative; width: 100%; margin: 12px 0; }
#hallway { display: block; width: 100%; border-radius: 12px; cursor: pointer; touch-action: manipulation; }
.msg { position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-50%); text-align: center; font-size: clamp(28px, 7vw, 64px); font-weight: bold; color: var(--ink); text-shadow: 0 0 16px #000, 0 2px 0 #000; pointer-events: none; opacity: 0; transition: opacity 0.15s; letter-spacing: 2px; }
.msg.show { opacity: 1; }
.msg.bump { color: var(--red); }
.msg.caught { color: var(--green); }
.msg.ears { color: #9bd7ff; font-size: clamp(22px, 5vw, 40px); }

.controls { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; width: 100%; padding-bottom: 12px; }
.controls button { background: var(--card); color: var(--ink); border: 2px solid #4a4160; border-radius: 12px; padding: 12px 22px; font-size: 18px; min-width: 120px; }
.controls button:hover:not(:disabled) { border-color: var(--gold); }
.controls button:disabled { opacity: 0.45; cursor: default; }
#btn-power { border-color: #7c5cd6; }
#btn-power.armed { background: #3d1f80; border-color: var(--purple); box-shadow: 0 0 14px rgba(155, 92, 255, 0.6); }

.overlay { position: fixed; inset: 0; background: rgba(8, 6, 14, 0.82); display: flex; align-items: center; justify-content: center; z-index: 40; padding: 16px; }
.overlay[hidden] { display: none; }
.card { background: var(--card); border: 2px solid #5a4a8a; border-radius: 18px; padding: 22px 26px 24px; max-width: 520px; width: 100%; text-align: center; box-shadow: 0 0 40px rgba(0, 0, 0, 0.6); }
.card h2 { margin-top: 6px; }
.card p { font-size: 18px; line-height: 1.5; color: var(--ink); }
.stars { font-size: 36px; color: var(--gold); letter-spacing: 6px; min-height: 1.2em; }
.stars .empty { color: #4a4160; }
.stars:empty { display: none; }
#overlay-art { width: 140px; height: 140px; margin: 0 auto; display: block; }
#overlay-art[hidden] { display: none; }

@media (max-width: 640px) {
  #app { padding: 12px 16px; }
  .hud { flex-direction: column; align-items: stretch; }
  .hud-hunter { justify-content: flex-start; }
  #hud-face { width: 64px; height: 64px; }
  .bubble { font-size: 14px; }
  .hud-stats { grid-template-columns: 1fr 1fr; font-size: 15px; }
  #sound-btn .label { display: none; }
  #sound-btn { position: absolute; }
  .hunter-card { width: 100%; max-width: 320px; }
  .controls button { min-width: 0; flex: 1; padding: 12px 10px; }
}
