:root {
  color-scheme: light;
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-strong: #eef2f7;
  --ink: #151a24;
  --muted: #697386;
  --line: #dbe2ec;
  --board: #171d29;
  --cell: #263044;
  --cell-soft: #313c52;
  --accent: #16a39a;
  --accent-strong: #0d827c;
  --danger: #ff6b5c;
  --shadow: 0 18px 45px rgba(20, 28, 43, 0.14);
  --radius: 8px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

button {
  font: inherit;
}

.block-blast-page .eyebrow::before {
  display: none;
}

.game-shell {
  width: min(1180px, calc(100vw - 32px));
  min-height: calc(100vh - 72px);
  margin: 0 auto;
  padding: clamp(18px, 3vw, 34px) 0;
  display: grid;
  grid-template-columns: minmax(190px, 250px) minmax(320px, 1fr) minmax(210px, 270px);
  gap: clamp(18px, 3vw, 30px);
  align-items: center;
}

.score-column,
.piece-column,
.board-column {
  min-width: 0;
}

.score-column,
.piece-column {
  display: grid;
  gap: 14px;
}

.brand-lockup {
  display: grid;
  gap: 2px;
}

.eyebrow {
  margin: 0;
  color: var(--accent-strong);
  font-size: 0.73rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  font-size: clamp(2rem, 4vw, 3.7rem);
  line-height: 0.95;
}

h2 {
  font-size: clamp(1.9rem, 5vw, 2.6rem);
}

.score-tile,
.metric,
.goal-panel,
.piece-button,
.empty-piece,
.modal {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.score-tile {
  padding: 18px;
  display: grid;
  gap: 6px;
}

.score-tile span,
.metric span,
.goal-row span,
.piece-heading,
.turn-message {
  color: var(--muted);
}

.score-tile strong {
  font-size: clamp(2.4rem, 7vw, 4.4rem);
  line-height: 0.95;
  font-variant-numeric: tabular-nums;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.metric {
  padding: 13px;
  display: grid;
  gap: 5px;
}

.metric strong {
  font-size: 1.42rem;
  font-variant-numeric: tabular-nums;
}

.mode-switch {
  padding: 4px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.mode-button {
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 800;
}

.mode-button.is-active {
  background: var(--ink);
  color: white;
}

.goal-panel {
  padding: 14px;
  display: grid;
  gap: 10px;
}

.goal-panel[hidden] {
  display: none;
}

.goal-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.goal-row strong {
  font-variant-numeric: tabular-nums;
}

.progress-track {
  height: 9px;
  border-radius: 999px;
  background: #e5ebf3;
  overflow: hidden;
}

.progress-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #16a39a, #f4b942);
  transition: width 180ms ease;
}

.board-column {
  display: grid;
  gap: 14px;
  justify-items: center;
}

.board-topline {
  width: min(100%, 560px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.status-pill {
  min-height: 34px;
  margin: 0;
  padding: 7px 12px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: #e9f8f6;
  color: var(--accent-strong);
  font-size: 0.85rem;
  font-weight: 800;
}

.icon-action {
  width: 42px;
  height: 42px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  color: var(--ink);
  cursor: pointer;
  font-size: 1.35rem;
  line-height: 1;
}

.board-wrap {
  width: min(100%, 560px);
}

.board {
  width: 100%;
  aspect-ratio: 1;
  padding: clamp(7px, 1.5vw, 10px);
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  grid-template-rows: repeat(8, minmax(0, 1fr));
  gap: clamp(5px, 1.1vw, 8px);
  border-radius: var(--radius);
  background: var(--board);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.08),
    0 20px 55px rgba(23, 29, 41, 0.25);
  touch-action: none;
}

.board-cell {
  position: relative;
  min-width: 0;
  min-height: 0;
  border: 0;
  border-radius: 6px;
  background: var(--cell);
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.22);
  cursor: crosshair;
  transition:
    transform 120ms ease,
    background-color 120ms ease,
    box-shadow 120ms ease,
    opacity 120ms ease;
}

.board-cell.filled {
  background: var(--cell-color);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.34),
    inset 0 -3px 0 rgba(0, 0, 0, 0.22);
}

.board-cell.filled::after,
.piece-block::after {
  content: "";
  position: absolute;
  inset: 15% 16% auto;
  height: 28%;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.28);
}

.board-cell.preview {
  background: rgba(22, 163, 154, 0.72);
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.55),
    0 0 0 2px rgba(22, 163, 154, 0.16);
}

.board-cell.blocked {
  background: rgba(255, 107, 92, 0.68);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.48);
}

.board-cell.clearing {
  animation: pop-cell 210ms ease-in-out 1;
  background: #f4b942;
}

.turn-message {
  width: min(100%, 560px);
  min-height: 28px;
  margin: 0;
  text-align: center;
  font-weight: 800;
}

.piece-heading {
  min-height: 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-weight: 900;
}

.piece-heading span:last-child {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.pieces {
  display: grid;
  gap: 12px;
}

.piece-button,
.empty-piece {
  width: 100%;
  min-height: 112px;
  display: grid;
  place-items: center;
}

.piece-button {
  border: 1px solid var(--line);
  cursor: grab;
  touch-action: none;
  transition:
    transform 140ms ease,
    border-color 140ms ease,
    box-shadow 140ms ease;
}

.piece-button:hover,
.piece-button.is-selected {
  transform: translateY(-2px);
  border-color: rgba(22, 163, 154, 0.6);
}

.piece-button.is-selected {
  box-shadow:
    var(--shadow),
    0 0 0 3px rgba(22, 163, 154, 0.18);
}

.piece-button.is-stuck {
  opacity: 0.58;
}

.piece-button:active {
  cursor: grabbing;
}

.empty-piece {
  border-style: dashed;
  box-shadow: none;
  background: transparent;
}

.piece-grid {
  --piece-cell: 24px;
  display: grid;
  grid-template-columns: repeat(var(--cols), var(--piece-cell));
  grid-template-rows: repeat(var(--rows), var(--piece-cell));
  gap: calc(var(--piece-cell) * 0.14);
}

.piece-block {
  position: relative;
  border-radius: max(4px, calc(var(--piece-cell) * 0.18));
  background: var(--piece-color);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.34),
    inset 0 -3px 0 rgba(0, 0, 0, 0.22);
}

.drag-ghost {
  position: fixed;
  z-index: 20;
  pointer-events: none;
  width: auto;
  min-height: 0;
  padding: 10px;
  opacity: 0.88;
  transform: translate(-50%, -50%);
}

.primary-action {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 0;
  border-radius: var(--radius);
  background: var(--ink);
  color: white;
  cursor: pointer;
  font-weight: 900;
}

.primary-action span:first-child {
  font-size: 1.1rem;
  line-height: 1;
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(21, 26, 36, 0.58);
  backdrop-filter: blur(8px);
}

.overlay[hidden] {
  display: none;
}

.modal {
  width: min(360px, 100%);
  padding: 24px;
  display: grid;
  gap: 16px;
  text-align: center;
}

.modal-score {
  margin: 0;
  color: var(--muted);
  font-size: 1.1rem;
  font-weight: 800;
}

.modal-score span {
  color: var(--ink);
  font-size: 2.2rem;
  font-variant-numeric: tabular-nums;
}

@keyframes pop-cell {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.12);
  }

  100% {
    transform: scale(0.16);
    opacity: 0;
  }
}

@media (max-width: 920px) {
  .game-shell {
    min-height: auto;
    grid-template-columns: 1fr;
    align-items: start;
    padding-bottom: 28px;
  }

  .score-column {
    grid-template-columns: 1fr;
  }

  .brand-lockup {
    text-align: center;
  }

  .metric-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .piece-column {
    order: 3;
  }

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

  .piece-button,
  .empty-piece {
    min-height: 104px;
  }
}

@media (max-width: 620px) {
  .game-shell {
    width: min(100vw - 20px, 560px);
    gap: 16px;
    padding-top: 12px;
  }

  h1 {
    font-size: 2.35rem;
  }

  .score-tile {
    padding: 14px;
  }

  .score-tile strong {
    font-size: 3rem;
  }

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

  .board {
    gap: 5px;
    padding: 7px;
  }

  .pieces {
    gap: 8px;
  }

  .piece-button,
  .empty-piece {
    min-height: 88px;
  }

  .piece-grid {
    --piece-cell: 19px;
  }
}
