:root {
  --bg: #f4f1e8;
  --panel: #fffdf8;
  --line: #d4ccbd;
  --text: #1f1f1c;
  --muted: #6d675c;
  --snake: #2f6f43;
  --snake-head: #1f4e2f;
  --food: #b7422f;
  --button: #efe7d8;
  --button-active: #e1d7c3;
  --shadow: 0 16px 40px rgba(43, 37, 28, 0.08);
  --board-a: rgba(236, 228, 213, 0.92);
  --board-b: rgba(228, 219, 202, 0.92);
  --board-c: rgba(232, 224, 210, 0.92);
  --board-d: rgba(224, 214, 196, 0.92);
  --board-accent-1: rgba(255, 255, 255, 0.05);
  --board-accent-2: rgba(25, 18, 12, 0.05);
  --board-accent-3: rgba(183, 66, 47, 0.16);
  --board-accent-4: rgba(47, 111, 67, 0.18);
  --pause-ink: #2d241d;
  --pause-muted: #766354;
  --pause-line: rgba(125, 97, 73, 0.28);
  --pause-card: rgba(255, 248, 237, 0.86);
  --pause-card-strong: rgba(246, 230, 209, 0.9);
  --pause-accent: #7f5038;
  --pause-accent-soft: rgba(127, 80, 56, 0.1);
  --veneno-a: rgba(171, 154, 191, 0.86);
  --veneno-b: rgba(198, 189, 145, 0.84);
  --veneno-c: rgba(118, 166, 160, 0.84);
  --veneno-d: rgba(137, 144, 182, 0.84);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Trebuchet MS", "Gill Sans", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

button,
input {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.game-panel {
  width: min(100%, 720px);
  background:
    radial-gradient(circle at top left, rgba(255, 242, 213, 0.42), transparent 34%),
    linear-gradient(180deg, rgba(255, 252, 246, 0.98), rgba(246, 239, 228, 0.96));
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 24px;
}

.board-wrap {
  display: flex;
  justify-content: center;
}

.command-strip {
  display: grid;
  gap: 8px;
  width: min(100%, 480px);
  margin: 14px auto 0;
}

.command-label {
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.command-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.command-input,
.command-send {
  min-height: 42px;
  border: 1px solid rgba(212, 204, 189, 0.8);
  border-radius: 14px;
  background: rgba(255, 253, 248, 0.92);
  color: var(--text);
  box-shadow: 0 8px 20px rgba(43, 37, 28, 0.05);
}

.command-input {
  width: 100%;
  padding: 10px 14px;
}

.command-send {
  padding: 10px 16px;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.board-stack {
  position: relative;
  width: min(92vw, 480px);
}

.board-stack.is-veneno .board {
  background:
    linear-gradient(135deg, rgba(178, 162, 198, 0.6), rgba(204, 198, 153, 0.54) 44%, rgba(109, 163, 156, 0.58));
  box-shadow:
    0 0 0 1px rgba(181, 166, 208, 0.26),
    0 0 20px rgba(121, 108, 160, 0.12);
  animation:
    veneno-board-flicker 300ms steps(2, end) infinite,
    veneno-board-pulse 1.1s ease-in-out infinite;
}

.board-stack.is-capicua .board {
  background:
    linear-gradient(180deg, rgba(220, 231, 255, 0.34), rgba(232, 242, 255, 0.14)),
    linear-gradient(90deg, rgba(76, 111, 214, 0.14), rgba(255, 255, 255, 0) 28%, rgba(255, 255, 255, 0) 72%, rgba(76, 111, 214, 0.14));
  box-shadow:
    0 0 0 1px rgba(117, 147, 226, 0.18),
    0 0 20px rgba(86, 122, 214, 0.12);
  animation:
    capicua-board-pulse 1.2s ease-in-out infinite,
    capicua-board-shimmer 1.8s linear infinite;
}

.board-stack.is-mystery-flash .board {
  animation: mystery-board-flash 900ms steps(2, end) infinite;
}

.hud-strip {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 2;
  display: flex;
  gap: 10px;
}

.shell-link-row {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 2;
}

.shell-link,
.sheet-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 8px 12px;
  border: 1px solid rgba(212, 204, 189, 0.5);
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.18);
  color: #3a2d23;
  text-decoration: none;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  backdrop-filter: blur(3px);
  box-shadow: 0 8px 20px rgba(43, 37, 28, 0.05);
}

.pause-shell-button {
  min-width: 40px;
  padding: 8px 10px;
  cursor: pointer;
  font-size: 0.95rem;
  line-height: 1;
}

.sheet-meta-actions {
  display: flex;
  justify-content: center;
  width: 100%;
}

.sheet-link {
  background: rgba(255, 248, 237, 0.72);
  border-color: rgba(125, 97, 73, 0.22);
}

.hud-chip {
  min-width: 72px;
  padding: 8px 10px;
  border: 1px solid rgba(212, 204, 189, 0.6);
  border-radius: 12px;
  background: rgba(255, 253, 248, 0.18);
  text-align: center;
  box-shadow: 0 8px 20px rgba(43, 37, 28, 0.05);
  backdrop-filter: blur(3px);
  position: relative;
}

.hud-chip.is-scored {
  border-color: rgba(216, 104, 67, 0.48);
  background: rgba(255, 244, 228, 0.3);
  box-shadow:
    0 10px 22px rgba(216, 104, 67, 0.12),
    0 0 0 1px rgba(216, 104, 67, 0.08);
  animation: score-chip-bump 340ms ease;
}

.hud-button {
  min-width: 54px;
  cursor: pointer;
}

.score-value-chip {
  display: block;
  font-size: 1.32rem;
  font-weight: 800;
  line-height: 1;
  color: #2d241d;
}

@keyframes score-chip-bump {
  0% {
    transform: translate3d(0, 0, 0) scale(1);
  }

  20% {
    transform: translate3d(-1px, 0, 0) scale(1.06);
  }

  40% {
    transform: translate3d(2px, -1px, 0) scale(1.08);
  }

  65% {
    transform: translate3d(-1px, 1px, 0) scale(1.03);
  }

  100% {
    transform: translate3d(0, 0, 0) scale(1);
  }
}

.board-burst {
  position: absolute;
  top: 0;
  left: 0;
  color: #d85a3a;
  font-size: 1.28rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  opacity: 0;
  transform: translate(-50%, 10px) scale(0.9);
  transition:
    opacity 180ms ease,
    transform 420ms ease;
  pointer-events: none;
  text-shadow:
    0 0 14px rgba(255, 244, 222, 0.95),
    0 2px 0 rgba(255, 255, 255, 0.45);
  z-index: 2;
}

.board-burst.is-visible {
  opacity: 1;
  transform: translate(-50%, -26px) scale(1.16);
}

.pause-modal {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 4;
  display: grid;
  gap: 12px;
  min-width: min(78vw, 280px);
  padding: 18px 16px;
  border: 1px solid rgba(164, 130, 96, 0.68);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 250, 241, 0.98), rgba(241, 231, 213, 0.95)),
    rgba(255, 253, 248, 0.96);
  box-shadow:
    0 20px 40px rgba(73, 48, 30, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.72);
  text-align: center;
  transform: translate(-50%, -50%);
}

.pause-modal[hidden] {
  display: none;
}

.pause-modal-title {
  margin: 0;
  color: var(--pause-ink);
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.pause-modal-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
}

.pause-modal-actions button {
  min-width: 108px;
  min-height: 40px;
  border: 1px solid var(--pause-line);
  border-radius: 12px;
  background: rgba(255, 248, 237, 0.86);
  color: var(--pause-ink);
  cursor: pointer;
  padding: 8px 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  box-shadow: 0 10px 24px rgba(68, 47, 31, 0.05);
}

.pause-modal-actions button:active {
  background: var(--button-active);
}

.board {
  width: 100%;
  aspect-ratio: var(--board-columns, 16) / var(--board-rows, 24);
  display: grid;
  grid-template-columns: repeat(var(--board-columns, 16), 1fr);
  grid-template-rows: repeat(var(--board-rows, 24), 1fr);
  gap: 3px;
  padding: 10px;
  border-radius: 18px;
  background: #ddd2bd;
  touch-action: none;
  overscroll-behavior: contain;
}

.title-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 18px;
  pointer-events: none;
  z-index: 2;
  transition: opacity 180ms ease;
}

.title-overlay.is-hidden {
  opacity: 0;
}

.veneno-splash {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: clamp(2.8rem, 14vw, 6rem);
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #a247ff;
  text-shadow:
    0 0 12px rgba(214, 173, 255, 0.75),
    0 0 28px rgba(162, 71, 255, 0.55),
    0 4px 18px rgba(39, 14, 76, 0.45);
  opacity: 0;
  transform: scale(0.82);
  pointer-events: none;
  z-index: 3;
}

.veneno-splash.is-visible {
  animation: veneno-splash-in 960ms ease;
}

.capicua-splash {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  opacity: 0;
  transform: scale(0.82);
  pointer-events: none;
  z-index: 3;
}

.capicua-splash.is-visible {
  animation: capicua-splash-in 1700ms ease;
}

.serpiente-splash {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  opacity: 0;
  transform: scale(0.82);
  pointer-events: none;
  z-index: 3;
}

.serpiente-splash.is-visible {
  animation: serpiente-splash-in 1700ms ease;
}

.mode-sigil {
  display: none;
}

.mode-label {
  font-size: clamp(2rem, 9vw, 3.8rem);
  font-weight: 900;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  opacity: 0;
}

.capicua-splash .mode-label {
  color: #426dff;
  text-shadow:
    0 0 12px rgba(180, 204, 255, 0.72),
    0 0 20px rgba(66, 109, 255, 0.28);
}

.serpiente-splash .mode-label {
  color: #245531;
  text-shadow:
    0 0 12px rgba(214, 235, 190, 0.62),
    0 0 18px rgba(36, 85, 49, 0.22);
}

.mystery-splash {
  position: absolute;
  inset: 0;
  display: grid;
  align-content: space-evenly;
  justify-items: center;
  padding-block: 18px;
  opacity: 0;
  pointer-events: none;
  z-index: 3;
}

.mystery-splash.is-visible {
  opacity: 1;
}

.mystery-splash span {
  font-size: clamp(1.15rem, 7vw, 2.9rem);
  font-weight: 900;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255, 246, 222, 0.92);
  text-shadow:
    0 0 10px rgba(255, 240, 171, 0.78),
    0 0 24px rgba(150, 92, 28, 0.42),
    0 3px 12px rgba(59, 39, 15, 0.38);
  opacity: 0;
  transform: translateY(-12px) scale(0.96);
}

.mystery-splash.is-visible span {
  animation: mystery-splash-cascade 1.2s ease-in-out infinite;
}

.mystery-splash.is-visible span:nth-child(2) {
  animation-delay: 0.14s;
}

.mystery-splash.is-visible span:nth-child(3) {
  animation-delay: 0.28s;
}

.mystery-splash.is-visible span:nth-child(4) {
  animation-delay: 0.42s;
}

.mystery-splash.is-visible span:nth-child(5) {
  animation-delay: 0.56s;
}

.scores-sheet {
  position: absolute;
  inset: 10px;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  align-content: stretch;
  justify-items: center;
  gap: 8px;
  padding: 12px;
  border-radius: 14px;
  background:
    radial-gradient(circle at top, rgba(255, 222, 170, 0.45), transparent 36%),
    radial-gradient(circle at bottom right, rgba(142, 179, 166, 0.2), transparent 32%),
    linear-gradient(180deg, rgba(255, 246, 232, 0.98), rgba(232, 220, 198, 0.96)),
    rgba(255, 253, 248, 0.96);
  border: 1px solid rgba(164, 130, 96, 0.75);
  overflow-y: auto;
  text-align: center;
  z-index: 3;
  box-shadow:
    0 24px 48px rgba(73, 48, 30, 0.18),
    inset 0 1px 0 rgba(255, 250, 240, 0.8);
}

.scores-sheet[hidden] {
  display: none;
}

.overlay-title {
  margin: 0;
  font-size: clamp(2.4rem, 9vw, 4.2rem);
  letter-spacing: 0.08em;
  color: var(--pause-ink);
  text-align: center;
  text-shadow:
      0 10px 26px rgba(255, 246, 222, 0.4),
      0 2px 0 rgba(255, 255, 255, 0.35);
}

.start-button {
  pointer-events: auto;
  appearance: none;
  border: 1px solid rgba(129, 102, 79, 0.22);
  border-radius: 999px;
  background: rgba(255, 246, 232, 0.72);
  color: var(--pause-ink);
  padding: 12px 26px;
  min-width: 138px;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  box-shadow: 0 10px 24px rgba(111, 83, 60, 0.12);
  backdrop-filter: blur(6px);
  cursor: pointer;
  transition: transform 120ms ease, background 120ms ease, box-shadow 120ms ease;
}

.start-button:hover,
.start-button:focus-visible {
  outline: none;
  transform: translateY(-1px);
  background: rgba(255, 248, 238, 0.88);
  box-shadow: 0 14px 30px rgba(111, 83, 60, 0.18);
}

.scores-sheet-title {
  font-size: clamp(1.45rem, 5vw, 2.25rem);
}

.snake-letter {
  display: inline-block;
  color: var(--snake-head);
  text-shadow: 10px 0 0 var(--snake), 20px 0 0 rgba(47, 111, 67, 0.75);
  animation: snake-sway 1.5s ease-in-out infinite;
}

@keyframes snake-sway {
  0%,
  100% {
    transform: translateX(0) rotate(-6deg);
  }

  50% {
    transform: translateX(2px) rotate(6deg);
  }
}

@keyframes veneno-splash-in {
  0% {
    opacity: 0;
    transform: scale(0.78);
  }

  15% {
    opacity: 1;
    transform: scale(1.04);
  }

  70% {
    opacity: 0.96;
    transform: scale(1);
  }

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

@keyframes capicua-splash-in {
  0% {
    opacity: 0;
    transform: scale(0.8);
  }

  14% {
    opacity: 1;
    transform: scale(1.02);
  }

  18%,
  46% {
    opacity: 1;
    transform: scale(1);
  }

  26%,
  40% {
    opacity: 1;
    transform: scale(1);
  }

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

@keyframes serpiente-splash-in {
  0% {
    opacity: 0;
    transform: scale(0.82);
  }

  16% {
    opacity: 1;
    transform: scale(1.01);
  }

  48%,
  78% {
    opacity: 1;
    transform: scale(1);
  }

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

.capicua-splash.is-visible .mode-label,
.serpiente-splash.is-visible .mode-label {
  animation: mode-label-flash 1700ms ease;
}

@keyframes mode-label-flash {
  0%,
  12% {
    opacity: 0;
    transform: scale(0.94);
  }

  24%,
  82% {
    opacity: 1;
    transform: scale(1);
  }

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

@keyframes veneno-board-flicker {
  0% {
    filter: saturate(1.05) brightness(0.98) hue-rotate(0deg);
  }

  50% {
    filter: saturate(1.22) brightness(1.05) hue-rotate(6deg);
  }

  100% {
    filter: saturate(1.08) brightness(0.99) hue-rotate(-4deg);
  }
}

@keyframes veneno-board-pulse {
  0%,
  100% {
    box-shadow:
      0 0 0 1px rgba(181, 166, 208, 0.24),
      0 0 18px rgba(121, 108, 160, 0.1);
  }

  50% {
    box-shadow:
      0 0 0 1px rgba(196, 182, 224, 0.3),
      0 0 26px rgba(149, 132, 186, 0.18);
  }
}

@keyframes capicua-board-pulse {
  0%,
  100% {
    box-shadow:
      0 0 0 1px rgba(117, 147, 226, 0.16),
      0 0 16px rgba(86, 122, 214, 0.1);
  }

  50% {
    box-shadow:
      0 0 0 1px rgba(138, 166, 236, 0.24),
      0 0 24px rgba(86, 122, 214, 0.16);
  }
}

@keyframes capicua-board-shimmer {
  0% {
    filter: saturate(1) brightness(1);
  }

  50% {
    filter: saturate(1.08) brightness(1.03);
  }

  100% {
    filter: saturate(1) brightness(1);
  }
}

@keyframes mystery-board-flash {
  0%,
  100% {
    filter: saturate(1) brightness(1);
    box-shadow:
      0 0 0 1px rgba(186, 154, 92, 0.14),
      0 0 14px rgba(137, 101, 38, 0.06);
  }

  30% {
    filter: saturate(1.2) brightness(1.08) hue-rotate(10deg);
    box-shadow:
      0 0 0 1px rgba(223, 187, 109, 0.32),
      0 0 24px rgba(185, 129, 47, 0.18);
  }

  60% {
    filter: saturate(1.08) brightness(1.02) hue-rotate(-8deg);
    box-shadow:
      0 0 0 1px rgba(169, 201, 214, 0.28),
      0 0 20px rgba(93, 132, 146, 0.14);
  }
}

@keyframes mystery-splash-cascade {
  0% {
    opacity: 0;
    transform: translateY(-14px) scale(0.94);
  }

  20% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }

  60% {
    opacity: 1;
    transform: translateY(5px) scale(1);
  }

  100% {
    opacity: 0;
    transform: translateY(14px) scale(0.98);
  }
}

.actions,
.name-row {
  display: flex;
  gap: 12px;
  justify-self: center;
}

.name-row {
  position: relative;
  width: min(100%, 360px);
}

.sheet-actions {
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  gap: 8px;
  width: min(100%, 420px);
  justify-self: center;
}

.sheet-actions button {
  flex: 0 0 196px;
  min-width: 196px;
  height: 42px;
  align-self: center;
  font-size: 0.82rem;
  white-space: nowrap;
}

.sheet-status {
  margin: 0;
  color: var(--pause-muted);
  line-height: 1.35;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  max-width: 28ch;
}

.sheet-status:empty {
  display: none;
}

.actions button,
#save-score-button {
  border: 1px solid var(--pause-line);
  background: rgba(255, 248, 237, 0.82);
  color: var(--pause-ink);
  border-radius: 12px;
  cursor: pointer;
  padding: 8px 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  box-shadow: 0 10px 24px rgba(68, 47, 31, 0.05);
}

.actions button:active,
#save-score-button:active {
  background: var(--button-active);
}

.scores-block {
  display: grid;
  align-self: stretch;
  align-content: start;
  gap: 4px;
  justify-items: center;
  width: 100%;
  min-height: 0;
  padding: 8px 12px 10px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 251, 245, 0.72), rgba(243, 232, 214, 0.64));
  border: 1px solid rgba(168, 136, 104, 0.2);
}

.scores-list {
  width: min(100%, 360px);
  margin: 0;
  padding-left: 0;
  list-style: none;
  color: var(--pause-ink);
  text-align: left;
  display: grid;
  gap: 5px;
}

.scores-list li {
  margin-bottom: 0;
}

.score-row {
  display: grid;
  grid-template-columns: 46px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border: 1px solid rgba(170, 137, 105, 0.36);
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(255, 252, 247, 0.95), rgba(244, 233, 214, 0.88)),
    var(--pause-card);
  box-shadow:
    0 10px 24px rgba(68, 47, 31, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.score-place,
.score-name,
.score-value {
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.score-place {
  display: inline-grid;
  place-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  color: var(--pause-accent);
  font-size: 0.78rem;
  font-weight: 700;
  background: var(--pause-accent-soft);
  border: 1px solid rgba(127, 80, 56, 0.18);
}

.score-name {
  color: var(--pause-ink);
  font-weight: 700;
  justify-self: start;
}

.score-value {
  color: #6d3421;
  font-weight: 800;
  justify-self: end;
}

.scores-pending {
  opacity: 1;
}

.score-row-entry {
  border-color: rgba(138, 88, 56, 0.52);
  background:
    linear-gradient(180deg, rgba(255, 248, 236, 0.98), rgba(244, 226, 197, 0.92)),
    var(--pause-card-strong);
}

.score-row-latest {
  border-color: rgba(130, 88, 43, 0.5);
  background:
    linear-gradient(180deg, rgba(255, 243, 220, 0.98), rgba(238, 221, 184, 0.94)),
    var(--pause-card-strong);
}

.score-row-latest .score-place,
.score-row-latest .score-value {
  color: #99592d;
  background: rgba(153, 89, 45, 0.12);
  border-color: rgba(153, 89, 45, 0.2);
}

.score-row-latest .score-name {
  color: #7d4320;
}

.scores-empty {
  color: var(--pause-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  text-align: center;
}

.name-entry {
  width: 100%;
}

.name-input {
  width: 100%;
  min-width: 0;
  padding: 10px 48px 10px 12px;
  border: 1px solid var(--pause-line);
  border-radius: 12px;
  background: rgba(255, 253, 249, 0.92);
  color: var(--pause-ink);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.name-confirm {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 10px;
  font-size: 1rem;
  line-height: 1;
}

.cell {
  border-radius: 4px;
  background: var(--board-a);
  box-shadow: inset 0 0 0 999px rgba(255, 255, 255, 0);
}

.cell.zone-a {
  background: var(--board-a);
}

.cell.zone-b {
  background: var(--board-b);
}

.cell.zone-c {
  background: var(--board-c);
}

.cell.zone-d {
  background: var(--board-d);
}

.cell.tone-1 {
  box-shadow: inset 0 0 0 999px var(--board-accent-1);
}

.cell.tone-2 {
  box-shadow: inset 0 0 0 999px var(--board-accent-2);
}

.cell.tone-pop {
  box-shadow: inset 0 0 0 999px var(--board-accent-3);
}

.cell.tone-pop-strong {
  box-shadow: inset 0 0 0 999px var(--board-accent-4);
}

.cell.tone-burst {
  box-shadow: inset 0 0 0 999px rgba(109, 49, 24, 0.22);
}

.cell.tone-burst-soft {
  box-shadow: inset 0 0 0 999px rgba(242, 192, 93, 0.18);
}

.cell.tone-wave {
  box-shadow: inset 0 0 0 999px rgba(90, 70, 145, 0.2);
}

.cell.tone-wave-soft {
  box-shadow: inset 0 0 0 999px rgba(184, 170, 227, 0.18);
}

.cell.tone-flare {
  box-shadow: inset 0 0 0 999px rgba(239, 128, 74, 0.24);
}

.cell.tone-flare-soft {
  box-shadow: inset 0 0 0 999px rgba(255, 216, 128, 0.18);
}

.cell.tone-grid {
  box-shadow: inset 0 0 0 999px rgba(82, 131, 165, 0.2);
}

.cell.tone-grid-soft {
  box-shadow: inset 0 0 0 999px rgba(159, 197, 214, 0.18);
}

.cell.tone-shock {
  box-shadow: inset 0 0 0 999px rgba(255, 245, 166, 0.28);
}

.cell.tone-shock-dark {
  box-shadow: inset 0 0 0 999px rgba(52, 31, 22, 0.24);
}

.cell.tone-ember {
  box-shadow: inset 0 0 0 999px rgba(255, 118, 69, 0.3);
}

.cell.tone-ember-deep {
  box-shadow: inset 0 0 0 999px rgba(142, 46, 34, 0.24);
}

.cell.veneno-a {
  background: var(--veneno-a);
  box-shadow: inset 0 0 0 999px rgba(255, 255, 255, 0.03);
}

.cell.veneno-b {
  background: var(--veneno-b);
  box-shadow: inset 0 0 0 999px rgba(24, 20, 17, 0.04);
}

.cell.veneno-c {
  background: var(--veneno-c);
  box-shadow: inset 0 0 0 999px rgba(255, 255, 255, 0.02);
}

.cell.veneno-d {
  background: var(--veneno-d);
  box-shadow: inset 0 0 0 999px rgba(30, 19, 42, 0.05);
}

.cell.capicua-a {
  box-shadow: inset 0 0 0 999px rgba(108, 142, 226, 0.12);
}

.cell.capicua-b {
  box-shadow: inset 0 0 0 999px rgba(197, 219, 255, 0.16);
}

.cell.capicua-c {
  box-shadow: inset 0 0 0 999px rgba(74, 106, 191, 0.1);
}

.cell.capicua-d {
  box-shadow: inset 0 0 0 999px rgba(227, 237, 255, 0.18);
}

.board-stack.is-veneno .cell.veneno-a {
  animation: veneno-cell-flash-a 340ms steps(2, end) infinite;
}

.board-stack.is-veneno .cell.veneno-b {
  animation: veneno-cell-flash-b 420ms steps(2, end) infinite;
}

.board-stack.is-veneno .cell.veneno-c {
  animation: veneno-cell-flash-c 360ms steps(2, end) infinite;
}

.board-stack.is-veneno .cell.veneno-d {
  animation: veneno-cell-flash-d 460ms steps(2, end) infinite;
}

@keyframes veneno-cell-flash-a {
  0%,
  100% {
    box-shadow: inset 0 0 0 999px rgba(255, 255, 255, 0.03);
  }

  50% {
    box-shadow: inset 0 0 0 999px rgba(255, 255, 255, 0.12);
  }
}

@keyframes veneno-cell-flash-b {
  0%,
  100% {
    box-shadow: inset 0 0 0 999px rgba(24, 20, 17, 0.04);
  }

  50% {
    box-shadow: inset 0 0 0 999px rgba(255, 239, 188, 0.12);
  }
}

@keyframes veneno-cell-flash-c {
  0%,
  100% {
    box-shadow: inset 0 0 0 999px rgba(255, 255, 255, 0.02);
  }

  50% {
    box-shadow: inset 0 0 0 999px rgba(185, 255, 244, 0.12);
  }
}

@keyframes veneno-cell-flash-d {
  0%,
  100% {
    box-shadow: inset 0 0 0 999px rgba(30, 19, 42, 0.05);
  }

  50% {
    box-shadow: inset 0 0 0 999px rgba(214, 201, 255, 0.14);
  }
}

.cell.snake {
  background: var(--snake-fill, var(--snake));
  box-shadow: none;
}

.cell.head {
  background:
    radial-gradient(circle at 34% 38%, #f2df67 0 13%, transparent 14%),
    radial-gradient(circle at 66% 38%, #f2df67 0 13%, transparent 14%),
    var(--snake-fill, var(--snake-head));
  box-shadow: none;
}

.cell.food {
  background: var(--food);
  box-shadow: none;
}

.cell.food.veneno-food {
  background:
    radial-gradient(circle at 34% 32%, rgba(245, 255, 255, 0.98) 0 20%, transparent 21%),
    radial-gradient(circle at 66% 68%, rgba(193, 148, 255, 0.96) 0 24%, transparent 25%),
    linear-gradient(135deg, #7ceeff, #8b7aff 58%, #d286ff);
  box-shadow:
    0 0 0 2px rgba(248, 253, 255, 0.82),
    0 0 16px rgba(126, 175, 255, 0.42),
    0 0 24px rgba(184, 128, 255, 0.26);
}

.cell.food.capicua-food {
  background:
    radial-gradient(circle at 32% 32%, rgba(255, 255, 255, 0.96) 0 12%, transparent 13%),
    radial-gradient(circle at 68% 32%, rgba(255, 255, 255, 0.96) 0 12%, transparent 13%),
    radial-gradient(circle at 50% 68%, rgba(52, 87, 215, 0.92) 0 16%, transparent 17%),
    linear-gradient(135deg, #1b2b6f, #537bff 50%, #1b2b6f);
  box-shadow:
    0 0 0 2px rgba(232, 239, 255, 0.8),
    0 0 14px rgba(83, 123, 255, 0.28);
}

.cell.head.veneno-head {
  background:
    radial-gradient(circle at 34% 38%, #fff9ff 0 14%, #ff4949 15% 22%, transparent 23%),
    radial-gradient(circle at 66% 38%, #fff9ff 0 14%, #ff4949 15% 22%, transparent 23%),
    var(--snake-fill, #101010);
}

.cell.head.capicua-head {
  background:
    radial-gradient(circle at 34% 38%, #f5fbff 0 14%, #4f7cff 15% 22%, transparent 23%),
    radial-gradient(circle at 66% 38%, #f5fbff 0 14%, #4f7cff 15% 22%, transparent 23%),
    var(--snake-fill, var(--snake-head));
  box-shadow:
    0 0 0 1px rgba(219, 232, 255, 0.34),
    0 0 18px rgba(79, 124, 255, 0.36);
}

.cell.capicua-tail {
  position: relative;
  box-shadow:
    0 0 0 1px rgba(246, 225, 120, 0.16),
    0 0 12px rgba(242, 223, 103, 0.2);
}

.cell.capicua-tail::before,
.cell.capicua-tail::after {
  content: "";
  position: absolute;
  top: 32%;
  width: 14%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: rgba(242, 223, 103, 0.38);
  box-shadow: 0 0 6px rgba(242, 223, 103, 0.26);
}

.cell.capicua-tail::before {
  left: 26%;
}

.cell.capicua-tail::after {
  right: 26%;
}

.cell.transition-head-blue,
.cell.transition-tail-yellow,
.cell.transition-head-yellow,
.cell.transition-tail-blue {
  position: relative;
}

.cell.transition-head-blue::before,
.cell.transition-head-blue::after,
.cell.transition-tail-yellow::before,
.cell.transition-tail-yellow::after,
.cell.transition-head-yellow::before,
.cell.transition-head-yellow::after,
.cell.transition-tail-blue::before,
.cell.transition-tail-blue::after {
  content: "";
  position: absolute;
  top: 32%;
  width: 14%;
  aspect-ratio: 1;
  border-radius: 50%;
}

.cell.transition-head-blue::before,
.cell.transition-tail-yellow::before,
.cell.transition-head-yellow::before,
.cell.transition-tail-blue::before {
  left: 26%;
}

.cell.transition-head-blue::after,
.cell.transition-tail-yellow::after,
.cell.transition-head-yellow::after,
.cell.transition-tail-blue::after {
  right: 26%;
}

.cell.transition-head-blue::before,
.cell.transition-head-blue::after,
.cell.transition-tail-blue::before,
.cell.transition-tail-blue::after {
  background: #4f7cff;
  box-shadow: 0 0 8px rgba(79, 124, 255, 0.82);
}

.cell.transition-tail-yellow::before,
.cell.transition-tail-yellow::after,
.cell.transition-head-yellow::before,
.cell.transition-head-yellow::after {
  background: #f2df67;
  box-shadow: 0 0 8px rgba(242, 223, 103, 0.82);
}

.cell.transition-head-blue::before,
.cell.transition-head-blue::after {
  opacity: var(--eye-transition-progress, 0);
}

.cell.transition-tail-yellow::before,
.cell.transition-tail-yellow::after {
  opacity: calc(1 - var(--eye-transition-progress, 0));
}

.cell.transition-head-yellow::before,
.cell.transition-head-yellow::after {
  opacity: var(--eye-transition-progress, 0);
}

.cell.transition-tail-blue::before,
.cell.transition-tail-blue::after {
  opacity: calc(1 - var(--eye-transition-progress, 0));
}

@media (max-width: 640px) {
  .game-panel {
    width: 100%;
    min-height: 100vh;
    border-radius: 0;
    padding: 12px;
  }

  .app-shell {
    padding: 0;
  }

  .actions {
    justify-content: space-between;
  }

  .board-stack {
    width: min(94vw, calc(92vh * (16 / 24)), 480px);
  }

  .title-overlay {
    gap: 14px;
  }

  .overlay-title {
    font-size: clamp(2rem, 10vw, 3.2rem);
  }

  .start-button {
    padding: 11px 22px;
    min-width: 126px;
    font-size: 0.88rem;
  }

  .scores-sheet {
    inset: 8px;
    gap: 6px;
    padding: 10px;
  }

  .command-strip {
    width: 100%;
    margin-top: 12px;
  }

  .command-label {
    font-size: 0.7rem;
  }

  .command-row {
    gap: 8px;
  }

  .command-send {
    padding-inline: 14px;
    font-size: 0.76rem;
  }

  .sheet-actions {
    width: 100%;
    max-width: 360px;
    gap: 6px;
  }

  .sheet-actions button {
    flex: 1 1 0;
    min-width: 0;
    font-size: 0.75rem;
  }

  .hud-strip {
    top: 14px;
    left: 14px;
  }

  .shell-link-row {
    top: 14px;
    right: 14px;
  }

  .overlay-title {
    font-size: clamp(2rem, 10vw, 3.2rem);
  }

  .sheet-status {
    font-size: 0.78rem;
  }

  .pause-modal {
    min-width: min(82vw, 272px);
    padding: 16px 14px;
  }

  .pause-modal-actions {
    gap: 8px;
  }

  .pause-modal-actions button {
    flex: 1 1 0;
    min-width: 0;
    font-size: 0.78rem;
  }
}
