/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

html {
  touch-action: pan-y;
}

body {
  background: #ffffff;
  color: #1f2933;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.4;
  margin: 2rem;
}

.authenticated-layout {
  margin: 0;
  padding: 5.5rem 2rem 2rem;
}

.app-content {
  margin: 0 auto;
  max-width: 78rem;
  width: 100%;
}

a,
button,
input[type="submit"] {
  font: inherit;
}

button,
input[type="submit"] {
  min-height: 2.75rem;
}

table {
  border-collapse: collapse;
  margin-top: 1rem;
  width: 100%;
}

th,
td {
  border-bottom: 1px solid #d8dee4;
  padding: 0.75rem;
  text-align: left;
  vertical-align: top;
}

td form {
  display: inline;
}

.flash,
.errors {
  border-radius: 6px;
  margin: 1rem 0;
  padding: 0.75rem 1rem;
}

.flash-alert,
.errors {
  background: #fff1f2;
  color: #9f1239;
}

.flash-notice {
  background: #ecfdf3;
  color: #027a48;
}

.field,
.actions {
  margin: 1rem 0;
}

.visually-hidden {
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  height: 1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

.app-header {
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid #d8dee4;
  box-sizing: border-box;
  left: 0;
  padding: 0.85rem 2rem;
  position: fixed;
  right: 0;
  top: 0;
  z-index: 20;
}

.app-header-inner {
  align-items: center;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1.5rem;
  justify-content: space-between;
  margin: 0 auto;
  max-width: 78rem;
}

.app-logo {
  align-items: center;
  color: #111827;
  display: inline-flex;
  flex: 0 0 auto;
  font-size: 2rem;
  font-weight: 700;
  gap: 0.6rem;
  text-decoration: none;
}

.app-logo-icon {
  flex: 0 0 auto;
  height: 1.25em;
  width: 1.25em;
}



.desktop-nav {
  align-items: center;
  display: flex;
  gap: 0.35rem;
  justify-content: end;
}

.nav-link,
.mobile-tab-link {
  align-items: center;
  color: #374151;
  display: inline-flex;
  flex-direction: column;
  gap: 0.2rem;
  justify-content: center;
  line-height: 1.1;
  text-decoration: none;
}

.nav-link {
  border: 1px solid transparent;
  border-radius: 6px;
  min-width: 5.75rem;
  padding: 0.45rem 0.75rem;
}

.nav-link-icon,
.mobile-tab-icon {
  flex: 0 0 auto;
}

.nav-link-icon {
  height: 1.55rem;
  width: 1.55rem;
}

.nav-link-label,
.mobile-tab-label {
  font-weight: 400;
  text-align: center;
}

.nav-link:hover,
.nav-link:focus,
.nav-link-active {
  background: #f8fafc;
  color: #111827;
}

.nav-link-active {
  border-color: #111827;
}

.mobile-tab-bar {
  display: none;
}

.gameplay-header {
  display: none;
}

.generation-panel {
  background: #f8fafc;
  border: 1px solid #d8dee4;
  border-radius: 6px;
  margin: 1.5rem 0;
  padding: 1rem;
}

.generation-panel h2,
.generation-panel p {
  margin-top: 0;
}

progress {
  vertical-align: middle;
}

.field label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.puzzle-editor,
.puzzle-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  margin: 1.5rem 0;
}

.sudoku-grid {
  display: grid;
  grid-template-columns: repeat(9, 2.5rem);
  grid-template-rows: repeat(9, 2.5rem);
  width: max-content;
}

.sudoku-grid-game {
  --game-cell-size: min(3.75rem, calc((100vw - 4rem) / 9));
  grid-template-columns: repeat(9, var(--game-cell-size));
  grid-template-rows: repeat(9, var(--game-cell-size));
}

.sudoku-square {
  border: 1px solid #a7b0ba;
  box-sizing: border-box;
  display: grid;
  height: var(--game-cell-size, 3.75rem);
  position: relative;
  width: var(--game-cell-size, 3.75rem);
}

.sudoku-cell {
  align-items: center;
  border: 1px solid #a7b0ba;
  box-sizing: border-box;
  display: flex;
  font-size: 1.2rem;
  height: 2.5rem;
  justify-content: center;
  text-align: center;
  width: 2.5rem;
}

input.sudoku-cell {
  caret-color: transparent;
  font-size: 16px;
  padding: 0;
}

.sudoku-square .sudoku-cell {
  background: transparent;
  border: 0;
  font-size: 1.55rem;
  grid-area: 1 / 1;
  height: 100%;
  position: relative;
  width: 100%;
  z-index: 1;
}

.sudoku-square:nth-child(3n),
.sudoku-cell:nth-child(3n) {
  border-right-color: #4b5563;
  border-right-width: 3px;
}

.sudoku-square:nth-child(9n),
.sudoku-cell:nth-child(9n) {
  border-right-color: #4b5563;
  border-right-width: 3px;
}

.sudoku-square:nth-child(n + 19):nth-child(-n + 27),
.sudoku-square:nth-child(n + 46):nth-child(-n + 54),
.sudoku-cell:nth-child(n + 19):nth-child(-n + 27),
.sudoku-cell:nth-child(n + 46):nth-child(-n + 54) {
  border-bottom-color: #4b5563;
  border-bottom-width: 3px;
}

.sudoku-square:nth-child(-n + 9),
.sudoku-cell:nth-child(-n + 9) {
  border-top-color: #4b5563;
  border-top-width: 3px;
}

.sudoku-square:nth-child(9n + 1),
.sudoku-cell:nth-child(9n + 1) {
  border-left-color: #4b5563;
  border-left-width: 3px;
}

.sudoku-square:nth-child(n + 73),
.sudoku-cell:nth-child(n + 73) {
  border-bottom-color: #4b5563;
  border-bottom-width: 3px;
}

.sudoku-notes {
  color: #9aa4b2;
  display: grid;
  font-size: 0.68rem;
  font-weight: 600;
  grid-area: 1 / 1;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  line-height: 1;
  pointer-events: none;
}

.sudoku-note {
  align-items: center;
  display: flex;
  justify-content: center;
  position: relative;
}

.game-page {
  max-width: 48rem;
}

.replay-page {
  max-width: 78rem;
}

.leaderboards-page,
.profile-page,
.replays-page {
  max-width: 52rem;
}

.game-header {
  margin-bottom: 1.5rem;
}

.page-header {
  margin-bottom: 1.5rem;
}

.game-header p {
  color: #52616f;
  margin: 0.25rem 0 0;
}

.page-header p {
  color: #52616f;
  margin-top: 0;
}

/* on the leaderboards page, lay the main list and the create-form sidebar
   out side by side inside .app-content (they are siblings via the layout) */
.app-content:has(> .leaderboards-page) {
  align-items: start;
  display: grid;
  gap: 2rem;
  grid-template-columns: 1fr 24rem;
}

.leaderboard-sidebar {
  padding-top: 3.25rem;
}

.app-content:has(> .leaderboards-page) > .flash {
  grid-column: 1 / -1;
}

.app-content:has(> .leaderboards-page) > .leaderboards-page {
  max-width: none;
}

/* let the list fill its column instead of the card-list's 28rem cap */
.leaderboard-links {
  max-width: none;
}

/* lay each card out as content + a trailing chevron affordance */
.leaderboard-links .card-link {
  align-items: center;
  gap: 1rem;
  grid-template-columns: minmax(0, 1fr) auto;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.leaderboard-links .card-link:hover,
.leaderboard-links .card-link:focus-visible {
  background: #f8fafc;
  border-color: #111827;
}

.leaderboard-links .card-link-text {
  display: grid;
  gap: 0.2rem;
  min-width: 0;
}

.leaderboard-links .card-link-title {
  font-weight: 700;
}

.leaderboard-links .card-link small {
  font-weight: 400;
}

.leaderboard-links .card-link-chevron {
  color: #a7b0ba;
  font-size: 1.1rem;
  transition: color 0.15s ease, transform 0.15s ease;
}

.leaderboard-links .card-link:hover .card-link-chevron,
.leaderboard-links .card-link:focus-visible .card-link-chevron {
  color: #111827;
  transform: translateX(0.15rem);
}

.leaderboard-panel {
  background: #f8fafc;
  border: 1px solid #d8dee4;
  border-radius: 6px;
  margin: 1.5rem 0;
  padding: 1.25rem;
}

.leaderboard-sidebar .leaderboard-panel {
  margin: 0;
}

.leaderboard-panel h2,
.leaderboard-panel p {
  margin-top: 0;
}

.leaderboard-panel h2 {
  margin-bottom: 0.35rem;
}

.leaderboard-panel > p {
  color: #52616f;
  margin-bottom: 1.25rem;
}

.leaderboard-panel .field {
  margin: 0;
}

.leaderboard-panel input[type="text"] {
  background: #ffffff;
  border: 1px solid #a7b0ba;
  border-radius: 6px;
  box-sizing: border-box;
  font: inherit;
  min-height: 2.75rem;
  padding: 0.5rem 0.75rem;
  width: 100%;
}

.leaderboard-panel input[type="text"]:focus {
  border-color: #111827;
  outline: 2px solid rgba(17, 24, 39, 0.15);
  outline-offset: 1px;
}

.leaderboard-submit {
  background: #111827;
  border: 1px solid #111827;
  border-radius: 6px;
  color: #ffffff;
  cursor: pointer;
  padding: 0.55rem 1rem;
  width: 100%;
}

.leaderboard-submit:hover {
  background: #000000;
}

.empty-state-title {
  font-weight: 700;
  margin-top: 0;
}

.leaderboards-list .empty-state p:last-child {
  color: #52616f;
  margin-bottom: 0;
}

tr.disqualified td {
  color: #8b93a1;
}

.badge-disqualified {
  background: #fbe9e9;
  border: 1px solid #e5b8b8;
  border-radius: 999px;
  color: #a13030;
  font-size: 0.75rem;
  font-weight: 600;
  margin-left: 0.35rem;
  padding: 0.1rem 0.55rem;
  text-transform: uppercase;
}

.medal {
  display: inline-block;
  vertical-align: -0.2em;
  width: 1.2rem;
  height: 1.2rem;
  margin-right: 0.4rem;
}

.medal-gold {
  color: #f2b705;
}

.medal-silver {
  color: #a9b1bd;
}

.medal-bronze {
  color: #cd7f32;
}

.profile-panel {
  background: #f8fafc;
  border: 1px solid #d8dee4;
  border-radius: 6px;
  margin: 1.5rem 0;
  padding: 1rem;
}

.profile-stats {
  display: grid;
  gap: 1rem;
  margin: 0 0 1.5rem;
}

.profile-stats div {
  display: grid;
  gap: 0.2rem;
}

.profile-stats dt {
  color: #52616f;
  font-weight: 600;
}

.profile-stats dd {
  color: #111827;
  font-size: 1.35rem;
  font-weight: 700;
  margin: 0;
}

.logout-button {
  background: #111827;
  border: 1px solid #111827;
  border-radius: 6px;
  color: #ffffff;
  cursor: pointer;
  padding: 0.45rem 0.9rem;
}

.member-list {
  padding-left: 1.25rem;
}

.game-start,
.game-board,
.game-complete {
  display: grid;
  gap: 1rem;
}

.card-list {
  display: grid;
  gap: 0.75rem;
  max-width: 28rem;
}

.card-link {
  border: 1px solid #a7b0ba;
  border-radius: 6px;
  color: #1f2933;
  display: grid;
  gap: 0.2rem;
  padding: 0.85rem 1rem;
  text-decoration: none;
}

.card-link:hover,
.card-link:focus {
  background: #f8fafc;
}

.card-link span {
  font-weight: 700;
}

.card-link small {
  color: #52616f;
}

.difficulty-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.difficulty-tabs a {
  border: 1px solid #a7b0ba;
  border-radius: 6px;
  color: #1f2933;
  padding: 0.45rem 0.75rem;
  text-decoration: none;
}

.difficulty-tabs a.active {
  background: #111827;
  border-color: #111827;
  color: #ffffff;
}

.member-table th,
.member-table td {
  border: 0;
}

.member-table thead th {
  background: #e5e9ee;
}

.member-table th:last-child,
.member-table td:last-child {
  text-align: right;
}

.member-table .col-time {
  text-align: right;
}

.member-table tbody tr:nth-child(even) {
  background: #f4f6f8;
}

.page-tabs {
  border-bottom: 1px solid #d8dee4;
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.page-tabs a {
  border-bottom: 2px solid transparent;
  color: #52616f;
  display: inline-grid;
  margin-bottom: -1px;
  padding: 0.5rem 0;
  text-decoration: none;
}

/* reserve the bold width so toggling the active tab doesn't shift the row */
.page-tabs a::after {
  content: attr(data-label);
  font-weight: 600;
  height: 0;
  overflow: hidden;
  visibility: hidden;
}

.page-tabs a:hover {
  color: #111827;
}

.page-tabs a.active {
  border-bottom-color: #111827;
  color: #111827;
  font-weight: 600;
}

.date-nav {
  align-items: center;
  display: grid;
  gap: 0.75rem;
  grid-template-columns: auto 1fr auto;
  margin: 1rem 0 1.5rem;
}

.date-nav-step {
  align-items: center;
  border: 1px solid #d8dee4;
  border-radius: 8px;
  color: #1f2933;
  display: inline-flex;
  font-size: 1.35rem;
  height: 2.75rem;
  justify-content: center;
  line-height: 1;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  width: 2.75rem;
}

.date-nav-step:hover,
.date-nav-step:focus-visible {
  background: #111827;
  border-color: #111827;
  color: #ffffff;
}

.date-nav-step.is-disabled {
  color: #cbd2d9;
  cursor: default;
}

.date-nav-current {
  display: grid;
  gap: 0.15rem;
  justify-items: center;
  text-align: center;
}

.date-nav-eyebrow {
  color: #52616f;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.date-nav-date {
  color: #111827;
  font-size: 1.15rem;
  font-weight: 700;
}

.game-board form {
  display: grid;
  gap: 1rem;
  justify-items: start;
}

.elapsed-timer {
  align-items: baseline;
  display: flex;
  gap: 0.5rem;
}

.elapsed-timer span {
  color: #52616f;
  font-weight: 600;
}

.elapsed-timer time {
  color: #111827;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.note-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.note-toggle {
  background: #f8fafc;
  border: 1px solid #a7b0ba;
  border-radius: 6px;
  color: #1f2933;
  cursor: pointer;
  padding: 0.45rem 0.75rem;
}

.note-toggle-active {
  background: #2563eb;
  border-color: #2563eb;
  color: #ffffff;
}

.note-toggle:disabled {
  color: #7b8794;
  cursor: not-allowed;
  opacity: 0.72;
}

.submit-solution {
  background: #111827;
  border: 1px solid #111827;
  border-radius: 6px;
  color: #ffffff;
  cursor: pointer;
  padding: 0.45rem 0.9rem;
}

.game-complete-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.share-result-button {
  background: #111827;
  border: 1px solid #111827;
  border-radius: 6px;
  color: #ffffff;
  cursor: pointer;
  padding: 0.45rem 0.9rem;
}

.share-result-status {
  color: #52616f;
  font-weight: 600;
}

.share-result-actions {
  align-items: center;
  display: flex;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.leaderboard-panel .share-result-actions {
  align-items: stretch;
  flex-direction: column;
  gap: 0.5rem;
}

.leaderboard-panel .share-result-button {
  width: 100%;
}

.mobile-keypad {
  display: none;
}

.replay-controls {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.replay-controls button,
.replay-controls select {
  background: #f8fafc;
  border: 1px solid #a7b0ba;
  border-radius: 6px;
  color: #1f2933;
  cursor: pointer;
  padding: 0.45rem 0.75rem;
}

.replay-controls label {
  align-items: center;
  color: #52616f;
  display: flex;
  font-weight: 600;
  gap: 0.35rem;
}

.replay-controls output {
  color: #111827;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.comparison-selector {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.comparison-selector label {
  color: #52616f;
  font-weight: 600;
}

.comparison-selector select {
  background: #f8fafc;
  border: 1px solid #a7b0ba;
  border-radius: 6px;
  color: #1f2933;
  font: inherit;
  padding: 0.45rem 0.75rem;
}

.replay-boards {
  align-items: start;
  display: grid;
  gap: 1.5rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 34rem), max-content));
}

#comparison_replay:empty {
  display: none;
}

.replay-board-panel {
  display: grid;
  gap: 0.75rem;
  overflow-x: auto;
}

.replay-board-header {
  align-items: baseline;
  display: flex;
  gap: 0.75rem;
  justify-content: space-between;
}

.replay-board-header h2 {
  font-size: 1rem;
  margin: 0;
}

.replay-board-header p {
  color: #52616f;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  margin: 0;
}

.sudoku-cell-given,
.sudoku-square .sudoku-cell-given {
  background: #eef2f6;
  color: #111827;
  font-weight: 700;
}

.sudoku-square .sudoku-cell-replay-editable[readonly] {
  background: transparent;
  color: #111827;
  font-weight: 400;
}

.sudoku-cell.sudoku-cell-active {
  background: #eaf3ff;
  outline: 3px solid #2563eb;
  outline-offset: 0;
  position: relative;
  z-index: 2;
}

.sudoku-square:has(.sudoku-cell-active) {
  z-index: 2;
}

.sudoku-square .sudoku-cell.sudoku-cell-active {
  background: rgba(234, 243, 255, 0.62);
}

.sudoku-square:has(.sudoku-cell-active) .sudoku-notes {
  color: #4b5563;
}

.replay-board .sudoku-square-active .sudoku-notes {
  color: #374151;
  position: relative;
  z-index: 3;
}

.replay-list {
  display: grid;
  gap: 0.75rem;
}

.replay-list-item {
  border: 1px solid #d8dee4;
  border-radius: 6px;
  color: #1f2933;
  display: grid;
  gap: 0.25rem 1rem;
  grid-template-columns: 1fr auto;
  padding: 0.9rem 1rem;
  text-decoration: none;
}

.replay-list-item:hover,
.replay-list-item:focus {
  background: #f8fafc;
}

.replay-list-title,
.replay-list-stat {
  color: #111827;
  font-weight: 700;
}

.replay-list-stat {
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.replay-list-meta {
  color: #52616f;
}

.empty-state {
  background: #f8fafc;
  border: 1px solid #d8dee4;
  border-radius: 6px;
  padding: 1rem;
}

@media (max-width: 42rem), (pointer: coarse) {
  body {
    margin: 0;
    padding: max(1rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) max(1rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
  }

  .app-content:has(> .leaderboards-page) {
    grid-template-columns: 1fr; /* stack: list, then form below */
  }

  .leaderboard-sidebar {
    padding-top: 0;
  }

  .member-table .col-completed {
    display: none;
  }

  /* the global `.actions { display: none }` below would hide the Create
     button on mobile — re-show it for this form */
  .leaderboard-panel .actions {
    display: block;
  }

  .authenticated-layout {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    height: 100vh;
    overflow: hidden;
    padding: 0;
  }

  @supports (height: 100dvh) {
    .authenticated-layout {
      height: 100dvh;
    }
  }

  .app-content {
    box-sizing: border-box;
    max-width: none;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    padding:
      1rem
      max(1rem, env(safe-area-inset-right))
      1.5rem
      max(1rem, env(safe-area-inset-left));
  }

  .gameplay-layout .app-content {
    min-height: 0;
    overflow: hidden;
    padding: 0;
    position: relative;
  }

  .game-page,
  .leaderboards-page,
  .profile-page,
  .replays-page,
  .replay-page {
    max-width: none;
  }

  .app-header {
    position: static;
    padding:
      calc(1rem + env(safe-area-inset-top))
      max(1rem, env(safe-area-inset-right))
      1rem
      max(1rem, env(safe-area-inset-left));
  }

  .app-header-inner {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
  }

  .app-logo {
    font-size: 2rem;
    min-width: 0;
  }

  .desktop-nav {
    display: none;
  }

  .mobile-tab-bar {
    background: rgba(255, 255, 255, 0.96);
    border-top: 1px solid #d8dee4;
    box-sizing: border-box;
    display: grid;
    gap: 0.35rem;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    padding:
      0.55rem
      max(1rem, env(safe-area-inset-right))
      calc(0.55rem + env(safe-area-inset-bottom))
      max(1rem, env(safe-area-inset-left));
  }

  .mobile-tab-link {
    border: 1px solid transparent;
    border-radius: 6px;
    font-size: 0.78rem;
    min-height: 2.75rem;
    padding: 0.4rem 0.35rem;
  }

  .mobile-tab-icon {
    height: 2rem;
    width: 2rem;
  }

  .mobile-tab-link-active {
    background: #f8fafc;
    border-color: #111827;
    color: #111827;
  }

  .gameplay-layout .app-header {
    display: none;
  }

  .gameplay-header {
    align-items: center;
    background: #ffffff;
    border-bottom: 1px solid #d8dee4;
    box-sizing: border-box;
    display: grid;
    grid-template-columns: 3rem minmax(0, 1fr) auto;
    min-height: calc(3rem + env(safe-area-inset-top));
    padding:
      env(safe-area-inset-top)
      max(0.75rem, env(safe-area-inset-right))
      0
      max(0.75rem, env(safe-area-inset-left));
  }

  .gameplay-back-link {
    align-items: center;
    color: #111827;
    display: inline-flex;
    height: 3rem;
    justify-content: center;
    justify-self: start;
    text-decoration: none;
    width: 3rem;
  }

  .gameplay-back-icon {
    height: 2rem;
    width: 2rem;
  }

  .gameplay-difficulty {
    color: #111827;
    font-size: 1rem;
    font-weight: 700;
    grid-column: 2;
    justify-self: center;
    min-width: 0;
    overflow: hidden;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .gameplay-timer {
    grid-column: 3;
    justify-content: end;
    width: auto;
  }

  .gameplay-timer time {
    font-size: 1rem;
  }

  .game-header {
    margin-bottom: 1rem;
  }

  .elapsed-timer {
    justify-content: space-between;
    width: 100%;
  }

  .game-toolbar,
  .actions {
    display: none;
  }

  .gameplay-layout .flash {
    left: max(0.75rem, env(safe-area-inset-left));
    margin: 0;
    position: absolute;
    right: max(0.75rem, env(safe-area-inset-right));
    top: 0.75rem;
    z-index: 30;
  }

  .gameplay-layout .game-page,
  .gameplay-layout .game-board {
    display: grid;
    gap: 0;
    height: 100%;
    min-height: 0;
    width: 100%;
  }

  .gameplay-layout .game-header,
  .gameplay-layout .game-board > .difficulty-tabs,
  .gameplay-layout .game-board > .elapsed-timer {
    display: none;
  }

  .game-board form {
    gap: 0.75rem;
    justify-items: center;
    width: 100%;
  }

  .gameplay-layout .game-board form {
    align-items: stretch;
    display: grid;
    gap: 0;
    grid-template-rows: auto minmax(0, 1fr);
    height: 100%;
    justify-items: stretch;
    min-height: 0;
    overflow: hidden;
  }

  .sudoku-grid-game {
    --game-cell-size: calc((100vw - 2rem - env(safe-area-inset-left) - env(safe-area-inset-right)) / 9);
    max-width: 100%;
  }

  .gameplay-layout .sudoku-grid-game {
    --game-cell-size: calc((100vw - env(safe-area-inset-left) - env(safe-area-inset-right)) / 9);
    height: calc(var(--game-cell-size) * 9);
    justify-self: center;
    max-width: none;
    width: calc(var(--game-cell-size) * 9);
  }

  .sudoku-square .sudoku-cell {
    font-size: clamp(1.1rem, 5vw, 1.55rem);
  }

  .sudoku-notes {
    font-size: clamp(0.46rem, 2.1vw, 0.68rem);
  }

  .gameplay-layout .sudoku-notes {
    font-size: clamp(0.7rem, 2.35vw, 0.76rem);
  }

  .mobile-keypad {
    display: grid;
    gap: 0.45rem;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    max-width: 34rem;
    padding-bottom: env(safe-area-inset-bottom);
    width: 100%;
  }

  .gameplay-layout .mobile-keypad {
    align-self: stretch;
    box-sizing: border-box;
    gap: clamp(0.25rem, 1.2vh, 0.45rem);
    grid-template-rows: repeat(5, minmax(0, 1fr));
    height: 100%;
    max-width: none;
    min-height: 0;
    padding:
      0.5rem
      max(0.75rem, env(safe-area-inset-right))
      calc(0.5rem + env(safe-area-inset-bottom))
      max(0.75rem, env(safe-area-inset-left));
  }

  .keypad-button {
    background: #f8fafc;
    border: 1px solid #a7b0ba;
    border-radius: 6px;
    color: #111827;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 700;
    min-height: 3rem;
    padding: 0.55rem;
  }

  .gameplay-layout .keypad-button {
    min-height: 0;
    padding: clamp(0.2rem, 1vh, 0.55rem);
  }

  .keypad-button:disabled {
    color: #7b8794;
    cursor: not-allowed;
    opacity: 0.72;
  }

  .keypad-button-secondary {
    color: #374151;
    font-size: 0.95rem;
    font-weight: 650;
  }

  .keypad-button-primary {
    background: #111827;
    border-color: #111827;
    color: #ffffff;
    font-size: 0.95rem;
    font-weight: 700;
  }

  .keypad-button.note-toggle-active {
    background: #2563eb;
    border-color: #2563eb;
    color: #ffffff;
  }
}

/* admin server stats page: responsive grid of metric panels */
.server-captured-at {
  color: #52616f;
  font-size: 0.9rem;
}

.server-stats-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr));
  margin: 1.5rem 0;
}

.server-panel {
  background: #f8fafc;
  border: 1px solid #d8dee4;
  border-radius: 6px;
  padding: 1rem;
}

.server-panel h2 {
  margin-top: 0;
}

.server-panel h3 {
  font-size: 1rem;
  margin: 1.25rem 0 0.5rem;
}

.server-panel-wide {
  grid-column: 1 / -1;
}

.server-panel dl {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  margin: 0;
}

.server-panel dl div {
  display: grid;
  gap: 0.2rem;
}

.server-panel dt {
  color: #52616f;
  font-size: 0.85rem;
  font-weight: 600;
}

.server-panel dd {
  color: #111827;
  font-size: 1.2rem;
  font-weight: 700;
  margin: 0;
}

.server-panel dd small {
  color: #52616f;
  font-size: 0.8rem;
  font-weight: 500;
}

.server-panel dd.server-panel-fine-print {
  font-size: 0.8rem;
  font-weight: 500;
  overflow-wrap: anywhere;
}

.server-panel table {
  margin-top: 0.5rem;
}

.badge-healthy {
  background: #e7f6ec;
  border: 1px solid #b3dfc2;
  border-radius: 999px;
  color: #1d7a3e;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.1rem 0.55rem;
  text-transform: uppercase;
}

.badge-stale {
  background: #fbe9e9;
  border: 1px solid #e5b8b8;
  border-radius: 999px;
  color: #a13030;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.1rem 0.55rem;
  text-transform: uppercase;
}
