:root {
  color-scheme: light;
  --ink: #17201d;
  --muted: #65716c;
  --paper: #ebe9e2;
  --panel: #f7f7f4;
  --line: #b7b9b2;
  --board: #68746a;
  --tile: #eef2ec;
  --starter: #2d756f;
  --letter2: #a7ddb0;
  --letter3: #2f8a52;
  --word2: #b87333;
  --word3: #a9442f;
  --good: #2abf6b;
  --bad: #ef5d5d;
  --steel-dark: #59625f;
  --steel-mid: #a9aca6;
  --steel-light: #f6f6f1;
  --gold-light: #fff3bf;
  --gold-mid: #e2bd62;
  --gold-dark: #9c7831;
  --bronze-light: #eec88e;
  --bronze-mid: #b68145;
  --bronze-dark: #74502b;
  --copper-light: #ffb29a;
  --copper-mid: #b94f37;
  --copper-dark: #5b2119;
  --shadow: 0 14px 38px rgba(23, 32, 29, 0.18);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.58), transparent 34%),
    radial-gradient(circle at 50% -8%, rgba(255, 255, 255, 0.78), transparent 34%),
    linear-gradient(180deg, #f3f1ea 0%, var(--paper) 100%);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

button {
  border: 1px solid #303936;
  background:
    linear-gradient(180deg, #4d5753 0%, #17201d 54%, #050807 100%);
  color: white;
  min-height: 42px;
  border-radius: 6px;
  padding: 0 16px;
  cursor: pointer;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.34),
    inset 0 -2px 0 rgba(0, 0, 0, 0.36),
    0 3px 7px rgba(23, 32, 29, 0.16);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(190px, 0.55fr) minmax(320px, 1fr);
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 6px clamp(10px, 3vw, 30px) 3px;
  border-bottom: 1px solid rgba(84, 89, 84, 0.28);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(226, 225, 217, 0.58)),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.16) 0 1px, transparent 1px 5px);
  position: static;
  top: 0;
  z-index: 5;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(1.15rem, 2.4vw, 1.65rem);
  line-height: 1.05;
}

.topbar p,
.trayHeader span {
  color: var(--muted);
  margin-top: 2px;
  font-size: 0.82rem;
}

.timerPanel {
  display: grid;
  align-content: center;
  justify-items: center;
  text-align: center;
}

.timerPanel span {
  display: block;
  color: var(--muted);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.timerPanel strong {
  display: block;
  color: var(--starter);
  font-size: clamp(1.35rem, 3.4vw, 2.05rem);
  line-height: 0.95;
}

.scorePanel {
  display: grid;
  grid-template-columns: 0.9fr repeat(3, minmax(0, 1fr));
  gap: 6px;
  align-items: center;
}

.boardScores {
  width: min(620px, 100%);
  justify-self: auto;
  margin: 0 auto 4px;
  padding: 3px 7px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.9) 0%, rgba(207, 209, 201, 0.78) 48%, rgba(246, 246, 242, 0.84) 100%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.16) 0 1px, transparent 1px 6px);
  border: 1px solid rgba(87, 92, 87, 0.42);
  border-radius: 8px;
  text-align: center;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.72),
    inset 0 -1px 0 rgba(0, 0, 0, 0.08),
    0 6px 14px rgba(23, 32, 29, 0.09);
}

.scoreMetric span {
  display: block;
  color: var(--muted);
  font-size: 0.56rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.scoreMetric {
  display: grid;
  align-content: center;
  justify-items: center;
  min-height: 40px;
}

.scoreMetric strong {
  display: block;
  font-size: clamp(0.98rem, 2.35vw, 1.42rem);
  line-height: 1;
}

.appShell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 24px;
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 0 clamp(10px, 2vw, 22px) 22px;
}

.gameArea {
  min-width: 0;
}

.desktopAd,
.leaderboard,
.wordTray {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(222, 223, 216, 0.72)),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.14) 0 1px, transparent 1px 6px);
  border: 1px solid rgba(93, 98, 93, 0.32);
  border-radius: 8px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.68),
    0 8px 20px rgba(23, 32, 29, 0.08);
}

.adSlot {
  min-height: 58px;
  display: grid;
  place-items: center;
  color: var(--muted);
  margin-bottom: 0;
}

.boardKey {
  position: absolute;
  inset: 7px;
  z-index: 4;
  display: grid;
  grid-template-columns: var(--cell) var(--cell) minmax(0, 1fr);
  justify-content: center;
  gap: 4px 8px;
  align-items: center;
  width: auto;
  max-width: none;
  margin: 0;
  align-content: center;
  padding: 34px 24px 22px;
  color: rgba(255, 255, 255, 0.94);
  font-size: clamp(1.02rem, 2.8vw, 1.48rem);
  line-height: 1.1;
  background:
    linear-gradient(180deg, rgba(98, 108, 101, 0.9), rgba(43, 55, 49, 0.88)),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.08) 0 1px, transparent 1px 7px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  box-shadow: 0 12px 26px rgba(23, 32, 29, 0.28);
  backdrop-filter: blur(6px);
}

.boardKey.closed {
  display: none;
}

.closeKeyBtn {
  position: absolute;
  top: 6px;
  right: 6px;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.42);
  background: rgba(255, 255, 255, 0.14);
  color: white;
  font-size: 0.78rem;
  border-radius: 4px;
}

.keyLine {
  display: contents;
}

.keyLineWide span:first-child {
  grid-column: 1 / 2;
}

.keyLineWide span:last-child {
  grid-column: 2 / 4;
}

.keyNote {
  grid-column: 1 / -1;
  padding-top: 8px;
  font-weight: 800;
}

.keyInstruction {
  grid-column: 1 / -1;
  color: rgba(255, 255, 255, 0.9);
  font-weight: 650;
}

.mobileOnlyInstruction {
  display: none;
}

.mobileRotateHint {
  display: none;
}

.mouseIcon,
.rotateKeyIcon {
  display: grid;
  place-items: center;
  width: var(--cell);
  height: var(--cell);
}

.mouseIcon {
  position: relative;
  border: 2px solid rgba(255, 255, 255, 0.92);
  border-radius: 999px 999px 12px 12px;
}

.mouseIcon::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 2px;
  bottom: 45%;
  border-left: 2px solid rgba(255, 255, 255, 0.75);
}

.mouseIcon::after {
  content: "";
  position: absolute;
  right: 4px;
  top: 4px;
  width: 38%;
  height: 36%;
  border-radius: 999px 999px 3px 3px;
  background: var(--word3);
}

.rotateKeyIcon {
  border: 2px solid rgba(255, 255, 255, 0.86);
  border-radius: 7px;
  background: var(--ink);
  color: white;
  font-weight: 900;
}

.keyTile {
  display: grid;
  place-items: center;
  width: var(--cell);
  height: var(--cell);
  border: 1px solid rgba(23, 32, 29, 0.34);
  border-radius: 4px;
  font-size: clamp(0.62rem, 1.75vw, 1rem);
  font-weight: 900;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.72),
    inset 0 -2px 0 rgba(23, 32, 29, 0.18),
    0 2px 4px rgba(0, 0, 0, 0.16);
}

.keyTile.starter {
  width: var(--cell);
  background: var(--starter);
  color: white;
  font-size: clamp(1.05rem, 2.8vw, 1.7rem);
}

.keyTile.dl {
  background: var(--letter2);
}

.keyTile.tl {
  background: var(--letter3);
  color: white;
}

.keyTile.dw {
  background:
    linear-gradient(135deg, rgba(255, 243, 214, 0.5) 0%, transparent 28%),
    linear-gradient(180deg, var(--bronze-light) 0%, #c99a5d 38%, var(--bronze-mid) 68%, var(--bronze-dark) 100%);
  color: #24150b;
}

.keyTile.tw {
  background:
    linear-gradient(135deg, rgba(255, 229, 218, 0.7) 0%, transparent 25%),
    linear-gradient(180deg, var(--copper-light) 0%, var(--copper-mid) 55%, var(--copper-dark) 100%);
  color: white;
}

.boardWrap {
  display: flex;
  justify-content: center;
  width: 100%;
}

.boardFrame {
  --cell: min(calc((100vw - 86px) / 15), 39px);
  position: relative;
  width: fit-content;
  max-width: 100%;
  padding: 6px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.7) 0%, transparent 22%),
    linear-gradient(180deg, #d7dad3 0%, #5d6964 7%, #88938c 25%, #45534c 54%, #1f2b27 100%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.22) 0 1px, rgba(0, 0, 0, 0.1) 1px 4px);
  border-radius: 10px;
  box-shadow:
    0 18px 42px rgba(23, 32, 29, 0.3),
    inset 0 2px 0 rgba(255, 255, 255, 0.68),
    inset 0 0 0 1px rgba(255, 255, 255, 0.18),
    inset 0 -4px 0 rgba(0, 0, 0, 0.34);
  border: 2px solid #29332f;
}

.boardStack {
  position: relative;
  width: max-content;
  max-width: 100%;
}

.board {
  display: grid;
  grid-template-columns: repeat(15, var(--cell));
  grid-template-rows: repeat(15, var(--cell));
  gap: 1px;
  background: transparent;
  touch-action: none;
}

.moveGhostLayer {
  position: absolute;
  inset: 0;
  z-index: 60;
  pointer-events: none;
  overflow: visible;
}

.moveGhostLayer[data-moving]:not([data-moving=""])::before {
  content: "moving " attr(data-moving);
  position: absolute;
  left: 4px;
  top: -24px;
  z-index: 61;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(23, 32, 29, 0.82);
  color: white;
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
}

.moveGhostTile {
  position: absolute;
  display: grid;
  place-items: center;
  z-index: 62;
  border: 2px solid rgba(23, 32, 29, 0.88);
  border-radius: 4px;
  background: linear-gradient(180deg, #f0f2ee 0%, #6f7d6c 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.5),
    inset 0 -2px 0 rgba(23, 32, 29, 0.12),
    0 0 0 3px rgba(255, 255, 255, 0.72),
    0 0 18px rgba(23, 32, 29, 0.42);
  opacity: 0.55;
  filter: grayscale(1);
}

.moveGhostTile .letter {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  font-size: clamp(0.82rem, 2.6vw, 1.22rem);
  font-weight: 900;
  color: var(--ink);
  line-height: 1;
  padding: 0 5px 5px 0;
}

.moveGhostTile .letterScore {
  position: absolute;
  right: 3px;
  bottom: 2px;
  font-size: clamp(0.54rem, 1.35vw, 0.75rem);
  font-weight: 900;
  color: rgba(23, 32, 29, 0.78);
  line-height: 1;
}

.cell {
  position: relative;
  display: grid;
  place-items: center;
  width: var(--cell);
  height: var(--cell);
  min-height: 0;
  border: 1px solid rgba(58, 71, 62, 0.5);
  border-radius: 4px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.88), transparent 38%),
    linear-gradient(180deg, #ffffff 0%, #e8ece7 34%, #cdd5ca 72%, #aeb8ad 100%);
  color: rgba(23, 32, 29, 0.7);
  padding: 0;
  overflow: hidden;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    inset 0 -2px 0 rgba(23, 32, 29, 0.18),
    inset 1px 0 0 rgba(255, 255, 255, 0.28),
    0 1px 0 rgba(255, 255, 255, 0.2);
}

.cell .bonus {
  position: absolute;
  inset: 50% 2px auto;
  transform: translateY(-50%);
  font-size: clamp(0.42rem, 1.15vw, 0.6rem);
  line-height: 1;
  font-weight: 800;
  pointer-events: none;
  text-align: center;
  color: currentColor;
}

.cell.starter .bonus {
  font-size: clamp(0.72rem, 1.8vw, 1rem);
}

.cell .letter,
.cell .previewLetter {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  font-size: clamp(0.82rem, 2.6vw, 1.22rem);
  font-weight: 900;
  color: var(--ink);
  line-height: 1;
  padding: 0 5px 5px 0;
}

.cell .letterScore,
.cell .previewScore {
  position: absolute;
  right: 3px;
  bottom: 2px;
  font-size: clamp(0.54rem, 1.35vw, 0.75rem);
  font-weight: 900;
  color: rgba(23, 32, 29, 0.78);
  line-height: 1;
}

.cell.starter {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.3), transparent 42%),
    linear-gradient(180deg, #58aaa2 0%, var(--starter) 58%, #1e4f4a 100%);
  color: white;
}

.cell.dl {
  background: linear-gradient(180deg, #dcf5df 0%, var(--letter2) 56%, #82ba8e 100%);
}

.cell.tl {
  background: linear-gradient(180deg, #53b978 0%, var(--letter3) 55%, #1f623a 100%);
  color: white;
}

.cell.dw {
  background:
    linear-gradient(135deg, rgba(255, 243, 214, 0.5) 0%, transparent 28%),
    linear-gradient(180deg, var(--bronze-light) 0%, #c99a5d 38%, var(--bronze-mid) 68%, var(--bronze-dark) 100%);
  color: #27170c;
}

.cell.tw {
  background:
    linear-gradient(135deg, rgba(255, 230, 219, 0.72) 0%, transparent 26%),
    linear-gradient(180deg, var(--copper-light) 0%, var(--copper-mid) 58%, var(--copper-dark) 100%);
  color: white;
}

.cell.previewGood,
.cell.placementGood {
  outline: 0;
  box-shadow:
    0 0 0 2px rgba(42, 191, 107, 0.88),
    0 0 14px rgba(42, 191, 107, 0.58),
    inset 0 1px 0 rgba(255, 255, 255, 0.65),
    inset 0 -2px 0 rgba(23, 32, 29, 0.09);
  z-index: 2;
}

.cell.previewBad,
.cell.placementBad {
  outline: 0;
  box-shadow:
    0 0 0 2px rgba(239, 93, 93, 0.88),
    0 0 14px rgba(239, 93, 93, 0.58),
    inset 0 1px 0 rgba(255, 255, 255, 0.65),
    inset 0 -2px 0 rgba(23, 32, 29, 0.09);
  z-index: 2;
}

.cell.ghostTile {
  box-shadow:
    0 0 0 2px rgba(77, 86, 77, 0.62),
    0 0 12px rgba(23, 32, 29, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.65),
    inset 0 -2px 0 rgba(23, 32, 29, 0.09);
  z-index: 8;
}

.cell.ghostTile .letterTile {
  z-index: 9;
  background: linear-gradient(180deg, #dfe6dc 0%, #8f9c8b 100%);
  opacity: 0.5;
  filter: grayscale(1);
}

.cell.occupied {
  color: var(--ink);
}

.cell.previewTile:not(.occupied) {
  color: var(--ink);
}

.cell.solutionTile {
  box-shadow:
    0 0 0 2px rgba(45, 128, 163, 0.88),
    0 0 14px rgba(45, 128, 163, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.65),
    inset 0 -2px 0 rgba(23, 32, 29, 0.09);
  z-index: 3;
}

.cell.occupied .bonus {
  display: none;
}

.cell.previewTile .bonus {
  display: none;
}

.cell.solutionTile .bonus {
  display: none;
}

.coveredBonus {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border: 1px solid rgba(43, 72, 39, 0.38);
  border-radius: 4px;
  font-size: clamp(0.42rem, 1.15vw, 0.6rem);
  font-weight: 900;
  line-height: 1;
  pointer-events: none;
  animation: bonusPulse 8.8s ease-in-out infinite;
  z-index: 4;
}

.coveredBonus.dl {
  background: linear-gradient(180deg, #c8eccd 0%, var(--letter2) 100%);
  color: rgba(23, 32, 29, 0.82);
}

.coveredBonus.tl {
  background: linear-gradient(180deg, #42a86a 0%, var(--letter3) 100%);
  color: white;
}

.coveredBonus.dw {
  background:
    linear-gradient(135deg, rgba(255, 243, 214, 0.5) 0%, transparent 28%),
    linear-gradient(180deg, var(--bronze-light) 0%, #c99a5d 38%, var(--bronze-mid) 68%, var(--bronze-dark) 100%);
  color: #24150b;
}

.coveredBonus.tw {
  background:
    linear-gradient(135deg, rgba(255, 230, 219, 0.72) 0%, transparent 26%),
    linear-gradient(180deg, var(--copper-light) 0%, var(--copper-mid) 58%, var(--copper-dark) 100%);
  color: white;
}

.coveredBonus.starter {
  background: linear-gradient(180deg, #3e867d 0%, var(--starter) 100%);
  color: white;
  font-size: clamp(0.72rem, 1.8vw, 1rem);
}

.cell:has(.coveredBonus) .letterTile:not(.ghostSurface) {
  animation: letterBonusCrossfade 8.8s ease-in-out infinite;
}

@keyframes bonusPulse {
  0%,
  22%,
  100% {
    opacity: 0;
  }

  45%,
  52% {
    opacity: 1;
  }

  67% {
    opacity: 0;
  }
}

@keyframes letterBonusCrossfade {
  0%,
  22%,
  100% {
    opacity: 1;
  }

  45%,
  52% {
    opacity: 0;
  }

  67% {
    opacity: 1;
  }
}

.placementDelta {
  position: absolute;
  left: 50%;
  top: 10px;
  z-index: 6;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 900;
  text-align: center;
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.9),
    0 0 6px rgba(255, 255, 255, 0.72);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 0);
  transition:
    opacity 180ms ease,
    transform 180ms ease;
  white-space: nowrap;
}

.placementDelta.show {
  opacity: 1;
}

.placementDelta.good {
  color: #137c43;
}

.placementDelta.bad {
  color: #c43c3c;
}

.placementDelta.neutral {
  color: var(--ink);
}

.placementDelta.placed {
  transition:
    opacity 900ms ease,
    transform 900ms ease;
}

.placementDelta.fading {
  opacity: 0;
}

.solutionLetter {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  font-size: clamp(0.82rem, 2.6vw, 1.22rem);
  font-weight: 900;
  color: var(--ink);
  line-height: 1;
  padding: 0 5px 5px 0;
}

.letterTile {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  place-items: center;
  border-radius: 4px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.92) 0%, rgba(255, 255, 255, 0.22) 23%, transparent 36%),
    linear-gradient(180deg, #fff8d4 0%, var(--gold-light) 18%, var(--gold-mid) 52%, #b88c37 76%, var(--gold-dark) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.82),
    inset 1px 0 0 rgba(255, 255, 255, 0.36),
    inset 0 -2px 0 rgba(72, 47, 16, 0.48),
    0 2px 5px rgba(23, 32, 29, 0.24);
}

.previewSurface {
  z-index: 5;
}

.solutionSurface {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.7), transparent 30%),
    linear-gradient(180deg, #e5f5ff 0%, #95c8e7 56%, #5b90b4 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.65),
    inset 0 -2px 0 rgba(23, 32, 29, 0.09);
}

.ghostSurface {
  z-index: 9;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.62), transparent 30%),
    linear-gradient(180deg, #e3e8e0 0%, #8f9c8b 100%);
  color: rgba(23, 32, 29, 0.68);
  opacity: 0.5;
  box-shadow:
    0 8px 12px rgba(23, 32, 29, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.48),
    inset 0 -2px 0 rgba(23, 32, 29, 0.1);
  filter: grayscale(1);
}

.pickupDust,
.dropDust {
  position: absolute;
  inset: -8px;
  z-index: 8;
  pointer-events: none;
  border-radius: 999px;
  background:
    radial-gradient(circle at 24% 62%, rgba(122, 95, 52, 0.48) 0 3px, transparent 4px),
    radial-gradient(circle at 70% 36%, rgba(255, 255, 255, 0.7) 0 4px, transparent 5px),
    radial-gradient(circle at 52% 74%, rgba(122, 95, 52, 0.34) 0 3px, transparent 5px);
}

.pickupDust {
  animation: pickupDust 700ms ease-out forwards;
}

.dropDust {
  z-index: 8;
  animation: dropDust 660ms ease-out forwards;
}

@keyframes pickupDust {
  0% {
    opacity: 0.72;
    transform: translateY(7px) scale(0.52);
    filter: blur(0);
  }

  100% {
    opacity: 0;
    transform: translateY(-8px) scale(1.45);
    filter: blur(1px);
  }
}

@keyframes dropDust {
  0% {
    opacity: 0;
    transform: scale(0.45);
  }

  22% {
    opacity: 0.78;
  }

  100% {
    opacity: 0;
    transform: scale(1.65);
    filter: blur(1px);
  }
}

.solutionScore {
  position: absolute;
  right: 3px;
  bottom: 2px;
  font-size: clamp(0.54rem, 1.35vw, 0.75rem);
  font-weight: 900;
  color: rgba(23, 32, 29, 0.78);
  line-height: 1;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin: 6px 0 8px;
}

.rotateButton {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 126px;
  padding: 0 14px;
  font-weight: 800;
}

.rotateGlyph {
  font-size: 1.15rem;
  line-height: 1;
}

.rotateHint {
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
}

.rotateHint kbd {
  display: inline-grid;
  place-items: center;
  min-width: 26px;
  min-height: 24px;
  padding: 0 6px;
  border: 1px solid rgba(54, 60, 56, 0.45);
  border-radius: 5px;
  background:
    linear-gradient(180deg, #ffffff 0%, #d6d9d3 48%, #f2f2ee 100%);
  color: var(--ink);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.72),
    inset 0 -2px 0 rgba(0, 0, 0, 0.12);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 900;
}

.solutionToggle {
  min-width: 138px;
}

#undoBtn,
#clearWordBtn,
#cancelMoveBtn,
.copyShareBtn {
  background:
    linear-gradient(180deg, #ffffff 0%, #d8dbd4 48%, #f3f3ef 100%);
  color: var(--ink);
  border-color: #777e78;
}

#startBtn {
  background:
    linear-gradient(180deg, #58aaa2 0%, var(--starter) 58%, #1e4f4a 100%);
  border-color: var(--starter);
}

#cancelMoveBtn {
  border-color: var(--bad);
  color: var(--bad);
}

.statusText {
  width: min(540px, 100%);
  min-height: 20px;
  margin: 3px auto 0;
  padding: 4px 8px;
  border-radius: 6px;
  background:
    linear-gradient(180deg, rgba(242, 242, 238, 0.82), rgba(197, 199, 192, 0.74));
  border: 1px solid rgba(90, 95, 90, 0.2);
  color: var(--muted);
  font-size: 0.86rem;
  text-align: center;
  pointer-events: none;
}

.statusText.good {
  color: #137c43;
}

.statusText.bad {
  color: #c43c3c;
}

.wordTray {
  width: min(540px, 100%);
  margin: 0 auto;
  padding: 2px 8px 4px;
  background: transparent;
  border: 0;
}

.trayHeader {
  display: none;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.trayHeader h2,
.leaderboard h2,
.modalBox h2 {
  font-size: 1rem;
}

.words {
  display: grid;
  justify-items: center;
  gap: 5px;
}

.wordRackRow {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  max-width: 100%;
  min-width: 0;
  flex-wrap: nowrap;
}

.wordChip {
  border: 0;
  background: transparent;
  color: var(--ink);
  border-radius: 4px;
  min-height: 34px;
  padding: 0;
  display: grid;
  place-items: center;
  cursor: grab;
  touch-action: none;
}

.wordChip:active {
  transform: translateY(-2px) scale(1.02);
  filter: drop-shadow(0 6px 7px rgba(23, 32, 29, 0.18));
}

.carryWord {
  position: fixed;
  z-index: 45;
  display: none;
  pointer-events: none;
  transform: translate(-50%, -130%) scale(1.06);
  filter: drop-shadow(0 13px 12px rgba(23, 32, 29, 0.34));
}

.carryWord.show {
  display: block;
  animation: carryLift 180ms ease-out;
}

@keyframes carryLift {
  from {
    opacity: 0.36;
    transform: translate(-50%, -85%) scale(0.94);
  }

  to {
    opacity: 1;
    transform: translate(-50%, -130%) scale(1.06);
  }
}

.wordChip.selected {
  outline: 0;
}

.wordChip.placed.valid {
  outline: 0;
}

.wordChip.placed.invalid {
  outline: 0;
}

.tileWord {
  display: flex;
  justify-content: center;
  gap: 2px;
  max-width: 100%;
  padding: 2px;
}

.miniTile {
  position: relative;
  display: grid;
  place-items: center;
  width: clamp(22px, 4vw, 30px);
  aspect-ratio: 1;
  border: 1px solid #a5863e;
  border-radius: 3px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(255, 255, 255, 0.22) 24%, transparent 36%),
    linear-gradient(180deg, #fff8d4 0%, var(--gold-light) 18%, var(--gold-mid) 56%, #b88c37 78%, var(--gold-dark) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.76),
    inset 1px 0 0 rgba(255, 255, 255, 0.32),
    inset 0 -2px 0 rgba(72, 47, 16, 0.42),
    0 1px 4px rgba(23, 32, 29, 0.22);
}

.miniLetter {
  font-size: clamp(0.76rem, 1.65vw, 0.98rem);
  font-weight: 900;
  line-height: 1;
  transform: translate(-1px, -1px);
}

.miniScore {
  position: absolute;
  right: 3px;
  bottom: 3px;
  font-size: 0.75rem;
  font-weight: 900;
  line-height: 1;
  color: rgba(23, 32, 29, 0.86);
  transform: none;
}

.leaderboard {
  align-self: start;
  padding: 16px;
  position: sticky;
  top: 94px;
}

.leaderboard ol {
  margin: 14px 0 0;
  padding-left: 22px;
}

.leaderboard li {
  margin-bottom: 10px;
  color: var(--muted);
}

.leaderboard strong {
  color: var(--ink);
}

.modal,
.mobileAd {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  place-items: center;
  background: rgba(23, 32, 29, 0.52);
  padding: 16px;
}

.modal {
  z-index: 1100;
}

.modal.open,
.mobileAd.open {
  display: grid;
}

.modalBox,
.mobileAdBox {
  width: min(380px, 100%);
  background: var(--panel);
  color: var(--ink);
  border-radius: 8px;
  padding: 20px;
  box-shadow: var(--shadow);
}

.modalBox label {
  display: grid;
  gap: 8px;
  margin-top: 16px;
  color: var(--muted);
}

.modalBox input {
  border: 1px solid var(--line);
  border-radius: 6px;
  min-height: 44px;
  padding: 0 12px;
  color: var(--ink);
}

.shareCard {
  white-space: pre;
  overflow: auto;
  max-height: 220px;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.78rem;
  line-height: 1.25;
}

.copyShareBtn {
  width: 100%;
  margin-top: 10px;
}

.modalActions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.modalActions button:first-child,
#resetBtn,
.mobileAdBox button {
  background: white;
  color: var(--ink);
}

.mobileAdBox {
  display: grid;
  gap: 18px;
  text-align: center;
  min-height: 220px;
  place-items: center;
}

.mobileAdBox span {
  max-width: min(220px, 100%);
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
  font-size: 0.94rem;
}

.policyPage {
  width: min(760px, 100%);
  margin: 0 auto;
  padding: 36px clamp(16px, 5vw, 40px);
}

.policyPage h1 {
  margin-bottom: 8px;
}

.policyPage h2 {
  margin-top: 24px;
  font-size: 1.1rem;
}

.policyPage p {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.55;
}

@media (max-width: 820px) {
  body {
    overflow-x: hidden;
  }

  .topbar {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
    padding: 5px 10px 2px;
    border-bottom-color: rgba(84, 89, 84, 0.18);
  }

  h1 {
    font-size: clamp(1.08rem, 5vw, 1.34rem);
    line-height: 1;
  }

  .topbar p {
    font-size: 0.76rem;
    margin-top: 1px;
  }

  .boardScores {
    width: calc(100vw - 16px);
    max-width: 360px;
    margin: 0 0 3px;
    padding: 2px 5px;
    border-radius: 7px;
    justify-self: center;
  }

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

  .scoreMetric {
    min-height: 34px;
  }

  .scoreMetric span,
  .timerPanel span {
    font-size: 0.5rem;
    letter-spacing: 0.06em;
  }

  .scoreMetric strong {
    font-size: clamp(0.9rem, 4vw, 1.14rem);
  }

  .scoreMetric:last-child {
    transform: translateX(-18px);
  }

  .timerPanel strong {
    font-size: clamp(1.42rem, 7vw, 1.86rem);
  }

  .appShell {
    display: block;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
    padding: 2px 8px 14px;
  }

  .gameArea {
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
  }

  .desktopAd {
    display: none;
  }

  .boardKey {
    grid-template-columns: var(--cell) var(--cell) minmax(0, 1fr);
    inset: 5px;
    font-size: clamp(0.88rem, 3.6vw, 1.08rem);
    padding: 31px 39px 12px 12px;
    gap: 4px 6px;
    background:
      linear-gradient(180deg, rgba(96, 108, 100, 0.84), rgba(38, 49, 44, 0.82)),
      repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.08) 0 1px, transparent 1px 7px);
  }

  .mobileOnlyInstruction {
    display: block;
  }

  .desktopOnlyInstruction,
  .desktopRotateHint {
    display: none;
  }

  .mobileRotateHint {
    display: block;
    flex-basis: 100%;
    max-width: calc(100vw - 24px);
    text-align: center;
    overflow-wrap: anywhere;
  }

  .keyNote {
    padding-top: 4px;
  }

  .closeKeyBtn {
    min-height: 28px;
    padding: 0 8px;
    font-size: 0.72rem;
  }

  .boardFrame {
    --cell: min(calc((100vw - 70px) / 15), 33px);
    padding: 4px;
    border-width: 2px;
    border-radius: 8px;
  }

  .board {
    gap: 1px;
  }

  .cell {
    border-radius: 3px;
  }

  .cell .bonus {
    font-size: clamp(0.38rem, 1.55vw, 0.52rem);
  }

  .cell .letter,
  .cell .previewLetter,
  .moveGhostTile .letter {
    font-size: clamp(0.74rem, 3.1vw, 1.03rem);
    padding: 0 4px 5px 0;
  }

  .cell .letterScore,
  .cell .previewScore,
  .moveGhostTile .letterScore {
    right: 2px;
    bottom: 2px;
    font-size: clamp(0.5rem, 1.8vw, 0.66rem);
  }

  .statusText {
    width: min(520px, calc(100vw - 16px));
    min-height: 17px;
    margin-top: 2px;
    padding: 2px 6px;
    font-size: 0.76rem;
  }

  .wordTray {
    width: calc(100vw - 16px);
    max-width: 520px;
    padding: 0 2px 2px;
  }

  .mobileAd {
    padding: 12px;
  }

  .mobileAdBox {
    width: calc(100vw - 28px);
    max-width: 340px;
    min-height: 190px;
    padding: 18px 14px;
  }

  .words {
    gap: 3px;
  }

  .wordRackRow {
    gap: 7px;
  }

  .wordChip {
    min-height: 29px;
  }

  .tileWord {
    gap: 1px;
    padding: 1px;
  }

  .miniTile {
    width: clamp(18px, 4.95vw, 24px);
  }

  .miniLetter {
    font-size: clamp(0.68rem, 3.2vw, 0.9rem);
  }

  .miniScore {
    right: 2px;
    bottom: 2px;
    font-size: clamp(0.52rem, 2.1vw, 0.66rem);
  }

  .controls {
    margin-top: 4px;
    gap: 7px;
  }

  .rotateButton {
    min-height: 38px;
    padding: 0 12px;
  }

  .rotateHint {
    font-size: 0.8rem;
  }

  .leaderboard {
    position: static;
    margin-top: 12px;
    padding: 12px;
  }
}

@media (max-width: 420px) {
  .topbar {
    align-items: flex-start;
    padding: 5px 8px 2px;
  }

  .boardScores {
    width: calc(100vw - 12px);
    padding: 2px 4px;
  }

  .mobileAdBox {
    width: calc(100vw - 24px);
    max-width: 320px;
  }

  .scorePanel {
    gap: 2px;
  }

  .scoreMetric span {
    font-size: 0.48rem;
  }

  .scoreMetric strong {
    font-size: 0.98rem;
  }

  .timerPanel strong {
    font-size: 1.62rem;
  }

  .boardFrame {
    --cell: calc((100vw - 66px) / 15);
  }

  .boardKey {
    font-size: clamp(0.78rem, 3.6vw, 0.96rem);
    padding: 30px 36px 10px 10px;
    gap: 3px 5px;
  }

  .wordChip {
    min-height: 27px;
    padding: 1px;
  }

  .miniTile {
    width: clamp(16px, 4.8vw, 20px);
  }

  .controls {
    align-items: center;
  }

  .rotateHint {
    font-size: 0.74rem;
  }
}
