* {
  box-sizing: border-box;
}

:root {
  --bg: #040511;
  --panel: rgba(8, 11, 31, .78);
  --ink: #ffffff;
  --muted: #bdc4ef;
  --cyan: #25e7ff;
  --pink: #ff43d1;
  --gold: #ffe66d;
  --green: #65ffa8;
  --violet: #8f5bff;
  --red: #ff5f7a;
}

html,
body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 14% 16%, rgba(255, 67, 209, .28), transparent 28%),
    radial-gradient(circle at 86% 20%, rgba(37, 231, 255, .24), transparent 30%),
    linear-gradient(135deg, #040511 0%, #150325 52%, #031c2f 100%);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(rgba(255,255,255,.035) 50%, rgba(0,0,0,.045) 50%) 0 0 / 100% 4px,
    radial-gradient(circle at 50% 64%, transparent 38%, rgba(0,0,0,.35));
  opacity: .78;
  z-index: 0;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle, rgba(255,255,255,.76) 1px, transparent 2px) 0 0/130px 130px,
    radial-gradient(circle, rgba(37,231,255,.8) 1px, transparent 2px) 60px 30px/180px 180px,
    radial-gradient(circle, rgba(255,67,209,.72) 1px, transparent 2px) 110px 80px/230px 230px;
  animation: stars 24s linear infinite;
  opacity: .48;
  z-index: 0;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 4px;
}

.game-shell {
  position: relative;
  z-index: 1;
  width: min(1180px, calc(100vw - 28px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px 0;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 14px;
}

.top-bar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 8px;
  background: rgba(4, 6, 20, .74);
  box-shadow: 0 18px 48px rgba(0,0,0,.28), inset 0 0 28px rgba(37,231,255,.06);
  backdrop-filter: blur(16px);
}

.home-link {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  border: 1px solid rgba(37,231,255,.34);
  border-radius: 999px;
  color: #eaffff;
  text-decoration: none;
  font-weight: 950;
  background: rgba(37,231,255,.09);
}

.title-block h1,
.info-panel h2,
.result-panel h2 {
  margin: 0;
  letter-spacing: 0;
  text-transform: uppercase;
}

.title-block h1 {
  font-size: clamp(28px, 5vw, 52px);
  line-height: .96;
  text-shadow: 0 0 22px rgba(37,231,255,.45), 0 0 36px rgba(255,67,209,.24);
}

.title-block p {
  margin: 5px 0 0;
  color: var(--gold);
  font-size: 12px;
  font-weight: 950;
  letter-spacing: .22em;
  text-transform: uppercase;
}

.score-panel {
  display: grid;
  grid-template-columns: repeat(3, minmax(78px, 1fr));
  gap: 8px;
}

.score-panel div {
  min-height: 54px;
  display: grid;
  align-content: center;
  gap: 2px;
  padding: 8px 11px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 8px;
  background: rgba(255,255,255,.06);
}

.score-panel span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.score-panel b {
  font-size: 22px;
}

.play-shell {
  position: relative;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(420px, 1fr) 370px;
  gap: 14px;
}

.daily-card,
.info-panel {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 8px;
  background:
    radial-gradient(circle at 25% 18%, rgba(37,231,255,.16), transparent 28%),
    radial-gradient(circle at 86% 84%, rgba(255,67,209,.14), transparent 26%),
    rgba(5, 8, 24, .78);
  box-shadow: 0 22px 70px rgba(0,0,0,.34), inset 0 0 34px rgba(255,255,255,.04);
  backdrop-filter: blur(16px);
}

.daily-card::before {
  content: "";
  position: absolute;
  inset: -40%;
  background: conic-gradient(from 120deg, transparent, rgba(37,231,255,.14), transparent, rgba(255,67,209,.16), transparent);
  animation: spinGlow 16s linear infinite;
  opacity: .75;
}

.daily-card {
  min-height: 0;
  display: grid;
  align-content: start;
  align-items: stretch;
  justify-items: center;
  gap: 12px;
  padding: 18px;
}

.mode-strip,
.play-guide,
.guess-tracker,
.board,
.message,
.starter-row,
.palette,
.actions {
  position: relative;
  z-index: 1;
}

.mode-strip {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 13px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 8px;
  background: rgba(0,0,0,.23);
}

.mode-strip span,
.mode-strip b {
  font-size: 12px;
  font-weight: 950;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.mode-strip b {
  color: var(--green);
  text-align: right;
}

.play-guide {
  width: min(100%, 620px);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.play-guide div {
  min-height: 66px;
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 12px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 8px;
  background: rgba(255,255,255,.055);
}

.play-guide b {
  color: #fff;
  font-size: 13px;
  text-transform: uppercase;
}

.play-guide span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 760;
}

.guess-tracker {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.guess-tracker i {
  width: 38px;
  height: 8px;
  display: block;
  border-radius: 999px;
  background: rgba(255,255,255,.14);
  box-shadow: inset 0 0 10px rgba(0,0,0,.2);
}

.guess-tracker i.active {
  background: linear-gradient(90deg, var(--cyan), #fff, var(--pink));
  box-shadow: 0 0 16px rgba(37,231,255,.28);
}

.guess-tracker i.done {
  background: rgba(255,230,109,.72);
  box-shadow: 0 0 14px rgba(255,230,109,.18);
}

.guess-tracker i.win {
  background: linear-gradient(90deg, var(--green), #fff, var(--cyan));
}

.guess-tracker i.loss {
  background: rgba(255,95,122,.68);
}

.board {
  display: grid;
  grid-template-rows: repeat(6, 1fr);
  gap: 8px;
  width: min(100%, 370px);
}

.guess-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.cell {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 2px solid rgba(255,255,255,.16);
  border-radius: 8px;
  background: rgba(255,255,255,.055);
  color: #ffffff;
  font-size: clamp(24px, 4.6vw, 38px);
  font-weight: 1000;
  text-shadow: 0 0 16px rgba(255,255,255,.34);
  transition: transform .18s ease, border-color .18s ease, background .18s ease;
}

.cell.filled {
  transform: translateY(-2px) scale(1.02);
  border-color: rgba(37,231,255,.55);
  background: rgba(37,231,255,.11);
  box-shadow: 0 0 20px rgba(37,231,255,.17);
}

.cell.reveal {
  animation: revealCell .42s ease both;
  animation-delay: calc(var(--i) * 90ms);
}

.cell.correct {
  border-color: rgba(101,255,168,.9);
  background: linear-gradient(135deg, rgba(101,255,168,.94), rgba(37,231,255,.70));
  box-shadow: 0 0 24px rgba(101,255,168,.45);
}

.cell.present {
  border-color: rgba(255,230,109,.95);
  background: linear-gradient(135deg, rgba(255,230,109,.95), rgba(255,67,209,.58));
  box-shadow: 0 0 24px rgba(255,230,109,.38);
}

.cell.absent {
  border-color: rgba(255,255,255,.14);
  background: rgba(22, 25, 48, .92);
  color: rgba(255,255,255,.58);
}

.message {
  min-height: 28px;
  color: var(--muted);
  font-weight: 850;
  text-align: center;
}

.message.alert {
  color: var(--gold);
  animation: nudge .22s ease;
}

.starter-row {
  width: min(100%, 620px);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: -6px;
}

.starter-row span {
  color: rgba(255,255,255,.68);
  font-size: 12px;
  font-weight: 950;
  text-transform: uppercase;
}

.starter-row button {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 999px;
  color: #07101b;
  background: linear-gradient(100deg, var(--gold), #ffffff, var(--green));
  font-weight: 1000;
  cursor: pointer;
  transition: transform .16s ease, filter .16s ease;
}

.starter-row button:hover {
  transform: translateY(-2px);
  filter: brightness(1.06);
}

.palette {
  width: min(100%, 620px);
  display: grid;
  gap: 7px;
}

.key-row {
  display: flex;
  justify-content: center;
  gap: 7px;
}

.symbol-button,
.primary-button,
.secondary-button {
  min-height: 46px;
  border: 0;
  border-radius: 8px;
  color: #07101b;
  font-weight: 1000;
  cursor: pointer;
  transition: transform .16s ease, filter .16s ease, box-shadow .16s ease;
}

.symbol-button {
  width: clamp(34px, 5vw, 44px);
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--tone), #ffffff);
  box-shadow: 0 0 22px color-mix(in srgb, var(--tone), transparent 58%), inset 0 -9px 14px rgba(0,0,0,.15);
  font-size: 18px;
}

.symbol-button.correct {
  background: linear-gradient(135deg, var(--green), var(--cyan));
  box-shadow: 0 0 22px rgba(101,255,168,.38), inset 0 -9px 14px rgba(0,0,0,.15);
}

.symbol-button.present {
  background: linear-gradient(135deg, var(--gold), var(--pink));
  box-shadow: 0 0 22px rgba(255,230,109,.32), inset 0 -9px 14px rgba(0,0,0,.15);
}

.symbol-button.absent {
  color: rgba(255,255,255,.7);
  background: #252941;
  box-shadow: inset 0 -9px 14px rgba(0,0,0,.16);
}

.symbol-button:hover,
.primary-button:hover,
.secondary-button:hover {
  transform: translateY(-2px);
  filter: brightness(1.08) saturate(1.1);
}

.symbol-button:disabled,
.primary-button:disabled,
.secondary-button:disabled {
  cursor: not-allowed;
  opacity: .55;
  transform: none;
}

.actions,
.panel-actions {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.primary-button {
  background: linear-gradient(100deg, var(--cyan), #ffffff, var(--pink));
  box-shadow: 0 18px 42px rgba(37,231,255,.18), 0 0 28px rgba(255,67,209,.18);
}

.secondary-button {
  color: #ffffff;
  border: 1px solid rgba(255,255,255,.16);
  background: rgba(255,255,255,.08);
}

.info-panel {
  display: grid;
  align-content: start;
  gap: 14px;
  padding: 18px;
}

.panel-block,
.result-panel {
  display: grid;
  gap: 14px;
}

.panel-block {
  padding: 14px;
  border: 1px solid rgba(255,255,255,.11);
  border-radius: 8px;
  background: rgba(255,255,255,.045);
}

.info-panel h2,
.result-panel h2 {
  font-size: clamp(26px, 4vw, 38px);
  line-height: 1;
}

.info-panel p,
.result-panel p {
  margin: 0;
  color: var(--muted);
  font-weight: 760;
}

.clue-grid {
  display: grid;
  gap: 10px;
}

.clue-grid div {
  display: grid;
  grid-template-columns: 46px 1fr;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 8px;
  background: rgba(255,255,255,.055);
}

.sample {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #ffffff;
  font-style: normal;
  font-weight: 1000;
}

.sample.correct { background: linear-gradient(135deg, var(--green), var(--cyan)); }
.sample.present { background: linear-gradient(135deg, var(--gold), var(--pink)); }
.sample.absent { background: #252941; color: rgba(255,255,255,.65); }

.clue-box {
  background:
    radial-gradient(circle at 18% 16%, rgba(255,230,109,.11), transparent 30%),
    radial-gradient(circle at 86% 12%, rgba(37,231,255,.12), transparent 28%),
    rgba(255,255,255,.045);
}

.clue-box h2 {
  font-size: clamp(24px, 3vw, 32px);
}

.clue-box .secondary-button {
  width: 100%;
}

.eyebrow {
  color: var(--gold) !important;
  font-size: 12px;
  font-weight: 1000;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.result-panel {
  padding: 16px;
  border: 1px solid rgba(101,255,168,.24);
  border-radius: 8px;
  background: rgba(101,255,168,.08);
  box-shadow: inset 0 0 24px rgba(101,255,168,.06);
}

.result-panel.hidden,
.hidden {
  display: none !important;
}

.win-burst {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  opacity: 0;
}

.win-burst.active {
  opacity: 1;
}

.win-burst span {
  position: absolute;
  left: 50%;
  top: 48%;
  width: 9px;
  height: 60px;
  border-radius: 999px;
  background: var(--tone, var(--cyan));
  box-shadow: 0 0 22px currentColor;
  transform: translate(-50%, -50%) rotate(var(--r));
  animation: burst .9s ease-out both;
}

.win-burst span:nth-child(1) { --tone: var(--cyan); --r: 0deg; }
.win-burst span:nth-child(2) { --tone: var(--pink); --r: 60deg; }
.win-burst span:nth-child(3) { --tone: var(--gold); --r: 120deg; }
.win-burst span:nth-child(4) { --tone: var(--green); --r: 180deg; }
.win-burst span:nth-child(5) { --tone: var(--violet); --r: 240deg; }
.win-burst span:nth-child(6) { --tone: #ffffff; --r: 300deg; }

@keyframes stars {
  to { background-position: 130px 130px, 240px 210px, 320px 260px; }
}

@keyframes spinGlow {
  to { transform: rotate(360deg); }
}

@keyframes revealCell {
  0% { transform: rotateX(0deg) scale(1); }
  45% { transform: rotateX(90deg) scale(.94); }
  100% { transform: rotateX(0deg) scale(1); }
}

@keyframes nudge {
  25% { transform: translateX(-5px); }
  70% { transform: translateX(5px); }
}

@keyframes burst {
  0% { opacity: 0; transform: translate(-50%, -50%) rotate(var(--r)) scale(.4); }
  25% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -50%) rotate(var(--r)) translateY(-270px) scale(1.25); }
}

@media (max-width: 900px) {
  body {
    overflow-y: auto;
  }

  .game-shell {
    min-height: 100vh;
  }

  .top-bar {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .score-panel {
    grid-template-columns: repeat(3, 1fr);
  }

  .play-shell {
    grid-template-columns: 1fr;
  }

  .daily-card {
    min-height: auto;
  }
}

@media (max-width: 560px) {
  .game-shell {
    width: min(100%, calc(100vw - 20px));
    padding: 10px 0;
  }

  .daily-card,
  .info-panel,
  .top-bar {
    padding: 12px;
  }

  .mode-strip {
    display: grid;
  }

  .mode-strip b {
    text-align: left;
  }

  .play-guide {
    grid-template-columns: 1fr;
  }

  .play-guide,
  .guess-tracker,
  .board,
  .starter-row,
  .palette {
    width: 100%;
    max-width: 340px;
  }

  .guess-tracker i {
    flex: 1;
    min-width: 0;
  }

  .board {
    gap: 6px;
  }

  .guess-row,
  .palette,
  .key-row,
  .actions,
  .panel-actions {
    gap: 6px;
  }

  .symbol-button {
    min-height: 42px;
    width: clamp(28px, 8vw, 38px);
    padding: 0;
  }

  .cell {
    border-radius: 7px;
  }

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