:root {
  --bg: #0a1020;
  --panel: rgba(15, 23, 42, 0.84);
  --panel-strong: rgba(13, 19, 35, 0.96);
  --text: #edf4ff;
  --muted: #9db0d3;
  --accent: #6ea8ff;
  --accent-strong: #407bff;
  --success: #34d399;
  --danger: #fb7185;
  --warning: #f59e0b;
  --shadow: 0 22px 60px rgba(0, 0, 0, 0.34);

  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 14px;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top, rgba(59, 130, 246, 0.7) 0%, rgba(59, 130, 246, 0) 28%),
    radial-gradient(circle at bottom, rgba(16, 185, 129, 0.14) 0%, rgba(16, 185, 129, 0) 26%),
    linear-gradient(180deg, #090f1f 0%, #0f172a 48%, #08111d 100%);
  color: var(--text);
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  touch-action: manipulation;
  overscroll-behavior: none;
}

button,
select {
  font: inherit;
  appearance: none;
  -webkit-appearance: none;
}

.app-shell {
  min-height: 100vh;
  min-height: 100dvh;
  padding:
    calc(8px + var(--safe-top))
    calc(8px + var(--safe-right))
    calc(8px + var(--safe-bottom))
    calc(8px + var(--safe-left));
}

.game-app {
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  gap: 8px;
  min-height: calc(100vh - var(--safe-top) - var(--safe-bottom) - 16px);
  min-height: calc(100dvh - var(--safe-top) - var(--safe-bottom) - 16px);
}

.topbar,
.hud,
.controls,
.board-frame {
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 18px;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-copy {
  min-width: 0;
}

.brand-mark {
  position: relative;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
}

.brand-mark__core,
.brand-mark__ring {
  position: absolute;
  inset: 0;
  border-radius: 999px;
}

.brand-mark__core {
  background:
    radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.35) 28%, rgba(255, 255, 255, 0) 30%),
    radial-gradient(circle at 50% 50%, rgba(110, 168, 255, 0.92), rgba(64, 123, 255, 0.86) 55%, rgba(64, 123, 255, 0.3) 75%, rgba(64, 123, 255, 0) 100%);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.12),
    0 0 18px rgba(64, 123, 255, 0.35);
}

.brand-mark__ring {
  inset: -4px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  opacity: 0.8;
}

.eyebrow {
  margin: 0 0 2px;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.game-title {
  margin: 0;
  font-size: 1.28rem;
  line-height: 1.02;
  letter-spacing: -0.03em;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.best-chip {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 62px;
  padding: 6px 8px;
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.04));
  border: 1px solid rgba(255, 255, 255, 0.06);
  text-align: center;
}

.best-chip__label {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.best-chip__value {
  font-size: 0.9rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #ffffff;
}

.icon-button {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  font-size: 1.05rem;
  cursor: pointer;
  transition: transform 150ms ease, background 150ms ease, box-shadow 150ms ease;
}

.icon-button:active {
  transform: scale(0.97);
}

.hud {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 8px;
  border-radius: 18px;
}

.hud-card {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 9px;
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.04));
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.hud-card--time.hud-card--warning {
  background: rgba(245, 158, 11, 0.12);
  box-shadow: inset 0 0 0 1px rgba(245, 158, 11, 0.2);
}

.hud-card--time.hud-card--danger {
  background: rgba(251, 113, 133, 0.12);
  box-shadow: inset 0 0 0 1px rgba(251, 113, 133, 0.24);
  animation: time-card-pulse 900ms ease-in-out infinite;
}

@keyframes time-card-pulse {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-1px); }
}

.hud-label {
  font-size: 0.68rem;
  color: var(--muted);
}

.hud-value {
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.hud-subtext {
  min-height: 0.9rem;
  font-size: 0.66rem;
  color: var(--muted);
  line-height: 1.15;
}

.time-bar {
  position: relative;
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  margin-top: 2px;
}

.time-bar__fill {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--success), var(--accent));
  transform-origin: left center;
  transition: width 220ms linear, background 220ms linear;
}

.hud-card--warning .time-bar__fill {
  background: linear-gradient(90deg, #fbbf24, var(--warning));
}

.hud-card--danger .time-bar__fill {
  background: linear-gradient(90deg, #fb7185, #ef4444);
}

.controls {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 8px;
  border-radius: 18px;
}

.control-button {
  min-height: 42px;
  border: 0;
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.05));
  color: var(--text);
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  transition:
    transform 150ms ease,
    box-shadow 150ms ease,
    background 150ms ease,
    filter 150ms ease,
    opacity 150ms ease;
}

.control-button:active {
  transform: scale(0.98);
}

.control-button:disabled,
.icon-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: saturate(0.65);
}

.control-button--primary {
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-strong) 100%);
  color: white;
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.28);
}

.board-section {
  min-height: 0;
  display: flex;
}

.board-frame {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  min-height: 0;
  padding: 8px;
  border-radius: 22px;
}

.board-meta {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 0 2px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

#remainingLabel {
  justify-self: center;
}

.move-state-pill {
  justify-self: end;
  padding: 5px 8px;
  border-radius: 999px;
  font-size: 0.68rem;
  line-height: 1;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.move-state-pill--ok {
  color: #d1fae5;
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.22);
}

.move-state-pill--warn {
  color: #fde68a;
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.22);
}

.move-state-pill--danger {
  color: #fecdd3;
  background: rgba(244, 63, 94, 0.12);
  border-color: rgba(244, 63, 94, 0.22);
}

.board-stack {
  position: relative;
  flex: 1;
  min-height: 0;
  border-radius: 18px;
  margin-left: -8px;
  margin-right: -8px;
  overflow: hidden;
  background:
    radial-gradient(circle at top, rgba(96, 165, 250, 0.08), rgba(96, 165, 250, 0) 30%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.02)),
    rgba(8, 14, 28, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.03),
    inset 0 0 40px rgba(59, 130, 246, 0.04);
}

.board-stack::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 0%, rgba(96, 165, 250, 0.12), rgba(96, 165, 250, 0) 38%);
  opacity: 0.9;
}

.board-stack--shuffled {
  animation: board-shuffle-flash 280ms ease;
}

@keyframes board-shuffle-flash {
  0% {
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.03),
      inset 0 0 0 rgba(59, 130, 246, 0.04);
  }
  50% {
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.03),
      inset 0 0 52px rgba(96, 165, 250, 0.15);
  }
  100% {
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.03),
      inset 0 0 40px rgba(59, 130, 246, 0.04);
  }
}

.game-board,
.board-layer {
  position: absolute;
  inset: 0;
}

.game-board {
  display: grid;
  grid-template-columns: repeat(var(--board-cols, 8), minmax(0, 1fr));
  grid-template-rows: repeat(var(--board-rows, 6), minmax(0, 1fr));
  gap: 6px;
  padding: 8px;
  align-content: stretch;
  justify-content: stretch;
}

.board-placeholder {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  border: 2px dashed rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  color: var(--muted);
  text-align: center;
  padding: 20px;
  font-weight: 600;
}

.board-canvas {
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.fx-layer {
  pointer-events: none;
  overflow: hidden;
}

.input-shield {
  background: transparent;
  pointer-events: auto;
}

.board-hint-text {
  margin: 0;
  padding: 0 2px;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.3;
  min-height: 2em;
}

.tile-slot {
  position: relative;
  min-width: 0;
  aspect-ratio: 1 / 1;
  border-radius: 16px;
}

.tile-slot--empty {
  background: rgba(255, 255, 255, 0.016);
  border: 1px solid rgba(255, 255, 255, 0.03);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

.tile {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  min-width: 0;
  border: 0;
  border-radius: 16px;
  padding: 0;
  background:
    radial-gradient(circle at 28% 18%, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.24) 20%, rgba(255, 255, 255, 0) 22%),
    linear-gradient(180deg, var(--tile-top, #ffffff) 0%, var(--tile-bottom, #eef4ff) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.82),
    inset 0 -1px 0 rgba(148, 163, 184, 0.18),
    0 10px 20px rgba(2, 6, 23, 0.18),
    0 0 0 1px rgba(255, 255, 255, 0.06);
  cursor: pointer;
  user-select: none;
  transition:
    transform 150ms ease,
    box-shadow 150ms ease,
    opacity 150ms ease,
    filter 150ms ease,
    background 150ms ease;
}

.tile::before {
  content: "";
  position: absolute;
  inset: 2px;
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0.04));
  opacity: 0.72;
  pointer-events: none;
}

.tile::after {
  content: "";
  position: absolute;
  inset: auto 14% 8% 14%;
  height: 11px;
  border-radius: 999px;
  background: radial-gradient(circle, var(--tile-aura, rgba(59, 130, 246, 0.14)), rgba(59, 130, 246, 0));
  opacity: 0;
  transition: opacity 150ms ease;
}

.tile:active {
  transform: scale(0.98);
}

.tile__emoji {
  position: relative;
  z-index: 1;
  font-size: clamp(1.25rem, 4vw, 1.8rem);
  line-height: 1;
  filter: drop-shadow(0 4px 8px rgba(2, 6, 23, 0.14));
}

.tile--selected {
  transform: translateY(-1px) scale(1.02);
  box-shadow:
    inset 0 0 0 2px rgba(59, 130, 246, 0.48),
    0 0 0 4px rgba(96, 165, 250, 0.14),
    0 16px 30px rgba(37, 99, 235, 0.22),
    0 0 20px var(--tile-glow, rgba(59, 130, 246, 0.2));
}

.tile--selected::after {
  opacity: 1;
}

.tile--hinted {
  transform: translateY(-1px) scale(1.02);
  box-shadow:
    inset 0 0 0 2px rgba(245, 158, 11, 0.5),
    0 0 0 4px rgba(245, 158, 11, 0.12),
    0 14px 30px rgba(245, 158, 11, 0.24);
}

.tile--matched {
  box-shadow:
    inset 0 0 0 2px rgba(52, 211, 153, 0.52),
    0 0 0 4px rgba(52, 211, 153, 0.14),
    0 14px 32px rgba(16, 185, 129, 0.22);
  animation: tile-match 220ms ease;
}

.tile--invalid {
  box-shadow:
    inset 0 0 0 2px rgba(251, 113, 133, 0.6),
    0 0 0 4px rgba(251, 113, 133, 0.12),
    0 10px 24px rgba(190, 24, 93, 0.24);
  animation: tile-shake 180ms ease;
}

@keyframes tile-shake {
  0% { transform: translateX(0); }
  25% { transform: translateX(-3px); }
  50% { transform: translateX(3px); }
  75% { transform: translateX(-2px); }
  100% { transform: translateX(0); }
}

@keyframes tile-match {
  0% { transform: scale(1); }
  50% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

.floating-text {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 5;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  white-space: nowrap;
  transform: translate(-50%, -50%);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.18);
  animation: floating-text-rise 720ms ease forwards;
}

.floating-text--score {
  color: #062b1f;
  background: rgba(209, 250, 229, 0.95);
}

.floating-text--time {
  color: #0c2550;
  background: rgba(219, 234, 254, 0.96);
}

.floating-text--danger {
  color: #4a1022;
  background: rgba(255, 228, 230, 0.96);
}

.floating-text--hint {
  color: #5b3b00;
  background: rgba(254, 243, 199, 0.96);
}

@keyframes floating-text-rise {
  0% {
    opacity: 0;
    transform: translate(-50%, -30%) scale(0.92);
  }
  15% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -115%) scale(1.02);
  }
}

.spark {
  position: absolute;
  left: 0;
  top: 0;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  transform: translate(-50%, -50%);
  pointer-events: none;
  animation: spark-burst 560ms ease-out forwards;
}

.spark--success {
  background: radial-gradient(circle, rgba(255, 255, 255, 0.95), rgba(52, 211, 153, 0.82) 50%, rgba(52, 211, 153, 0));
}

.spark--danger {
  background: radial-gradient(circle, rgba(255, 255, 255, 0.95), rgba(251, 113, 133, 0.82) 50%, rgba(251, 113, 133, 0));
}

.spark--warning {
  background: radial-gradient(circle, rgba(255, 255, 255, 0.95), rgba(245, 158, 11, 0.82) 50%, rgba(245, 158, 11, 0));
}

@keyframes spark-burst {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) translate(0, 0) scale(0.5);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) translate(var(--dx), var(--dy)) scale(1.35);
  }
}

.hidden {
  display: none !important;
}

.screen-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding:
    calc(20px + var(--safe-top))
    calc(16px + var(--safe-right))
    calc(20px + var(--safe-bottom))
    calc(16px + var(--safe-left));
  background: rgba(4, 8, 18, 0.72);
  backdrop-filter: blur(10px);
}

.screen-overlay--start {
  background:
    radial-gradient(circle at 50% 20%, rgba(64, 123, 255, 0.18), rgba(64, 123, 255, 0) 28%),
    rgba(4, 8, 18, 0.72);
}

.screen-overlay--victory {
  background:
    radial-gradient(circle at 50% 20%, rgba(16, 185, 129, 0.18), rgba(16, 185, 129, 0) 28%),
    rgba(4, 8, 18, 0.72);
}

.screen-overlay--defeat {
  background:
    radial-gradient(circle at 50% 20%, rgba(251, 113, 133, 0.14), rgba(251, 113, 133, 0) 28%),
    rgba(4, 8, 18, 0.72);
}

.overlay-card {
  width: min(100%, 430px);
  padding: 22px 18px;
  border-radius: 26px;
  background:
    radial-gradient(circle at top, rgba(96, 165, 250, 0.08), rgba(96, 165, 250, 0) 30%),
    var(--panel-strong);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: var(--shadow);
  text-align: center;
  animation: overlay-pop 220ms ease;
}

.overlay-card--result.overlay-card--victory {
  background:
    radial-gradient(circle at top, rgba(16, 185, 129, 0.14), rgba(16, 185, 129, 0) 30%),
    var(--panel-strong);
}

.overlay-card--result.overlay-card--defeat {
  background:
    radial-gradient(circle at top, rgba(251, 113, 133, 0.12), rgba(251, 113, 133, 0) 30%),
    var(--panel-strong);
}

.overlay-card--settings {
  width: min(100%, 360px);
}

@keyframes overlay-pop {
  0% {
    opacity: 0;
    transform: scale(0.96) translateY(8px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 6px 12px;
  margin-bottom: 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: #dbeafe;
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.hero-badge--result {
  margin-bottom: 12px;
}

.hero-art {
  position: relative;
  width: 170px;
  height: 110px;
  margin: 0 auto 14px;
}

.hero-art__halo {
  position: absolute;
  inset: 18px 18px 10px;
  border-radius: 999px;
  background:
    radial-gradient(circle, rgba(96, 165, 250, 0.34), rgba(96, 165, 250, 0) 65%);
  filter: blur(8px);
}

.hero-art__tile {
  position: absolute;
  width: 56px;
  height: 56px;
  border-radius: 18px;
  background:
    radial-gradient(circle at 28% 18%, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.22) 20%, rgba(255, 255, 255, 0) 22%),
    linear-gradient(180deg, #ffffff 0%, #e8f0ff 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.82),
    0 12px 22px rgba(2, 6, 23, 0.18);
}

.hero-art__tile::before {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(96, 165, 250, 0.24), rgba(96, 165, 250, 0.06));
}

.hero-art__tile::after {
  content: "";
  position: absolute;
  inset: 18px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(37, 99, 235, 0.85), rgba(96, 165, 250, 0.72));
}

.hero-art__tile--a {
  left: 8px;
  top: 30px;
  transform: rotate(-10deg);
}

.hero-art__tile--b {
  left: 56px;
  top: 8px;
  transform: rotate(6deg);
}

.hero-art__tile--c {
  right: 8px;
  top: 32px;
  transform: rotate(10deg);
}

.overlay-toolbar {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
}

.settings-grid {
  margin: 0 0 14px;
}

.language-field {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
}

.language-field--menu {
  display: flex;
  justify-content: space-between;
  width: 100%;
}

.language-label {
  font-size: 0.74rem;
  color: var(--muted);
  white-space: nowrap;
}

.language-select {
  min-width: 118px;
  height: 34px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  outline: none;
}
.language-select option {
  background: black;
}

.overlay-kicker {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.overlay-title {
  margin: 0 0 12px;
  font-size: 1.9rem;
  line-height: 1.02;
}

.overlay-text {
  margin: 0 -10px 16px;
  color: var(--muted);
  line-height: 1.5;
  font-size: 0.95rem;
}

.start-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin: 0 0 16px;
}

.start-stat {
  padding: 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.05);
}

.start-stat__label {
  display: block;
  margin-bottom: 4px;
  font-size: 0.76rem;
  color: var(--muted);
}

.start-stat__value {
  font-size: 1.08rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.rules-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 0 0 18px;
}

.rule-chip {
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-size: 0.76rem;
  font-weight: 700;
}

.record-note {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 8px 14px;
  margin: 0 0 14px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.14);
  color: #d1fae5;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.03em;
}

.result-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin: 0 0 18px;
}

.result-stat {
  padding: 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.05);
}

.result-stat__label {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.76rem;
}

.result-stat__value {
  font-size: 1.06rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.overlay-button {
  width: 100%;
  min-height: 50px;
  border: 0;
  border-radius: 16px;
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-strong) 100%);
  color: white;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 12px 26px rgba(37, 99, 235, 0.28);
  transition: transform 150ms ease, filter 150ms ease;
}

.overlay-button:active {
  transform: scale(0.985);
}

.overlay-button--secondary {
  margin-bottom: 10px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.08));
  box-shadow: none;
}

@media (min-width: 700px) {
  .app-shell {
    display: grid;
    place-items: center;
    padding: 12px;
  }

  .game-app {
    width: min(100%, 560px);
    min-height: min(940px, calc(100vh - 24px));
    min-height: min(940px, calc(100dvh - 24px));
    gap: 12px;
  }

  .topbar {
    padding: 14px 16px;
    border-radius: 24px;
  }

  .brand-mark {
    width: 44px;
    height: 44px;
  }

  .eyebrow {
    font-size: 0.72rem;
    margin-bottom: 4px;
  }

  .game-title {
    font-size: 1.52rem;
  }

  .best-chip {
    min-width: 74px;
    padding: 8px 10px;
  }

  .best-chip__label {
    font-size: 0.68rem;
  }

  .best-chip__value {
    font-size: 0.96rem;
  }

  .icon-button {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    font-size: 1.2rem;
  }

  .hud,
  .controls {
    gap: 10px;
    padding: 10px;
    border-radius: 24px;
  }

  .hud-card {
    padding: 12px;
    gap: 4px;
  }

  .hud-label {
    font-size: 0.8rem;
  }

  .hud-value {
    font-size: 1.1rem;
  }

  .hud-subtext {
    font-size: 0.74rem;
  }

  .control-button {
    min-height: 48px;
    font-size: 1rem;
    border-radius: 14px;
  }

  .board-frame {
    padding: 12px;
    border-radius: 28px;
  }

  .board-meta {
    font-size: 0.88rem;
    gap: 10px;
  }

  .move-state-pill {
    font-size: 0.74rem;
    padding: 6px 10px;
  }

  .board-stack {
    border-radius: 22px;
  }

  .game-board {
    gap: 10px;
    padding: 12px;
  }

  .board-hint-text {
    font-size: 0.85rem;
    min-height: 2.35em;
  }

  .tile {
    border-radius: 18px;
  }

  .tile::before {
    border-radius: 16px;
  }

  .tile__emoji {
    font-size: clamp(1.4rem, 4vw, 2rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}