:root {
  --bg-0: #050711;
  --bg-1: #091122;
  --ink: #f4fbff;
  --muted: #99aac6;
  --muted-2: #62708b;
  --line: rgba(178, 225, 255, 0.22);
  --glass: rgba(11, 20, 40, 0.68);
  --glass-strong: rgba(13, 25, 52, 0.84);
  --cyan: #55e7ff;
  --pink: #ff5fd2;
  --gold: #ffd36a;
  --green: #70ffad;
  --red: #ff6876;
  --violet: #a580ff;
  --tile-size: 56px;
  --tile-gap: 5px;
  --board-px: 548px;
  --ease-out: cubic-bezier(0.2, 0.86, 0.24, 1);
  --ease-spring: cubic-bezier(0.14, 1.35, 0.32, 1);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  overflow-x: hidden;
}

body {
  min-height: 100vh;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg-0);
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

.app {
  position: relative;
  min-height: 100vh;
  isolation: isolate;
  overflow: hidden;
  background:
    radial-gradient(circle at 20% 8%, rgba(85, 231, 255, 0.18), transparent 28%),
    radial-gradient(circle at 82% 14%, rgba(255, 95, 210, 0.16), transparent 26%),
    linear-gradient(135deg, #050711 0%, #081426 54%, #0b1021 100%);
}

.backdrop {
  position: fixed;
  inset: 0;
  z-index: -2;
  overflow: hidden;
  pointer-events: none;
}

.backdrop__stars,
.backdrop__mesh,
.backdrop__rings {
  position: absolute;
  inset: 0;
}

.backdrop__stars {
  opacity: 0.75;
  background-image:
    radial-gradient(circle, rgba(255, 255, 255, 0.72) 0 1px, transparent 1.6px),
    radial-gradient(circle, rgba(85, 231, 255, 0.7) 0 1px, transparent 1.8px);
  background-position: 0 0, 38px 58px;
  background-size: 118px 118px, 172px 172px;
  animation: starDrift 32s linear infinite;
}

.backdrop__mesh--one {
  background:
    radial-gradient(circle at 24% 28%, rgba(85, 231, 255, 0.24), transparent 22%),
    radial-gradient(circle at 70% 66%, rgba(112, 255, 173, 0.13), transparent 24%);
  filter: blur(12px);
  animation: meshFloat 11s ease-in-out infinite alternate;
}

.backdrop__mesh--two {
  background:
    radial-gradient(circle at 76% 24%, rgba(255, 95, 210, 0.2), transparent 24%),
    radial-gradient(circle at 38% 80%, rgba(255, 211, 106, 0.12), transparent 20%);
  filter: blur(18px);
  animation: meshFloat 15s ease-in-out infinite alternate-reverse;
}

.backdrop__rings {
  opacity: 0.33;
  background:
    repeating-radial-gradient(circle at 50% 48%, transparent 0 88px, rgba(85, 231, 255, 0.12) 90px 92px, transparent 94px 180px);
  animation: ringPulse 9s ease-in-out infinite;
}

.shell {
  position: relative;
  width: min(1480px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) clamp(12px, 2.6vw, 30px) max(18px, env(safe-area-inset-bottom));
}

.screen {
  display: none;
  min-height: calc(100vh - 36px);
  animation: screenIn 420ms var(--ease-out) both;
}

.screen.is-active {
  display: grid;
}

.title-screen {
  place-items: center;
  align-content: center;
  gap: clamp(22px, 4vw, 44px);
  text-align: center;
}

.title-copy {
  position: relative;
  z-index: 2;
  width: min(780px, 94vw);
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--cyan);
  font-size: clamp(0.72rem, 1.6vw, 0.84rem);
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(3.2rem, 11vw, 8.5rem);
  line-height: 0.86;
  text-shadow:
    0 0 20px rgba(85, 231, 255, 0.45),
    0 0 72px rgba(255, 95, 210, 0.28);
}

h2 {
  font-size: clamp(1.4rem, 4vw, 2.1rem);
}

.tagline {
  width: min(620px, 92vw);
  margin: 22px auto 0;
  color: #dbe9ff;
  font-size: clamp(1rem, 2.5vw, 1.22rem);
  line-height: 1.55;
}

.title-orbit {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(74vw, 760px);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border: 1px solid rgba(85, 231, 255, 0.16);
  border-radius: 50%;
  box-shadow:
    inset 0 0 60px rgba(85, 231, 255, 0.1),
    0 0 90px rgba(255, 95, 210, 0.12);
  animation: orbitSpin 26s linear infinite;
}

.title-orbit span {
  position: absolute;
  width: clamp(28px, 6vw, 54px);
  aspect-ratio: 1;
  border-radius: 28% 72% 48% 52%;
  background:
    radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.92), transparent 14%),
    linear-gradient(135deg, rgba(85, 231, 255, 0.95), rgba(255, 95, 210, 0.8));
  box-shadow:
    0 0 24px rgba(85, 231, 255, 0.72),
    inset -10px -12px 18px rgba(7, 12, 29, 0.38);
}

.title-orbit span:nth-child(1) {
  top: 4%;
  left: 48%;
}

.title-orbit span:nth-child(2) {
  right: 10%;
  top: 64%;
  background:
    radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.92), transparent 14%),
    linear-gradient(135deg, rgba(255, 211, 106, 0.95), rgba(255, 104, 118, 0.84));
}

.title-orbit span:nth-child(3) {
  left: 8%;
  bottom: 18%;
  background:
    radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.92), transparent 14%),
    linear-gradient(135deg, rgba(112, 255, 173, 0.95), rgba(85, 231, 255, 0.78));
}

.title-orbit span:nth-child(4) {
  left: 14%;
  top: 20%;
  opacity: 0.68;
}

.title-actions,
.modal__actions {
  position: relative;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

.btn {
  min-width: 148px;
  min-height: 48px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  padding: 0 24px;
  cursor: pointer;
  font-weight: 850;
  background: rgba(13, 25, 52, 0.72);
  box-shadow:
    0 16px 45px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
  transition:
    transform 160ms var(--ease-out),
    border-color 160ms var(--ease-out),
    filter 160ms var(--ease-out),
    background 160ms var(--ease-out);
}

.btn:hover,
.btn:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(85, 231, 255, 0.58);
  filter: brightness(1.08);
  outline: none;
}

.btn:active {
  transform: translateY(1px) scale(0.99);
}

.btn--primary {
  border-color: rgba(85, 231, 255, 0.58);
  color: #04111c;
  background:
    linear-gradient(135deg, #55e7ff, #70ffad 52%, #ffd36a);
  box-shadow:
    0 0 26px rgba(85, 231, 255, 0.34),
    0 22px 50px rgba(0, 0, 0, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.58);
}

.btn--ghost {
  color: #e7f5ff;
}

.title-stats {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  width: min(850px, 94vw);
}

.title-stats div,
.panel,
.hud,
.board-chrome,
.modal__panel {
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.025)),
    var(--glass);
  box-shadow:
    0 24px 70px rgba(0, 0, 0, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(18px);
}

.title-stats div {
  min-height: 92px;
  border-radius: 8px;
  padding: 16px;
  text-align: left;
}

.title-stats strong,
.title-stats span {
  display: block;
}

.title-stats strong {
  margin-bottom: 7px;
}

.title-stats span {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.35;
}

.game-screen {
  grid-template-rows: auto 1fr;
  gap: 14px;
}

.hud {
  display: grid;
  grid-template-columns: minmax(150px, auto) 1fr auto;
  align-items: center;
  gap: 14px;
  min-height: 82px;
  border-radius: 8px;
  padding: 12px;
}

.hud__brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  position: relative;
  width: 42px;
  height: 42px;
  border-radius: 30% 70% 46% 54%;
  background:
    radial-gradient(circle at 34% 28%, rgba(255, 255, 255, 0.95) 0 10%, transparent 18%),
    conic-gradient(from 210deg, var(--cyan), var(--green), var(--gold), var(--pink), var(--cyan));
  box-shadow:
    0 0 26px rgba(85, 231, 255, 0.54),
    inset -10px -10px 16px rgba(0, 0, 0, 0.32);
}

.brand-mark::after {
  content: "";
  position: absolute;
  inset: 10px;
  border: 1px solid rgba(5, 7, 17, 0.5);
  border-radius: inherit;
}

.hud__kicker,
.stat span,
.mini-stat span,
.combo-meter span,
.board-status span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hud__brand strong {
  display: block;
  font-size: 1.24rem;
  line-height: 1;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(92px, 1fr));
  gap: 8px;
}

.stat {
  min-height: 58px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 8px;
  padding: 9px 12px;
  background: rgba(0, 0, 0, 0.14);
}

.stat strong {
  display: block;
  margin-top: 4px;
  font-size: clamp(1rem, 2.1vw, 1.26rem);
  line-height: 1;
}

.stat--combo strong {
  color: var(--gold);
  text-shadow: 0 0 18px rgba(255, 211, 106, 0.42);
}

.hud__actions {
  display: grid;
  grid-auto-flow: column;
  gap: 8px;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  cursor: pointer;
  color: #e9f9ff;
  background: rgba(8, 18, 38, 0.76);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    0 12px 28px rgba(0, 0, 0, 0.24);
  transition:
    transform 150ms var(--ease-out),
    border-color 150ms var(--ease-out),
    background 150ms var(--ease-out);
}

.icon-btn span {
  font-weight: 950;
}

.icon-btn:hover,
.icon-btn:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(85, 231, 255, 0.62);
  outline: none;
}

.icon-btn:active {
  transform: translateY(1px) scale(0.98);
}

.icon-btn--danger:hover,
.icon-btn--danger:focus-visible {
  border-color: rgba(255, 104, 118, 0.66);
}

.game-layout {
  display: grid;
  grid-template-columns: minmax(210px, 260px) minmax(300px, 1fr) minmax(190px, 240px);
  gap: 14px;
  min-height: 0;
}

.panel,
.board-chrome {
  border-radius: 8px;
}

.panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 0;
  padding: 16px;
}

.panel__header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.panel__header h2 {
  font-size: 1rem;
}

.panel-dot {
  width: 10px;
  height: 10px;
  border-radius: 99px;
  background: var(--pink);
  box-shadow: 0 0 18px rgba(255, 95, 210, 0.72);
}

.panel-dot--cyan {
  background: var(--cyan);
  box-shadow: 0 0 18px rgba(85, 231, 255, 0.72);
}

.objective-list {
  display: grid;
  gap: 8px;
}

.objective {
  display: grid;
  gap: 7px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 11px;
  background: rgba(0, 0, 0, 0.14);
}

.objective__top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.84rem;
  font-weight: 800;
}

.objective__top span:last-child {
  color: var(--muted);
  white-space: nowrap;
}

.progress {
  height: 7px;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.1);
}

.progress span,
.combo-meter__fill {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--cyan), var(--green), var(--gold));
  box-shadow: 0 0 18px rgba(85, 231, 255, 0.32);
  transition: width 260ms var(--ease-out);
}

.combo-meter {
  margin-top: auto;
  display: grid;
  gap: 10px;
}

.combo-meter__top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: end;
}

.combo-meter__top strong {
  color: var(--gold);
}

.combo-meter__track {
  height: 12px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.08);
}

.board-panel {
  display: grid;
  min-height: 0;
}

.board-chrome {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 10px;
  min-height: 0;
  padding: 12px;
}

.board-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 34px;
  padding: 0 3px;
}

.board-status strong {
  color: var(--cyan);
  font-size: 0.9rem;
}

.board-shell {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 360px;
  border-radius: 8px;
  overflow: hidden;
  background:
    linear-gradient(rgba(85, 231, 255, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 95, 210, 0.06) 1px, transparent 1px),
    radial-gradient(circle at 50% 40%, rgba(85, 231, 255, 0.16), transparent 45%),
    rgba(2, 7, 18, 0.66);
  background-size: 34px 34px, 34px 34px, auto, auto;
  box-shadow:
    inset 0 0 54px rgba(85, 231, 255, 0.08),
    inset 0 0 0 1px rgba(255, 255, 255, 0.06);
  transition:
    transform 360ms var(--ease-spring),
    opacity 260ms var(--ease-out);
}

.board-shell.is-rebuilding {
  transform: scale(0.965);
  opacity: 0.58;
}

.board {
  position: relative;
  width: var(--board-px);
  height: var(--board-px);
  max-width: 100%;
  max-height: 100%;
  border-radius: 8px;
  touch-action: none;
  user-select: none;
  transition:
    width 380ms var(--ease-spring),
    height 380ms var(--ease-spring);
}

.board::before {
  content: "";
  position: absolute;
  inset: calc(var(--tile-gap) * -1);
  border-radius: 8px;
  border: 1px solid rgba(85, 231, 255, 0.24);
  box-shadow:
    0 0 40px rgba(85, 231, 255, 0.12),
    inset 0 0 45px rgba(255, 95, 210, 0.08);
  pointer-events: none;
}

.tile {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--tile-size);
  height: var(--tile-size);
  border-radius: 8px;
  cursor: pointer;
  will-change: transform, opacity, filter;
  transition:
    transform 250ms var(--ease-spring),
    opacity 180ms var(--ease-out),
    filter 160ms var(--ease-out);
}

.tile.is-new {
  animation: tileArrive 360ms var(--ease-spring) both;
}

.tile.is-selected {
  z-index: 5;
  filter: brightness(1.2);
}

.tile.is-selected .tile-shell {
  transform: translateY(-3px) scale(1.04);
  box-shadow:
    0 0 0 2px rgba(255, 255, 255, 0.18),
    0 0 28px var(--tile-glow),
    0 16px 28px rgba(0, 0, 0, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.tile.is-hint .tile-shell {
  animation: hintPulse 700ms ease-in-out infinite alternate;
}

.tile.is-invalid .tile-shell {
  animation: invalidWobble 340ms ease-in-out both;
}

.tile.is-matched {
  pointer-events: none;
  animation: matchPop 260ms var(--ease-out) both;
}

.tile.is-special-pop .tile-shell {
  animation: specialBirth 520ms var(--ease-spring) both;
}

.tile.is-blocker {
  cursor: default;
}

.tile.is-frozen .frost,
.tile.is-hazard .hazard-ring {
  opacity: 1;
}

.tile-shell {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background:
    radial-gradient(circle at 34% 24%, rgba(255, 255, 255, 0.78) 0 8%, transparent 18%),
    radial-gradient(circle at 58% 66%, rgba(255, 255, 255, 0.22), transparent 30%),
    linear-gradient(135deg, var(--tile-a), var(--tile-b));
  box-shadow:
    0 0 18px color-mix(in srgb, var(--tile-glow) 62%, transparent),
    0 12px 22px rgba(0, 0, 0, 0.26),
    inset 0 1px 0 rgba(255, 255, 255, 0.34),
    inset -10px -12px 20px rgba(0, 0, 0, 0.28);
  transition:
    transform 170ms var(--ease-out),
    box-shadow 170ms var(--ease-out),
    filter 170ms var(--ease-out);
}

.tile:hover .tile-shell {
  transform: translateY(-2px);
  filter: brightness(1.07);
}

.tile-shell::before {
  content: "";
  position: absolute;
  inset: -35%;
  background: linear-gradient(110deg, transparent 34%, rgba(255, 255, 255, 0.24) 48%, transparent 62%);
  transform: translateX(-55%) rotate(12deg);
  animation: shimmer 4.4s ease-in-out infinite;
  opacity: 0.72;
}

.tile-shell::after {
  content: "";
  position: absolute;
  inset: 17%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: inherit;
  opacity: 0.72;
}

.tile-icon {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 72%;
  height: 72%;
  border-radius: 50%;
  color: rgba(255, 255, 255, 0.94);
  font-size: calc(var(--tile-size) * 0.43);
  font-weight: 950;
  line-height: 1;
  text-shadow:
    0 0 8px rgba(255, 255, 255, 0.72),
    0 0 18px var(--tile-glow);
  background:
    radial-gradient(circle at 32% 24%, rgba(255, 255, 255, 0.54), transparent 20%),
    radial-gradient(circle, rgba(255, 255, 255, 0.08), rgba(0, 0, 0, 0.1));
}

.tile-special {
  position: absolute;
  z-index: 3;
  right: 5px;
  bottom: 5px;
  display: grid;
  place-items: center;
  width: 24%;
  min-width: 14px;
  aspect-ratio: 1;
  border-radius: 50%;
  color: #07121d;
  font-size: calc(var(--tile-size) * 0.19);
  font-weight: 950;
  background: linear-gradient(135deg, #fff, var(--gold));
  box-shadow: 0 0 14px rgba(255, 211, 106, 0.72);
  opacity: 0;
  transform: scale(0.7);
  transition:
    opacity 180ms var(--ease-out),
    transform 180ms var(--ease-spring);
}

.tile[data-special] .tile-special {
  opacity: 1;
  transform: scale(1);
}

.tile[data-special="line-row"] .tile-special::before {
  content: "-";
}

.tile[data-special="line-col"] .tile-special::before {
  content: "|";
}

.tile[data-special="bomb"] .tile-special::before {
  content: "*";
}

.tile[data-special="mega"] .tile-special::before {
  content: "O";
}

.frost,
.hazard-ring {
  position: absolute;
  inset: 0;
  z-index: 4;
  opacity: 0;
  pointer-events: none;
  border-radius: inherit;
}

.frost {
  border: 2px solid rgba(184, 240, 255, 0.7);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.28), transparent 52%),
    repeating-linear-gradient(45deg, transparent 0 9px, rgba(255, 255, 255, 0.16) 10px 12px);
  box-shadow: inset 0 0 22px rgba(184, 240, 255, 0.26);
}

.hazard-ring {
  inset: 4px;
  border: 2px solid rgba(255, 104, 118, 0.76);
  box-shadow:
    0 0 14px rgba(255, 104, 118, 0.42),
    inset 0 0 14px rgba(255, 104, 118, 0.2);
  animation: hazardPulse 900ms ease-in-out infinite alternate;
}

.hazard-count {
  position: absolute;
  z-index: 5;
  left: 6px;
  top: 4px;
  color: #fff;
  font-size: calc(var(--tile-size) * 0.18);
  font-weight: 950;
  text-shadow: 0 0 8px rgba(255, 104, 118, 0.9);
  opacity: 0;
}

.tile.is-hazard .hazard-count {
  opacity: 1;
}

.tile.is-blocker .tile-shell {
  background:
    radial-gradient(circle at 35% 22%, rgba(255, 255, 255, 0.28), transparent 15%),
    linear-gradient(135deg, #4c5870, #172131 58%, #0b0f18);
  box-shadow:
    0 0 15px rgba(130, 154, 180, 0.18),
    0 12px 22px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    inset -10px -12px 20px rgba(0, 0, 0, 0.38);
}

.tile.is-blocker .tile-icon {
  color: #d4e0ee;
  background: rgba(255, 255, 255, 0.08);
  text-shadow: 0 0 14px rgba(255, 255, 255, 0.34);
}

.effects-layer {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.particle {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: var(--s);
  height: var(--s);
  border-radius: 50%;
  background: var(--c);
  box-shadow: 0 0 16px var(--c);
  transform: translate(-50%, -50%);
  animation: particleFly var(--d) var(--ease-out) forwards;
}

.score-float,
.combo-callout,
.hint-callout {
  position: absolute;
  z-index: 12;
  left: var(--x);
  top: var(--y);
  color: #fff;
  font-weight: 950;
  text-shadow:
    0 2px 8px rgba(0, 0, 0, 0.8),
    0 0 18px var(--c, rgba(85, 231, 255, 0.75));
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.score-float {
  font-size: clamp(0.82rem, 2vw, 1.12rem);
  animation: floatScore 850ms var(--ease-out) forwards;
}

.combo-callout {
  font-size: clamp(1.5rem, 5vw, 3.6rem);
  letter-spacing: 0;
  animation: comboPunch 880ms var(--ease-spring) forwards;
}

.hint-callout {
  padding: 6px 10px;
  border: 1px solid rgba(85, 231, 255, 0.38);
  border-radius: 8px;
  background: rgba(6, 16, 32, 0.76);
  color: var(--cyan);
  font-size: 0.78rem;
  animation: floatScore 900ms var(--ease-out) forwards;
}

.shockwave {
  position: absolute;
  z-index: 8;
  left: var(--x);
  top: var(--y);
  width: var(--r);
  height: var(--r);
  border: 2px solid var(--c, rgba(85, 231, 255, 0.75));
  border-radius: 50%;
  box-shadow: 0 0 30px var(--c, rgba(85, 231, 255, 0.34));
  transform: translate(-50%, -50%) scale(0.1);
  animation: shockwave 560ms var(--ease-out) forwards;
  pointer-events: none;
}

.level-banner {
  position: absolute;
  z-index: 20;
  left: 50%;
  top: 50%;
  min-width: min(440px, 86%);
  padding: 18px 22px;
  border: 1px solid rgba(85, 231, 255, 0.35);
  border-radius: 8px;
  color: #fff;
  text-align: center;
  font-size: clamp(1.4rem, 5vw, 3rem);
  font-weight: 950;
  text-shadow: 0 0 22px rgba(85, 231, 255, 0.55);
  background:
    linear-gradient(135deg, rgba(85, 231, 255, 0.16), rgba(255, 95, 210, 0.12)),
    rgba(5, 10, 22, 0.8);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.44);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0.9);
}

.level-banner.is-visible {
  animation: bannerIn 1550ms var(--ease-spring) forwards;
}

.status-stack {
  display: grid;
  gap: 8px;
}

.mini-stat {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  min-height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 9px 10px;
  background: rgba(0, 0, 0, 0.14);
}

.mini-stat strong {
  white-space: nowrap;
}

.tile-guide {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.guide-token {
  display: grid;
  place-items: center;
  min-height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  color: #fff;
  background:
    radial-gradient(circle at 35% 25%, rgba(255, 255, 255, 0.48), transparent 18%),
    linear-gradient(135deg, var(--tile-a), var(--tile-b));
  box-shadow: 0 0 16px color-mix(in srgb, var(--tile-glow) 44%, transparent);
  font-size: 1.15rem;
  font-weight: 950;
  text-shadow: 0 0 12px var(--tile-glow);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  place-items: center;
  padding: 18px;
  background:
    radial-gradient(circle at 50% 28%, rgba(85, 231, 255, 0.14), transparent 34%),
    rgba(1, 4, 12, 0.72);
  backdrop-filter: blur(12px);
}

.modal.is-active {
  display: grid;
  animation: modalFade 220ms var(--ease-out) both;
}

.modal__panel {
  width: min(440px, 100%);
  border-radius: 8px;
  padding: clamp(22px, 5vw, 34px);
  text-align: center;
  animation: modalRise 300ms var(--ease-spring) both;
}

.modal__panel--wide {
  width: min(540px, 100%);
  text-align: left;
}

.modal-copy {
  color: var(--muted);
  line-height: 1.5;
}

.final-score {
  display: block;
  margin: 16px 0;
  color: var(--gold);
  font-size: clamp(2.5rem, 13vw, 5rem);
  line-height: 0.95;
  text-shadow: 0 0 30px rgba(255, 211, 106, 0.45);
}

.toggle-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin: 16px 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 13px;
  background: rgba(0, 0, 0, 0.14);
}

.toggle-row strong,
.toggle-row small {
  display: block;
}

.toggle-row small {
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.3;
}

.toggle-row input {
  width: 46px;
  height: 25px;
  accent-color: var(--cyan);
}

.app.is-shaking .board-shell {
  animation: screenShake 260ms linear both;
}

.app.reduce-motion *,
.app.reduce-motion *::before,
.app.reduce-motion *::after {
  animation-duration: 1ms !important;
  transition-duration: 80ms !important;
}

@keyframes screenIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.99);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes modalFade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modalRise {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes starDrift {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(-120px, 118px, 0); }
}

@keyframes meshFloat {
  from { transform: translate3d(-2%, -1%, 0) scale(1); }
  to { transform: translate3d(2%, 1%, 0) scale(1.04); }
}

@keyframes ringPulse {
  0%, 100% { transform: scale(1); opacity: 0.28; }
  50% { transform: scale(1.04); opacity: 0.42; }
}

@keyframes orbitSpin {
  from { transform: translate(-50%, -50%) rotate(0deg); }
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

@keyframes shimmer {
  0%, 58% { transform: translateX(-68%) rotate(12deg); }
  78%, 100% { transform: translateX(68%) rotate(12deg); }
}

@keyframes tileArrive {
  from {
    opacity: 0;
    filter: blur(5px) brightness(1.5);
  }
  to {
    opacity: 1;
    filter: blur(0) brightness(1);
  }
}

@keyframes hintPulse {
  from {
    box-shadow:
      0 0 0 1px rgba(255, 255, 255, 0.18),
      0 0 22px var(--cyan),
      0 12px 24px rgba(0, 0, 0, 0.28),
      inset 0 1px 0 rgba(255, 255, 255, 0.4);
  }
  to {
    box-shadow:
      0 0 0 3px rgba(255, 211, 106, 0.28),
      0 0 34px var(--gold),
      0 16px 30px rgba(0, 0, 0, 0.34),
      inset 0 1px 0 rgba(255, 255, 255, 0.5);
  }
}

@keyframes invalidWobble {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-5px); }
  40% { transform: translateX(5px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(3px); }
}

@keyframes matchPop {
  0% {
    opacity: 1;
    filter: brightness(1);
    transform: scale(1);
  }
  45% {
    opacity: 1;
    filter: brightness(1.8);
    transform: scale(1.18);
  }
  100% {
    opacity: 0;
    filter: brightness(2.4) blur(7px);
    transform: scale(0.38);
  }
}

@keyframes specialBirth {
  0% { transform: scale(0.82) rotate(-4deg); }
  58% { transform: scale(1.16) rotate(3deg); }
  100% { transform: scale(1) rotate(0); }
}

@keyframes hazardPulse {
  from { opacity: 0.58; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1.03); }
}

@keyframes particleFly {
  to {
    opacity: 0;
    transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(0.3);
  }
}

@keyframes floatScore {
  0% { opacity: 0; transform: translate(-50%, -30%) scale(0.86); }
  18% { opacity: 1; transform: translate(-50%, -50%) scale(1.08); }
  100% { opacity: 0; transform: translate(-50%, -150%) scale(1); }
}

@keyframes comboPunch {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.72) rotate(-2deg); }
  20% { opacity: 1; transform: translate(-50%, -50%) scale(1.08) rotate(1deg); }
  100% { opacity: 0; transform: translate(-50%, -68%) scale(1) rotate(0); }
}

@keyframes shockwave {
  to {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.4);
  }
}

@keyframes bannerIn {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.86); }
  16%, 78% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -48%) scale(1.05); }
}

@keyframes screenShake {
  0%, 100% { transform: translate3d(0, 0, 0); }
  18% { transform: translate3d(-5px, 3px, 0); }
  36% { transform: translate3d(5px, -2px, 0); }
  54% { transform: translate3d(-3px, -4px, 0); }
  72% { transform: translate3d(3px, 4px, 0); }
}

@media (max-width: 1120px) {
  .game-layout {
    grid-template-columns: minmax(170px, 220px) minmax(300px, 1fr);
  }

  .info-panel {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: start;
  }

  .status-stack {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .shell {
    padding-inline: 10px;
  }

  .screen {
    min-height: calc(100vh - 20px);
  }

  .title-stats {
    grid-template-columns: 1fr;
  }

  .hud {
    grid-template-columns: 1fr auto;
  }

  .hud__brand {
    order: 1;
  }

  .hud__actions {
    order: 2;
  }

  .stat-grid {
    order: 3;
    grid-column: 1 / -1;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .stat {
    min-width: 0;
    padding: 8px;
  }

  .stat span {
    font-size: 0.62rem;
  }

  .game-layout {
    grid-template-columns: 1fr;
  }

  .objectives-panel {
    order: 2;
  }

  .board-panel {
    order: 1;
  }

  .info-panel {
    order: 3;
    grid-template-columns: 1fr;
  }

  .board-shell {
    min-height: min(94vw, 620px);
  }

  .panel {
    padding: 12px;
  }

  .objective-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .shell {
    padding-top: 10px;
  }

  .hud {
    gap: 10px;
    min-height: 0;
    padding: 10px;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
  }

  .hud__brand strong {
    font-size: 1rem;
  }

  .hud__actions {
    gap: 6px;
  }

  .icon-btn {
    width: 40px;
    height: 40px;
  }

  .stat-grid {
    gap: 6px;
  }

  .stat {
    min-height: 52px;
  }

  .stat strong {
    font-size: 0.98rem;
  }

  .board-chrome {
    padding: 8px;
  }

  .board-shell {
    min-height: calc(100vw - 36px);
  }

  .objective-list,
  .status-stack {
    grid-template-columns: 1fr;
  }

  .title-orbit {
    width: 98vw;
  }
}
