:root {
  color-scheme: light;
  --bg: #f5f6f0;
  --surface: #ffffff;
  --ink: #17221c;
  --muted: #627066;
  --line: #cbd5cc;
  --cell: #d8dfcf;
  --tile: #f3d798;
  --tile-hi: #ffe8a9;
  --tile-shadow: #c99743;
  --tile-ink: #2a2115;
  --blank: #8362c8;
  --blank-hi: #a68ae0;
  --accent: #236f5c;
  --accent-strong: #154e42;
  --placement: #ffe36e;
  --word: #b84a3f;
  --triple-letter: #2e8c8a;
  --double-letter: #87bfd5;
  --quad-letter: #7452a3;
  --triple-word: #dd6f3d;
  --quad-word: #e1bd3a;
  --phone-column: 430px;
  --board-column: 860px;
  --app-vh: 100dvh;
  --rack-dock-height: 132px;
  --rack-dock-space: 132px;
  --board-viewport-height: calc(var(--app-vh) - var(--rack-dock-space) - 10px);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  overflow-x: hidden;
  --keyboard-bottom: 0px;
}

.loading-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, #f8fbf6, #eef5eb);
  color: var(--ink);
  padding: 22px;
  transition: opacity 0.24s ease, visibility 0.24s ease;
}

.loading-screen.is-hidden {
  opacity: 0;
  visibility: hidden;
}

.loading-card {
  display: grid;
  justify-items: center;
  width: min(100%, 360px);
  gap: 10px;
  text-align: center;
}

.loading-card strong {
  color: var(--accent-strong);
  font-size: 1.18rem;
  font-weight: 950;
}

.loading-card > span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.loading-brand {
  margin-bottom: 4px;
  transform: scale(1.05);
}

.loading-progress {
  overflow: hidden;
  width: min(100%, 310px);
  height: 10px;
  border: 1px solid rgba(35, 111, 92, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: inset 0 1px 2px rgba(21, 78, 66, 0.08);
}

.loading-progress span {
  display: block;
  width: 4%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #36b885);
  box-shadow: 0 0 14px rgba(54, 184, 133, 0.35);
  transition: width 0.18s ease;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:focus {
  outline: none;
}

button:focus-visible {
  outline: 2px solid rgba(21, 78, 66, 0.56);
  outline-offset: 2px;
}

.app-shell {
  min-height: 100vh;
  min-height: var(--app-vh);
}

.play-screen {
  min-height: 100vh;
  min-height: var(--app-vh);
  padding: 0 8px calc(var(--rack-dock-space) + 10px);
}

@media (max-width: 919px) {
  .play-screen {
    height: var(--app-vh);
    min-height: 0;
    overflow: hidden;
    padding-bottom: calc(var(--rack-dock-space) + 8px);
  }
}

.mini-bar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  max-width: var(--phone-column);
  margin: 0 auto 8px;
  padding: 4px 0 6px;
  background: rgba(245, 246, 240, 0.94);
  backdrop-filter: blur(10px);
}

.top-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.ad-slot {
  display: none;
  place-items: center;
  width: calc(100% + 20px);
  max-width: none;
  min-height: 0;
  margin: 0 -10px 6px;
}

.ad-slot[hidden] {
  display: none;
}

.ad-placeholder {
  position: relative;
  width: 100%;
  aspect-ratio: 960 / 297;
  display: block;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background-color: #111823;
  color: inherit;
  text-decoration: none;
}

.ad-placeholder img {
  width: 100%;
  height: 100%;
  display: grid;
  object-fit: cover;
}

.ad-slot[data-ad-mode="personalised"] .ad-placeholder {
  outline: 0;
}

.remove-ads-link {
  width: fit-content;
  display: block;
  margin: 3px auto 5px;
  color: var(--accent-strong);
  font-size: 0.72rem;
  font-weight: 900;
  line-height: 1.3;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

.remove-ads-link[hidden] {
  display: none;
}

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

.visitor-counter {
  position: fixed;
  z-index: 18;
  right: max(8px, env(safe-area-inset-right));
  bottom: calc(var(--rack-dock-space) + max(8px, env(safe-area-inset-bottom)));
  border: 1px solid rgba(98, 112, 102, 0.16);
  border-radius: 999px;
  background: rgba(246, 247, 243, 0.68);
  color: rgba(98, 112, 102, 0.74);
  padding: 2px 6px;
  font-size: 0.58rem;
  font-weight: 850;
  line-height: 1.1;
  cursor: text;
  pointer-events: auto;
  user-select: text;
  backdrop-filter: blur(8px);
}

.visitor-counter[hidden] {
  display: none;
}

.brand {
  display: flex;
  gap: 2px;
  align-items: center;
  white-space: nowrap;
}

.brand-tile {
  width: clamp(20px, 6vw, 30px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 1px solid #c8943c;
  border-radius: 7px;
  background: linear-gradient(145deg, var(--tile-hi), var(--tile));
  color: var(--tile-ink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.74), inset 0 -3px 0 rgba(156, 105, 35, 0.22), 0 2px 0 var(--tile-shadow);
  font-size: clamp(0.76rem, 2.9vw, 1rem);
  font-weight: 950;
  line-height: 1;
}

.icon-button {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  padding: 0;
  font-size: 1.4rem;
  font-weight: 900;
}

.icon-button svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.board-zone {
  position: relative;
  z-index: 1;
  isolation: isolate;
  max-width: var(--board-column);
  margin: 0 auto;
}

.score-pill,
.turn-pill {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.84);
  padding: 0 9px;
  height: 42px;
  min-width: 42px;
}

.score-pill strong,
.turn-pill span {
  color: var(--accent-strong);
  font-size: 1rem;
  font-weight: 950;
}

.board-scroller {
  overflow: auto;
  overscroll-behavior-x: contain;
  overscroll-behavior-y: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  height: min(var(--board-viewport-height), 760px);
  padding: 6px;
  touch-action: none;
  user-select: none;
  cursor: grab;
}

body.is-rack-entry .board-scroller,
body.is-word-entry .board-scroller {
  height: min(44dvh, calc(100vw - 18px), 500px);
}

body.is-keyboard-focus .desktop-suggestion-strip,
body.is-keyboard-focus .mobile-suggestion-strip {
  display: none;
}

body.is-keyboard-focus .board-scroller {
  height: min(30dvh, calc(100vw - 18px), 320px);
}

.board-scroller::-webkit-scrollbar,
.moves::-webkit-scrollbar,
.rack-tiles::-webkit-scrollbar,
.letter-palette::-webkit-scrollbar,
.score-tiles::-webkit-scrollbar {
  display: none;
}

.board-scroller:active {
  cursor: grabbing;
}

.board {
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--board-size, 15), minmax(0, 1fr));
  width: min(680px, max(calc(100vw - 20px), calc(var(--board-viewport-height) - 14px)));
  min-width: 0;
  aspect-ratio: 1;
  margin: 0 auto;
  border: 2px solid #526055;
  background: #526055;
  gap: 1px;
}

.board.entry-reminder {
  box-shadow: 0 0 0 4px rgba(35, 111, 92, 0.1), 0 0 22px rgba(35, 111, 92, 0.12);
}

.board.entry-reminder-pop {
  animation: board-entry-pop 0.86s ease;
}

@keyframes board-entry-pop {
  0%,
  100% {
    box-shadow: 0 0 0 4px rgba(35, 111, 92, 0.1), 0 0 22px rgba(35, 111, 92, 0.12);
  }

  45% {
    box-shadow: 0 0 0 8px rgba(54, 184, 133, 0.22), 0 0 34px rgba(54, 184, 133, 0.22);
  }
}

.settings-sheet[hidden],
.word-detail-sheet[hidden],
.app-modal-sheet[hidden] {
  display: none;
}

.settings-sheet,
.word-detail-sheet,
.app-modal-sheet {
  position: fixed;
  z-index: 40;
  inset: 0;
  display: grid;
  place-items: end center;
  background: rgba(23, 34, 28, 0.32);
  padding: 16px 10px max(16px, env(safe-area-inset-bottom));
}

.word-detail-sheet {
  z-index: 42;
}

.app-modal-sheet {
  z-index: 50;
  place-items: start center;
  overflow: auto;
  padding: max(8px, env(safe-area-inset-top)) 8px max(8px, env(safe-area-inset-bottom));
}

.sheet-card,
.word-detail-card,
.app-modal-card {
  width: min(100%, 460px);
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 18px 48px rgba(23, 34, 28, 0.24);
  padding: 14px;
}

.app-modal-card {
  max-height: calc(100dvh - 16px);
  overflow: auto;
  border-radius: 16px;
  padding: 12px;
}

.welcome-card,
.consent-card {
  text-align: center;
}

.consent-card {
  display: flex;
  flex-direction: column;
}

.welcome-card {
  padding: 10px;
}

.app-modal-card h2 {
  margin: 5px 0 4px;
  font-size: 0.95rem;
  line-height: 1.12;
}

.app-modal-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 650;
  line-height: 1.3;
}

.modal-logo {
  display: inline-flex;
  gap: 3px;
  margin-bottom: 8px;
}

.modal-logo span,
.consent-icon,
.consent-brand span {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid #c8943c;
  border-radius: 9px;
  background: linear-gradient(145deg, var(--tile-hi), var(--tile));
  color: var(--tile-ink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.74), inset 0 -4px 0 rgba(156, 105, 35, 0.2), 0 2px 0 var(--tile-shadow);
  font-weight: 950;
}

.consent-brand {
  display: inline-flex;
  gap: 2px;
  align-items: center;
  justify-content: center;
  margin: 0 auto 3px;
}

.welcome-brand {
  margin-top: 4px;
}

.site-domain {
  margin: 4px 0 2px;
  color: var(--accent-strong);
  font-size: 0.72rem;
  font-weight: 950;
  letter-spacing: 0;
}

.consent-brand span {
  position: relative;
  width: clamp(22px, 6.4vw, 32px);
  height: clamp(22px, 6.4vw, 32px);
  border-radius: 7px;
  font-size: clamp(0.78rem, 3.2vw, 1.05rem);
  line-height: 1;
  transform-origin: 50% 65%;
  overflow: hidden;
}

.welcome-brand span::after {
  position: absolute;
  inset: -40%;
  content: "";
  background: linear-gradient(115deg, transparent 34%, rgba(255, 255, 255, 0.9) 48%, transparent 62%);
  opacity: 0;
  transform: translateX(-80%) rotate(8deg);
}

.welcome-brand.is-animating span {
  animation: welcome-tile-ripple 0.62s cubic-bezier(0.18, 0.86, 0.24, 1) both;
}

.welcome-brand.is-animating span::after {
  animation: welcome-tile-flare 0.48s ease-out both;
  animation-delay: inherit;
}

.consent-brand span:nth-child(1) {
  animation-delay: 180ms;
  rotate: -5deg;
  translate: 0 2px;
}

.consent-brand span:nth-child(2) {
  animation-delay: 255ms;
  rotate: 3deg;
  translate: 0 -1px;
}

.consent-brand span:nth-child(3) {
  animation-delay: 330ms;
  rotate: -2deg;
  translate: 0 1px;
}

.consent-brand span:nth-child(4) {
  animation-delay: 405ms;
  rotate: 4deg;
  translate: 0 -2px;
}

.consent-brand span:nth-child(5) {
  animation-delay: 480ms;
  rotate: -3deg;
  translate: 0 1px;
}

.consent-brand span:nth-child(6) {
  animation-delay: 555ms;
  rotate: 2deg;
  translate: 0 -1px;
}

.consent-brand span:nth-child(7) {
  animation-delay: 630ms;
  rotate: -4deg;
  translate: 0 2px;
}

.consent-brand span:nth-child(8) {
  animation-delay: 705ms;
  rotate: 3deg;
  translate: 0 -1px;
}

.consent-brand span:nth-child(9) {
  animation-delay: 780ms;
  rotate: -2deg;
  translate: 0 1px;
}

@keyframes welcome-tile-ripple {
  0%,
  100% {
    transform: translateY(0) scale(1);
  }

  34% {
    transform: translateY(-8px) scale(1.12);
  }

  64% {
    transform: translateY(1px) scale(0.98);
  }
}

@keyframes welcome-tile-flare {
  0% {
    opacity: 0;
    transform: translateX(-80%) rotate(8deg);
  }

  42% {
    opacity: 0.72;
  }

  100% {
    opacity: 0;
    transform: translateX(80%) rotate(8deg);
  }
}

.welcome-setup {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 8px 0;
  text-align: left;
}

.welcome-setup label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 950;
  text-transform: uppercase;
}

.welcome-setup select {
  min-width: 0;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 8px;
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: none;
}

.consent-icon {
  margin: 0 auto 10px;
  border-color: rgba(35, 111, 92, 0.22);
  background: #d9f3ec;
  color: var(--accent);
  font-size: 1.6rem;
  box-shadow: none;
}

.how-to-grid,
.consent-options {
  display: grid;
  gap: 6px;
  margin: 8px 0;
  text-align: left;
}

.how-to-grid div,
.consent-option,
.privacy-details {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(246, 247, 243, 0.72);
  padding: 7px;
}

.welcome-steps div {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

.welcome-steps strong {
  position: relative;
  width: 26px;
  height: 26px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  align-self: center;
  border-radius: 999px;
  background: var(--accent);
  color: transparent;
  font-size: 0;
  line-height: 1;
  overflow: visible;
}

.welcome-steps strong::before {
  content: attr(data-step);
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 0.8rem;
  line-height: 1;
}

.welcome-steps span {
  margin-top: 0;
}

.welcome-purpose {
  display: grid;
  gap: 6px;
  margin: 8px 0;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(246, 247, 243, 0.72);
  color: var(--muted);
  text-align: center;
}

.welcome-purpose p {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1.34;
}

.welcome-purpose p:first-child {
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 950;
}

.how-to-grid strong,
.consent-option strong {
  display: block;
  font-size: 0.74rem;
  font-weight: 950;
}

.how-to-grid span,
.consent-option small,
.privacy-details p {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 700;
  line-height: 1.28;
}

.how-to-grid.welcome-steps strong {
  position: relative;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  align-self: center;
  margin: 0;
  border-radius: 999px;
  background: var(--accent);
  color: transparent;
  font-size: 0;
  line-height: 1;
  overflow: hidden;
}

.how-to-grid.welcome-steps strong::before {
  content: attr(data-step);
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 0.82rem;
  font-weight: 950;
  line-height: 1;
}

.consent-option {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.consent-option input {
  width: 24px;
  height: 24px;
  accent-color: var(--accent);
}

:root[data-native-app="ios"] .tracking-consent,
:root[data-native-app="ios"] #acceptConsentButton,
:root[data-native-app="ios"] #rejectConsentButton,
:root[data-native-app="ios"] .remove-ads-link,
:root[data-native-app="ios"] .ad-slot,
:root[data-native-app="ios"] .visitor-counter {
  display: none;
}

:root:not([data-native-app="ios"]) .native-only-action {
  display: none;
}

.consent-option input.essential-consent {
  accent-color: #c7ccc7;
}

.consent-option input.essential-consent:checked {
  filter: saturate(0.25) brightness(1.08);
}

.privacy-details {
  margin: 6px 0 0;
  text-align: left;
}

.privacy-details summary {
  color: var(--accent-strong);
  cursor: pointer;
  font-size: 0.76rem;
  font-weight: 950;
}

.pass-exchange-card h2 {
  margin: 0 0 8px;
  color: var(--accent-strong);
  font-size: 1rem;
  line-height: 1.1;
}

.pass-exchange-card p {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 760;
  line-height: 1.3;
}

.pass-exchange-card .rule-note {
  color: var(--accent-strong);
  font-size: 0.7rem;
}

.modal-actions,
.settings-actions {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

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

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

.consent-card .modal-actions {
  position: sticky;
  bottom: -12px;
  z-index: 2;
  margin: 8px -4px 0;
  padding: 6px 4px 2px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.82), #fff 22%);
}

.welcome-actions .primary-action {
  height: 44px;
  font-size: 0.95rem;
}

.secondary-action,
.settings-actions button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--accent-strong);
  font-weight: 950;
}

.native-disclaimer,
.legal-copy {
  text-align: left;
}

.native-disclaimer {
  margin: 7px 0 0;
  padding: 7px;
  border: 1px solid rgba(35, 111, 92, 0.18);
  border-radius: 8px;
  background: rgba(217, 243, 236, 0.38);
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 720;
  line-height: 1.28;
}

.legal-card {
  display: grid;
  gap: 10px;
  text-align: left;
}

.legal-header {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  justify-content: space-between;
}

.legal-header h2 {
  margin-top: 0;
}

.legal-copy {
  display: grid;
  gap: 8px;
}

.legal-copy p {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 720;
  line-height: 1.34;
}

.copyright-line {
  margin-top: 8px !important;
  color: rgba(98, 112, 102, 0.84) !important;
  font-size: 0.64rem !important;
  font-weight: 750 !important;
}

@media (max-height: 720px) {
  .app-modal-card {
    padding: 9px;
  }

  .consent-brand {
    margin-bottom: 2px;
  }

  .consent-brand span {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    font-size: 0.9rem;
  }

  .site-domain {
    font-size: 0.7rem;
  }

  .consent-card h2 {
    margin-top: 1px;
  }

  .consent-options {
    gap: 5px;
    margin: 6px 0;
  }

  .consent-option,
  .privacy-details {
    padding: 6px;
  }

  .consent-option input {
    width: 22px;
    height: 22px;
  }

  .consent-option small {
    display: none;
  }

  .consent-card .modal-actions button {
    min-height: 34px;
    font-size: 0.8rem;
  }

  .copyright-line {
    margin-top: 4px !important;
  }
}

.coach-layer {
  position: fixed;
  z-index: 45;
  inset: 0;
  pointer-events: none;
}

.coach-layer[hidden] {
  display: none;
}

.coach-panel {
  position: fixed;
  z-index: 2;
  left: 50%;
  top: max(var(--coach-panel-top, 10px), env(safe-area-inset-top));
  width: min(var(--phone-column), calc(100vw - 20px));
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  translate: -50% 0;
  border: 1px solid rgba(35, 111, 92, 0.28);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.97);
  color: var(--ink);
  padding: 10px;
  pointer-events: auto;
  box-shadow: 0 10px 30px rgba(23, 34, 28, 0.2);
}

.coach-panel h2 {
  margin: 0;
  color: var(--accent-strong);
  font-size: 0.96rem;
  font-weight: 950;
  line-height: 1.1;
}

.coach-panel p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  line-height: 1.2;
}

.coach-panel-actions {
  display: flex;
  gap: 7px;
}

.coach-skip,
.coach-next {
  min-width: 62px;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--accent-strong);
  padding: 0 10px;
  font-size: 0.82rem;
  font-weight: 950;
}

.coach-next {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.coach-card {
  position: fixed;
  left: clamp(12px, var(--coach-left, 50vw), calc(100vw - 230px));
  top: clamp(84px, var(--coach-top, 50vh), calc(100vh - 122px));
  width: min(218px, calc(100vw - 24px));
  display: grid;
  gap: 3px;
  border: 1px solid rgba(21, 78, 66, 0.14);
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  padding: 9px 10px;
  box-shadow: 0 8px 24px rgba(23, 34, 28, 0.16);
  animation: coach-bob 1.7s ease-in-out infinite;
}

.coach-card[hidden] {
  display: none;
}

.coach-card strong {
  color: var(--accent-strong);
  font-size: 0.82rem;
  font-weight: 950;
  line-height: 1.08;
}

.coach-card span:not(.coach-arrow) {
  color: var(--muted);
  font-size: 0.67rem;
  font-weight: 780;
  line-height: 1.25;
}

.coach-rack {
  animation-delay: 0.18s;
}

.coach-turn {
  animation-delay: 0.34s;
}

.coach-arrow {
  position: absolute;
  left: var(--arrow-left, 50%);
  top: var(--arrow-top, -12px);
  width: 20px;
  height: 14px;
  translate: -50% 0;
  background: #fff;
  clip-path: polygon(50% 100%, 0 0, 100% 0);
  filter: drop-shadow(0 1px 0 rgba(21, 78, 66, 0.14)) drop-shadow(0 6px 8px rgba(23, 34, 28, 0.12));
}

@keyframes coach-bob {
  0%,
  100% {
    translate: 0 0;
  }

  50% {
    translate: 0 -5px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .welcome-brand.is-animating span,
  .welcome-brand.is-animating span::after {
    animation: none;
  }

  .coach-card {
    animation: none;
  }
}

.sheet-header,
.word-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.sheet-header h2,
.word-detail-header h2 {
  margin: 0;
  font-size: 1.1rem;
}

.word-detail-header p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
}

.word-detail-body {
  display: grid;
  gap: 10px;
}

.detail-row {
  display: grid;
  gap: 3px;
}

.detail-row span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.detail-row strong {
  font-size: 0.9rem;
}

.score-tiles {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-top: 2px;
}

.score-tile {
  min-width: 43px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  padding: 6px 5px;
  text-align: center;
}

.score-new {
  border-color: var(--accent);
  background: #d9f3ec;
}

.score-tile span {
  display: block;
  font-size: 1.05rem;
  font-weight: 950;
}

.score-tile small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 850;
}

.delete-word-action[hidden] {
  display: none;
}

.delete-word-action {
  width: 100%;
  height: 38px;
  margin-top: 12px;
  border: 1px solid #c74c41;
  border-radius: 8px;
  background: #fff5f4;
  color: #9d3028;
  font-weight: 950;
}

.settings-grid {
  display: grid;
  gap: 10px;
}

.settings-grid label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.settings-grid select,
.primary-action {
  min-height: 44px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 0 10px;
  font-weight: 850;
}

.primary-action {
  margin-top: 12px;
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.cell {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  aspect-ratio: 1 / 1;
  min-width: 0;
  border: 0;
  background: var(--cell);
  color: #2e3d35;
  font-size: clamp(0.48rem, 1.2vw, 0.72rem);
  font-weight: 900;
  line-height: 1;
  text-align: center;
  padding: 0;
  overflow: visible;
  appearance: none;
}

.center-star {
  color: var(--accent-strong);
  font-size: clamp(0.82rem, 2.6vw, 1.3rem);
  font-weight: 950;
  line-height: 1;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.64);
}

.cell.double-word,
.cell.triple-word,
.cell.quadruple-word {
  background: color-mix(in srgb, var(--word) 26%, var(--cell));
}

.cell.double-letter {
  background: color-mix(in srgb, var(--double-letter) 62%, var(--cell));
}

.cell.triple-letter {
  background: color-mix(in srgb, var(--triple-letter) 54%, var(--cell));
}

.cell.quadruple-letter {
  background: color-mix(in srgb, var(--quad-letter) 42%, var(--cell));
}

.cell.triple-word {
  background: color-mix(in srgb, var(--triple-word) 45%, var(--cell));
}

.cell.quadruple-word {
  background: color-mix(in srgb, var(--quad-word) 55%, var(--cell));
}

.cell.has-tile,
.cell.placement {
  z-index: 4;
  color: var(--tile-ink);
}

.cell.suggestion-target {
  z-index: 3;
  cursor: pointer;
}

.cell.selected-suggestion-cell {
  z-index: 6;
}

.cell.hovered-suggestion-cell {
  z-index: 8;
}

.cell.selected-suggestion-cell.has-tile,
.cell.selected-suggestion-cell.placement {
  z-index: 7;
}

.cell:focus-visible {
  outline: 2px solid rgba(21, 78, 66, 0.7);
  outline-offset: -4px;
}

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

.word-outline {
  position: absolute;
  z-index: 6;
  border: 3px solid #c92828;
  border-radius: 8px;
  box-shadow: 0 3px 12px rgba(201, 40, 40, 0.18);
  pointer-events: none;
}

.word-outline::after {
  content: "✕";
  position: absolute;
  right: -8px;
  top: -10px;
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #c92828;
  color: #fff;
  font-size: 0.64rem;
  font-weight: 950;
  line-height: 1;
}

.word-outline-selected {
  border-color: rgba(21, 78, 66, 0.88);
  box-shadow: 0 0 0 3px rgba(54, 184, 133, 0.16), 0 8px 20px rgba(21, 78, 66, 0.18);
}

.word-outline-selected::after {
  content: "i";
  background: var(--accent);
}

.cell.selected-board-word-cell {
  z-index: 7;
}

.cell.selected-board-word-cell .tile {
  box-shadow: 0 0 0 3px rgba(54, 184, 133, 0.18), var(--tile-shadow);
}

.suggestion-path {
  position: absolute;
  z-index: 2;
  border: 0;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.01);
  padding: 0;
  pointer-events: auto;
}

.suggestion-path.selected,
.suggestion-path.hovered {
  z-index: 4;
  border: 2px solid rgba(21, 78, 66, 0.76);
  background: rgba(35, 111, 92, 0.06);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.7), 0 4px 14px rgba(21, 78, 66, 0.16);
}

.suggestion-path.hovered {
  z-index: 10;
  border-color: rgba(10, 125, 88, 0.92);
  background: rgba(54, 184, 133, 0.12);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.82), 0 0 0 3px rgba(54, 184, 133, 0.18), 0 8px 22px rgba(21, 78, 66, 0.22);
}

.move-preview-chip {
  position: absolute;
  z-index: 35;
  display: grid;
  grid-template-columns: auto auto;
  gap: 0 7px;
  align-items: center;
  max-width: min(76%, 250px);
  border: 1px solid rgba(35, 111, 92, 0.34);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--accent-strong);
  padding: 4px 9px;
  font-size: clamp(0.64rem, 1.5vw, 0.78rem);
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 6px 16px rgba(21, 78, 66, 0.18);
  transform: translate(-50%, -145%);
}

.move-preview-chip[data-direction="down"] {
  transform: translate(18%, -50%);
}

.move-preview-chip span,
.move-preview-chip strong,
.move-preview-chip small {
  pointer-events: none;
}

.move-preview-chip strong {
  color: var(--accent);
}

.move-preview-chip small {
  grid-column: 1 / -1;
  overflow: hidden;
  max-width: 100%;
  color: var(--muted);
  font-size: 0.56rem;
  font-weight: 800;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.move-preview-chip.hovered {
  border-color: rgba(10, 125, 88, 0.64);
  box-shadow: 0 0 0 3px rgba(54, 184, 133, 0.18), 0 8px 20px rgba(21, 78, 66, 0.2);
}

.tile {
  position: relative;
  z-index: 5;
  width: min(84%, calc(100% - 6px));
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 1px solid #c8943c;
  border-radius: 8px;
  background: linear-gradient(145deg, var(--tile-hi), var(--tile));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.74), inset 0 -4px 0 rgba(156, 105, 35, 0.2), 0 2px 0 var(--tile-shadow), 0 3px 7px rgba(42, 33, 21, 0.16);
  font-size: clamp(1rem, 3vw, 1.55rem);
  font-weight: 900;
}

.blank-tile {
  border-color: #5e43a5;
  background: linear-gradient(145deg, var(--blank-hi), var(--blank));
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.42), inset 0 -4px 0 rgba(52, 34, 103, 0.26), 0 2px 0 #513899, 0 0 0 3px rgba(131, 98, 200, 0.2), 0 0 18px rgba(131, 98, 200, 0.48);
}

.tile-letter {
  line-height: 1;
}

.tile-value,
.tile-bonus {
  position: absolute;
  line-height: 1;
  font-weight: 950;
}

.tile-value {
  right: 10%;
  bottom: 9%;
  color: rgba(42, 33, 21, 0.72);
  font-size: clamp(0.42rem, 1.1vw, 0.58rem);
}

.blank-tile .tile-value {
  color: rgba(255, 255, 255, 0.86);
}

.blank-tile::after {
  position: absolute;
  left: 50%;
  bottom: -5px;
  translate: -50% 0;
  content: "BL";
  border-radius: 999px;
  background: #f8f5ff;
  color: #5e43a5;
  padding: 1px 4px 0;
  font-size: clamp(0.34rem, 0.9vw, 0.46rem);
  font-weight: 950;
  line-height: 1.15;
  box-shadow: 0 1px 4px rgba(52, 34, 103, 0.22);
}

.tile-bonus {
  left: 50%;
  bottom: 3%;
  translate: -50% 0;
  border: 1px solid rgba(42, 33, 21, 0.14);
  border-radius: 4px;
  background: #fff;
  color: var(--accent-strong);
  padding: 1px 3px 0;
  font-size: clamp(0.34rem, 0.9vw, 0.46rem);
  letter-spacing: 0;
  box-shadow: 0 1px 4px rgba(23, 34, 28, 0.14);
}

.placement .tile {
  background: linear-gradient(145deg, #fff18d, var(--placement));
  border-color: #c4a100;
}

.ghost-placement .tile {
  opacity: 0.46;
  border-color: #9aa4d8;
  background: linear-gradient(145deg, #f2f4ff, #d6dcff);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.78), inset 0 -4px 0 rgba(82, 91, 190, 0.14), 0 2px 0 rgba(82, 91, 190, 0.36);
}

.ghost-placement .blank-tile {
  opacity: 0.78;
  border-color: #6f55b5;
  background: linear-gradient(145deg, #f4edff, #bba7ee);
  color: #3d2a78;
}

.ghost-placement:hover .tile,
.ghost-placement:focus-visible .tile {
  opacity: 0.72;
}

.selected-suggestion-cell.ghost-placement .tile,
.selected-suggestion-cell.placement .tile,
.hovered-suggestion-cell.ghost-placement .tile,
.hovered-suggestion-cell.placement .tile {
  opacity: 1;
  border-color: #c4a100;
  background: linear-gradient(145deg, #fff18d, var(--placement));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.74), inset 0 -4px 0 rgba(156, 105, 35, 0.2), 0 2px 0 var(--tile-shadow), 0 3px 7px rgba(42, 33, 21, 0.16);
}

.applying-suggestion-cell.placement .tile {
  opacity: 1;
  animation: tile-apply-drop 0.42s cubic-bezier(0.18, 0.82, 0.2, 1) both;
}

.applying-suggestion-cell.placement:nth-child(2n) .tile {
  animation-delay: 0.025s;
}

.applying-suggestion-cell.placement:nth-child(3n) .tile {
  animation-delay: 0.05s;
}

@keyframes tile-apply-drop {
  0% {
    filter: saturate(1.08);
    transform: translateY(-18%) scale(1.08) rotate(-1deg);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8), inset 0 -4px 0 rgba(156, 105, 35, 0.2), 0 12px 18px rgba(42, 33, 21, 0.28);
  }

  62% {
    transform: translateY(4%) scale(0.98) rotate(0.4deg);
  }

  100% {
    filter: saturate(1);
    transform: translateY(0) scale(1) rotate(0);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.74), inset 0 -4px 0 rgba(156, 105, 35, 0.2), 0 2px 0 var(--tile-shadow), 0 3px 7px rgba(42, 33, 21, 0.16);
  }
}

.selected-suggestion-cell.ghost-placement .blank-tile,
.selected-suggestion-cell.placement .blank-tile,
.placement .blank-tile {
  border-color: #5e43a5;
  background: linear-gradient(145deg, var(--blank-hi), var(--blank));
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.42), inset 0 -4px 0 rgba(52, 34, 103, 0.26), 0 2px 0 #513899, 0 0 0 3px rgba(131, 98, 200, 0.24), 0 0 20px rgba(131, 98, 200, 0.52);
}

.draft-tile .tile {
  opacity: 0.76;
  background: linear-gradient(145deg, #f8fbf6, #e9efe5);
  border-color: #8fa096;
  color: rgba(23, 34, 28, 0.72);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.82), inset 0 -4px 0 rgba(98, 112, 102, 0.1), 0 0 0 2px rgba(35, 111, 92, 0.14), 0 2px 0 #b5c0b6;
}

.draft-start .tile {
  outline: 3px solid rgba(35, 111, 92, 0.32);
  outline-offset: 1px;
}

.pending-tile .tile {
  background: linear-gradient(145deg, #effff9, #d9f3ec);
  border-color: var(--accent);
}

.premium-consumed .tile {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.78),
    inset 0 -4px 0 rgba(156, 105, 35, 0.2),
    0 2px 0 var(--tile-shadow),
    0 0 0 3px rgba(255, 255, 255, 0.7),
    0 0 16px rgba(35, 111, 92, 0.32);
}

.premium-consumed-double-letter .tile {
  background: linear-gradient(145deg, #fff8dc, var(--tile));
  border-color: #4f9fbe;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.78),
    inset 0 -4px 0 rgba(79, 159, 190, 0.14),
    0 2px 0 #6aa9bd,
    0 0 0 3px rgba(135, 191, 213, 0.52),
    0 0 16px rgba(79, 159, 190, 0.42);
}

.premium-consumed-triple-letter .tile {
  background: linear-gradient(145deg, #fff8dc, var(--tile));
  border-color: var(--triple-letter);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.78),
    inset 0 -4px 0 rgba(46, 140, 138, 0.14),
    0 2px 0 #5caaa3,
    0 0 0 3px rgba(46, 140, 138, 0.46),
    0 0 18px rgba(46, 140, 138, 0.42);
}

.premium-consumed-double-word .tile {
  background: linear-gradient(145deg, #fff8dc, var(--tile));
  border-color: #b86a48;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.78),
    inset 0 -4px 0 rgba(184, 74, 63, 0.13),
    0 2px 0 #c78b6d,
    0 0 0 3px rgba(184, 74, 63, 0.36),
    0 0 16px rgba(184, 74, 63, 0.38);
}

.premium-consumed-triple-word .tile {
  background: linear-gradient(145deg, #fff3d4, var(--tile));
  border-color: var(--triple-word);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.78),
    inset 0 -4px 0 rgba(221, 111, 61, 0.16),
    0 2px 0 #c98153,
    0 0 0 3px rgba(221, 111, 61, 0.42),
    0 0 18px rgba(221, 111, 61, 0.45);
}

.active-cell {
  outline: 3px solid var(--accent);
  outline-offset: -3px;
  z-index: 1;
}

.active-cell::before {
  content: "";
  position: absolute;
  inset: 4px;
  border: 2px solid rgba(255, 255, 255, 0.78);
  border-radius: 5px;
  pointer-events: none;
}

.move-badge {
  position: absolute;
  z-index: 2;
  right: 22px;
  top: 62px;
  display: none;
  max-width: min(78vw, 320px);
  border: 1px solid rgba(21, 78, 66, 0.28);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 8px 28px rgba(21, 78, 66, 0.18);
  padding: 8px 10px;
}

.move-badge.visible {
  display: block;
}

.word-chip {
  position: absolute;
  z-index: 7;
  left: 0;
  top: 0;
  translate: -50% -50%;
  border: 1px solid rgba(21, 78, 66, 0.24);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
  padding: 3px 7px;
  font-size: 0.58rem;
  font-weight: 950;
  line-height: 1;
  box-shadow: 0 4px 14px rgba(23, 34, 28, 0.12);
  backdrop-filter: blur(6px);
}

.word-chip[data-direction="across"] {
  translate: -50% -100%;
}

.word-chip[data-direction="down"] {
  translate: -50% -50%;
}

.word-chip[data-side="left"] {
  translate: -100% -50%;
}

.word-chip[data-side="right"] {
  translate: 0 -50%;
}

.word-chip-valid {
  border-color: rgba(47, 158, 100, 0.48);
  color: #16643d;
}

.word-chip-unknown {
  border-color: rgba(199, 76, 65, 0.58);
  color: #9d3028;
}

.status-mark {
  display: inline-grid;
  place-items: center;
  width: 1.05em;
  height: 1.05em;
  border-radius: 999px;
  color: #fff;
  font-size: 0.78em;
  font-weight: 950;
  line-height: 1;
  vertical-align: 0.05em;
}

.status-valid {
  background: #2f9e64;
}

.status-unknown {
  background: #c74c41;
}

.badge-word {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  font-weight: 900;
}

.badge-score {
  color: var(--accent-strong);
}

.badge-detail {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
}

.suggestion-strip {
  max-width: var(--phone-column);
  margin: 6px auto 0;
}

.desktop-suggestion-strip {
  display: none;
}

.strip-title {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
  padding: 0 2px 4px;
  text-transform: uppercase;
}

.suggestion-hint {
  min-height: 1.1rem;
  margin: -2px 2px 5px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 760;
  line-height: 1.25;
}

.suggestion-hint.is-reminder {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid rgba(35, 111, 92, 0.22);
  border-radius: 999px;
  background: rgba(217, 243, 236, 0.72);
  color: var(--accent-strong);
  padding: 4px 8px;
  cursor: pointer;
  animation: reminder-pulse 1.9s ease-in-out infinite;
}

.suggestion-hint.is-reminder::before {
  content: "•";
  display: inline-grid;
  width: 14px;
  height: 14px;
  place-items: center;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.7rem;
  line-height: 1;
  box-shadow: 0 0 0 0 rgba(35, 111, 92, 0.28);
}

.suggestion-hint.is-reminder:focus-visible {
  outline: 3px solid rgba(35, 111, 92, 0.28);
  outline-offset: 2px;
}

@keyframes reminder-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(35, 111, 92, 0.14);
  }

  50% {
    box-shadow: 0 0 0 4px rgba(35, 111, 92, 0.08);
  }
}

.moves {
  display: flex;
  gap: 8px;
  margin: 0;
  padding: 0 0 4px;
  list-style: none;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.move {
  min-width: 132px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 7px;
  text-align: left;
  transform: translateY(0) scale(1);
  transform-origin: center;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease, background 0.16s ease;
}

.move.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(35, 111, 92, 0.16);
}

.move:hover,
.move:focus-visible {
  border-color: rgba(10, 125, 88, 0.74);
  background: linear-gradient(180deg, #fff, #f4fffa);
  box-shadow: 0 0 0 3px rgba(54, 184, 133, 0.16), 0 8px 22px rgba(21, 78, 66, 0.14);
  transform: translateY(-2px) scale(1.025);
}

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

.move.uses-blank {
  border-color: rgba(94, 67, 165, 0.44);
  background: linear-gradient(180deg, #fff, #faf7ff);
}

.move-main {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: baseline;
}

.move-word {
  display: inline-flex;
  gap: 1px;
  align-items: baseline;
  font-weight: 900;
}

.move-letter {
  display: inline-block;
  min-width: 0.62em;
  text-align: center;
}

.move-letter-board,
.move-letter-blank {
  border-radius: 5px;
  padding: 0 2px;
}

.move-letter-board {
  background: rgba(46, 191, 132, 0.16);
  color: #067449;
  box-shadow: inset 0 -1px 0 rgba(6, 116, 73, 0.28);
}

.move-letter-blank {
  background: rgba(131, 98, 200, 0.16);
  color: #5e43a5;
  box-shadow: inset 0 -1px 0 rgba(94, 67, 165, 0.28);
}

.move-score {
  color: var(--accent-strong);
  font-weight: 900;
}

.move-detail {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 750;
}

.move-definition {
  display: -webkit-box;
  margin-top: 6px;
  overflow: hidden;
  color: var(--accent-strong);
  font-size: 0.68rem;
  font-weight: 760;
  line-height: 1.22;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.blank-use {
  width: fit-content;
  margin-top: 5px;
  border: 1px solid rgba(94, 67, 165, 0.22);
  border-radius: 999px;
  background: #f1ebff;
  color: #5e43a5;
  padding: 2px 6px;
  font-size: 0.62rem;
  font-weight: 950;
  line-height: 1.1;
}

.rack-dock {
  position: fixed;
  z-index: 30;
  left: 0;
  right: 0;
  bottom: var(--keyboard-bottom);
  max-height: min(58dvh, 430px);
  overflow-x: hidden;
  overflow-y: auto;
  border-top: 1px solid var(--line);
  background: rgba(246, 247, 243, 0.96);
  backdrop-filter: blur(12px);
  padding: 8px 8px max(8px, env(safe-area-inset-bottom));
  box-shadow: 0 -12px 34px rgba(23, 34, 28, 0.12);
}

body.is-rack-entry .mobile-suggestion-strip,
body.is-word-entry .mobile-suggestion-strip {
  display: none;
}

body.is-rack-entry .rack-dock {
  max-height: min(52dvh, 350px);
}

body.is-word-entry .rack-dock {
  max-height: min(64dvh, 420px);
}

body.is-word-entry .rack-row {
  opacity: 0.54;
}

body.is-word-entry .rack-tiles {
  pointer-events: none;
}

body.is-keyboard-focus .rack-row,
body.is-keyboard-focus .opponent-entry-note,
body.is-keyboard-focus .turn-actions,
body.is-keyboard-focus #clearCellButton {
  display: none;
}

body.is-keyboard-focus .letter-picker {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

body.is-keyboard-focus .rack-dock {
  max-height: min(24dvh, 172px);
  padding-top: 6px;
}

body.is-keyboard-focus .picker-header {
  grid-template-columns: minmax(0, 1fr) 64px 76px;
  margin-bottom: 5px;
}

body.is-keyboard-focus .picker-header span {
  overflow: hidden;
  font-size: 0.62rem;
  white-space: nowrap;
  text-overflow: ellipsis;
}

body.is-keyboard-focus .picker-header button {
  height: 28px;
  min-width: 64px;
  width: 100%;
  font-size: 0.68rem;
}

body.is-keyboard-focus .word-entry {
  grid-template-columns: 84px minmax(0, 1fr) 70px;
  gap: 5px;
}

body.is-keyboard-focus .direction-toggle {
  grid-column: auto;
  gap: 4px;
}

body.is-keyboard-focus .direction-toggle button {
  min-width: 0;
  height: 34px;
  padding: 0;
  font-size: 0;
}

body.is-keyboard-focus .direction-toggle button span {
  font-size: 1rem;
}

body.is-keyboard-focus .word-input-wrap,
body.is-keyboard-focus #placeWordButton {
  height: 34px;
}

body.is-keyboard-focus #placeWordButton {
  padding: 0 6px;
  font-size: 0.78rem;
}

@media (max-width: 919px) {
  .mobile-suggestion-strip {
    position: fixed;
    z-index: 29;
    right: 8px;
    bottom: calc(var(--rack-dock-height) + max(7px, env(safe-area-inset-bottom)));
    left: 8px;
    max-width: var(--phone-column);
    margin: 0 auto;
    border: 1px solid rgba(203, 213, 204, 0.86);
    border-radius: 9px;
    background: rgba(246, 247, 243, 0.97);
    padding: 7px 8px;
    box-shadow: 0 10px 26px rgba(23, 34, 28, 0.1);
    backdrop-filter: blur(12px);
  }

  .mobile-suggestion-strip .suggestion-hint {
    display: -webkit-box;
    min-height: 0;
    margin-bottom: 0;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .mobile-suggestion-strip .moves:empty {
    display: none;
  }

  body.is-rack-entry .mobile-suggestion-strip,
  body.is-word-entry .mobile-suggestion-strip,
  body.is-keyboard-focus .mobile-suggestion-strip {
    display: none;
  }

  body.is-word-entry:not(.is-keyboard-focus) .play-screen {
    padding-bottom: calc(var(--rack-dock-height) + 8px);
  }

  body.is-word-entry:not(.is-keyboard-focus) .rack-dock {
    position: fixed;
    right: 0;
    left: 0;
    bottom: var(--keyboard-bottom);
    max-width: none;
    max-height: min(38dvh, 260px);
    margin: 0;
    border: 0;
    border-top: 1px solid var(--line);
    border-radius: 0;
    box-shadow: 0 -12px 34px rgba(23, 34, 28, 0.12);
  }

  body.is-word-entry:not(.is-keyboard-focus) .board-scroller {
    height: calc(var(--app-vh) - var(--rack-dock-height) - 10px);
  }

  body.is-word-entry:not(.is-keyboard-focus) .board {
    width: min(max(calc(100vw - 20px), calc(var(--app-vh) - var(--rack-dock-height) - 24px)), 1100px);
  }

  body.is-word-entry:not(.is-keyboard-focus) .letter-picker {
    max-width: var(--phone-column);
    margin-right: auto;
    margin-left: auto;
  }

  body.is-word-entry:not(.is-keyboard-focus) .rack-row,
  body.is-word-entry:not(.is-keyboard-focus) .turn-actions,
  body.is-word-entry:not(.is-keyboard-focus) .opponent-entry-note,
  body.is-word-entry:not(.is-keyboard-focus) #clearCellButton {
    display: none;
  }

  body.is-word-entry:not(.is-keyboard-focus) .letter-picker {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
  }

  body.is-word-entry:not(.is-keyboard-focus) .picker-header {
    grid-template-columns: minmax(0, 1fr) 78px;
  }

  body.is-word-entry:not(.is-keyboard-focus) .picker-header span {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  body.is-word-entry:not(.is-keyboard-focus) .word-entry {
    grid-template-columns: 92px minmax(0, 1fr) 72px;
    gap: 6px;
  }

  body.is-word-entry:not(.is-keyboard-focus) #placeWordButton {
    padding: 0 5px;
    font-size: 0.8rem;
  }

  body.is-word-entry:not(.is-keyboard-focus) .direction-toggle {
    grid-column: auto;
    gap: 5px;
  }

  body.is-word-entry:not(.is-keyboard-focus) .direction-toggle button {
    min-width: 0;
    padding: 0;
    font-size: 0;
  }

  body.is-word-entry:not(.is-keyboard-focus) .direction-toggle button span {
    font-size: 1.08rem;
  }
}

.rack-row,
.paint-row {
  max-width: var(--phone-column);
  margin: 0 auto;
}

.rack-row {
  max-width: var(--phone-column);
}

.dock-label {
  display: block;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 900;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.rack-tiles,
.letter-palette {
  display: flex;
  gap: 5px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.rack-tile,
.palette-tile,
.selected-paint button {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  position: relative;
  display: grid;
  place-items: center;
  border: 1px solid #c8943c;
  border-radius: 8px;
  background: linear-gradient(145deg, var(--tile-hi), var(--tile));
  color: var(--tile-ink);
  font-weight: 950;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72), inset 0 -4px 0 rgba(156, 105, 35, 0.2), 0 2px 0 var(--tile-shadow);
}

.rack-letter {
  line-height: 1;
}

.rack-value {
  position: absolute;
  right: 4px;
  bottom: 3px;
  color: rgba(42, 33, 21, 0.72);
  font-size: 0.48rem;
  line-height: 1;
}

.rack-blank {
  border-color: #bdaee8;
  background: linear-gradient(145deg, #f8f5ff, #eee8ff);
  color: #5e43a5;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.82), inset 0 -4px 0 rgba(94, 67, 165, 0.12), 0 2px 0 #c9bce9;
}

.rack-blank .rack-value {
  color: #6f55b5;
}

.rack-tile {
  touch-action: none;
}

.rack-tile.empty {
  border-color: var(--line);
  background: #fff;
  color: var(--muted);
  box-shadow: none;
}

.rack-tiles.refill-reminder .rack-tile.empty:first-of-type {
  border-color: var(--accent);
  background: #f8fffc;
  box-shadow: 0 0 0 3px rgba(54, 184, 133, 0.14), 0 0 18px rgba(54, 184, 133, 0.18);
  animation: reminder-tile-glow 1.6s ease-in-out infinite;
}

@keyframes reminder-tile-glow {
  0%,
  100% {
    box-shadow: 0 0 0 2px rgba(54, 184, 133, 0.1), 0 0 10px rgba(54, 184, 133, 0.14);
  }

  50% {
    box-shadow: 0 0 0 4px rgba(54, 184, 133, 0.18), 0 0 22px rgba(54, 184, 133, 0.24);
  }
}

.turn-actions {
  width: min(100%, var(--phone-column));
  display: grid;
  grid-template-columns: 40px minmax(54px, 0.62fr) minmax(56px, 0.68fr) minmax(52px, 0.56fr) minmax(84px, 1fr);
  gap: 5px;
  margin: 8px auto 0;
}

.dock-settings {
  width: 40px;
  height: 40px;
  border-radius: 8px;
}

.dock-settings svg {
  width: 21px;
  height: 21px;
}

.clear-suggestion,
.undo-action,
.pass-action,
.finish-action {
  min-height: 40px;
  min-width: 0;
  width: 100%;
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 0 6px;
  font-size: 0.76rem;
  font-weight: 900;
}

.clear-suggestion {
  background: var(--surface);
  color: var(--accent-strong);
}

.undo-action {
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink);
}

.pass-action {
  border-color: var(--line);
  background: #fff;
  color: var(--accent-strong);
}

.pass-action[hidden] {
  display: none;
}

.finish-action {
  background: var(--accent);
  color: #fff;
}

.finish-action.is-solving {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
}

.finish-action.is-solving::before {
  width: 14px;
  height: 14px;
  content: "";
  border: 2px solid rgba(98, 112, 102, 0.35);
  border-top-color: var(--accent-strong);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.clear-suggestion:disabled,
.undo-action:disabled,
.pass-action:disabled,
.finish-action:disabled {
  border-color: var(--line);
  background: #e7ece7;
  color: var(--muted);
  cursor: default;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.rack-picker {
  width: min(100%, var(--phone-column));
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
  margin: 8px auto 0;
  max-height: min(32vh, 228px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 2px;
  padding-bottom: max(4px, env(safe-area-inset-bottom));
}

.rack-picker[hidden] {
  display: none;
}

.rack-picker-tile {
  min-height: 36px;
  border: 1px solid #c8943c;
  border-radius: 7px;
  background: linear-gradient(145deg, var(--tile-hi), var(--tile));
  color: var(--tile-ink);
  padding: 0;
  font-size: 0.82rem;
  font-weight: 950;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72), inset 0 -3px 0 rgba(156, 105, 35, 0.18);
}

.rack-picker-blank {
  border-color: #bdaee8;
  background: linear-gradient(145deg, #f8f5ff, #eee8ff);
  color: #5e43a5;
}

.rack-picker-tile:disabled {
  border-color: var(--line);
  background: #e7ece7;
  color: var(--muted);
  box-shadow: none;
  cursor: default;
}

.palette-tile {
  border-color: var(--line);
  background: #fff;
  box-shadow: none;
}

.palette-tile.selected {
  border-color: var(--accent);
  background: var(--placement);
  box-shadow: 0 0 0 2px rgba(35, 111, 92, 0.16);
}

.letter-picker[hidden] {
  display: none;
}

.letter-picker {
  max-width: var(--phone-column);
  margin: 8px auto 0;
  overflow: hidden;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.opponent-entry-note {
  display: grid;
  gap: 2px;
  margin-bottom: 7px;
  border: 1px solid rgba(35, 111, 92, 0.16);
  border-radius: 8px;
  background: rgba(246, 247, 243, 0.88);
  padding: 7px 8px;
}

.opponent-entry-note strong {
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 950;
  line-height: 1.1;
}

.opponent-entry-note span {
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 760;
  line-height: 1.25;
}

.picker-header {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 7px;
  align-items: center;
  margin-bottom: 7px;
}

.picker-header span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.picker-header button {
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  padding: 0 8px;
  font-size: 0.74rem;
  font-weight: 900;
}

.picker-header button:disabled {
  color: var(--muted);
  opacity: 0.55;
}

.word-entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 7px;
  align-items: stretch;
}

.direction-toggle {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
}

.direction-toggle button,
.word-input-wrap,
#placeWordButton {
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 8px;
  font-weight: 900;
}

.direction-toggle button {
  display: inline-flex;
  position: relative;
  overflow: hidden;
  gap: 6px;
  align-items: center;
  justify-content: center;
  transition: background 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease, color 0.14s ease;
}

.direction-toggle button span {
  color: var(--accent-strong);
  font-size: 1rem;
  line-height: 1;
}

.direction-toggle button.selected {
  border-color: var(--accent);
  background: #d9f3ec;
  color: var(--accent-strong);
  box-shadow: inset 0 0 0 1px rgba(35, 111, 92, 0.28), 0 0 0 2px rgba(35, 111, 92, 0.12);
}

.direction-toggle button.selected::after {
  content: "";
  position: absolute;
  inset: auto 10px 5px;
  height: 3px;
  border-radius: 999px;
  background: var(--accent);
}

.word-input-wrap {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0 6px 0 8px;
  border-color: rgba(35, 111, 92, 0.48);
  border-width: 2px;
  background: #fff;
}

.word-input-wrap:focus-within {
  outline: 2px solid rgba(35, 111, 92, 0.22);
  outline-offset: 2px;
  animation: entry-focus-pulse 1.4s ease-in-out infinite;
}

@keyframes entry-focus-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(35, 111, 92, 0.18), 0 0 0 0 rgba(221, 158, 0, 0);
  }

  50% {
    box-shadow: 0 0 0 4px rgba(35, 111, 92, 0.12), 0 0 18px rgba(221, 158, 0, 0.28);
  }
}

.word-entry-prefix {
  min-width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(98, 112, 102, 0.28);
  border-radius: 7px;
  background: #e8ece5;
  color: rgba(23, 34, 28, 0.62);
  font-size: 0.82rem;
  font-weight: 950;
  line-height: 1;
}

.word-entry-feedback {
  min-width: 52px;
  flex: 0 0 auto;
  max-width: 88px;
  height: 22px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  margin-left: auto;
  padding: 0 6px;
  font-size: 0.74rem;
  font-weight: 950;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.word-entry-feedback.valid {
  background: #d9f3ec;
  color: var(--accent-strong);
}

.word-entry-feedback.invalid {
  background: #f8dddd;
  color: #b12b2b;
  animation: invalid-nudge 0.42s ease;
}

.word-entry-feedback[hidden] {
  visibility: hidden;
  display: inline-grid;
}

.word-entry input {
  min-width: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: transparent;
  color: var(--ink);
  padding: 0;
  text-transform: uppercase;
}

.word-entry input:focus {
  outline: none;
}

.word-entry input::placeholder {
  color: rgba(98, 112, 102, 0.7);
  text-transform: none;
}

#placeWordButton {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

#placeWordButton:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

@keyframes invalid-nudge {
  0%,
  100% {
    translate: 0 0;
  }

  30% {
    translate: -2px 0;
  }

  60% {
    translate: 2px 0;
  }
}

@media (min-width: 920px) {
  .play-screen {
    padding-top: 0;
    padding-bottom: 178px;
  }

  .ad-slot {
    display: none;
  }

  .ad-placeholder {
    width: 100%;
  }

  .board {
    width: min(820px, calc(100vw - 96px), calc(100dvh - 148px));
    min-width: 0;
  }

  body.is-keyboard-focus .rack-row {
    display: block;
  }

  body.is-keyboard-focus .opponent-entry-note {
    display: grid;
  }

  body.is-keyboard-focus .turn-actions {
    display: grid;
  }

  body.is-keyboard-focus #clearCellButton {
    display: inline-block;
  }

  body.is-keyboard-focus .mobile-suggestion-strip {
    display: block;
  }

  body.is-keyboard-focus .letter-picker {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--line);
  }

  body.is-keyboard-focus .rack-dock {
    max-height: min(58dvh, 430px);
  }
}

@media (min-width: 1120px) {
  .play-screen {
    width: min(100%, 1680px);
    min-height: 100dvh;
    display: grid;
    grid-template-columns: minmax(190px, 280px) minmax(620px, 1fr) minmax(190px, 280px);
    grid-template-areas:
      "left board right";
    gap: 10px 12px;
    align-items: start;
    margin: 0 auto;
    padding-right: 14px;
    padding-bottom: 148px;
    padding-left: 14px;
  }

  .remove-ads-link {
    grid-column: 1 / -1;
  }

  .board-zone {
    grid-area: board;
    width: 100%;
    max-width: none;
    margin: 0;
  }

  .board-scroller {
    height: min(calc(100dvh - 128px), calc(100vw - 420px), 1100px);
    padding: 6px;
  }

  body.is-rack-entry .board-scroller,
  body.is-word-entry .board-scroller,
  body.is-keyboard-focus .board-scroller {
    height: min(calc(100dvh - 128px), calc(100vw - 420px), 1100px);
  }

  body.is-keyboard-focus .desktop-suggestion-strip {
    display: block;
  }

  .board {
    width: min(100%, calc(100dvh - 142px));
  }

  .mobile-suggestion-strip {
    display: none;
  }

  .desktop-suggestion-strip {
    position: sticky;
    top: 8px;
    display: block;
    min-width: 0;
    max-height: calc(100dvh - 166px);
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.82);
    padding: 8px;
    box-shadow: 0 10px 30px rgba(23, 34, 28, 0.08);
  }

  .desktop-suggestion-left {
    grid-area: left;
  }

  .desktop-suggestion-right {
    grid-area: right;
  }

  .desktop-suggestion-strip .moves {
    display: grid;
    gap: 8px;
    max-height: calc(100dvh - 220px);
    overflow-x: hidden;
    overflow-y: auto;
    padding: 0 2px 4px;
  }

  .desktop-suggestion-strip .move {
    width: 100%;
    min-width: 0;
  }

  .rack-dock {
    padding-top: 8px;
    padding-bottom: max(8px, env(safe-area-inset-bottom));
  }
}
