:root {
  color-scheme: light;
  --bg: #f7f5ef;
  --ink: #18212f;
  --muted: #657083;
  --panel: #ffffff;
  --line: #d9deea;
  --blue: #2563eb;
  --blue-dark: #1e40af;
  --teal: #0f766e;
  --gold: #c07912;
  --rose: #be123c;
  --ok: #16803c;
  --bad: #c2410c;
  --shadow: 0 20px 45px rgba(24, 33, 47, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.13), transparent 32rem),
    linear-gradient(135deg, #f7f5ef 0%, #edf6f2 58%, #f6edf0 100%);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button {
  font: inherit;
}

.app {
  width: min(1120px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 32px 0;
  display: grid;
  grid-template-columns: minmax(0, 0.88fr) minmax(360px, 1.12fr);
  gap: 28px;
  align-items: center;
}

.hero {
  min-height: 520px;
  display: grid;
  align-content: center;
  gap: 28px;
}

.eyebrow,
.label {
  margin: 0 0 8px;
  color: var(--teal);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  font-size: clamp(3rem, 8vw, 5.4rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.hero__text {
  max-width: 34rem;
  margin: 20px 0 0;
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1.7;
}

.hero__art {
  width: min(100%, 420px);
  filter: drop-shadow(0 22px 28px rgba(24, 33, 47, 0.16));
}

.game {
  border: 1px solid rgba(217, 222, 234, 0.9);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
  padding: clamp(18px, 3vw, 28px);
}

.game__top {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
}

h2 {
  min-height: 3.2rem;
  margin: 0;
  font-size: clamp(1.4rem, 3vw, 2rem);
  line-height: 1.15;
}

.score {
  min-width: 80px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  text-align: center;
  background: #f8fafc;
}

.score span {
  display: block;
  color: var(--blue-dark);
  font-size: 2rem;
  font-weight: 900;
  line-height: 1;
}

.score small {
  color: var(--muted);
  font-weight: 700;
}

.level-switch {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin: 22px 0;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

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

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

.board {
  display: grid;
  gap: 16px;
}

.answer,
.word-bank {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 10px;
  min-height: 118px;
  padding: 14px;
  border-radius: 8px;
}

.answer {
  border: 2px dashed #9aa8bd;
  background: #f8fafc;
}

.answer.is-over {
  border-color: var(--blue);
  background: #edf4ff;
}

.answer .tile {
  cursor: grab;
}

.word-bank {
  border: 1px solid var(--line);
  background: #fff9ec;
}

.tile {
  min-height: 44px;
  padding: 0 15px;
  border: 0;
  border-radius: 8px;
  background: var(--blue);
  color: white;
  cursor: grab;
  font-weight: 850;
  box-shadow: 0 7px 0 var(--blue-dark);
  touch-action: none;
  user-select: none;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.tile:nth-child(3n + 2) {
  background: var(--teal);
  box-shadow: 0 7px 0 #115e59;
}

.tile:nth-child(3n) {
  background: var(--gold);
  box-shadow: 0 7px 0 #92400e;
}

.tile:hover {
  transform: translateY(-2px);
}

.tile:active,
.tile.is-dragging {
  cursor: grabbing;
  box-shadow: 0 3px 0 rgba(24, 33, 47, 0.45);
}

.tile.is-touch-dragging {
  position: fixed;
  z-index: 20;
  pointer-events: none;
  opacity: 0.96;
  transform: none;
}

.drop-marker {
  align-self: stretch;
  width: 7px;
  min-height: 44px;
  border-radius: 999px;
  background: var(--rose);
  box-shadow: 0 0 0 4px rgba(190, 18, 60, 0.12);
}

.feedback {
  min-height: 2.8rem;
  margin: 16px 0;
  color: var(--muted);
  font-weight: 750;
  line-height: 1.4;
}

.feedback.is-good {
  color: var(--ok);
}

.feedback.is-bad {
  color: var(--bad);
}

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

.button {
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  cursor: pointer;
  font-weight: 850;
}

.button:hover {
  border-color: var(--blue);
}

.button--primary {
  border-color: var(--rose);
  background: var(--rose);
  color: white;
}

@media (max-width: 860px) {
  .app {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .hero {
    min-height: auto;
    padding-top: 10px;
  }

  .hero__art {
    max-height: 210px;
  }
}

@media (max-width: 560px) {
  .app {
    width: min(100% - 20px, 1120px);
    padding: 10px 0 24px;
  }

  .game__top,
  .actions {
    grid-template-columns: 1fr 1fr;
  }

  .game__top {
    display: grid;
  }

  .score {
    justify-self: start;
  }

  .actions {
    display: grid;
  }

  .level-switch {
    grid-template-columns: 1fr;
  }

  .button,
  .tile,
  .level-button {
    min-height: 48px;
  }
}
