:root {
  --ink: #eef6ff;
  --muted: #8fb4cc;
  --accent: #4ec8e8;
  --warm: #f5c842;
  --danger: #ff6b5c;
  --ok: #6dffb0;
  --void: #071018;
  --panel: rgba(6, 18, 32, 0.84);
  --line: rgba(100, 190, 240, 0.22);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

html,
body {
  margin: 0;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  font-family: "Jua", system-ui, sans-serif;
  background:
    radial-gradient(ellipse at 25% 0%, rgba(60, 150, 220, 0.22), transparent 46%),
    radial-gradient(ellipse at 90% 90%, rgba(245, 200, 66, 0.12), transparent 40%),
    linear-gradient(165deg, #0b1c2c, #060e16 55%, #0f2438);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
}

.stage {
  position: relative;
  width: min(100vw, 420px);
  height: min(100dvh, 800px);
  max-height: 100dvh;
  overflow: hidden;
  border-radius: 22px;
  box-shadow:
    0 28px 56px rgba(0, 0, 0, 0.48),
    0 0 0 1px rgba(100, 190, 240, 0.14),
    inset 0 0 80px rgba(40, 120, 180, 0.06);
  background: var(--void);
}

#game {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.hud {
  position: absolute;
  top: max(10px, env(safe-area-inset-top));
  left: 10px;
  right: 10px;
  z-index: 5;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  pointer-events: none;
}

.panel {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 108px;
  padding: 9px 12px;
  border-radius: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  backdrop-filter: blur(12px);
  font-size: 12px;
  color: var(--muted);
}

.panel.right {
  text-align: right;
  align-items: flex-end;
}

.panel b {
  color: var(--warm);
  font-size: 18px;
  font-family: "Bagel Fat One", "Jua", cursive;
  font-weight: 400;
  line-height: 1.1;
}

.goal-meter {
  position: absolute;
  top: max(78px, calc(env(safe-area-inset-top) + 68px));
  left: 14px;
  right: 14px;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  z-index: 5;
  overflow: hidden;
  pointer-events: none;
}

.goal-meter i {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--warm));
  transition: width 0.2s ease;
}

.hint {
  position: absolute;
  left: 50%;
  bottom: max(14px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 5;
  width: min(92%, 340px);
  text-align: center;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(6, 18, 32, 0.8);
  border: 1px solid var(--line);
  color: #d5eaf5;
  font-size: 12px;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.hint.fade {
  opacity: 0;
}

.overlay {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  text-align: center;
  padding: max(28px, env(safe-area-inset-top)) 18px 24px;
  overflow-y: auto;
  background:
    radial-gradient(circle at 50% 8%, rgba(70, 160, 230, 0.22), transparent 42%),
    radial-gradient(circle at 80% 70%, rgba(245, 200, 66, 0.08), transparent 35%),
    rgba(4, 12, 22, 0.95);
}

.overlay.hidden {
  display: none;
}

.title-thumb {
  width: 124px;
  height: 124px;
  object-fit: cover;
  border-radius: 28px;
  margin: 4px 0 12px;
  box-shadow:
    0 0 0 2px rgba(245, 200, 66, 0.45),
    0 0 32px rgba(80, 180, 255, 0.35),
    0 14px 30px rgba(0, 0, 0, 0.45);
}

.badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(70, 180, 230, 0.18);
  border: 1px solid rgba(70, 180, 230, 0.4);
  color: #b8e8f8;
  font-size: 11px;
  letter-spacing: 0.16em;
  margin-bottom: 8px;
}

.badge.soft {
  background: rgba(109, 255, 176, 0.14);
  border-color: rgba(109, 255, 176, 0.4);
  color: #c8f5dc;
}

h1 {
  margin: 0;
  font-family: "Bagel Fat One", "Jua", cursive;
  font-weight: 400;
  font-size: clamp(38px, 10vw, 50px);
  color: #fff;
  text-shadow: 0 0 28px rgba(80, 180, 255, 0.28);
}

.overlay p {
  margin: 10px 0 14px;
  color: var(--muted);
  line-height: 1.55;
  font-size: 14px;
  max-width: 310px;
}

.overlay p b {
  color: var(--warm);
}

.rules {
  list-style: none;
  margin: 0 0 18px;
  padding: 0;
  width: min(100%, 300px);
  text-align: left;
}

.rules li {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 7px;
  padding: 9px 11px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(100, 190, 240, 0.1);
  font-size: 13px;
  color: #d0e4f2;
}

.rules i {
  flex: 0 0 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-style: normal;
  font-size: 12px;
  background: rgba(70, 180, 230, 0.28);
  color: #dff6ff;
}

.btn {
  appearance: none;
  border: none;
  min-width: 168px;
  min-height: 50px;
  padding: 0 28px;
  border-radius: 999px;
  font: inherit;
  font-size: 18px;
  color: #1a2228;
  cursor: pointer;
  background: linear-gradient(180deg, #ffe07a, #f0a83a);
  box-shadow:
    0 5px 0 #b56f22,
    0 10px 24px rgba(245, 200, 66, 0.25);
}

.btn:active {
  transform: translateY(2px);
  box-shadow: 0 3px 0 #b56f22;
}

.overlay a {
  margin-top: 14px;
  color: #9bbfd6;
  text-decoration: none;
  font-size: 13px;
}
