:root {
  --page-bg: #ebe2d1;
  --panel: rgba(248, 242, 229, 0.96);
  --panel-border: #d8c6a5;
  --text-main: #2e261a;
  --text-soft: #665845;
  --accent: #425b46;
  --accent-soft: #d9e9d6;
  --board-bg: #f7f1e4;
  --board-line: #9d8b68;
  --board-strong: #5a4c36;
  --board-highlight: #e8dfc7;
  --board-selected: #d9e9d6;
  --board-conflict: #f4d5d1;
  --shadow: 0 16px 40px rgba(30, 28, 22, 0.1);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--page-bg);
  color: var(--text-main);
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1.65;
}

a { color: var(--accent); }

.page-shell {
  width: min(1100px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 48px;
}

.breadcrumb {
  margin: 0 0 16px;
  color: var(--text-soft);
  font-size: 0.94rem;
}

.hero,
.daily-game,
.help-panel,
.related-panel,
.controls-panel,
.board-panel {
  border: 1px solid var(--panel-border);
  background: var(--panel);
  border-radius: 18px;
}

.hero,
.daily-game,
.help-panel,
.related-panel {
  margin-bottom: 18px;
  padding: 24px;
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1, h2 { line-height: 1.16; letter-spacing: 0; }

h1 {
  margin: 0 0 10px;
  font-size: clamp(2rem, 5vw, 3.4rem);
}

h2 {
  margin: 0 0 12px;
  font-size: 1.45rem;
}

.lead,
.controls-panel p,
.help-panel p {
  margin: 0;
  color: var(--text-soft);
}

.status-bar {
  display: grid;
  grid-template-columns: 1.35fr repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}

.status-bar div {
  min-width: 0;
  padding: 10px;
  border-radius: 8px;
  background: #f3ecdd;
  text-align: center;
}

.status-bar span {
  display: block;
  color: var(--text-soft);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.status-bar strong {
  display: block;
  min-height: 1.5em;
  overflow-wrap: anywhere;
}

.game-layout {
  display: grid;
  grid-template-columns: minmax(300px, 1fr) 290px;
  gap: 18px;
  align-items: start;
}

.board-panel,
.controls-panel {
  padding: 18px;
}

.sudoku-board {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  width: min(590px, 100%);
  margin: 0 auto;
  padding: 3px;
  border-radius: 12px;
  background: var(--board-strong);
}

.sudoku-cell {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  min-width: 0;
  padding: 0;
  border: 1px solid var(--board-line);
  background: var(--board-bg);
  color: #274634;
  cursor: pointer;
  font: 700 1.55rem Georgia, serif;
}

.sudoku-cell.fixed {
  color: var(--text-main);
}

.sudoku-cell.selected {
  background: var(--board-selected);
}

.sudoku-cell.related {
  background: var(--board-highlight);
}

.sudoku-cell.conflict {
  background: var(--board-conflict);
  color: #922f2c;
}

.sudoku-cell.box-right { border-right: 3px solid var(--board-strong); }
.sudoku-cell.box-bottom { border-bottom: 3px solid var(--board-strong); }

.notes-grid {
  position: absolute;
  inset: 3px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  font-size: clamp(0.48rem, 1vw, 0.66rem);
  color: #5f7765;
}

.notes-grid span {
  display: grid;
  place-items: center;
}

.number-pad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 14px 0;
}

.number-pad button,
.actions button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: #fffdf6;
  color: var(--text-main);
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
}

.number-pad button {
  font-size: 1.18rem;
}

.number-pad button:hover,
.actions button:hover {
  background: #f0e6d2;
}

.number-pad button:focus-visible,
.actions button:focus-visible,
.sudoku-cell:focus-visible,
.button:focus-visible {
  outline: 3px solid rgba(66, 91, 70, 0.26);
  outline-offset: 2px;
}

.actions {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.actions button[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.actions .quiet-button {
  color: var(--text-soft);
}

.win-panel[hidden] {
  display: none;
}

.win-panel {
  margin-top: 18px;
  padding: 20px;
  border: 1px solid #c9dbc7;
  border-radius: 12px;
  background: #eef4ee;
  text-align: center;
}

.win-links {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 18px;
}

.button {
  border-color: var(--accent);
  background: var(--accent);
  color: #fffdf6;
  padding: 10px 16px;
}

.button.secondary {
  background: transparent;
  color: var(--accent);
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.related-grid a {
  min-height: 100px;
  padding: 14px;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: #f3ecdd;
  color: inherit;
  text-decoration: none;
}

.related-grid strong {
  display: block;
  margin-bottom: 5px;
}

.related-grid span {
  color: var(--text-soft);
}

@media (max-width: 760px) {
  .page-shell { width: min(100% - 18px, 1100px); padding: 14px 0 28px; }
  .hero, .daily-game, .help-panel, .related-panel { padding: 16px; border-radius: 14px; }
  .status-bar, .game-layout, .related-grid { grid-template-columns: 1fr; }
  .status-bar { gap: 6px; }
  .board-panel, .controls-panel { padding: 10px; border-radius: 12px; }
  .sudoku-cell { font-size: clamp(1rem, 5vw, 1.3rem); }
  .win-links { flex-direction: column; }
}
