:root {
  --ink: #e8f4ff;
  --mute: #8aa3b8;
  --bg: #071018;
  --card: rgba(12, 24, 36, 0.72);
  --line: rgba(140, 210, 255, 0.18);
  --accent: #3de0c5;
  --accent-2: #ffb14a;
  --danger: #ff6b7a;
  --font: 'Outfit', system-ui, sans-serif;
  --display: 'Syne', var(--font);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  min-height: 100vh;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  padding: 1rem clamp(0.8rem, 2vw, 1.5rem) 1.5rem;
}

.glow {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse at 20% 0%, rgba(61, 224, 197, 0.16), transparent 42%),
    radial-gradient(ellipse at 85% 15%, rgba(255, 177, 74, 0.12), transparent 38%),
    radial-gradient(ellipse at 50% 100%, rgba(70, 120, 255, 0.12), transparent 45%),
    linear-gradient(180deg, #0a1520 0%, #071018 55%, #050b12 100%);
}

.top {
  display: flex;
  align-items: flex-end;
  gap: 1rem;
  margin-bottom: 0.85rem;
}
.back {
  color: var(--mute);
  text-decoration: none;
  font-size: 0.9rem;
  margin-bottom: 0.35rem;
}
.back:hover { color: var(--ink); }
.brand h1 {
  font-family: var(--display);
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  letter-spacing: -0.03em;
  line-height: 1;
}
.brand p { color: var(--mute); font-size: 0.9rem; margin-top: 0.2rem; }

.stage {
  position: relative;
  width: min(960px, 100%);
  margin: 0 auto;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  box-shadow:
    0 0 0 1px rgba(0,0,0,0.35),
    0 24px 80px rgba(0, 0, 0, 0.45),
    0 0 80px rgba(61, 224, 197, 0.12),
    inset 0 0 60px rgba(255, 180, 80, 0.04);
  background: #02070c;
  aspect-ratio: 16 / 9;
}
.stage::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  box-shadow: inset 0 0 80px rgba(0, 0, 0, 0.35);
  z-index: 3;
}

#game {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: auto;
  background: #061018;
}

.hud {
  position: absolute;
  top: 0.7rem;
  left: 0.7rem;
  right: 0.7rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  pointer-events: none;
  gap: 0.5rem;
  z-index: 2;
}
.hearts { display: flex; gap: 0.25rem; filter: drop-shadow(0 2px 6px rgba(0,0,0,0.45)); }
.heart {
  width: 22px;
  height: 20px;
  background: linear-gradient(160deg, #ff8a9a, #e23d55);
  clip-path: path('M11 18 C11 18 2 12 2 7 C2 4 4 2 6.5 2 C8.5 2 10 3.2 11 5 C12 3.2 13.5 2 15.5 2 C18 2 20 4 20 7 C20 12 11 18 11 18 Z');
  opacity: 0.28;
}
.heart.on { opacity: 1; box-shadow: 0 0 12px rgba(255, 100, 120, 0.45); }
.stats { display: flex; flex-wrap: wrap; gap: 0.35rem; justify-content: flex-end; }
.pill {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  background: rgba(8, 18, 28, 0.55);
  border: 1px solid var(--line);
  backdrop-filter: blur(10px);
  color: var(--ink);
}

.hint {
  position: absolute;
  left: 50%;
  bottom: 0.65rem;
  transform: translateX(-50%);
  font-size: 0.72rem;
  color: rgba(232, 244, 255, 0.78);
  background: rgba(6, 14, 22, 0.55);
  border: 1px solid rgba(140, 210, 255, 0.16);
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  pointer-events: none;
  z-index: 2;
  white-space: nowrap;
  max-width: calc(100% - 1rem);
  overflow: hidden;
  text-overflow: ellipsis;
  transition: opacity 0.25s ease, color 0.25s ease;
}
.hint.flash {
  color: var(--accent-2);
  border-color: rgba(255, 177, 74, 0.35);
}

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background:
    radial-gradient(ellipse at 50% 30%, rgba(61, 224, 197, 0.12), transparent 50%),
    rgba(4, 10, 16, 0.72);
  backdrop-filter: blur(6px);
  z-index: 5;
  padding: 1rem;
}
.overlay.hidden { display: none; }

.panel {
  width: min(420px, 100%);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 1.4rem 1.35rem 1.25rem;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
  text-align: center;
  animation: rise 0.4s ease;
}
.hero-panel {
  background:
    linear-gradient(160deg, rgba(20, 40, 55, 0.9), rgba(10, 20, 30, 0.88));
  width: min(480px, 100%);
  max-height: min(92%, 640px);
  overflow: auto;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
  color: var(--accent);
  font-weight: 700;
  margin-bottom: 0.45rem;
}
.panel h2 {
  font-family: var(--display);
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  letter-spacing: -0.03em;
  margin-bottom: 0.55rem;
}
.lead {
  color: var(--mute);
  line-height: 1.45;
  margin-bottom: 1.1rem;
  font-size: 0.95rem;
}
.tiny { color: var(--mute); font-size: 0.78rem; margin-top: 0.7rem; }

.tips {
  list-style: none;
  text-align: left;
  margin: 1rem 0 0;
  padding: 0.7rem 0.85rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(4, 12, 20, 0.45);
  display: grid;
  gap: 0.45rem;
}
.tips li {
  position: relative;
  padding-left: 1.05rem;
  color: var(--ink);
  font-size: 0.8rem;
  line-height: 1.35;
  opacity: 0.88;
}
.tips li::before {
  content: '✦';
  position: absolute;
  left: 0;
  top: 0.05rem;
  color: var(--accent);
  font-size: 0.7rem;
}
.pause-tips {
  margin: 0.2rem 0 0.85rem;
  text-align: left;
}
#pause-tip {
  min-height: 1.2em;
  color: var(--accent-2);
  margin: 0 0 0.85rem;
}
.cta {
  font: inherit;
  font-weight: 700;
  border: 0;
  border-radius: 999px;
  padding: 0.75rem 1.3rem;
  cursor: pointer;
  color: #041018;
  background: linear-gradient(120deg, var(--accent), #7af0ff);
  box-shadow: 0 8px 28px rgba(61, 224, 197, 0.28);
  transition: transform 0.12s, filter 0.12s;
}
.cta:hover { transform: translateY(-1px); filter: brightness(1.05); }
.cta.ghost {
  display: block;
  width: 100%;
  margin-top: 0.5rem;
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: none;
}

.dialog {
  width: min(560px, 100%);
  align-self: end;
  margin-bottom: 1.2rem;
  background: rgba(8, 18, 28, 0.88);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1rem 1.15rem;
  backdrop-filter: blur(12px);
  box-shadow: 0 16px 40px rgba(0,0,0,0.35);
  animation: rise 0.25s ease;
  text-align: left;
}
.dialog .who {
  font-weight: 700;
  color: var(--accent-2);
  margin-bottom: 0.35rem;
}
.dialog .line {
  font-size: 1.02rem;
  line-height: 1.4;
  min-height: 2.6em;
}

@media (max-width: 640px) {
  .hint { font-size: 0.65rem; }
  .heart { width: 18px; height: 16px; }
}
