:root {
  --bg: #070708;
  --page-bg: #1c1c1f;
  --panel: #101114;
  --empty: #2a2a32;
  --pit: #000000;
  --well-slot: #1a1a22;
  --risk-red: hsl(0 82% 52%);
  --risk-yellow: hsl(48 88% 50%);
  --line: rgba(255, 255, 255, 0.22);
  --text: #f4f4f5;
  --muted: #9a9aa3;
  --overlay-bg: rgba(0, 0, 0, 0.62);
  --card-bg: #141418;
  --phone-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
  --btn-primary-bg: #f4f4f5;
  --btn-primary-text: #111;
  --armed-border: color-mix(in srgb, white 55%, transparent);
  color-scheme: dark;
}

html[data-theme="day"] {
  --bg: #f4f4f6;
  --page-bg: #e8e8ec;
  --panel: #ffffff;
  --empty: #d4d4dc;
  --pit: #ececf1;
  --well-slot: #dedee6;
  --line: rgba(0, 0, 0, 0.14);
  --text: #18181b;
  --muted: #71717a;
  --overlay-bg: rgba(255, 255, 255, 0.72);
  --card-bg: #ffffff;
  --phone-shadow: 0 30px 80px rgba(0, 0, 0, 0.12);
  --btn-primary-bg: #18181b;
  --btn-primary-text: #f4f4f5;
  --armed-border: color-mix(in srgb, black 28%, transparent);
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--page-bg);
  color: var(--text);
  font-family: ui-rounded, "Nunito", "Segoe UI", system-ui, sans-serif;
}

body {
  min-height: 100dvh;
  height: 100dvh;
  display: grid;
  place-items: center;
}

.phone {
  position: relative;
  width: min(100%, 420px);
  height: min(100dvh, 860px);
  max-height: 100%;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 28px;
  padding:
    max(12px, env(safe-area-inset-top, 0px))
    max(12px, env(safe-area-inset-right, 0px))
    max(12px, env(safe-area-inset-bottom, 0px))
    max(12px, env(safe-area-inset-left, 0px));
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
  box-shadow: var(--phone-shadow);
  user-select: none;
}

.welcome {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: flex;
  flex-direction: column;
  padding:
    max(28px, env(safe-area-inset-top, 0px))
    max(20px, env(safe-area-inset-right, 0px))
    max(20px, env(safe-area-inset-bottom, 0px))
    max(20px, env(safe-area-inset-left, 0px));
  background: var(--bg);
}

.welcome.hidden {
  display: none;
}

.welcome-main {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.welcome-logo {
  margin: 0;
  font-size: clamp(2rem, 9vw, 2.6rem);
  font-weight: 700;
  letter-spacing: 0.01em;
}

.welcome-tag {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.4;
}

.welcome-spectrum {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin: 22px 0 8px;
}

.welcome-spectrum span {
  height: 12px;
  border-radius: 3px;
  background: var(--hue);
}

.tutorial {
  position: absolute;
  inset: 0;
  z-index: 7;
  display: flex;
  flex-direction: column;
  padding:
    max(28px, env(safe-area-inset-top, 0px))
    max(20px, env(safe-area-inset-right, 0px))
    max(20px, env(safe-area-inset-bottom, 0px))
    max(20px, env(safe-area-inset-left, 0px));
  background: var(--bg);
}

.tutorial.hidden {
  display: none;
}

.tutorial-main {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

.tutorial-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
}

.tutorial-kicker {
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tutorial-title {
  margin: 22px 0 0;
  font-size: clamp(1.35rem, 6vw, 1.7rem);
  font-weight: 700;
}

.tutorial-body {
  margin: 20px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.tutorial-body p {
  margin: 0;
}

.tutorial-body p + p {
  margin-top: 1.1em;
}

.tutorial-demo {
  margin: 28px 0 0;
}

.tutorial-demo:empty {
  display: none;
}

.tutorial-after {
  margin: 20px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.tutorial-after + .tutorial-after {
  margin-top: 1.1em;
}

.demo {
  --demo-cell: 22px;
  --demo-gap: 2px;
  --demo-board: calc(var(--demo-cell) * 5 + var(--demo-gap) * 4);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.demo.is-stack {
  flex-direction: column;
  gap: 8px;
}

.demo.is-side {
  align-items: stretch;
  gap: 8px;
  width: 100%;
}

.demo-panel {
  flex: 0 0 auto;
  width: var(--demo-board);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}

.demo-mid {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  align-self: center;
  max-width: 4.5rem;
}

.demo-caption {
  margin: 0;
  color: var(--muted);
  font-size: 0.62rem;
  line-height: 1.25;
  text-align: center;
}

.demo-row {
  display: flex;
  gap: var(--demo-gap);
}

.demo-grid {
  display: flex;
  flex-direction: column;
  gap: var(--demo-gap);
  width: var(--demo-board);
}

.demo-cell {
  position: relative;
  width: var(--demo-cell);
  height: var(--demo-cell);
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--empty);
}

.demo-tile {
  position: absolute;
  inset: 0;
  border-radius: 2px;
  background: var(--hue);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, white 18%, transparent);
}

.demo-tile.is-cook {
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb, white 18%, transparent),
    0 0 8px color-mix(in srgb, var(--hue) 55%, transparent);
}

.demo-arrow {
  flex: 0 0 auto;
  color: var(--text);
  font-size: 1.2rem;
  line-height: 1;
}

.demo-well-block {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-sizing: border-box;
  padding: 0 0 4px;
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  border-radius: 0 0 5px 5px;
  background: color-mix(in srgb, var(--empty) 70%, transparent);
}

.demo-mini-well {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 2px;
  width: 100%;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
}

.demo-mini-well-col {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.demo-mini-well-cell {
  width: 100%;
  height: 9px;
  border-radius: 1px;
  background: var(--well-slot);
}

.demo-mini-well-cell.is-filled {
  background: var(--hue);
}

.demo-mini-well-cell.is-new {
  box-shadow: 0 0 6px color-mix(in srgb, var(--hue) 70%, transparent);
}

.demo-mini-spectrum {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 2px;
  width: 100%;
  padding: 4px 0 0;
  border-top: 1px solid var(--line);
}

.demo-mini-spectrum span {
  position: relative;
  min-width: 0;
  height: 14px;
  border-radius: 2px;
  background: var(--hue);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--hue) 40%, black);
  overflow: hidden;
}

.demo-mini-spectrum .mark {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 9px;
  height: 9px;
  transform: translate(-50%, -50%);
}

.demo-stack {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.demo-stack > * + * {
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.demo-layout {
  --demo-cell: 28px;
  --demo-gap: 3px;
  --demo-board: calc(var(--demo-cell) * 5 + var(--demo-gap) * 4);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  margin: 0 auto;
}

.demo-layout-block {
  width: var(--demo-board);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}

.demo-layout-label {
  margin: 0;
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-align: center;
}

.tutorial-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  flex: 0 0 auto;
}

.tutorial-skip {
  appearance: none;
  flex: 0 0 auto;
  margin: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 0;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.tutorial-back {
  appearance: none;
  flex: 0 0 auto;
  min-width: 5.6em;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 10px 14px;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
}

.tutorial-back.is-off {
  visibility: hidden;
  pointer-events: none;
}

.tutorial-dots {
  flex: 1;
  display: flex;
  justify-content: center;
  gap: 6px;
}

.tutorial-dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--line);
}

.tutorial-dots span.is-on {
  background: var(--text);
}

.play-btn {
  appearance: none;
  flex: 0 0 auto;
  width: 100%;
  margin-top: 18px;
  border: 0;
  border-radius: 999px;
  padding: 14px 18px;
  font: inherit;
  font-size: 1.15rem;
  font-weight: 800;
  cursor: pointer;
  background: linear-gradient(160deg, #ff7a59 0%, #ffd45e 100%);
  color: #1a1208;
}

.play-btn:active {
  filter: brightness(1.06);
}

.play-btn.tutorial-next {
  width: auto;
  min-width: 5.6em;
  margin-top: 0;
  padding: 10px 18px;
  font-size: 0.95rem;
}

.lang-switch {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex: 0 0 auto;
  margin: 12px 0 0;
}

.lang-switch button {
  appearance: none;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 6px 12px;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
}

.lang-switch button.is-on {
  color: var(--text);
  border-color: var(--armed-border);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex: 0 0 auto;
  min-width: 0;
}

.topbar > .brand {
  min-width: 0;
  flex: 1;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.brand-mark {
  width: clamp(24px, 6vw, 28px);
  height: clamp(24px, 6vw, 28px);
  flex: 0 0 auto;
}

.logo {
  margin: 0;
  font-size: clamp(1.05rem, 4.6vw, 1.28rem);
  font-weight: 700;
  letter-spacing: 0.01em;
}

.rainbow-word span:nth-child(1) { color: hsl(0 82% 56%); }
.rainbow-word span:nth-child(2) { color: hsl(35 82% 56%); }
.rainbow-word span:nth-child(3) { color: hsl(70 82% 56%); }
.rainbow-word span:nth-child(4) { color: hsl(105 82% 56%); }
.rainbow-word span:nth-child(5) { color: hsl(140 82% 56%); }
.rainbow-word span:nth-child(6) { color: hsl(175 82% 56%); }
.rainbow-word span:nth-child(7) { color: hsl(210 82% 56%); }
.rainbow-word span:nth-child(8) { color: hsl(245 82% 56%); }
.rainbow-word span:nth-child(9) { color: hsl(280 82% 56%); }
.rainbow-word span:nth-child(10) { color: hsl(315 82% 56%); }

.bottombar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: 0 0 auto;
  margin-bottom: 14px;
}

.bottom-primary {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.replay-btn {
  appearance: none;
  flex: 0 0 auto;
  margin: 0;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 8px 14px;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.replay-btn:active:not(:disabled) {
  color: var(--text);
  background: var(--panel);
}

.replay-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.board-replay-shade {
  position: absolute;
  inset: 0;
  z-index: 5;
  background: var(--overlay-bg);
  pointer-events: auto;
}

.board-replay-shade.hidden {
  display: none;
}

.board-wrap.replay-focus {
  position: relative;
  z-index: 6;
}

.bottom-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.help-btn,
.sound-btn,
.theme-btn {
  appearance: none;
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}

.theme-btn {
  font-size: 0.95rem;
  display: grid;
  place-items: center;
}

.help-btn:active,
.sound-btn:active,
.theme-btn:active {
  color: var(--text);
  background: var(--panel);
}

.sound-btn {
  display: grid;
  place-items: center;
}

.sound-icon {
  width: 16px;
  height: 16px;
  display: none;
}

.sound-btn .sound-on {
  display: block;
}

.sound-btn.is-muted .sound-on {
  display: none;
}

.sound-btn.is-muted .sound-off {
  display: block;
}

.log-btn {
  appearance: none;
  flex: 0 0 auto;
  margin: 0;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 8px 14px;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.log-btn:active {
  color: var(--text);
  background: var(--panel);
}

.retry {
  appearance: none;
  flex: 0 0 auto;
  margin: 0;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 8px 16px;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.retry:active {
  color: var(--text);
  background: var(--panel);
}

.retry.is-armed {
  color: var(--text);
  border-color: var(--armed-border);
  background: var(--panel);
}

.meters {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex: 0 0 auto;
  min-width: 0;
}

.score-wrap {
  min-width: 0;
  padding: 0;
  text-align: right;
}

.score-label {
  display: block;
  color: var(--muted);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

#level,
#lines,
#score {
  font-size: clamp(1.05rem, 4.4vw, 1.4rem);
  font-weight: 700;
  display: inline-block;
}

#score.bump {
  animation: score-bump 280ms ease-out;
}

.well-wrap {
  --well-h: 160px;
  --well-row-gap: 2px;
  --well-gap-total: calc(var(--well-row-gap) * 11);
  --risk-red-end: calc((var(--well-h) - var(--well-gap-total)) / 6 + var(--well-row-gap));
  --risk-yellow-end: calc((var(--well-h) - var(--well-gap-total)) / 3 + var(--well-row-gap) * 3);
  position: relative;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  column-gap: 2px;
  padding: 2px 6px 6px;
  border: 1px solid var(--line);
  border-top: 0;
  border-radius: 0 0 8px 8px;
  background: var(--pit);
  flex: 0 0 auto;
  min-height: 0;
}

.well-wrap::before,
.well-wrap::after {
  content: "";
  position: absolute;
  top: 2px;
  width: 2px;
  height: var(--well-h);
  pointer-events: none;
  z-index: 2;
  background: linear-gradient(
    to bottom,
    var(--risk-red) 0,
    var(--risk-red) var(--risk-red-end),
    var(--risk-yellow) var(--risk-red-end),
    var(--risk-yellow) var(--risk-yellow-end),
    transparent var(--risk-yellow-end)
  );
}

.well-wrap::before {
  left: 0;
}

.well-wrap::after {
  right: 0;
}

.board-wrap {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  flex: 0 0 auto;
  align-self: center;
  width: 100%;
  min-height: 0;
}

.well {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: subgrid;
  height: 160px;
  min-height: 0;
  overflow: hidden;
}

.spectrum {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: subgrid;
  margin-top: 6px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.spectrum span {
  position: relative;
  height: 24px;
  border-radius: 3px;
  background: var(--hue);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--hue) 40%, black);
  overflow: hidden;
}

.spectrum .mark {
  position: absolute;
  top: 50%;
  left: 50%;
  right: auto;
  bottom: auto;
  width: 14px;
  height: 14px;
  margin: 0;
  transform: translate(-50%, -50%);
}

.well-col {
  position: relative;
  display: grid;
  grid-template-rows: repeat(12, 1fr);
  gap: 2px;
  overflow: visible;
}

.well-cell.is-drop-in {
  z-index: 2;
  animation: well-drop-in 0.78s cubic-bezier(0.2, 0.85, 0.2, 1) both;
}

.well-cell {
  border-radius: 3px;
  background: var(--well-slot);
}

.well-cell.filled {
  background: var(--hue);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--hue) 40%, black);
}

.well-cell.just-added {
  animation: pop-in 180ms ease-out;
}

.well-cell.flashing {
  z-index: 1;
  animation: well-flash 0.72s ease-in-out forwards;
}

.well-cell.dropping {
  animation: well-drop 0.42s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.well-cell.is-explode {
  z-index: 3;
  animation: well-explode 0.32s ease-out forwards;
}

@keyframes well-flash {
  0%,
  35% {
    filter: brightness(1);
    transform: scale(1);
  }
  12%,
  48% {
    filter: brightness(2.5);
    transform: scale(1.12);
    box-shadow: 0 0 10px var(--hue);
  }
  70% {
    filter: brightness(1.2);
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(0.35);
  }
}

@keyframes well-drop {
  from {
    transform: translateY(calc(-100% - 2px));
  }
  to {
    transform: translateY(0);
  }
}

@keyframes well-explode {
  0% {
    opacity: 1;
    transform: scale(1) rotate(0deg);
    filter: brightness(1);
  }
  22% {
    opacity: 1;
    transform: scale(1.55) rotate(12deg);
    filter: brightness(2.6);
    box-shadow: 0 0 14px var(--hue);
  }
  100% {
    opacity: 0;
    transform: scale(0.2) translateY(-22px) rotate(-18deg);
    filter: brightness(3);
  }
}

@keyframes well-drop-in {
  from {
    transform: translateY(calc(var(--drop, -11) * (100% + 2px)));
  }
  to {
    transform: translateY(0);
  }
}

@keyframes score-bump {
  0% {
    transform: scale(1);
  }
  40% {
    transform: scale(1.28);
  }
  100% {
    transform: scale(1);
  }
}

.board {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-template-rows: repeat(5, 1fr);
  gap: 4px;
  padding: 6px;
  width: 100%;
  aspect-ratio: 1;
  touch-action: none;
}

.cell {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--empty);
}

.tile {
  position: absolute;
  inset: 0;
  border-radius: 3px;
  background: var(--hue);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, white 18%, transparent);
}

.tile.spawn {
  animation: pop-in 180ms ease-out;
}

.tile.merge {
  animation: merge-pop 200ms ease-out;
}

.tile.will-merge {
  z-index: 1;
  animation: will-merge-flash 80ms ease-out;
  box-shadow:
    inset 0 0 0 3px #fff,
    0 0 10px rgba(255, 255, 255, 0.8);
}

.tile.replay-mark {
  z-index: 2;
  box-shadow:
    inset 0 0 0 3px #fff,
    0 0 12px rgba(255, 255, 255, 0.7);
  animation: replay-pulse 700ms ease-in-out infinite;
}

.tile.replay-same {
  animation: replay-pulse 900ms ease-in-out infinite;
}

.tile.replay-pop {
  animation: replay-pop 700ms ease-out;
}

.tile.replay-spawn {
  animation: replay-spawn-in 650ms ease-out;
}

@keyframes replay-pulse {
  0%,
  100% {
    transform: scale(1);
    filter: brightness(1);
  }
  50% {
    transform: scale(1.08);
    filter: brightness(1.22);
  }
}

@keyframes replay-pop {
  0% {
    transform: scale(1);
  }
  40% {
    transform: scale(1.12);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes replay-spawn-in {
  0% {
    transform: scale(0.35);
    opacity: 0.2;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes will-merge-flash {
  0% {
    transform: scale(1);
  }
  45% {
    transform: scale(1.07);
  }
  100% {
    transform: scale(1);
  }
}

.mark {
  display: block;
  pointer-events: none;
  overflow: visible;
  fill: none;
  stroke: rgb(0 0 0 / 0.38);
  stroke-width: 2px;
  stroke-linejoin: round;
  stroke-linecap: round;
}

html[data-theme="day"] .mark {
  stroke: rgb(255 255 255 / 0.72);
  stroke-width: 2.5px;
}

.mark * {
  vector-effect: non-scaling-stroke;
}

.tile .mark,
.demo-tile .mark {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 56%;
  height: 56%;
  transform: translate(-50%, -50%);
}

.overlay {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: grid;
  place-items: center;
  background: var(--overlay-bg);
  padding: 24px;
}

.overlay.hidden {
  display: none;
}

.overlay-card {
  width: min(100%, 280px);
  padding: 22px 20px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card-bg);
  text-align: center;
}

#over-title {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 700;
}

#over-reason {
  margin: 8px 0 0;
  color: var(--muted);
}

.over-score {
  margin: 16px 0 18px;
  font-size: 1.05rem;
}

.level-up-card {
  background: linear-gradient(160deg, #ff7a59 0%, #ffd45e 100%);
  color: #1a1208;
  border: none;
  box-shadow: 0 10px 36px rgba(255, 150, 70, 0.45);
}

.level-up-kicker {
  margin: 0;
  color: rgba(26, 18, 8, 0.62);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

#level-up-title {
  margin: 8px 0 0;
  font-size: 1.55rem;
  font-weight: 700;
}

.best-score-card {
  padding: 26px 22px;
}

.best-score-lead {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.35;
}

.best-score-cta {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 1rem;
  font-weight: 600;
}

#restart {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--btn-primary-bg);
  color: var(--btn-primary-text);
  border-radius: 999px;
  padding: 10px 18px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

@keyframes pop-in {
  from {
    transform: scale(0.55);
    opacity: 0.2;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes merge-pop {
  0% {
    transform: scale(0.86);
  }
  60% {
    transform: scale(1.08);
  }
  100% {
    transform: scale(1);
  }
}

@media (max-width: 430px) {
  .phone {
    width: 100%;
    height: 100dvh;
    max-height: 100dvh;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }
}
