:root {
  --primary: #d9a441;
  --primary-dark: #c28f34;
  --accent: #2f6a54;
  --accent-dark: #1f4a3d;
  --ink-on-gold: #4a3413;
  --success: #16a34a;
  --danger: #dc2626;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Karla', sans-serif;
  background: radial-gradient(circle at top, var(--accent) 0%, var(--accent-dark) 70%);
  color: #eef0ea;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.wrap { width: 100%; max-width: 480px; position: relative; }

.back-link { display: inline-block; margin-bottom: 20px; color: #eef0ea; text-decoration: none; font-size: 14px; opacity: 0.8; }
.back-link:hover { opacity: 1; }

.header-row { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.header-icon {
  width: 44px; height: 44px; border-radius: 12px;
  background: rgba(217, 164, 65, 0.15);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; flex-shrink: 0;
}
.title { font-family: 'Bitter', serif; font-size: 21px; margin: 0 0 2px; color: #fff; }
.subtitle { font-size: 13px; opacity: 0.8; margin: 0; }
.header-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.score-chip {
  font-size: 13px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(217, 164, 65, 0.3);
  border-radius: 999px;
  padding: 6px 12px;
}
.score-chip strong { color: var(--primary); font-family: 'JetBrains Mono', monospace; }
.restart-btn {
  border: 1px solid rgba(217, 164, 65, 0.4);
  background: transparent;
  color: #eef0ea;
  border-radius: 10px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.restart-btn:hover { background: var(--primary); border-color: var(--primary); color: var(--ink-on-gold); }

.stats-row {
  display: flex;
  justify-content: center;
  gap: 32px;
  margin-bottom: 18px;
}
.stat { text-align: center; }
.stat-label { display: block; font-size: 11px; opacity: 0.7; text-transform: uppercase; letter-spacing: 0.05em; }
.stat-value { font-family: 'JetBrains Mono', monospace; font-size: 24px; font-weight: 800; color: var(--primary); }

.board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.cell {
  aspect-ratio: 1 / 1;
  border-radius: 10px;
  border: 2px solid rgba(217, 164, 65, 0.3);
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  font-family: 'JetBrains Mono', monospace;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}
.cell:hover:not(:disabled) { border-color: var(--primary); }
.cell.start { border-color: var(--primary); background: rgba(217, 164, 65, 0.25); }
.cell.selected { border-color: var(--success); background: rgba(22, 163, 74, 0.35); }
.cell.error { border-color: var(--danger); background: rgba(220, 38, 38, 0.35); }

.win-banner {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 12px;
  background: rgba(22, 163, 74, 0.18);
  border: 1px solid var(--success);
  text-align: center;
  font-size: 14px;
}
.win-banner strong { color: var(--primary); font-family: 'JetBrains Mono', monospace; }
.hidden { display: none; }
