:root {
  color-scheme: light;
  --bg: #f7f3ec;
  --ink: #18202a;
  --muted: #5e6875;
  --line: #d9d2c8;
  --paper: #fffaf2;
  --accent: #0f7b6c;
  --accent-strong: #0a554b;
  --sky: #dcecf5;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(15, 123, 108, 0.12), transparent 32rem),
    linear-gradient(315deg, var(--sky), transparent 28rem),
    var(--bg);
}

a {
  color: inherit;
}

.page-shell {
  width: min(920px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  align-content: center;
  gap: 28px;
  padding: 48px 0;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(300px, 0.8fr);
  align-items: center;
  gap: clamp(24px, 5vw, 56px);
  padding: clamp(28px, 6vw, 56px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 242, 0.82);
  box-shadow: 0 24px 80px rgba(24, 32, 42, 0.11);
}

.hero-copy {
  min-width: 0;
}

.hero-image {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 5 / 3;
  border: 1px solid var(--line);
  border-radius: 8px;
  object-fit: cover;
  box-shadow: 0 18px 54px rgba(24, 32, 42, 0.16);
}

.eyebrow {
  margin: 0 0 16px;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--accent-strong);
}

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

.lead {
  max-width: 620px;
  margin: 24px 0 0;
  font-size: clamp(1rem, 2vw, 1.25rem);
  line-height: 1.7;
  color: var(--muted);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 32px;
}

.button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #ffffff;
  font-weight: 750;
  text-decoration: none;
}

.button.primary {
  border-color: var(--accent);
  color: #ffffff;
  background: var(--accent);
}

.button:focus-visible {
  outline: 3px solid rgba(15, 123, 108, 0.35);
  outline-offset: 3px;
}

.tetris-panel {
  padding: clamp(18px, 4vw, 28px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 242, 0.88);
  box-shadow: 0 18px 60px rgba(24, 32, 42, 0.09);
}

.tetris-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.tetris-head h2 {
  margin: 0;
  font-size: clamp(1.7rem, 4vw, 2.65rem);
  line-height: 1;
  letter-spacing: 0;
}

.tetris-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(76px, 1fr));
  gap: 1px;
  overflow: hidden;
  min-width: min(100%, 310px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
}

.tetris-stats span {
  display: grid;
  gap: 4px;
  padding: 10px;
  color: var(--muted);
  background: #ffffff;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.tetris-stats strong {
  color: var(--ink);
  font-size: 1.12rem;
}

.tetris-stage {
  display: grid;
  grid-template-columns: minmax(180px, 240px) minmax(180px, 1fr);
  align-items: start;
  gap: 18px;
}

#tetris-board {
  width: min(100%, 240px);
  height: auto;
  aspect-ratio: 1 / 2;
  border: 1px solid #101820;
  border-radius: 8px;
  background: #101820;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.tetris-side {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.next-piece {
  display: grid;
  gap: 8px;
  width: min(100%, 146px);
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

#tetris-next {
  width: 96px;
  height: 96px;
  border-radius: 8px;
  background: #f2f7f8;
}

.game-buttons,
.touch-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.game-buttons .button {
  min-width: 88px;
}

.touch-controls button {
  display: inline-flex;
  width: 46px;
  height: 46px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #ffffff;
  font: inherit;
  font-weight: 850;
  cursor: pointer;
}

.touch-controls button[data-move="drop"] {
  width: auto;
  min-width: 76px;
  padding: 0 14px;
}

.touch-controls button:focus-visible {
  outline: 3px solid rgba(15, 123, 108, 0.35);
  outline-offset: 3px;
}

.status {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
}

.status > div {
  min-width: 0;
  padding: 18px;
  background: rgba(255, 250, 242, 0.88);
}

.label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--muted);
}

.status strong {
  display: block;
  overflow-wrap: anywhere;
}

@media (max-width: 640px) {
  .page-shell {
    width: min(100% - 24px, 920px);
    padding: 24px 0;
  }

  .hero {
    grid-template-columns: 1fr;
    padding: 28px;
  }

  .tetris-head,
  .tetris-stage {
    grid-template-columns: 1fr;
  }

  .tetris-head {
    display: grid;
    align-items: start;
  }

  .tetris-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    min-width: 0;
  }

  #tetris-board {
    justify-self: center;
  }

  .next-piece {
    width: 100%;
  }

  .game-buttons .button {
    flex: 1 1 110px;
    width: auto;
  }

  .touch-controls button {
    flex: 1 1 46px;
  }

  .status {
    grid-template-columns: 1fr;
  }

  .button {
    width: 100%;
  }
}
