/* Daily Sudoku. Mobile-first. */
:root {
  --navy: #0a0f1e; --cyan: #00d4ff; --white: #f0f4ff; --silver: #c8d6e8; --muted: #8aa0c4; --gold: #f4c150;
  --panel: #121b30; --line: rgba(255,255,255,.12); --given: #e8eef9; --mine: #6fd3ff; --bad: #ff6b81;
  --cell: #131d35; --peer: #1b2a4a; --same: #2b4a7a; --sel: #3a5f9c;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; background: var(--navy); color: var(--white); font-family: 'DM Sans', system-ui, sans-serif; overflow-x: hidden; touch-action: manipulation; }
button, input { font-family: inherit; }

.top { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px 8px; padding: 8px 10px 4px; max-width: 560px; margin: 0 auto; }
.top h1 { font-family: 'Bebas Neue', sans-serif; font-weight: 400; font-size: 1.7rem; letter-spacing: 1px; margin: 0; line-height: 1; }
.top h1 span { color: var(--gold); }
.back { color: var(--cyan); text-decoration: none; font-size: .86rem; font-weight: 500; white-space: nowrap; padding: 8px 0; }
.back:hover { text-decoration: underline; }
.tools { display: flex; gap: 5px; flex-wrap: wrap; }
.ibtn { background: rgba(255,255,255,.08); color: var(--white); border: 1px solid rgba(255,255,255,.15); border-radius: 9px; min-height: 40px; min-width: 40px; font-size: .8rem; cursor: pointer; padding: 0 8px; }
.ibtn:hover { background: rgba(0,212,255,.18); }

.wrap { max-width: 560px; margin: 0 auto; padding: 4px 10px 28px; }
.daybar { text-align: center; margin: 2px 0 8px; }
.day-title { font-size: 1.05rem; font-weight: 700; }
.day-sub { font-size: .8rem; color: var(--muted); }
.levels { display: flex; gap: 6px; margin-bottom: 8px; }
.lv { flex: 1; min-height: 44px; background: #16213a; color: var(--silver); border: 1px solid var(--line); border-radius: 10px; font-size: .92rem; font-weight: 700; cursor: pointer; }
.lv i { font-style: normal; }
.lv[aria-selected="true"] { background: var(--gold); color: #3b2a14; border-color: transparent; }
.hud { display: flex; gap: 6px; margin-bottom: 8px; }
.stat { flex: 1; background: rgba(255,255,255,.06); border: 1px solid var(--line); border-radius: 10px; padding: 4px 6px; text-align: center; min-width: 0; }
.stat .k { display: block; font-size: .62rem; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); }
.stat .v { display: block; font-size: 1.1rem; font-weight: 700; font-variant-numeric: tabular-nums; }

.grid-wrap { display: flex; justify-content: center; }
.grid { width: 100%; max-width: 480px; aspect-ratio: 1 / 1; display: grid; grid-template-columns: repeat(9, 1fr); grid-template-rows: repeat(9, 1fr);
  border: 3px solid var(--cyan); border-radius: 6px; background: var(--cyan); gap: 1px; user-select: none; -webkit-user-select: none; overflow: hidden; }
.c { position: relative; background: var(--cell); border: 0; padding: 0; margin: 0; color: var(--mine); font-weight: 500; font-size: min(7vw, 32px); cursor: pointer;
  display: flex; align-items: center; justify-content: center; border-radius: 0; min-width: 0; min-height: 0; line-height: 1; }
.c.given { color: var(--given); font-weight: 700; }
.c.r2, .c.r5 { margin-bottom: 2px; }
.c.c2, .c.c5 { margin-right: 2px; }
.c.peer { background: var(--peer); }
.c.same { background: var(--same); }
.c.sel { background: var(--sel); box-shadow: inset 0 0 0 2px var(--gold); z-index: 1; }
.c.bad { color: var(--bad); }
.c.bad.given { color: var(--bad); }
.c.wrong { background: #5a1f2c; }
.c .notes { position: absolute; inset: 1px; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); font-size: min(2.7vw, 11px); font-weight: 500; color: var(--silver); }
.c .notes b { display: flex; align-items: center; justify-content: center; font-weight: 500; }
.c .notes b.hl { color: var(--gold); font-weight: 700; }
.c:focus-visible { outline: 2px solid var(--gold); outline-offset: -2px; z-index: 2; }

.status { min-height: 1.4em; margin: 6px 2px 4px; font-size: .86rem; color: var(--silver); text-align: center; }
.pad { display: grid; grid-template-columns: repeat(9, 1fr); gap: 4px; max-width: 480px; margin: 0 auto 8px; }
.pad button { position: relative; min-height: 48px; padding: 0; background: #223357; color: var(--white); border: 1px solid var(--line); border-radius: 9px; font-size: min(6vw, 24px); font-weight: 700; cursor: pointer; }
.pad button small { position: absolute; right: 3px; bottom: 1px; font-size: 9px; font-weight: 500; color: var(--muted); }
.pad button:disabled { opacity: .3; cursor: default; }
.pad button:hover:not(:disabled) { background: #2b4170; }
.pad.pencil button { background: #3b2a54; }
.acts { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; max-width: 480px; margin: 0 auto 10px; }
.btn { flex: 1 1 0; font-size: .86rem; font-weight: 500; color: var(--white); background: #223357; border: 1px solid var(--line); border-radius: 10px; padding: 8px 8px; min-height: 44px; cursor: pointer; white-space: nowrap; }
.btn:hover:not(:disabled) { background: #2b4170; }
.btn:disabled { opacity: .4; cursor: default; }
.btn[aria-pressed="true"] { background: var(--gold); color: #3b2a14; font-weight: 700; }
.btn.primary { background: var(--gold); color: #3b2a14; border-color: transparent; font-weight: 700; }
.modal-actions .btn { flex: 0 1 auto; padding: 8px 14px; }
.chk { display: flex; align-items: flex-start; gap: 8px; font-size: .78rem; color: var(--muted); max-width: 480px; margin: 0 auto; }
.chk input { width: 18px; height: 18px; accent-color: var(--gold); flex: none; }
.btn:focus-visible, .ibtn:focus-visible, .lv:focus-visible, .pad button:focus-visible, input:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.modal { position: fixed; inset: 0; background: rgba(5,8,18,.78); display: flex; align-items: center; justify-content: center; padding: 12px; z-index: 2000; }
.modal[hidden] { display: none; }
.modal .card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 16px; max-width: 520px; width: 100%; max-height: 88vh; overflow-y: auto; }
.modal .card.small { max-width: 400px; text-align: center; }
.modal h2 { margin: 0 0 8px; font-size: 1.2rem; }
.modal ul { margin: 0; padding-left: 18px; font-size: .88rem; line-height: 1.5; color: var(--silver); }
.modal-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 14px; }
.fine { font-size: .74rem; color: var(--muted); }
.share { width: 100%; background: #0c1426; color: var(--white); border: 1px solid var(--line); border-radius: 8px; padding: 10px 8px; font-size: .8rem; }
.arch { display: flex; flex-direction: column; gap: 4px; max-height: 50vh; overflow-y: auto; }
.arow { display: flex; align-items: center; gap: 6px; padding: 4px 0; border-bottom: 1px solid var(--line); font-size: .82rem; }
.arow .d { flex: 1; min-width: 0; color: var(--silver); }
.arow .d b { color: var(--white); }
.arow button { min-height: 40px; min-width: 56px; padding: 0 6px; border-radius: 8px; border: 1px solid var(--line); background: #223357; color: var(--white); font-size: .78rem; cursor: pointer; }
.arow button.ok { background: #1d5a3c; }
.sgrid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 8px; }
.sbox { background: rgba(255,255,255,.06); border-radius: 10px; padding: 8px; text-align: center; }
.sbox b { display: block; font-size: 1.5rem; }
.sbox span { font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }
.stbl { width: 100%; border-collapse: collapse; font-size: .84rem; }
.stbl th, .stbl td { padding: 5px 6px; border-bottom: 1px solid var(--line); text-align: right; }
.stbl th:first-child, .stbl td:first-child { text-align: left; }
.stbl th { color: var(--muted); font-weight: 500; }

@media (min-width: 520px) { .c { font-size: 32px; } .c .notes { font-size: 11px; } .pad button { font-size: 24px; } }
