:root {
  --cell-size: 2.6rem;
  --cell-font-size: 1.15rem;
  --bg-color: #f7eeef;
  --panel-color: #fff9f8;
  --panel-border-color: rgba(0, 0, 0, 0.06);
  --text-color: #31272a;
  --muted-color: #78656b;
  --border-color: #d5bcc2;
  --selection-color: #f1dde3;
  --active-color: #e7c3cd;
  --correct-color: #dcebdd;
  --error-color: #efd5d5;
  --focus-color: #9c596c;
  --complete-clue-bg: #f5fbf5;
  --complete-clue-border: #84a588;
  --button-bg: rgba(255, 255, 255, 0.48);
  --button-hover-bg: rgba(255, 255, 255, 0.72);
  --grid-scroll-bg: linear-gradient(180deg, rgba(255, 255, 255, 0.62) 0%, rgba(255, 255, 255, 0.28) 100%);
  --cell-bg: rgba(255, 255, 255, 0.92);
  --clue-bg: rgba(255, 255, 255, 0.54);
  --drawer-bg: rgba(255, 249, 248, 0.58);
  --shadow: 0 14px 36px rgba(102, 61, 74, 0.12);
}

body[data-theme="velvet"] {
  --bg-color: #140f16;
  --panel-color: #211821;
  --panel-border-color: rgba(240, 199, 212, 0.14);
  --text-color: #f7f1f3;
  --muted-color: #ccb8c0;
  --border-color: #5d4452;
  --selection-color: #4a3341;
  --active-color: #674658;
  --correct-color: #3d4b3a;
  --error-color: #5a2c39;
  --focus-color: #f0c7d4;
  --complete-clue-bg: rgba(102, 126, 98, 0.18);
  --complete-clue-border: rgba(186, 210, 176, 0.32);
  --button-bg: rgba(255, 255, 255, 0.08);
  --button-hover-bg: rgba(255, 255, 255, 0.16);
  --grid-scroll-bg: linear-gradient(180deg, rgba(38, 28, 37, 0.96) 0%, rgba(22, 16, 22, 0.98) 100%);
  --cell-bg: #2a1f2a;
  --clue-bg: rgba(255, 255, 255, 0.06);
  --drawer-bg: rgba(33, 24, 33, 0.58);
  --shadow: 0 22px 48px rgba(0, 0, 0, 0.42);
}

body[data-theme="sea"] {
  --bg-color: #e4efed;
  --panel-color: #eef6f3;
  --panel-border-color: rgba(56, 92, 90, 0.1);
  --text-color: #355154;
  --muted-color: #6b8381;
  --border-color: #b4cac7;
  --selection-color: #d4e8e2;
  --active-color: #b4d4cc;
  --correct-color: #c8e0d8;
  --error-color: #ead8cf;
  --focus-color: #467d77;
  --complete-clue-bg: #ddeee6;
  --complete-clue-border: #78a69a;
  --button-bg: rgba(236, 246, 243, 0.92);
  --button-hover-bg: rgba(228, 241, 237, 0.98);
  --grid-scroll-bg: linear-gradient(180deg, rgba(238, 246, 243, 0.96) 0%, rgba(227, 239, 235, 0.99) 100%);
  --cell-bg: #edf6f3;
  --clue-bg: rgba(236, 246, 243, 0.42);
  --drawer-bg: rgba(238, 246, 243, 0.58);
  --shadow: 0 14px 36px rgba(47, 86, 82, 0.12);
}

body[data-theme="red-of-you"] {
  --bg-color: #5f0d19;
  --panel-color: rgba(103, 18, 30, 0.84);
  --panel-border-color: rgba(255, 211, 219, 0.16);
  --text-color: #fff3f5;
  --muted-color: #e5b0b7;
  --border-color: #a53e52;
  --selection-color: #8e2037;
  --active-color: #bf3553;
  --correct-color: #5d4536;
  --error-color: #7a1730;
  --focus-color: #ffd5dd;
  --complete-clue-bg: rgba(126, 52, 67, 0.88);
  --complete-clue-border: rgba(255, 201, 211, 0.28);
  --button-bg: rgba(255, 255, 255, 0.08);
  --button-hover-bg: rgba(255, 255, 255, 0.15);
  --grid-scroll-bg:
    radial-gradient(circle at 10% 12%, rgba(255, 224, 231, 0.28) 0 0.22rem, transparent 0.26rem),
    radial-gradient(circle at 24% 30%, rgba(255, 196, 208, 0.22) 0 0.16rem, transparent 0.2rem),
    radial-gradient(circle at 72% 18%, rgba(255, 227, 234, 0.24) 0 0.18rem, transparent 0.22rem),
    radial-gradient(circle at 84% 42%, rgba(255, 205, 216, 0.18) 0 0.14rem, transparent 0.18rem),
    radial-gradient(circle at 60% 78%, rgba(255, 227, 233, 0.2) 0 0.18rem, transparent 0.22rem),
    linear-gradient(180deg, rgba(119, 16, 35, 0.96) 0%, rgba(84, 10, 24, 0.98) 100%);
  --cell-bg: rgba(99, 17, 31, 0.96);
  --clue-bg: rgba(255, 255, 255, 0.06);
  --drawer-bg: rgba(103, 18, 30, 0.56);
  --shadow: 0 24px 52px rgba(33, 4, 10, 0.42);
}

body[data-theme="green-of-me"] {
  --bg-color: #203429;
  --panel-color: rgba(33, 53, 41, 0.9);
  --panel-border-color: rgba(198, 220, 205, 0.12);
  --text-color: #eef6ef;
  --muted-color: #bdd0c1;
  --border-color: #5f7a64;
  --selection-color: #35513f;
  --active-color: #486a53;
  --correct-color: #425f48;
  --error-color: #5d4a3d;
  --focus-color: #dce8db;
  --complete-clue-bg: rgba(71, 96, 76, 0.86);
  --complete-clue-border: rgba(199, 219, 198, 0.22);
  --button-bg: rgba(255, 255, 255, 0.07);
  --button-hover-bg: rgba(255, 255, 255, 0.13);
  --grid-scroll-bg:
    radial-gradient(circle at top left, rgba(218, 231, 218, 0.08), transparent 26%),
    linear-gradient(180deg, rgba(43, 67, 49, 0.98) 0%, rgba(25, 42, 31, 0.99) 100%);
  --cell-bg: rgba(40, 60, 46, 0.97);
  --clue-bg: rgba(255, 255, 255, 0.05);
  --drawer-bg: rgba(33, 53, 41, 0.56);
  --shadow: 0 22px 48px rgba(7, 16, 10, 0.4);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.88), transparent 28%),
    linear-gradient(180deg, #fcf3f4 0%, var(--bg-color) 56%, #ecdce1 100%);
  color: var(--text-color);
}

body[data-theme="velvet"] {
  background:
    radial-gradient(circle at top left, rgba(240, 199, 212, 0.08), transparent 22%),
    linear-gradient(180deg, #1f1620 0%, var(--bg-color) 56%, #0d090f 100%);
}

body[data-theme="sea"] {
  background:
    radial-gradient(circle at 12% 16%, rgba(255, 255, 255, 0.72), transparent 24%),
    radial-gradient(circle at 82% 14%, rgba(205, 232, 227, 0.42), transparent 18%),
    radial-gradient(circle at 68% 72%, rgba(196, 226, 220, 0.3), transparent 20%),
    linear-gradient(180deg, #f1faf8 0%, var(--bg-color) 52%, #c4dbd6 100%);
}

body[data-theme="red-of-you"] {
  background:
    radial-gradient(circle at 16% 18%, rgba(255, 213, 223, 0.16), transparent 18%),
    radial-gradient(circle at 76% 16%, rgba(255, 219, 227, 0.12), transparent 16%),
    linear-gradient(180deg, #7a1126 0%, var(--bg-color) 58%, #2f0610 100%);
}

body[data-theme="green-of-me"] {
  background:
    radial-gradient(circle at 14% 14%, rgba(224, 236, 224, 0.08), transparent 22%),
    linear-gradient(180deg, #304a37 0%, var(--bg-color) 54%, #152118 100%);
}

button,
input {
  font: inherit;
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  max-width: 1600px;
  margin: 0 auto;
  padding: 1.25rem 2.5rem;
}

body.access-locked {
  position: fixed;
  inset: 0;
  width: 100%;
  overflow: hidden;
}

body.access-locked .app-shell {
  visibility: hidden;
}

.access-gate {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 1rem;
  overflow: hidden;
  overscroll-behavior: none;
  background:
    radial-gradient(circle at 25% 20%, rgba(255, 255, 255, 0.72), transparent 28%),
    var(--bg-color);
}

.access-gate.hidden {
  display: none;
}

.access-card {
  width: min(100%, 27rem);
  padding: 2rem;
  border: 1px solid var(--panel-border-color);
  border-radius: 22px;
  background: var(--panel-color);
  box-shadow: var(--shadow);
}

.access-card h1 {
  font-size: clamp(1.65rem, 5vw, 2.2rem);
}

.access-card > p:not(.access-eyebrow):not(.access-error) {
  margin: 0.65rem 0 1.4rem;
  color: var(--muted-color);
}

.access-eyebrow,
.access-card label {
  color: var(--muted-color);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.access-eyebrow {
  margin: 0 0 0.5rem;
}

.access-controls {
  display: flex;
  gap: 0.65rem;
  margin-top: 0.45rem;
}

.access-controls input {
  min-width: 0;
  flex: 1;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  background: var(--cell-bg);
  color: var(--text-color);
  outline: none;
}

.access-controls input:focus {
  border-color: var(--focus-color);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus-color) 22%, transparent);
}

.access-error {
  min-height: 1.25rem;
  margin: 0.65rem 0 0;
  color: #b63b52;
  font-size: 0.9rem;
}

.hero,
.board-panel,
.clues-panel {
  background: var(--panel-color);
  border: 1px solid var(--panel-border-color);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: end;
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.eyebrow {
  margin: 0 0 0.35rem;
  color: var(--muted-color);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.78rem;
}

h1,
h2 {
  margin: 0;
}

.subtitle,
.status-panel p {
  margin: 0.35rem 0 0;
  color: var(--muted-color);
}

.mobile-sheet-toggle {
  display: none;
}

.mobile-sheet-nav {
  display: none;
}

.secondary-action {
  padding: 0.55rem 0.9rem;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(300px, 0.95fr);
  gap: 1rem;
  align-items: start;
}

.board-panel,
.clues-panel {
  padding: 1rem;
  height: calc(100vh - 13rem);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 0.9rem;
  align-items: center;
}

.control-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
}

.developer-control[hidden] {
  display: none;
}

.developer-control.is-active {
  background: var(--active-color);
  border-color: var(--focus-color);
}

.control-icon {
  width: 1.15rem;
  height: 1.15rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.theme-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-left: auto;
}

.theme-label {
  color: var(--muted-color);
  font-size: 0.92rem;
}

.theme-switcher {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
}

.theme-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  justify-content: flex-start;
  width: 100%;
}

.theme-chip-icon {
  width: 1rem;
  height: 1rem;
  position: relative;
  display: inline-block;
  flex: 0 0 auto;
  color: currentColor;
}

.theme-chip-icon-sun {
  width: 0.68rem;
  height: 0.68rem;
  margin: 0.16rem;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.9;
}

.theme-chip-icon-sun::before,
.theme-chip-icon-sun::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  opacity: 0.82;
}

.theme-chip-icon-sun::before {
  background:
    linear-gradient(currentColor, currentColor) center top / 0.08rem 0.22rem no-repeat,
    linear-gradient(currentColor, currentColor) center bottom / 0.08rem 0.22rem no-repeat,
    linear-gradient(currentColor, currentColor) left center / 0.22rem 0.08rem no-repeat,
    linear-gradient(currentColor, currentColor) right center / 0.22rem 0.08rem no-repeat;
  inset: -0.26rem;
}

.theme-chip-icon-sun::after {
  transform: rotate(45deg);
  background:
    linear-gradient(currentColor, currentColor) center top / 0.08rem 0.2rem no-repeat,
    linear-gradient(currentColor, currentColor) center bottom / 0.08rem 0.2rem no-repeat,
    linear-gradient(currentColor, currentColor) left center / 0.2rem 0.08rem no-repeat,
    linear-gradient(currentColor, currentColor) right center / 0.2rem 0.08rem no-repeat;
  inset: -0.26rem;
}

.theme-chip-icon-moon {
  width: 1.15rem;
  height: 1.15rem;
  fill: currentColor;
}

.theme-chip-icon-moon .moon-disc {
  opacity: 0.2;
}

.theme-chip-icon-moon .moon-crescent {
  opacity: 0.88;
}

.theme-chip-icon-letter {
  width: 1rem;
  height: 1rem;
  display: grid;
  place-items: center;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  line-height: 1;
  transform: translateY(0.07rem);
}

.theme-chip-name {
  font-weight: 600;
}

button {
  -webkit-appearance: none;
  appearance: none;
  border: 1px solid var(--border-color);
  background: var(--button-bg);
  color: var(--text-color);
  border-radius: 999px;
  padding: 0.65rem 1rem;
  cursor: pointer;
  transition: background-color 160ms ease, border-color 160ms ease, transform 160ms ease;
}

button:focus:not(:focus-visible) {
  outline: none;
}

button:hover {
  background: var(--button-hover-bg);
  border-color: var(--focus-color);
}

button:focus-visible,
.clue-button:focus-visible {
  outline: 3px solid var(--focus-color);
  outline-offset: 2px;
}

.cell-input:focus-visible {
  outline: none;
}

.grid-scroll {
  overflow: auto;
  flex: 1;
  min-height: 0;
  border: 1px solid rgba(98, 78, 58, 0.14);
  border-radius: 14px;
  background: var(--grid-scroll-bg);
  padding: 1cm;
}

.grid {
  display: grid;
  width: max-content;
  gap: 1px;
  background: var(--border-color);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
}

.cell {
  width: var(--cell-size);
  height: var(--cell-size);
  position: relative;
  isolation: isolate;
}

.cell-number {
  position: absolute;
  top: 0.12rem;
  left: 0.16rem;
  z-index: 2;
  font-size: 0.56rem;
  line-height: 1;
  color: var(--muted-color);
  pointer-events: none;
  font-weight: 700;
}

.cell-input {
  width: 100%;
  height: 100%;
  position: relative;
  z-index: 1;
  border: none;
  background: var(--cell-bg);
  text-align: center;
  text-transform: uppercase;
  border-radius: 0;
  color: var(--text-color);
  font-size: var(--cell-font-size);
  font-weight: 600;
  padding: 0.4rem 0.2rem 0.1rem;
  appearance: none;
  outline: none;
}

.cell-input.is-letter-entering {
  animation: letter-enter 170ms cubic-bezier(0.2, 0.8, 0.3, 1);
}

@keyframes letter-enter {
  from {
    font-size: 0.25rem;
    opacity: 0.15;
  }

  70% {
    font-size: calc(var(--cell-font-size) * 1.12);
    opacity: 1;
  }

  to {
    font-size: var(--cell-font-size);
    opacity: 1;
  }
}

.cell.is-selected .cell-input {
  background: var(--selection-color);
  z-index: 3;
}

.cell.is-active .cell-input {
  background: var(--active-color);
  box-shadow: inset 0 0 0 2px var(--focus-color);
  z-index: 4;
}

.cell.is-correct .cell-input {
  background: var(--correct-color);
  box-shadow: inset 0 0 0 1px rgba(169, 205, 182, 0.2);
}

.cell.is-error .cell-input {
  background: var(--error-color);
  box-shadow: inset 0 0 0 1px rgba(220, 162, 176, 0.3);
}

body[data-theme="velvet"] .cell.is-correct .cell-input {
  box-shadow: inset 0 0 0 1px rgba(197, 214, 170, 0.22);
}

body[data-theme="velvet"] .cell.is-error .cell-input {
  box-shadow: inset 0 0 0 1px rgba(201, 133, 149, 0.26);
}

body[data-theme="sea"] .cell.is-correct .cell-input {
  box-shadow: inset 0 0 0 1px rgba(94, 148, 134, 0.24);
}

body[data-theme="sea"] .cell.is-error .cell-input {
  box-shadow: inset 0 0 0 1px rgba(190, 155, 139, 0.28);
}

body[data-theme="red-of-you"] .cell.is-correct .cell-input {
  box-shadow: inset 0 0 0 1px rgba(230, 197, 185, 0.22);
}

body[data-theme="red-of-you"] .cell.is-error .cell-input {
  box-shadow: inset 0 0 0 1px rgba(255, 190, 205, 0.24);
}

body[data-theme="green-of-me"] .cell.is-correct .cell-input {
  box-shadow: inset 0 0 0 1px rgba(177, 203, 179, 0.2);
}

body[data-theme="green-of-me"] .cell.is-error .cell-input {
  box-shadow: inset 0 0 0 1px rgba(200, 178, 161, 0.22);
}

.clues-list {
  padding-left: 0;
  margin: 1rem 0 0;
  list-style: none;
  display: grid;
  gap: 0.45rem;
  overflow: auto;
  flex: 1;
  min-height: 0;
}

.clue-item {
  margin: 0;
}

.clue-button {
  width: 100%;
  text-align: left;
  border-radius: 12px;
  padding: 0.75rem 0.85rem;
  background: var(--clue-bg);
}

.clue-button.is-selected {
  background: var(--selection-color);
}

.clue-button.is-complete {
  border-color: var(--complete-clue-border);
  background: var(--complete-clue-bg);
}

.clues-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.clue-order {
  font-weight: 700;
  margin-right: 0.45rem;
}

.theme-chip {
  padding: 0.5rem 0.85rem;
  font-size: 0.92rem;
}

.theme-chip.is-selected {
  background: var(--active-color);
  border-color: var(--focus-color);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.24);
}

body[data-theme="sea"] .theme-chip[data-theme="sea"] .theme-chip-icon-sun,
body[data-theme="velvet"] .theme-chip[data-theme="velvet"] .theme-chip-icon-moon {
  transform: translateY(-0.02rem);
}

.theme-toast {
  display: none;
}

@media (max-width: 640px) {
  .theme-switcher {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cell-input.is-letter-entering {
    animation: none;
  }
}

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(20, 16, 10, 0.45);
  z-index: 200;
}

.modal.hidden {
  display: none;
}

.modal-card {
  max-width: 28rem;
  background: var(--panel-color);
  color: var(--text-color);
  padding: 1.5rem;
  border-radius: 20px;
  box-shadow: var(--shadow);
  text-align: center;
}

.modal-actions {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

@media (max-width: 980px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .hero {
    flex-direction: column;
    align-items: start;
  }

  .board-panel,
  .clues-panel {
    height: auto;
  }

  .grid-scroll {
    flex: none;
    max-height: none;
  }

  .clues-list {
    flex: none;
    overflow: visible;
  }
}

@media (max-width: 640px) {
  :root {
    --cell-size: 2.9rem;
    --cell-font-size: 1.2rem;
    --mobile-sheet-peek-height: 6.2rem;
    --app-viewport-height: 100dvh;
    --keyboard-offset: 0px;
  }

  html,
  body {
    width: 100%;
    height: 100%;
    min-height: 0;
    overflow: hidden;
    overscroll-behavior: none;
  }

  body {
    isolation: isolate;
  }

  body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    background: inherit;
    pointer-events: none;
  }

  .access-gate {
    inset: auto 0 0;
    width: 100%;
    height: var(--app-viewport-height);
    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));
  }

  .access-card {
    max-height: calc(var(--app-viewport-height) - 2rem);
    overflow: hidden;
  }

  .app-shell {
    width: 100%;
    height: var(--app-viewport-height);
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding:
      max(0.8rem, env(safe-area-inset-top))
      max(1.15rem, env(safe-area-inset-right))
      0.8rem
      max(1.15rem, env(safe-area-inset-left));
    overflow: hidden;
  }

  .hero {
    flex: 0 0 auto;
  }

  body.keyboard-open .hero {
    display: none;
  }

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

  .control-button {
    width: 2.5rem;
    height: 2.5rem;
    flex: 0 0 2.5rem;
    padding: 0;
  }

  .control-button .control-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
  }

  .theme-bar {
    gap: 0;
    flex-wrap: nowrap;
  }

  .theme-label {
    display: none;
  }

  .theme-switcher {
    width: auto;
    display: flex;
    gap: 0.35rem;
  }

  .theme-chip {
    width: 2.35rem;
    height: 2.35rem;
    justify-content: center;
    padding: 0;
  }

  .theme-chip-name {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
  }

  .theme-toast {
    position: fixed;
    top: max(1rem, env(safe-area-inset-top));
    left: 50%;
    z-index: 150;
    display: block;
    max-width: calc(100vw - 2rem);
    padding: 0.65rem 1.15rem;
    border: 1px solid var(--panel-border-color);
    border-radius: 999px;
    background: var(--drawer-bg);
    color: var(--text-color);
    box-shadow: var(--shadow);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    font-size: 0.92rem;
    font-weight: 700;
    line-height: 1.2;
    text-align: center;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -0.75rem);
    transition: opacity 220ms ease, transform 220ms ease;
  }

  .theme-toast.is-visible {
    opacity: 1;
    transform: translate(-50%, 0);
  }

  .layout {
    flex: 1;
    height: 0;
    min-height: 0;
    gap: 0.85rem;
  }

  .board-panel,
  .clues-panel {
    border-radius: 20px;
  }

  body[data-mobile-mode="sheet"] .layout {
    display: block;
    position: relative;
  }

  body[data-mobile-mode="sheet"] .board-panel {
    width: 100%;
    height: 100%;
    min-height: 0;
    position: relative;
    z-index: 1;
  }

  body[data-mobile-mode="sheet"] .clues-panel {
    position: fixed;
    left: 0;
    right: 0;
    bottom: var(--keyboard-offset);
    height: min(72dvh, 40rem, var(--app-viewport-height));
    padding: 0;
    z-index: 50;
    border-radius: 20px 20px 0 0;
    background: var(--drawer-bg);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    transform: translateY(calc(100% - var(--mobile-sheet-peek-height)));
    transition: transform 220ms ease, bottom 160ms ease;
  }

  body[data-mobile-mode="sheet"][data-mobile-sheet="open"] .clues-panel {
    transform: translateY(0);
  }

  body[data-mobile-mode="sheet"] .clues-panel-header {
    flex: 0 0 auto;
    gap: 0.25rem;
    padding-inline-start: max(0.35rem, env(safe-area-inset-left));
    padding-inline-end: max(0.35rem, env(safe-area-inset-right));
  }

  body[data-mobile-mode="sheet"] .clues-panel-header > h2 {
    display: none;
  }

  body[data-mobile-mode="sheet"] .mobile-sheet-toggle {
    min-width: 0;
    flex: 1;
    min-height: 6.2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 0.35rem max(1rem, env(safe-area-inset-bottom));
    border: 0;
    border-radius: 20px 20px 0 0;
    background: transparent;
    color: var(--text-color);
    text-align: left;
  }

  body[data-mobile-mode="sheet"] .mobile-sheet-nav {
    width: 2.25rem;
    height: 2.25rem;
    flex: 0 0 2.25rem;
    display: grid;
    place-items: center;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    color: var(--muted-color);
    opacity: 0.72;
  }

  body[data-mobile-mode="sheet"] .mobile-sheet-nav:hover,
  body[data-mobile-mode="sheet"] .mobile-sheet-nav:active {
    border: 0;
    background: transparent;
    color: var(--text-color);
    opacity: 1;
  }

  body[data-mobile-mode="sheet"] .mobile-sheet-nav svg {
    width: 0.95rem;
    height: 0.95rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  body[data-mobile-mode="sheet"] .mobile-sheet-toggle:focus-visible {
    outline: 3px solid var(--focus-color);
    outline-offset: -4px;
  }

  body[data-mobile-mode="sheet"] .mobile-clue-copy {
    min-width: 0;
    display: grid;
    gap: 0.2rem;
  }

  body[data-mobile-mode="sheet"] .mobile-clue-kicker {
    color: var(--muted-color);
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
  }

  body[data-mobile-mode="sheet"] .mobile-clue-text {
    font-size: 0.95rem;
    line-height: 1.3;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  body[data-mobile-mode="sheet"] .mobile-sheet-chevron {
    width: 0.75rem;
    height: 0.75rem;
    flex: 0 0 auto;
    border-top: 2px solid currentColor;
    border-left: 2px solid currentColor;
    transform: translateY(0.2rem) rotate(45deg);
    transition: transform 220ms ease;
  }

  body[data-mobile-mode="sheet"][data-mobile-sheet="open"] .mobile-sheet-chevron {
    transform: translateY(-0.2rem) rotate(225deg);
  }

  body[data-mobile-mode="sheet"] .clues-list {
    flex: 1;
    min-height: 0;
    margin: 0;
    padding: 0 max(1rem, env(safe-area-inset-right)) max(1rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
    overflow: auto;
    touch-action: pan-y;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  body[data-mobile-mode="sheet"] .app-shell {
    min-height: 0;
    padding-bottom: calc(var(--mobile-sheet-peek-height) + max(0.8rem, env(safe-area-inset-bottom)));
  }

  body[data-mobile-mode="sheet"] .grid-scroll {
    flex: 1;
    min-height: 0;
    max-height: none;
    padding: 0.9rem;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }
}
