.sudoku-body {
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(10,12,15,.82), rgba(10,12,15,.96)),
    url('../img/hero.webp') center top / cover fixed;
  touch-action: manipulation;
}

.sudoku-shell {
  width: var(--shell);
  margin: 0 auto;
  padding: 110px 0 70px;
}

.sudoku-hero {
  max-width: 760px;
  padding: 24px 0 36px;
}

.sudoku-hero h1 {
  font-size: clamp(2.4rem, 1.7rem + 3vw, 4.8rem);
  margin: .45rem 0 .85rem;
}

.login-panel,
.install-panel,
.side-panel {
  border: 1px solid rgba(216,182,103,.22);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(20,24,29,.92), rgba(10,12,15,.94));
  box-shadow: 0 20px 70px rgba(0,0,0,.36), inset 0 1px 0 rgba(255,255,255,.05);
}

.login-panel {
  margin-top: 18px;
  padding: 14px;
}

.install-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 4px;
  padding: 12px;
}

.install-panel strong,
.install-panel span {
  display: block;
}

.install-panel strong {
  color: var(--bone);
  font-weight: 800;
}

.install-panel span {
  color: var(--ash);
  font-size: .86rem;
}

.sync-title {
  color: var(--bone);
  font-family: var(--f-display);
  font-weight: 700;
  margin-bottom: 4px;
}

.login-status {
  color: var(--gold-lit);
  font-weight: 700;
  margin-bottom: 6px;
}

.login-note {
  color: var(--ash);
  font-size: .9rem;
  line-height: 1.45;
}

.login-form {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.login-form label,
.select-wrap span,
.timer span,
.stats-grid span,
.records-panel span {
  color: var(--fog);
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.login-row {
  display: grid;
  gap: 8px;
}

.login-row input,
.select-wrap select {
  min-width: 0;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(6,8,10,.76);
  color: var(--bone);
  padding: .78rem .9rem;
}

.link-btn {
  margin-top: 12px;
  border: 0;
  background: transparent;
  color: var(--gold-lit);
  cursor: pointer;
  font-weight: 700;
}

.login-message,
.game-message {
  min-height: 1.4em;
  color: var(--ash);
  font-size: .92rem;
  margin-top: 12px;
}

.is-hidden {
  display: none !important;
}

.sudoku-game {
  padding: 0;
}

.game-toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 190px 150px;
  gap: 14px;
  align-items: stretch;
  margin-bottom: 18px;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: rgba(6,8,10,.72);
}

.segmented button {
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  color: var(--ash);
  cursor: pointer;
  font-weight: 800;
  padding: .9rem .7rem;
}

.segmented button:last-child {
  border-right: 0;
}

.segmented button.is-active {
  background: linear-gradient(180deg, var(--gold-lit), var(--gold));
  color: #201705;
}

.select-wrap,
.timer {
  display: grid;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(6,8,10,.72);
  padding: 9px 12px;
}

.timer strong {
  font-size: 1.25rem;
  line-height: 1.2;
}

.game-layout {
  display: grid;
  grid-template-columns: minmax(320px, 680px) minmax(280px, 360px);
  gap: 24px;
  align-items: start;
}

.board-wrap {
  width: 100%;
}

.sudoku-board {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  width: min(100%, 680px);
  aspect-ratio: 1;
  border: 3px solid var(--gold);
  border-radius: 8px;
  overflow: hidden;
  background: #080a0c;
  box-shadow: 0 24px 70px rgba(0,0,0,.42);
}

.cell {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 1;
  border: 1px solid rgba(255,255,255,.08);
  background: rgba(18,22,27,.9);
  color: var(--bone);
  cursor: pointer;
  font-family: var(--f-display);
  font-size: clamp(1rem, 2.8vw, 2rem);
  font-weight: 700;
  touch-action: manipulation;
}

.cell:nth-child(3n) {
  border-right-color: rgba(216,182,103,.5);
}

.cell:nth-child(n+19):nth-child(-n+27),
.cell:nth-child(n+46):nth-child(-n+54) {
  border-bottom-color: rgba(216,182,103,.5);
}

.cell.is-clue {
  background: rgba(8,10,12,.98);
  color: var(--gold-lit);
}

.cell.is-selected {
  background: rgba(111,168,184,.25);
  box-shadow: inset 0 0 0 2px var(--ice);
}

.cell.is-same {
  background: rgba(216,182,103,.24);
  color: #ffe6a3;
}

.cell.is-peer {
  background: rgba(216,182,103,.11);
}

.cell.is-wrong {
  color: #ffb4a8;
  background: rgba(154,59,59,.32);
}

.cell.is-locked {
  cursor: not-allowed;
  opacity: .72;
}

.side-panel {
  display: grid;
  padding: 18px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}

.stats-grid div,
.records-panel div {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(6,8,10,.58);
  padding: 10px;
}

.stats-grid strong,
.records-panel strong {
  display: block;
  margin-top: 2px;
  font-size: 1.15rem;
}

.records-panel {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 18px;
}

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

.number-pad button {
  aspect-ratio: 1.45;
  border: 1px solid rgba(216,182,103,.2);
  border-radius: 6px;
  background: rgba(184,146,60,.12);
  color: var(--bone);
  cursor: pointer;
  font-family: var(--f-display);
  font-size: 1.35rem;
  font-weight: 700;
}

.number-pad button:hover {
  border-color: var(--gold);
  color: var(--gold-lit);
}

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

@media (max-width: 900px) {
  .sudoku-body {
    background:
      linear-gradient(180deg, rgba(10,12,15,.88), rgba(10,12,15,.98)),
      url('../img/hero.webp') center top / cover scroll;
  }

  .sudoku-body .nav-inner {
    height: auto;
    min-height: 78px;
    flex-wrap: wrap;
    padding: 10px 0;
  }

  .sudoku-body .nav-links {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 12px;
    padding: 0;
    border: 0;
    background: transparent;
    transform: none;
  }

  .sudoku-body .nav-links a {
    padding: 0;
  }

  .sudoku-hero,
  .game-layout,
  .game-toolbar {
    grid-template-columns: 1fr;
  }

  .sudoku-shell {
    padding-top: 116px;
    padding-bottom: 34px;
  }

  .sudoku-hero {
    padding: 10px 0 22px;
  }

  .sudoku-hero h1 {
    font-size: 2.3rem;
  }

  .sudoku-hero .lede {
    font-size: .98rem;
    line-height: 1.55;
  }

  .game-toolbar {
    gap: 10px;
    margin-bottom: 12px;
  }

  .segmented button {
    min-height: 44px;
    padding: .7rem .45rem;
  }

  .select-wrap,
  .timer {
    min-height: 58px;
  }

  .game-layout {
    gap: 12px;
  }

  .sudoku-board {
    width: 100%;
    max-width: 640px;
    margin: 0 auto;
  }

  .side-panel {
    gap: 10px;
    padding: 12px;
  }

  .number-pad {
    order: -3;
    grid-template-columns: repeat(9, 1fr);
    gap: 4px;
    margin-bottom: 0;
  }

  .number-pad button {
    min-height: 42px;
    aspect-ratio: auto;
    font-size: 1.05rem;
  }

  .actions-grid {
    order: -2;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
  }

  .actions-grid .btn {
    justify-content: center;
    min-height: 42px;
    padding: .62rem .35rem;
    font-size: .78rem;
  }

  .game-message {
    order: -1;
    margin-top: 0;
    min-height: auto;
  }

  .stats-grid,
  .records-panel {
    gap: 6px;
    margin-bottom: 0;
  }

  .stats-grid div,
  .records-panel div {
    padding: 8px 6px;
  }

  .stats-grid span,
  .records-panel span {
    font-size: .68rem;
    letter-spacing: .04em;
  }

  .stats-grid strong,
  .records-panel strong {
    font-size: .98rem;
  }

  .login-panel {
    margin-top: 4px;
  }

  .install-panel {
    align-items: stretch;
    flex-direction: column;
  }
}

@media (max-width: 560px) {
  .sudoku-shell {
    width: min(100% - 16px, 480px);
    padding-top: 126px;
  }

  .sudoku-body .nav-inner {
    gap: 8px;
  }

  .sudoku-body .brand-name {
    font-size: .86rem;
  }

  .sudoku-body .brand img {
    width: 34px;
    height: 34px;
  }

  .sudoku-body .nav-links {
    width: 100%;
    justify-content: space-between;
    gap: 6px;
  }

  .sudoku-body .nav-links a {
    font-size: .76rem;
  }

  .sudoku-body .nav-inner > .btn {
    min-height: 34px;
    padding: .45rem .7rem;
    font-size: .75rem;
  }

  .sudoku-hero {
    padding-top: 0;
    padding-bottom: 16px;
  }

  .sudoku-hero h1 {
    font-size: 1.95rem;
  }

  .sudoku-hero .lede {
    font-size: .92rem;
  }

  .game-toolbar {
    grid-template-columns: 1fr 1fr;
  }

  .segmented {
    grid-column: 1 / -1;
  }

  .timer strong {
    font-size: 1.08rem;
  }

  .sudoku-board {
    border-width: 2px;
    border-radius: 6px;
  }

  .login-row {
    grid-template-columns: 1fr;
  }

  .cell {
    font-size: .98rem;
    border-width: .5px;
  }

  .cell.is-selected {
    box-shadow: inset 0 0 0 1.5px var(--ice);
  }

  .side-panel {
    padding: 10px;
  }

  .number-pad {
    position: sticky;
    bottom: 8px;
    z-index: 5;
    padding: 6px;
    border: 1px solid rgba(216,182,103,.18);
    border-radius: 8px;
    background: rgba(10,12,15,.92);
    box-shadow: 0 14px 40px rgba(0,0,0,.34);
  }

  .number-pad button {
    min-height: 38px;
    font-size: .95rem;
  }

  .actions-grid {
    grid-template-columns: 1fr 1fr;
  }

  .actions-grid .btn {
    font-size: .82rem;
  }

  .login-note {
    font-size: .84rem;
  }
}

@media (max-width: 380px) {
  .sudoku-shell {
    width: min(100% - 10px, 370px);
  }

  .sudoku-body .nav-links a {
    font-size: .7rem;
  }

  .cell {
    font-size: .9rem;
  }

  .number-pad {
    gap: 3px;
  }

  .number-pad button {
    min-height: 34px;
    font-size: .88rem;
  }
}
