/* NSC Daily Sudoku
   A print-puzzle-page treatment: newsprint paper tone, ink-navy rules,
   a monospace grid (numbers line up the way they do in a real puzzle box),
   and a small rubber-stamp green for success. No cards, no shadows. */

.nsc-sudoku {
	--nsc-ink: #23262b;
	--nsc-paper: #ece5d6;
	--nsc-paper-2: #e2d9c4;
	--nsc-rule: #23262b;
	--nsc-accent: #a8342a;
	--nsc-success: #2f6f4e;
	--nsc-success-bg: #dfe9df;
	--nsc-given: #23262b;
	--nsc-entry: #2c4a6e;
	--nsc-error: #a8342a;
	--nsc-selected: #d9c98a;
	--nsc-peer: #ded4bb;

	--nsc-font-display: Georgia, 'Source Serif 4', 'Iowan Old Style', serif;
	--nsc-font-ui: -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, Arial, sans-serif;
	--nsc-font-grid: 'IBM Plex Mono', 'SFMono-Regular', Consolas, Menlo, monospace;

	max-width: 420px;
	margin: 0 auto;
	padding: 1.5rem 1rem 2rem;
	background: var(--nsc-paper);
	color: var(--nsc-ink);
	font-family: var(--nsc-font-ui);
	box-sizing: border-box;
}

.nsc-sudoku *,
.nsc-sudoku *::before,
.nsc-sudoku *::after {
	box-sizing: border-box;
}

/* ---------- Masthead ---------- */

.nsc-sudoku__masthead {
	text-align: center;
	border-bottom: 3px solid var(--nsc-rule);
	padding-bottom: 0.75rem;
	margin-bottom: 1rem;
}

.nsc-sudoku__title {
	font-family: var(--nsc-font-display);
	font-weight: 700;
	font-size: 1.5rem;
	letter-spacing: 0.03em;
	margin: 0 0 0.35rem;
	text-transform: uppercase;
}

.nsc-sudoku__meta {
	font-size: 0.85rem;
	color: var(--nsc-ink);
	opacity: 0.75;
	line-height: 1.5;
}

.nsc-sudoku__meta strong {
	font-weight: 600;
}

.nsc-sudoku__streak {
	display: inline-block;
	margin-top: 0.35rem;
	font-size: 0.8rem;
	font-weight: 600;
	color: var(--nsc-accent);
}

/* ---------- Status row (timer / mistakes) ---------- */

.nsc-sudoku__status {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	font-family: var(--nsc-font-grid);
	font-size: 0.95rem;
	margin-bottom: 0.6rem;
	padding: 0 0.15rem;
}

.nsc-sudoku__status-mistakes.is-flagged {
	color: var(--nsc-error);
}

/* ---------- Grid ---------- */

.nsc-sudoku__board {
	display: grid;
	grid-template-columns: repeat(9, 1fr);
	grid-template-rows: repeat(9, 1fr);
	width: 100%;
	aspect-ratio: 1 / 1;
	background: var(--nsc-rule);
	border: 3px solid var(--nsc-rule);
	gap: 1px;
	user-select: none;
	-webkit-user-select: none;
}

.nsc-sudoku__cell {
	background: var(--nsc-paper);
	display: flex;
	align-items: center;
	justify-content: center;
	font-family: var(--nsc-font-grid);
	font-size: clamp(1rem, 4.2vw, 1.3rem);
	font-weight: 500;
	color: var(--nsc-entry);
	cursor: pointer;
	position: relative;
	line-height: 1;
}

.nsc-sudoku__cell.is-given {
	color: var(--nsc-given);
	font-weight: 700;
	cursor: default;
}

.nsc-sudoku__cell.is-peer {
	background: var(--nsc-peer);
}

.nsc-sudoku__cell.is-selected {
	background: var(--nsc-selected);
}

.nsc-sudoku__cell.is-error {
	color: var(--nsc-error);
	animation: nsc-sudoku-shake 0.25s linear;
}

.nsc-sudoku__cell.is-correct-flash {
	animation: nsc-sudoku-flash 0.4s ease-out;
}

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

@keyframes nsc-sudoku-flash {
	0% { background: var(--nsc-success-bg); }
	100% { background: var(--nsc-paper); }
}

/* Thick borders every third line, to mark the 3x3 boxes. */
.nsc-sudoku__cell:nth-child(3n) {
	border-right: 3px solid var(--nsc-rule);
}
.nsc-sudoku__cell:nth-child(9n) {
	border-right: none;
}
.nsc-sudoku__cell.is-box-bottom {
	border-bottom: 3px solid var(--nsc-rule);
}

/* ---------- Number pad ---------- */

.nsc-sudoku__pad {
	display: grid;
	grid-template-columns: repeat(10, 1fr);
	gap: 0.35rem;
	margin-top: 0.85rem;
}

.nsc-sudoku__pad-btn {
	font-family: var(--nsc-font-grid);
	font-size: 1rem;
	background: var(--nsc-paper-2);
	border: 1px solid var(--nsc-rule);
	color: var(--nsc-ink);
	border-radius: 3px;
	padding: 0.5rem 0;
	cursor: pointer;
}

.nsc-sudoku__pad-btn:active {
	background: var(--nsc-selected);
}

.nsc-sudoku__pad-btn.nsc-sudoku__erase {
	font-family: var(--nsc-font-ui);
	font-size: 0.8rem;
}

/* ---------- Completion panel ---------- */

.nsc-sudoku__complete {
	margin-top: 1rem;
	padding: 0.9rem 1rem;
	background: var(--nsc-success-bg);
	border: 1px solid var(--nsc-success);
	text-align: center;
	display: none;
}

.nsc-sudoku__complete.is-visible {
	display: block;
}

.nsc-sudoku__complete-headline {
	font-family: var(--nsc-font-display);
	font-weight: 700;
	color: var(--nsc-success);
	margin: 0 0 0.35rem;
	font-size: 1.1rem;
}

.nsc-sudoku__complete-stats {
	font-family: var(--nsc-font-grid);
	font-size: 0.9rem;
	margin-bottom: 0.75rem;
}

.nsc-sudoku__share-btn {
	font-family: var(--nsc-font-ui);
	font-weight: 600;
	font-size: 0.9rem;
	background: var(--nsc-ink);
	color: var(--nsc-paper);
	border: none;
	padding: 0.6rem 1.1rem;
	border-radius: 3px;
	cursor: pointer;
}

.nsc-sudoku__share-btn:active {
	opacity: 0.85;
}

.nsc-sudoku__share-status {
	display: block;
	margin-top: 0.5rem;
	font-size: 0.8rem;
	color: var(--nsc-ink);
	opacity: 0.75;
	min-height: 1.1em;
}

.nsc-sudoku-noscript {
	font-family: var(--nsc-font-ui);
	text-align: center;
}

@media (prefers-reduced-motion: reduce) {
	.nsc-sudoku__cell,
	.nsc-sudoku__complete {
		animation: none !important;
	}
}
