/* Sudoku page styles — pairs with ../../shared.css */
:root {
  --given: #1c2a3a;
  --user: #1f3a5f;
  --user-bad: #c0392b;
  --highlight: #f4e3b2;
  --highlight-soft: #f7ecc8;
  --same-num: #e9d79a;
  --cell-hover: #f3e7c4;
}

/* Game header row */
.game-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}
.game-title {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 700;
  font-size: 32px;
  letter-spacing: -0.01em;
  margin: 0;
  color: var(--ink);
  line-height: 1;
}
.game-sub { margin: 6px 0 0; color: var(--muted); font-size: 13px; }

.meta { display: flex; gap: 10px; }
.stat {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 14px;
  min-width: 92px;
  text-align: center;
  box-shadow: var(--shadow);
}
.stat-label {
  display: block;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.stat-value {
  display: block;
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 700;
  font-size: 20px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}

/* Difficulty tabs */
.difficulty {
  display: inline-flex;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}
.diff-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  font: 600 14px 'Inter', sans-serif;
  padding: 8px 18px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 180ms ease, color 180ms ease;
}
.diff-btn:hover { color: var(--ink); }
.diff-btn.is-active {
  background: var(--accent);
  color: #fbf6ea;
  box-shadow: 0 6px 16px -8px rgba(31, 58, 95, 0.5);
}

/* Play area */
.play-area {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 28px;
  align-items: start;
}
@media (max-width: 860px) {
  .play-area { grid-template-columns: 1fr; }
}

/* Board */
.board-wrap {
  position: relative;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
}

.board {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  grid-template-rows: repeat(9, 1fr);
  aspect-ratio: 1 / 1;
  width: 100%;
  background: var(--line-strong);
  border: 2px solid var(--line-strong);
  border-radius: 8px;
  overflow: hidden;
  gap: 1px;
  user-select: none;
}

.cell {
  position: relative;
  background: var(--paper);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 500;
  font-size: clamp(20px, 4.2vw, 30px);
  color: var(--user);
  cursor: pointer;
  transition: background 120ms ease;
  outline: none;
  border: 0;
  padding: 0;
}
.cell:hover { background: var(--cell-hover); }
.cell.is-given { color: var(--given); font-weight: 700; }
.cell.is-bad { color: var(--user-bad); }
.cell.is-peer { background: var(--highlight-soft); }
.cell.is-same { background: var(--same-num); }
.cell.is-selected { background: var(--highlight) !important; box-shadow: inset 0 0 0 2px var(--accent); }
.cell.flash { animation: flash 600ms ease; }

@keyframes flash {
  0% { background: #c8e6c9; }
  100% { background: var(--paper); }
}

/* Number entry — pop-in when a value is placed */
@keyframes su-value-in {
  0%   { transform: scale(0.5); opacity: 0; }
  60%  { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
.cell:not(.is-given):not(:empty) {
  animation: su-value-in 160ms ease-out;
}

/* Error — gentle shake */
@keyframes su-err-shake {
  0%, 100% { transform: translateX(0); }
  30% { transform: translateX(-2px); }
  70% { transform: translateX(2px); }
}
.cell.is-bad { animation: su-err-shake 240ms ease-in-out; }

@media (prefers-reduced-motion: reduce) {
  .cell.flash, .cell:not(.is-given):not(:empty), .cell.is-bad { animation: none; }
}

/* 3x3 box dividers — thicker borders */
.cell[data-col="2"], .cell[data-col="5"] { box-shadow: inset -2px 0 0 var(--line-strong); }
.cell[data-row="2"], .cell[data-row="5"] { box-shadow: inset 0 -2px 0 var(--line-strong); }
.cell[data-col="2"][data-row="2"],
.cell[data-col="2"][data-row="5"],
.cell[data-col="5"][data-row="2"],
.cell[data-col="5"][data-row="5"] {
  box-shadow: inset -2px 0 0 var(--line-strong), inset 0 -2px 0 var(--line-strong);
}
.cell.is-selected[data-col="2"],
.cell.is-selected[data-col="5"],
.cell.is-selected[data-row="2"],
.cell.is-selected[data-row="5"],
.cell.is-selected[data-col="2"][data-row="2"],
.cell.is-selected[data-col="2"][data-row="5"],
.cell.is-selected[data-col="5"][data-row="2"],
.cell.is-selected[data-col="5"][data-row="5"] {
  box-shadow: inset 0 0 0 2px var(--accent);
}

/* Notes (pencil marks) */
.notes {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  width: 100%;
  height: 100%;
  font-family: 'Inter', sans-serif;
  font-size: clamp(8px, 1.2vw, 11px);
  color: var(--muted);
  font-weight: 600;
}
.notes span { display: flex; align-items: center; justify-content: center; }

/* Overlay */
.overlay {
  position: absolute;
  inset: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(251, 246, 234, 0.85);
  backdrop-filter: blur(6px);
  border-radius: 8px;
  z-index: 10;
}
.overlay[hidden] { display: none; }
.overlay-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 24px 26px;
  text-align: center;
  max-width: 320px;
  box-shadow: var(--shadow);
}
.overlay-card h2 {
  font-family: 'Fraunces', serif;
  font-size: 26px;
  margin: 0 0 8px;
  color: var(--ink);
}
.overlay-card p { margin: 0 0 16px; color: var(--ink-soft); }
.overlay-actions { display: flex; gap: 8px; justify-content: center; }

/* Side panel */
.side { display: flex; flex-direction: column; gap: 14px; }

.numpad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.num {
  position: relative;
  appearance: none;
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 12px;
  padding: 16px 0;
  cursor: pointer;
  font-family: 'Fraunces', Georgia, serif;
  font-size: 26px;
  font-weight: 600;
  color: var(--ink);
  box-shadow: var(--shadow);
  transition: transform 120ms ease, background 160ms ease, color 160ms ease;
}
.num:hover { background: var(--highlight-soft); }
.num:active { transform: translateY(1px); }
.num.is-done { color: var(--muted); background: var(--bg-2); }
.num em {
  position: absolute;
  bottom: 4px;
  right: 8px;
  font-style: normal;
  font-family: 'Inter', sans-serif;
  font-size: 10px;
  color: var(--muted);
  font-weight: 600;
}

.tools {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.tool {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 10px;
  padding: 10px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  font: 600 11px 'Inter', sans-serif;
  color: var(--ink-soft);
  transition: background 140ms ease, color 140ms ease;
}
.tool svg { width: 18px; height: 18px; }
.tool:hover { background: var(--highlight-soft); color: var(--ink); }
.tool[aria-pressed="true"] {
  background: var(--accent);
  color: var(--paper);
  border-color: var(--accent);
}
.tool em { font-style: normal; font-weight: 700; }

.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.howto {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  color: var(--ink-soft);
  font-size: 13px;
}
.howto summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--ink);
  list-style: none;
}
.howto summary::-webkit-details-marker { display: none; }
.howto summary::after { content: ' +'; color: var(--muted); }
.howto[open] summary::after { content: ' −'; }
.howto ul { margin: 10px 0 0; padding-left: 18px; }
.howto li { margin: 6px 0; line-height: 1.5; }

@media (max-width: 520px) {
  .game-head { flex-direction: column; align-items: flex-start; gap: 12px; }
  .meta { width: 100%; }
  .stat { flex: 1; }
  /* Compact numpad — fit all 9 numbers on one row for one-thumb play */
  .numpad { grid-template-columns: repeat(9, 1fr); gap: 4px; }
  .num { padding: 10px 0; font-size: 18px; border-radius: 8px; min-height: 48px; }
  .num em { font-size: 9px; bottom: 2px; right: 3px; }
  .game-title { font-size: 26px; }
}
