:root {
  --bg: #101914;
  --bg-soft: #17231c;
  --panel: #203326;
  --panel-light: #2f4a36;
  --stone: #c8d1c3;
  --paper: #f4f0dc;
  --muted: #b9c9b7;
  --ink: #f8f6ea;
  --grass: #69b84f;
  --leaf: #2f8f4d;
  --gold: #f3c653;
  --redstone: #e15b42;
  --water: #5db7d7;
  --tile-empty: #17241d;
  --tile-border: #446348;
  --tile-filled: #293d30;
  --correct: #5da75a;
  --present: #c9a646;
  --absent: #516056;
  --key-unused: #516056;
  --key-absent: #32443a;
  --shadow: rgba(0, 0, 0, 0.34);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(105, 184, 79, 0.08) 1px, transparent 1px),
    linear-gradient(0deg, rgba(105, 184, 79, 0.08) 1px, transparent 1px),
    var(--bg);
  background-size: 56px 56px;
  overflow-x: hidden;
}

button,
input {
  font: inherit;
}

.fireworks-stage {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 8;
}

main,
footer {
  position: relative;
  z-index: 1;
}

main {
  display: grid;
  gap: 4rem;
  width: min(1120px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 3rem 0 2.75rem;
}

.launch-section,
.preview-section {
  display: grid;
  justify-items: center;
  text-align: center;
}

.launch-section {
  min-height: calc(100vh - 7rem);
  align-content: center;
  padding: 1rem 0 2rem;
}

.brand-row {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1rem;
  color: var(--gold);
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  max-width: 13ch;
  color: var(--paper);
  font-size: 4.9rem;
  line-height: 0.94;
  font-weight: 900;
}

.intro-copy {
  max-width: 760px;
  margin-top: 1.25rem;
  color: var(--muted);
  font-size: 1.24rem;
  line-height: 1.65;
}

.countdown {
  --segment-min: 10rem;
  display: grid;
  grid-template-columns: repeat(4, minmax(var(--segment-min), 1fr));
  gap: 0.8rem;
  width: min(100%, 860px);
  margin-top: 2rem;
}

.countdown-segment {
  min-width: 0;
  padding: 1rem 0.75rem 0.9rem;
  border: 1px solid rgba(248, 246, 234, 0.12);
  border-radius: 8px;
  background: rgba(32, 51, 38, 0.86);
  box-shadow: 0 18px 50px var(--shadow);
}

.count-value,
.count-label {
  display: block;
}

.count-value {
  color: var(--paper);
  font-size: 3.55rem;
  line-height: 1;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.count-value.tick {
  animation: countTick 420ms ease;
}

.count-label {
  margin-top: 0.45rem;
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.launch-time {
  margin-top: 1rem;
  color: var(--stone);
  font-size: 0.98rem;
}

.preview-section {
  align-content: start;
  gap: 1.4rem;
  padding: 0 0 1.5rem;
}

.section-copy h2 {
  max-width: 720px;
  color: var(--paper);
  font-size: 1.7rem;
  line-height: 1.25;
}

.wordle-shell {
  --wordle-shell-width: 33.75rem;
  --wordle-board-width: 22.55rem;
  width: min(100%, var(--wordle-shell-width));
  overflow-x: auto;
  border: 1px solid rgba(248, 246, 234, 0.13);
  border-radius: 8px;
  background: rgba(17, 28, 22, 0.72);
  box-shadow: 0 18px 50px var(--shadow);
  padding: 1rem;
  scrollbar-color: var(--panel-light) transparent;
}

.wordle-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid rgba(248, 246, 234, 0.1);
}

.wordle-title {
  color: var(--paper);
  font-size: 1rem;
  font-weight: 900;
}

.wordle-date {
  color: var(--gold);
  font-size: 0.84rem;
  font-weight: 800;
  white-space: nowrap;
}

.wordle-status {
  min-height: 2.45rem;
  display: grid;
  align-items: center;
  color: var(--muted);
  font-size: 0.98rem;
}

.wordle-board {
  --word-length: 5;
  --guess-count: 6;
  display: grid;
  grid-template-columns: repeat(var(--word-length), minmax(0, 1fr));
  justify-content: center;
  gap: 0.45rem;
  width: min(100%, var(--wordle-board-width));
  margin: 0 auto 1rem;
}

.tile {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 1;
  border: 2px solid var(--tile-border);
  border-radius: 6px;
  color: var(--paper);
  background: var(--tile-empty);
  font-size: 2rem;
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
  user-select: none;
  transform-style: preserve-3d;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.tile.filled {
  border-color: var(--stone);
  background: var(--tile-filled);
  transform: scale(1.035);
}

.tile.correct,
.tile.present,
.tile.absent,
.tile.skipped {
  border-color: transparent;
}

.tile.correct {
  background: var(--correct);
}

.tile.present {
  background: var(--present);
}

.tile.absent {
  background: var(--absent);
}

.tile.skipped {
  border-color: rgba(248, 246, 234, 0.08);
  background: rgba(81, 96, 86, 0.22);
}

.tile.reveal {
  animation: tileReveal 520ms ease both;
}

.tile.shake {
  animation: tileShake 420ms ease;
}

.tile.win {
  animation: tileWin 700ms ease both;
}

.keyboard {
  display: grid;
  gap: 0.42rem;
  touch-action: manipulation;
}

.keyboard-row {
  display: flex;
  justify-content: center;
  gap: 0.35rem;
}

.key {
  min-width: 0;
  min-height: 3rem;
  flex: 1 1 0;
  border: 0;
  border-radius: 6px;
  color: var(--paper);
  background: var(--key-unused);
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.22);
  font-size: 0.9rem;
  font-weight: 900;
  text-transform: uppercase;
  cursor: pointer;
}

.key:active {
  transform: translateY(2px);
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.22);
}

.key.wide {
  flex: 1.45 1 0;
  font-size: 0.78rem;
}

.key.correct {
  background: var(--correct);
}

.key.present {
  background: var(--present);
}

.key.absent {
  background: var(--key-absent);
}

footer {
  display: grid;
  justify-items: center;
  gap: 0.75rem;
  padding: 1.5rem 1rem 2.8rem;
  color: var(--muted);
  text-align: center;
}

.next-wordle {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
  justify-content: center;
  font-size: 0.92rem;
}

.next-wordle strong {
  color: var(--gold);
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
}

footer p {
  color: var(--paper);
  font-size: 0.95rem;
}

.short-guess-note {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.35;
}

@keyframes countTick {
  0% {
    transform: translateY(-0.18rem);
    color: var(--gold);
  }
  100% {
    transform: translateY(0);
    color: var(--paper);
  }
}

@keyframes tileReveal {
  0% {
    transform: rotateX(0deg);
  }
  48% {
    transform: rotateX(90deg);
  }
  100% {
    transform: rotateX(0deg);
  }
}

@keyframes tileShake {
  0%,
  100% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-0.35rem);
  }
  40% {
    transform: translateX(0.35rem);
  }
  60% {
    transform: translateX(-0.25rem);
  }
  80% {
    transform: translateX(0.25rem);
  }
}

@keyframes tileWin {
  0%,
  100% {
    transform: translateY(0);
  }
  45% {
    transform: translateY(-0.55rem);
  }
}

@media (max-width: 860px) {
  main {
    gap: 3rem;
    padding-top: 2rem;
  }

  h1 {
    font-size: 3.6rem;
  }

  .intro-copy {
    font-size: 1.08rem;
  }

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

@media (max-width: 560px) {
  main {
    width: min(100% - 1rem, 1120px);
    padding-top: 1.25rem;
  }

  .launch-section {
    min-height: calc(100vh - 5rem);
  }

  h1 {
    max-width: 10ch;
    font-size: 2.7rem;
  }

  .intro-copy {
    font-size: 1rem;
    line-height: 1.55;
  }

  .countdown {
    gap: 0.55rem;
    margin-top: 1.4rem;
  }

  .countdown-segment {
    padding: 0.8rem 0.45rem 0.72rem;
  }

  .count-value {
    font-size: 2.35rem;
  }

  .count-label {
    font-size: 0.68rem;
  }

  .section-copy h2 {
    font-size: 1.35rem;
  }

  .wordle-shell {
    padding: 0.75rem 0.5rem 0.8rem;
  }

  .wordle-topline {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.3rem;
  }

  .wordle-board {
    gap: 0.32rem;
  }

  .tile {
    border-radius: 5px;
    font-size: 1.35rem;
  }

  .key {
    min-height: 2.65rem;
    border-radius: 5px;
    font-size: 0.78rem;
  }

  .key.wide {
    font-size: 0.68rem;
  }
}
