* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: #0f111a;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: 'Segoe UI', sans-serif;
  color: #e8e8f0;
  user-select: none;
}

/* ── Nav buttons ─────────────────────────────────────────────────────────────── */

.back-btn {
  position: fixed;
  top: 12px; left: 14px;
  background: rgba(255,255,255,0.10);
  color: #ccc;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  text-decoration: none;
  z-index: 100;
  transition: background 0.15s;
}
.back-btn:hover { background: rgba(255,255,255,0.18); }

.help-btn {
  position: fixed;
  top: 12px; right: 14px;
  background: rgba(255,255,255,0.10);
  color: #ccc;
  border: none;
  width: 32px; height: 32px;
  border-radius: 50%;
  font-size: 15px;
  cursor: pointer;
  z-index: 100;
  transition: background 0.15s;
}
.help-btn:hover { background: rgba(255,255,255,0.18); }

/* ── Layout ──────────────────────────────────────────────────────────────────── */

#game-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 60px 16px 16px;
  width: 100%;
  max-width: 520px;
}

#top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

#title-label {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 2px;
  color: #a090f0;
}

#timer-display {
  font-size: 20px;
  font-variant-numeric: tabular-nums;
  color: #e8e8f0;
  font-weight: 600;
  letter-spacing: 1px;
}

#grid-container {
  background: #1a1c2e;
  border-radius: 12px;
  padding: 8px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

/* ── Grid ────────────────────────────────────────────────────────────────────── */

#grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 3px;
}

.cell {
  width: 64px;
  height: 64px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.1s, transform 0.08s;
  position: relative;
  border: 2px solid transparent;
}

.cell.fixed {
  background: #2a284a;
  color: #c0b4ff;
  cursor: default;
  border-color: #3d3870;
}

.cell.empty {
  background: rgba(255,255,255,0.04);
  color: transparent;
}
.cell.empty:hover {
  background: rgba(160,144,240,0.15);
}

.cell.filled {
  background: rgba(160,144,240,0.18);
  color: #d0c8ff;
  border-color: rgba(160,144,240,0.3);
}
.cell.filled:hover {
  background: rgba(160,144,240,0.28);
}

.cell.error {
  background: rgba(240,100,100,0.2);
  color: #f07070;
  border-color: rgba(240,100,100,0.4);
  animation: shake 0.25s ease;
}

.cell.correct {
  background: rgba(80,200,120,0.2);
  color: #60e090;
  border-color: rgba(80,200,120,0.4);
}

.cell.selected {
  border-color: #a090f0;
  transform: scale(1.08);
  z-index: 2;
}

@keyframes shake {
  0%,100% { transform: translateX(0); }
  25%      { transform: translateX(-4px); }
  75%      { transform: translateX(4px); }
}

/* ── Number picker ───────────────────────────────────────────────────────────── */

#picker {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 4px;
  width: 100%;
}

.pick-btn {
  height: 36px;
  border-radius: 8px;
  border: none;
  background: rgba(255,255,255,0.06);
  color: #bbb;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.1s;
  font-family: inherit;
}
.pick-btn:hover    { background: rgba(160,144,240,0.2); color: #fff; }
.pick-btn.used     { opacity: 0.25; }
.pick-btn.selected { background: #6050c0; color: #fff; }

/* ── Bottom bar ──────────────────────────────────────────────────────────────── */

#bottom-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  justify-content: space-between;
}

#progress-label {
  font-size: 13px;
  color: #888;
  flex: 1;
}

.ctrl-btn {
  padding: 8px 16px;
  border-radius: 20px;
  border: none;
  background: rgba(255,255,255,0.08);
  color: #ccc;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s;
  font-family: inherit;
}
.ctrl-btn:hover   { background: rgba(255,255,255,0.15); }
.ctrl-btn.danger  { color: #f09090; }
.ctrl-btn.danger:hover { background: rgba(240,100,100,0.15); }

/* ── Responsive ──────────────────────────────────────────────────────────────── */

@media (max-width: 480px) {
  .cell { width: 50px; height: 50px; font-size: 13px; border-radius: 6px; }
  #grid { gap: 2px; }
  #grid-container { padding: 6px; }
  .pick-btn { height: 34px; font-size: 13px; }
}
