:root {
  color-scheme: light;
  --bg: #f4efe6;
  --bg-accent: #f7d9a7;
  --card: rgba(255, 251, 244, 0.84);
  --card-border: rgba(98, 74, 54, 0.16);
  --text: #2f261f;
  --muted: #6a5b50;
  --key: #efe5d7;
  --key-text: #2f261f;
  --correct: #6aa35f;
  --present: #d8b84a;
  --absent: #8f8479;
  --empty: #fbf7f0;
  --shadow: 0 24px 60px rgba(84, 57, 29, 0.14);
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --max-width: 31rem;
  --tile-size: min(17vw, 4.25rem);
  --key-height: min(12vw, 3.6rem);
  font-family: "Trebuchet MS", "Avenir Next", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.72), transparent 34%),
    radial-gradient(circle at bottom right, rgba(255, 209, 148, 0.55), transparent 30%),
    linear-gradient(180deg, #f8f1e6 0%, #eed9bc 100%);
}

body::before,
body::after {
  position: fixed;
  inset: auto;
  content: "";
  pointer-events: none;
  z-index: 0;
}

body::before {
  width: 18rem;
  height: 18rem;
  top: -5rem;
  right: -4rem;
  border-radius: 999px;
  background: rgba(159, 205, 145, 0.22);
  filter: blur(10px);
}

body::after {
  width: 14rem;
  height: 14rem;
  left: -5rem;
  bottom: 8rem;
  border-radius: 999px;
  background: rgba(227, 180, 80, 0.2);
  filter: blur(10px);
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(100%, var(--max-width));
  margin: 0 auto;
  padding: max(1rem, env(safe-area-inset-top)) 1rem max(1.25rem, env(safe-area-inset-bottom));
  display: grid;
  gap: 0.9rem;
}

.hero-card,
.board-card,
.keyboard-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.hero-card {
  padding: 1.25rem;
}

.board-card {
  padding: 1rem;
}

.keyboard-card {
  padding: 0.95rem;
}

.eyebrow {
  margin: 0 0 0.3rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
}

.hero-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

h1 {
  margin: 0;
  font-size: clamp(2.4rem, 8vw, 3.4rem);
  line-height: 0.92;
  letter-spacing: -0.06em;
}

.hero-copy {
  margin: 0.75rem 0 0;
  font-size: 0.98rem;
  line-height: 1.45;
  color: var(--muted);
  max-width: 30ch;
}

.controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 1rem;
}

.primary-button,
.ghost-button,
.key {
  border: 0;
  cursor: pointer;
  font: inherit;
  transition:
    transform 140ms ease,
    box-shadow 140ms ease,
    background-color 140ms ease,
    color 140ms ease;
}

.primary-button,
.ghost-button {
  min-height: 2.8rem;
  padding: 0 1rem;
  border-radius: 999px;
  font-weight: 700;
}

.primary-button {
  background: linear-gradient(135deg, #2f261f, #4a3a2d);
  color: #fff7ed;
  box-shadow: 0 12px 24px rgba(47, 38, 31, 0.2);
}

.ghost-button {
  background: rgba(255, 248, 238, 0.86);
  color: var(--text);
  border: 1px solid rgba(47, 38, 31, 0.08);
}

.primary-button:hover,
.ghost-button:hover,
.key:hover {
  transform: translateY(-1px);
}

.primary-button:active,
.ghost-button:active,
.key:active {
  transform: translateY(1px) scale(0.99);
}

.status-text {
  margin: 0;
  min-height: 1.3rem;
  text-align: right;
  font-size: 0.9rem;
  color: var(--muted);
}

.board {
  display: grid;
  gap: 0.38rem;
  justify-content: center;
}

.board-row {
  display: grid;
  grid-template-columns: repeat(5, var(--tile-size));
  gap: 0.38rem;
}

.tile {
  width: var(--tile-size);
  height: var(--tile-size);
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  border: 2px solid rgba(106, 91, 80, 0.18);
  background: var(--empty);
  font-size: clamp(1.35rem, 7vw, 1.95rem);
  font-weight: 800;
  text-transform: uppercase;
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.03);
  transition:
    transform 180ms ease,
    background-color 180ms ease,
    border-color 180ms ease,
    color 180ms ease;
}

.tile.filled {
  border-color: rgba(74, 58, 45, 0.45);
}

.tile.revealed {
  color: #fff;
  border-color: transparent;
}

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

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

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

.tile.pop {
  animation: pop 180ms ease;
}

.keyboard {
  display: grid;
  gap: 0.45rem;
}

.keyboard-row {
  display: grid;
  gap: 0.38rem;
}

.keyboard-row.top {
  grid-template-columns: repeat(10, minmax(0, 1fr));
}

.keyboard-row.middle {
  grid-template-columns: repeat(9, minmax(0, 1fr));
  padding: 0 0.75rem;
}

.keyboard-row.bottom {
  grid-template-columns: 1.45fr repeat(7, minmax(0, 1fr)) 1.45fr;
}

.key {
  min-height: var(--key-height);
  border-radius: 1rem;
  background: var(--key);
  color: var(--key-text);
  font-size: 0.92rem;
  font-weight: 800;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.05);
}

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

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

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

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

.toast {
  position: fixed;
  left: 50%;
  bottom: max(1rem, calc(env(safe-area-inset-bottom) + 0.5rem));
  transform: translate(-50%, 140%);
  padding: 0.85rem 1rem;
  border-radius: 999px;
  background: rgba(47, 38, 31, 0.96);
  color: #fff7ed;
  font-weight: 700;
  box-shadow: 0 18px 36px rgba(47, 38, 31, 0.28);
  transition: transform 180ms ease;
  z-index: 3;
}

.toast.visible {
  transform: translate(-50%, 0);
}

.noscript {
  margin: 0;
  padding: 1rem;
  text-align: center;
}

@keyframes pop {
  0% {
    transform: scale(0.92);
  }
  60% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
  }
}

@media (max-width: 430px) {
  .hero-row,
  .controls {
    flex-direction: column;
    align-items: stretch;
  }

  .status-text {
    text-align: left;
  }

  .ghost-button,
  .primary-button {
    width: 100%;
  }
}