/* Sudoku — page styles (uses tokens from ../assets/site.css) */

.head-controls { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.seg {
  display: inline-flex; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 3px; gap: 2px;
}
.seg button {
  appearance: none; border: 0; background: transparent; color: var(--muted); cursor: pointer;
  font: 600 13px/1 var(--font-body); padding: 9px 12px; border-radius: 999px; transition: background .15s, color .15s;
}
.seg button:hover { color: var(--text); }
.seg button[aria-checked="true"] { background: var(--panel-2); color: var(--accent); box-shadow: inset 0 0 0 1px var(--line); }

.sd-layout { display: grid; grid-template-columns: minmax(0, 520px) minmax(0, 340px); gap: 18px; justify-content: center; align-items: start; }
@media (max-width: 900px) { .sd-layout { grid-template-columns: minmax(0, 520px); } }

.board-panel { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.stats { display: grid; grid-template-columns: repeat(4, auto); justify-content: space-between; gap: 8px; }
.stats .stat.right { align-items: flex-end; }
.stats .value { font-size: 20px; }
#diffLabel { color: var(--accent); }

/* ---- board ---- */
.board-wrap { position: relative; width: 100%; }
.board {
  display: grid; grid-template-columns: repeat(9, minmax(0, 1fr));
  border: 2px solid #8a90d6; border-radius: 10px; overflow: hidden; background: #1a1c3c;
  user-select: none; -webkit-user-select: none; touch-action: manipulation;
}
.sd-cell {
  position: relative; aspect-ratio: 1 / 1; display: grid; place-items: center; cursor: pointer;
  border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
  font: 600 clamp(18px, 6vw, 30px)/1 var(--font-display); color: var(--accent-2);
  transition: background .1s ease; -webkit-tap-highlight-color: transparent;
}
.sd-cell.c8 { border-right: 0; }
.sd-cell.r8 { border-bottom: 0; }
.sd-cell.bx { border-right: 2px solid #8a90d6; }
.sd-cell.by { border-bottom: 2px solid #8a90d6; }
.sd-cell.given { color: var(--text); }
.sd-cell.hinted { color: var(--accent); }
.sd-cell.wrong { color: var(--bad); }
.sd-cell.peer { background: rgba(255, 255, 255, .055); }
.sd-cell.same { background: rgba(79, 209, 197, .22); }
.sd-cell.conflict { background: rgba(255, 93, 93, .26); }
.sd-cell.sel { background: rgba(255, 204, 51, .32); box-shadow: inset 0 0 0 2px var(--accent); }
.sd-cell.flash-bad { animation: flashbad .6s ease; }
.sd-cell.flash-good { animation: flashgood .6s ease; }
@keyframes flashbad { 40% { background: rgba(255, 93, 93, .55); } }
@keyframes flashgood { 40% { background: rgba(94, 224, 122, .4); } }
.board.won .sd-cell { animation: wave .7s ease both; }
@keyframes wave { 40% { background: rgba(255, 204, 51, .35); } }

.notes {
  position: absolute; inset: 2px; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr);
  font: 500 clamp(8px, 2.3vw, 12px)/1 var(--font-display); color: var(--muted); pointer-events: none;
}
.notes span { display: grid; place-items: center; }
.notes span.hl { color: var(--accent-2); font-weight: 700; }

.board-overlay {
  position: absolute; inset: 0; display: none; place-items: center; border-radius: 10px;
  background: rgba(15, 16, 32, .7); font-family: var(--font-display); font-weight: 600; color: var(--muted);
}
.board-overlay.show { display: grid; }

/* ---- controls ---- */
.controls-panel { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.tools { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.tool {
  appearance: none; border: 1px solid transparent; background: transparent; color: var(--muted); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px 2px; border-radius: 12px;
  font: 600 12px/1 var(--font-body); -webkit-tap-highlight-color: transparent; min-width: 0;
}
.tool .ico {
  width: 44px; height: 44px; border-radius: 50%; background: var(--panel-2); border: 1px solid var(--line);
  display: grid; place-items: center; font-size: 19px; color: var(--text); transition: background .15s, color .15s;
}
.tool:hover .ico { background: #31356a; }
.tool:active .ico { transform: translateY(1px); }
.tool[aria-pressed="true"] { color: var(--accent); }
.tool[aria-pressed="true"] .ico { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.tool b { font-weight: 700; }
.tool:disabled { opacity: .4; cursor: not-allowed; }

.numpad { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.num-btn {
  appearance: none; position: relative; border: 1px solid var(--line); background: var(--panel-2); color: var(--text);
  border-radius: 12px; cursor: pointer; aspect-ratio: 1.5 / 1; font: 700 28px/1 var(--font-display);
  transition: background .12s, transform .08s; -webkit-tap-highlight-color: transparent;
}
.num-btn:hover { background: #31356a; }
.num-btn:active { transform: translateY(1px); }
.num-btn .left { position: absolute; right: 8px; bottom: 6px; font: 600 11px/1 var(--font-body); color: var(--muted); }
.num-btn.done { opacity: .3; }
.num-btn.notes-mode { color: var(--accent); }

.help { margin: 0; color: var(--muted); font-size: 12.5px; text-align: center; line-height: 1.5; }
@media (hover: none) { .kbd-only { display: none; } }

@media (max-width: 900px) {
  .numpad { grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 5px; }
  .num-btn { aspect-ratio: auto; height: 54px; font-size: 24px; border-radius: 10px; }
  .num-btn .left { right: 0; left: 0; bottom: 4px; text-align: center; font-size: 10px; }
  .num-btn { padding-bottom: 10px; }
}
@media (max-width: 420px) {
  .panel { padding: 10px; }
  .seg button { padding: 8px 9px; font-size: 12px; }
  .stats .value { font-size: 17px; }
  .head-controls { width: 100%; justify-content: space-between; }
  .tool .ico { width: 40px; height: 40px; }
}

/* ---- toast ---- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text); padding: 10px 16px; border-radius: 999px;
  box-shadow: var(--shadow); font-weight: 500; font-size: 14px; transition: opacity .2s ease, transform .2s ease; z-index: 60;
  max-width: calc(100% - 32px); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---- modal extras ---- */
.win-badge {
  width: 64px; height: 64px; border-radius: 50%; margin: 0 auto 12px; display: grid; place-items: center;
  background: var(--accent); color: var(--accent-ink); font-size: 30px;
}
.win-stats { display: flex; justify-content: center; gap: 28px; margin: 6px 0 18px; }
.win-stats .stat { align-items: center; }
.btn-row.center { justify-content: center; }
