:root {
  color-scheme: dark;
  --bg: #050a11;
  --surface: #07111d;
  --surface-strong: #0b1624;
  --surface-raised: #152233;
  --surface-raised-2: #1d2a3b;
  --text: #f6f8fc;
  --muted: #aab3c3;
  --line: rgb(255 255 255 / 14%);
  --line-strong: rgb(255 255 255 / 24%);
  --accent: #58a2ff;
  --accent-soft: rgb(88 162 255 / 24%);
  --correct: #3f9449;
  --correct-strong: #62d66d;
  --present: #c59a16;
  --present-strong: #f1c744;
  --absent: #303b49;
  --key-disabled: #03060a;
  --key-disabled-surface: #070b11;
  --key-disabled-text: rgb(118 130 148 / 78%);
  --key-disabled-line: rgb(255 255 255 / 7%);
  --danger: #ff8d8d;
  --success: #95f49d;
  --shadow: 0 30px 100px rgb(0 0 0 / 48%);
  --app-height: 100svh;
  --keyboard-icon-size: 28px;
}

@supports (height: 100dvh) {
  :root {
    --app-height: 100dvh;
  }
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100%;
  margin: 0;
  overflow-x: hidden;
  touch-action: manipulation;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    linear-gradient(145deg, rgb(4 9 16 / 96%) 0%, rgb(5 13 24 / 96%) 45%, rgb(15 33 57 / 96%) 100%),
    linear-gradient(30deg, #06130f 0%, #06111f 55%, #182742 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(125deg, transparent 0 42%, rgb(83 229 145 / 12%) 62%, transparent 82%),
    linear-gradient(315deg, transparent 0 48%, rgb(91 152 255 / 18%) 78%, transparent 100%);
  opacity: 0.9;
}

button {
  font: inherit;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

svg {
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

h1,
h2,
p {
  margin-top: 0;
}

.modal-open {
  overflow: hidden;
}

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

.app-shell {
  min-height: var(--app-height);
  display: grid;
  place-items: center;
  padding: 28px max(18px, env(safe-area-inset-right)) 28px max(18px, env(safe-area-inset-left));
}

.game-shell {
  width: min(100%, 430px);
  min-height: min(880px, calc(100svh - 56px));
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: max(24px, env(safe-area-inset-top)) 18px max(20px, env(safe-area-inset-bottom));
  border: 1px solid rgb(255 255 255 / 12%);
  border-radius: 34px;
  background:
    linear-gradient(180deg, rgb(11 24 39 / 94%) 0%, rgb(4 12 21 / 97%) 54%, rgb(3 9 16 / 99%) 100%),
    var(--surface);
  box-shadow: var(--shadow), inset 0 1px 0 rgb(255 255 255 / 14%);
}

.game-header {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) 54px;
  gap: 10px;
  align-items: center;
}

.icon-button {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  background: rgb(11 19 31 / 76%);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 8%);
  cursor: pointer;
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.icon-button svg {
  width: 26px;
  height: 26px;
}

.icon-button:hover,
.icon-button:focus-visible {
  border-color: rgb(88 162 255 / 72%);
  box-shadow: 0 0 0 4px var(--accent-soft), inset 0 1px 0 rgb(255 255 255 / 10%);
  outline: none;
}

.icon-button:active {
  transform: translateY(1px);
}

.title-stack {
  grid-column: 2;
  min-width: 0;
  text-align: center;
}

#settings-button {
  grid-column: 1;
}

#help-button {
  grid-column: 3;
}

h1 {
  margin: 0;
  font-size: 2.08rem;
  line-height: 1.04;
  letter-spacing: 0;
  font-weight: 900;
}

.title-link {
  color: inherit;
  border-radius: 4px;
  text-decoration: none;
}

.title-link:hover {
  color: rgb(226 237 255);
  text-shadow: 0 0 18px rgb(88 162 255 / 38%);
}

.title-link:focus-visible {
  color: rgb(226 237 255);
  outline: 3px solid rgb(88 162 255 / 58%);
  outline-offset: 4px;
}

.puzzle-meta {
  min-height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: nowrap;
  gap: 8px;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
  line-height: 1.2;
  white-space: nowrap;
}

.puzzle-meta span {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 4px;
}

.puzzle-meta svg {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  color: rgb(205 216 235 / 82%);
}

.puzzle-meta span + span::before {
  content: "";
  width: 4px;
  height: 4px;
  margin-right: 6px;
  border-radius: 999px;
  background: rgb(255 255 255 / 28%);
}

.puzzle-meta strong {
  color: var(--text);
  font-size: 0.9rem;
}

.seed-date-link {
  min-width: 0;
  max-width: 100%;
  padding: 2px 7px;
  border: 1px solid rgb(88 162 255 / 30%);
  border-radius: 999px;
  color: rgb(231 240 255 / 92%);
  background: rgb(88 162 255 / 14%);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 8%);
  line-height: 1;
  text-decoration: none;
  transition: border-color 140ms ease, background 140ms ease, box-shadow 140ms ease;
}

.seed-date-link:hover,
.seed-date-link:focus-visible {
  border-color: rgb(88 162 255 / 62%);
  background: rgb(88 162 255 / 22%);
  box-shadow: 0 0 0 3px rgb(88 162 255 / 16%), inset 0 1px 0 rgb(255 255 255 / 10%);
  outline: none;
}

.seed-date-link[hidden] {
  display: none;
}

.daily-panel {
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgb(7 17 30 / 72%);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 8%);
}

.puzzle-tabs {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.puzzle-tab {
  min-width: 0;
  height: 64px;
  padding: 0 4px;
  border: 1px solid rgb(255 255 255 / 8%);
  border-radius: 8px;
  color: var(--text);
  background:
    linear-gradient(180deg, rgb(28 42 59 / 78%), rgb(15 26 41 / 82%)),
    var(--surface-raised);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 8%);
  cursor: pointer;
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease, background 140ms ease;
}

.puzzle-tab span,
.puzzle-tab small {
  display: block;
}

.puzzle-tab span {
  font-size: 1.62rem;
  line-height: 1;
  font-weight: 850;
}

.puzzle-tab small {
  margin-top: 6px;
  overflow: hidden;
  color: rgb(239 244 255 / 82%);
  font-size: 0.7rem;
  line-height: 1;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.puzzle-tab:hover:not(:disabled),
.puzzle-tab:focus-visible {
  border-color: rgb(88 162 255 / 46%);
  outline: none;
}

.puzzle-tab.active {
  border-color: rgb(88 162 255 / 95%);
  color: #f8fbff;
  background:
    linear-gradient(180deg, rgb(31 78 136 / 82%), rgb(16 43 84 / 92%)),
    #122c53;
  box-shadow:
    0 0 0 3px rgb(88 162 255 / 20%),
    0 0 22px rgb(88 162 255 / 30%),
    inset 0 1px 0 rgb(255 255 255 / 18%);
}

.puzzle-tab.active small {
  color: #73b7ff;
}

.puzzle-tab.solved {
  border-color: rgb(112 229 125 / 68%);
  background:
    linear-gradient(180deg, rgb(70 154 76 / 88%), rgb(40 110 50 / 94%)),
    var(--correct);
}

.puzzle-tab.solved small,
.puzzle-tab.solved.active small {
  color: rgb(237 255 240 / 88%);
}

.puzzle-tab.missed {
  border-color: rgb(255 255 255 / 12%);
  background:
    linear-gradient(180deg, rgb(67 79 94 / 88%), rgb(43 53 66 / 94%)),
    var(--absent);
}

.play-more-panel {
  min-height: 58px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px 10px 14px;
  border: 1px solid rgb(112 229 125 / 24%);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgb(28 79 48 / 36%), rgb(10 25 20 / 72%)),
    rgb(7 17 30 / 74%);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 8%);
}

.play-more-panel[hidden] {
  display: none;
}

.play-more-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.play-more-copy strong,
.play-more-copy span {
  overflow-wrap: anywhere;
  white-space: normal;
}

.play-more-copy strong {
  color: #f1fff3;
  font-size: 0.92rem;
  font-weight: 850;
  line-height: 1.1;
}

.play-more-copy span {
  color: rgb(213 226 239 / 74%);
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1.24;
}

.play-more-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.primary-action,
.secondary-action {
  height: 38px;
  min-width: 104px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 13px;
  border-radius: 10px;
  font-size: 0.78rem;
  font-weight: 850;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease, transform 140ms ease;
}

.primary-action {
  border: 1px solid rgb(112 229 125 / 58%);
  color: #06110a;
  background: linear-gradient(180deg, #a6ffad, #66d96f);
}

.secondary-action {
  border: 1px solid rgb(255 255 255 / 16%);
  color: rgb(239 244 255 / 90%);
  background: rgb(12 23 36 / 74%);
}

.primary-action[hidden],
.secondary-action[hidden] {
  display: none;
}

.primary-action:hover,
.primary-action:focus-visible,
.secondary-action:hover,
.secondary-action:focus-visible {
  border-color: rgb(255 255 255 / 48%);
  outline: none;
}

.primary-action:active,
.secondary-action:active {
  transform: translateY(1px);
}

.board-wrap {
  width: min(100%, 380px);
  position: relative;
  margin: 6px auto 0;
}

.grid {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}

.grid.loading {
  min-height: min(42dvh, 330px);
  place-items: center;
}

.loading-message {
  width: 100%;
  padding: 18px 16px;
  border: 1px solid rgb(88 162 255 / 20%);
  border-radius: 8px;
  color: rgb(221 232 248 / 82%);
  background: rgb(10 22 36 / 72%);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 8%);
  font-size: 0.88rem;
  font-weight: 850;
  line-height: 1.2;
  text-align: center;
}

.loading-message.error {
  border-color: rgb(255 141 141 / 26%);
  color: rgb(255 211 211 / 88%);
}

.toast-region {
  position: absolute;
  top: 12px;
  left: 50%;
  z-index: 20;
  width: min(100% - 24px, 300px);
  display: grid;
  justify-items: center;
  gap: 8px;
  pointer-events: none;
  transform: translateX(-50%);
}

.toast-message {
  max-width: 100%;
  margin: 0;
  padding: 11px 15px;
  border-radius: 6px;
  color: #fff;
  background: #101113;
  box-shadow: 0 12px 30px rgb(0 0 0 / 34%);
  font-size: 0.84rem;
  font-weight: 850;
  line-height: 1.16;
  text-align: center;
  animation: toast-in 120ms ease-out both;
}

.toast-message.leaving {
  animation: toast-out 180ms ease-in both;
}

.word-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.tile {
  width: 100%;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 1px solid rgb(255 255 255 / 16%);
  border-radius: 8px;
  color: var(--text);
  background:
    linear-gradient(145deg, rgb(47 58 72 / 88%), rgb(28 38 51 / 92%)),
    var(--surface-raised-2);
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 14%),
    inset 0 -16px 32px rgb(0 0 0 / 14%),
    0 10px 24px rgb(0 0 0 / 24%);
  font-size: 2.9rem;
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
  text-shadow: 0 2px 2px rgb(0 0 0 / 28%);
  user-select: none;
}

.tile.filled:not(.correct):not(.present):not(.absent) {
  border-color: rgb(255 255 255 / 22%);
}

.tile.correct,
.legend-tile.correct {
  border-color: rgb(127 244 138 / 36%);
  background:
    linear-gradient(145deg, rgb(88 183 93 / 92%), rgb(48 132 57 / 95%)),
    var(--correct);
}

.tile.present,
.legend-tile.present {
  border-color: rgb(255 216 79 / 36%);
  background:
    linear-gradient(145deg, rgb(229 185 41 / 94%), rgb(178 132 13 / 96%)),
    var(--present);
}

.tile.absent,
.legend-tile.absent {
  border-color: rgb(255 255 255 / 12%);
  background:
    linear-gradient(145deg, rgb(55 67 82 / 94%), rgb(35 45 58 / 98%)),
    var(--absent);
}

.final-row .tile {
  border-color: rgb(255 255 255 / 20%);
  background:
    linear-gradient(145deg, rgb(6 16 27 / 76%), rgb(2 8 15 / 86%)),
    #030b14;
  box-shadow:
    inset 0 0 0 2px rgb(255 255 255 / 6%),
    inset 0 1px 0 rgb(255 255 255 / 7%);
}

.final-row .tile.active {
  border-color: rgb(88 162 255 / 94%);
  box-shadow:
    0 0 0 3px rgb(88 162 255 / 18%),
    0 0 18px rgb(88 162 255 / 26%),
    inset 0 0 0 2px rgb(88 162 255 / 36%);
}

.final-row .tile.correct {
  border-color: rgb(127 244 138 / 36%);
  background:
    linear-gradient(145deg, rgb(88 183 93 / 92%), rgb(48 132 57 / 95%)),
    var(--correct);
}

.final-row.shake {
  animation: row-shake 420ms cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

.tile.clue-shake {
  outline: 3px solid rgb(255 255 255 / 56%);
  outline-offset: 2px;
  animation: clue-tile-shake 520ms cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

.keyboard {
  width: 100%;
  max-width: 398px;
  display: grid;
  gap: 8px;
  margin: auto auto 0;
}

.keyboard-row {
  width: 100%;
  min-width: 0;
  display: flex;
  justify-content: center;
  align-items: stretch;
  gap: 6px;
}

.keyboard-row:nth-child(2)::before,
.keyboard-row:nth-child(2)::after {
  content: "";
  flex: 0.45 1 0;
}

.key {
  flex: 1 1 0;
  min-width: 0;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid rgb(255 255 255 / 10%);
  border-radius: 7px;
  color: #f7f9fd;
  background:
    linear-gradient(180deg, rgb(43 55 70 / 92%), rgb(31 42 55 / 96%)),
    #202b39;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 10%);
  font-size: 1.26rem;
  font-weight: 850;
  line-height: 1;
  text-transform: uppercase;
  cursor: pointer;
  transition: filter 90ms ease, transform 90ms ease;
}

.key.wide {
  flex-grow: 1.55;
  font-size: 0.74rem;
  letter-spacing: 0;
}

.key.icon-key {
  font-size: 1rem;
}

.key.icon-key svg {
  width: var(--keyboard-icon-size);
  height: var(--keyboard-icon-size);
  stroke-width: 2.35;
}

.key:hover:not(:disabled),
.key:focus-visible {
  filter: brightness(1.09);
  outline: none;
}

.key:active:not(:disabled) {
  filter: brightness(0.93);
  transform: translateY(1px);
}

.key.correct {
  border-color: rgb(115 227 128 / 34%);
  background:
    linear-gradient(180deg, rgb(82 169 88 / 94%), rgb(45 123 54 / 98%)),
    var(--correct);
}

.key.present {
  border-color: rgb(255 213 69 / 34%);
  background:
    linear-gradient(180deg, rgb(214 171 29 / 94%), rgb(165 123 13 / 98%)),
    var(--present);
}

.key.absent {
  border-color: var(--key-disabled-line);
  color: var(--key-disabled-text);
  background:
    linear-gradient(180deg, rgb(13 18 25 / 98%), rgb(4 8 13 / 100%)),
    var(--key-disabled);
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 4%),
    inset 0 -18px 28px rgb(0 0 0 / 44%);
  text-shadow: none;
}

.key:disabled {
  cursor: not-allowed;
  filter: none;
}

.key:disabled:not(.correct):not(.present) {
  border-color: var(--key-disabled-line);
  color: var(--key-disabled-text);
  background:
    linear-gradient(180deg, rgb(10 14 20 / 98%), rgb(2 5 9 / 100%)),
    var(--key-disabled-surface);
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 3%),
    inset 0 -16px 24px rgb(0 0 0 / 52%);
  text-shadow: none;
}

.app-modal:not([open]) {
  display: none;
}

.app-modal {
  width: min(calc(100% - 36px), 390px);
  max-height: min(82svh, 620px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 22px;
  color: var(--text);
  background:
    linear-gradient(180deg, rgb(13 27 44 / 98%) 0%, rgb(4 12 21 / 99%) 100%),
    var(--surface);
  box-shadow: 0 28px 80px rgb(0 0 0 / 62%), inset 0 1px 0 rgb(255 255 255 / 12%);
}

.app-modal::backdrop {
  background:
    linear-gradient(180deg, rgb(1 4 8 / 58%), rgb(1 4 8 / 76%)),
    rgb(0 0 0 / 48%);
  backdrop-filter: blur(8px);
}

.modal-header {
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 16px 10px 22px;
  border-bottom: 1px solid rgb(255 255 255 / 9%);
}

.modal-title {
  margin: 0;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: rgb(239 244 255 / 92%);
  font-size: 1.02rem;
  line-height: 1.1;
  font-weight: 800;
}

.modal-title svg {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  color: #68f074;
}

.answer-modal .modal-title svg {
  color: rgb(205 216 235 / 82%);
}

.modal-close {
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgb(255 255 255 / 10%);
  border-radius: 999px;
  color: rgb(220 229 244 / 84%);
  background: rgb(8 16 27 / 76%);
  cursor: pointer;
  transition: border-color 140ms ease, color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.modal-close svg {
  width: 22px;
  height: 22px;
}

.modal-close:hover,
.modal-close:focus-visible {
  border-color: rgb(88 162 255 / 60%);
  color: var(--text);
  box-shadow: 0 0 0 4px var(--accent-soft);
  outline: none;
}

.modal-close:active {
  transform: translateY(1px);
}

.modal-content {
  max-height: calc(min(82svh, 620px) - 70px);
  padding: 18px 22px 22px;
  overflow-y: auto;
  color: var(--muted);
}

.modal-content p {
  margin-bottom: 14px;
  font-size: 0.92rem;
  line-height: 1.45;
}

.answer-content {
  display: grid;
  gap: 16px;
  padding-top: 22px;
}

.options-section {
  display: grid;
  gap: 12px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgb(255 255 255 / 9%);
}

.options-copy {
  display: grid;
  gap: 4px;
}

.options-copy h3,
.options-copy p {
  margin: 0;
}

.options-copy h3 {
  color: rgb(239 244 255 / 92%);
  font-size: 0.9rem;
  font-weight: 850;
  line-height: 1.1;
}

.options-copy p {
  color: rgb(213 226 239 / 70%);
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.2;
}

.modal-action-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.legend {
  display: grid;
  gap: 8px;
  color: rgb(214 222 237 / 84%);
  font-size: 0.88rem;
  font-weight: 700;
}

.legend span {
  display: flex;
  align-items: center;
  gap: 10px;
}

.legend-tile {
  width: 20px;
  height: 20px;
  display: inline-block;
  border: 1px solid transparent;
  border-radius: 5px;
}

.modal-action {
  width: 100%;
  height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 14px;
  border-radius: 12px;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 7%);
  font-size: 0.9rem;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease, transform 140ms ease;
}

.modal-action svg {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
}

.modal-action:hover:not(:disabled),
.modal-action:focus-visible {
  outline: none;
}

.modal-action:active:not(:disabled) {
  transform: translateY(1px);
}

.modal-action:disabled {
  cursor: not-allowed;
  filter: grayscale(0.65) brightness(0.72);
}

.share-action {
  border: 1px solid rgb(88 162 255 / 58%);
  color: rgb(221 235 255 / 92%);
  background: rgb(38 86 151 / 20%);
}

.share-action:hover:not(:disabled),
.share-action:focus-visible {
  border-color: rgb(114 180 255 / 86%);
  color: #f6fbff;
  background: rgb(46 107 185 / 28%);
}

.seed-action {
  border: 1px solid rgb(112 229 125 / 54%);
  color: #ddffdf;
  background: rgb(45 131 58 / 20%);
}

.seed-action:hover:not(:disabled),
.seed-action:focus-visible {
  border-color: rgb(139 247 149 / 82%);
  color: #f4fff4;
  background: rgb(52 151 65 / 28%);
}

.reveal-action {
  border: 1px solid rgb(255 116 116 / 62%);
  color: #ff8d8d;
  background: rgb(118 27 32 / 16%);
}

.reveal-action:hover:not(:disabled),
.reveal-action:focus-visible {
  border-color: rgb(255 144 144 / 86%);
  color: #ffb0b0;
  background: rgb(148 38 43 / 24%);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(-6px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes toast-out {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }

  to {
    opacity: 0;
    transform: translateY(-4px) scale(0.98);
  }
}

@keyframes row-shake {
  10%,
  90% {
    transform: translateX(-1px);
  }

  20%,
  80% {
    transform: translateX(2px);
  }

  30%,
  50%,
  70% {
    transform: translateX(-4px);
  }

  40%,
  60% {
    transform: translateX(4px);
  }
}

@keyframes clue-tile-shake {
  10%,
  90% {
    transform: translateX(-1px) scale(1.015);
  }

  20%,
  80% {
    transform: translateX(2px) scale(1.015);
  }

  30%,
  50%,
  70% {
    transform: translateX(-4px) scale(1.015);
  }

  40%,
  60% {
    transform: translateX(4px) scale(1.015);
  }
}

@media (prefers-reduced-motion: reduce) {
  .toast-message,
  .toast-message.leaving,
  .final-row.shake,
  .tile.clue-shake {
    animation: none;
  }
}

@media (max-height: 900px) {
  .app-shell {
    padding-top: 20px;
    padding-bottom: 20px;
  }

  .game-shell {
    gap: 9px;
    padding-top: max(18px, env(safe-area-inset-top));
    padding-bottom: max(14px, env(safe-area-inset-bottom));
  }

  .game-header {
    grid-template-columns: 50px minmax(0, 1fr) 50px;
  }

  .icon-button {
    width: 50px;
    height: 50px;
  }

  h1 {
    font-size: 1.95rem;
  }

  .puzzle-meta {
    min-height: 14px;
    font-size: 0.74rem;
  }

  .daily-panel {
    padding: 7px;
  }

  .puzzle-tab {
    height: 56px;
  }

  .board-wrap {
    width: min(100%, 344px);
    margin-top: 2px;
  }

  .grid {
    gap: 8px;
  }

  .word-row {
    gap: 8px;
  }

  .tile {
    font-size: 2.45rem;
  }

  .keyboard {
    gap: 6px;
  }

  .key {
    height: 50px;
  }

  .modal-header {
    min-height: 64px;
  }
}

/* Mobile fit layer: fluid viewport sizing owns the phone cascade. */
@media (max-width: 480px) {
  html,
  body {
    min-height: var(--app-height);
    overflow: hidden;
  }

  .app-shell {
    height: var(--app-height);
    min-height: var(--app-height);
    padding: 0;
    place-items: stretch;
    overflow: hidden;
  }

  .game-shell {
    --shell-gap: clamp(5px, 0.9dvh, 10px);
    --control-size: clamp(40px, 5.4dvh, 52px);
    --keyboard-bleed: clamp(18px, 5vw, 24px);
    --keyboard-row-gap: clamp(4px, 0.7dvh, 7px);
    --keyboard-key-height: clamp(42px, 5.8dvh, 56px);
    --keyboard-key-font: clamp(1rem, 2dvh, 1.18rem);
    --keyboard-wide-font: clamp(0.62rem, 1.16dvh, 0.72rem);
    --keyboard-icon-size: clamp(25px, 3.35dvh, 32px);
    --board-gap: clamp(4px, 0.75dvh, 8px);
    --tab-height: clamp(42px, 5.8dvh, 56px);
    width: 100%;
    height: var(--app-height);
    min-height: 0;
    gap: var(--shell-gap);
    padding: max(8px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
    border: 0;
    border-radius: 0;
    box-shadow: none;
    overflow: hidden;
  }

  .game-header {
    grid-template-columns: var(--control-size) minmax(0, 1fr) var(--control-size);
    gap: clamp(8px, 1.1dvh, 10px);
  }

  .icon-button {
    width: var(--control-size);
    height: var(--control-size);
  }

  .icon-button svg {
    width: clamp(21px, 2.8dvh, 26px);
    height: clamp(21px, 2.8dvh, 26px);
  }

  h1 {
    font-size: clamp(1.52rem, 3.12dvh, 1.96rem);
    line-height: 1.02;
  }

  .puzzle-meta {
    min-height: 0;
    gap: clamp(5px, 0.8dvh, 8px);
    font-size: clamp(0.66rem, 1.26dvh, 0.78rem);
    line-height: 1.1;
  }

  .puzzle-meta svg {
    width: clamp(12px, 1.6dvh, 15px);
    height: clamp(12px, 1.6dvh, 15px);
  }

  .puzzle-meta span {
    gap: clamp(3px, 0.45dvh, 4px);
  }

  .puzzle-meta span + span::before {
    width: clamp(3px, 0.45dvh, 4px);
    height: clamp(3px, 0.45dvh, 4px);
    margin-right: clamp(3px, 0.6dvh, 6px);
  }

  .daily-panel {
    padding: clamp(4px, 0.75dvh, 7px);
    border-radius: 14px;
  }

  .puzzle-tabs {
    gap: clamp(5px, 0.8dvh, 8px);
  }

  .puzzle-tab {
    height: var(--tab-height);
    border-radius: 8px;
  }

  .puzzle-tab span {
    font-size: clamp(1.16rem, 2.5dvh, 1.48rem);
  }

  .puzzle-tab small {
    margin-top: clamp(3px, 0.48dvh, 6px);
    font-size: clamp(0.52rem, 1.05dvh, 0.66rem);
  }

  .play-more-panel {
    min-height: clamp(48px, 6.1dvh, 58px);
    gap: clamp(8px, 1.1dvh, 12px);
    padding: clamp(8px, 1dvh, 10px) clamp(9px, 2.2vw, 12px);
    border-radius: 12px;
  }

  .play-more-copy strong {
    font-size: clamp(0.78rem, 1.45dvh, 0.9rem);
  }

  .play-more-copy span {
    font-size: clamp(0.62rem, 1.12dvh, 0.74rem);
  }

  .play-more-actions {
    gap: 6px;
  }

  .primary-action,
  .secondary-action {
    height: clamp(34px, 4.4dvh, 38px);
    min-width: clamp(94px, 24vw, 112px);
    padding: 0 clamp(10px, 2.4vw, 13px);
    border-radius: 9px;
    font-size: clamp(0.68rem, 1.18dvh, 0.78rem);
  }

  .board-wrap {
    --board-max: clamp(300px, 41dvh, 390px);
    width: min(100%, var(--board-max));
    margin: 0 auto;
  }

  .grid,
  .word-row {
    gap: var(--board-gap);
  }

  .tile {
    border-radius: 7px;
    font-size: clamp(1.84rem, 5.7dvh, 2.72rem);
  }

  .keyboard {
    width: calc(100% + var(--keyboard-bleed));
    max-width: none;
    gap: var(--keyboard-row-gap);
    margin: auto calc(var(--keyboard-bleed) / -2) 0;
  }

  .keyboard-row {
    gap: clamp(4px, 0.58dvh, 5px);
  }

  .key {
    height: var(--keyboard-key-height);
    border-radius: 8px;
    font-size: var(--keyboard-key-font);
  }

  .key.wide {
    font-size: var(--keyboard-wide-font);
  }

  .app-modal {
    --modal-header-height: clamp(56px, 7dvh, 64px);
    --modal-max-height: min(calc(var(--app-height) - 28px), 620px);
    width: min(calc(100% - 28px), 390px);
    max-height: var(--modal-max-height);
  }

  .modal-header {
    min-height: var(--modal-header-height);
    padding: 10px 14px 9px 18px;
  }

  .modal-title {
    gap: 10px;
    font-size: clamp(0.94rem, 1.8dvh, 1.02rem);
  }

  .modal-title svg {
    width: clamp(24px, 3dvh, 28px);
    height: clamp(24px, 3dvh, 28px);
  }

  .modal-close {
    width: clamp(40px, 5.2dvh, 46px);
    height: clamp(40px, 5.2dvh, 46px);
  }

  .modal-content {
    max-height: calc(var(--modal-max-height) - var(--modal-header-height));
    padding: clamp(15px, 2dvh, 18px) 18px clamp(16px, 2.4dvh, 22px);
  }

  .answer-content {
    gap: clamp(13px, 1.8dvh, 16px);
  }

  .modal-action-row {
    gap: 8px;
  }

  .modal-action {
    height: clamp(42px, 5.4dvh, 46px);
    gap: 8px;
    padding: 0 clamp(10px, 2.4vw, 14px);
    border-radius: 11px;
    font-size: clamp(0.78rem, 1.45dvh, 0.9rem);
  }

  .modal-action svg {
    width: clamp(18px, 2.4dvh, 20px);
    height: clamp(18px, 2.4dvh, 20px);
  }
}

@media (max-width: 380px) {
  .game-shell {
    --shell-gap: clamp(4px, 0.8dvh, 8px);
    --control-size: clamp(38px, 5.2dvh, 46px);
    --keyboard-bleed: 16px;
    --keyboard-row-gap: clamp(4px, 0.62dvh, 6px);
    --keyboard-key-height: clamp(40px, 5.6dvh, 54px);
    --keyboard-key-font: clamp(0.9rem, 1.88dvh, 1.1rem);
    --keyboard-wide-font: clamp(0.56rem, 1.08dvh, 0.68rem);
    --keyboard-icon-size: clamp(23px, 3.45dvh, 29px);
    --board-gap: clamp(4px, 0.65dvh, 6px);
    --tab-height: clamp(38px, 5.45dvh, 50px);
    padding-right: max(12px, env(safe-area-inset-right));
    padding-left: max(12px, env(safe-area-inset-left));
  }

  h1 {
    font-size: clamp(1.28rem, 2.85dvh, 1.62rem);
  }

  .puzzle-meta {
    gap: clamp(4px, 0.65dvh, 6px);
    font-size: clamp(0.58rem, 1.14dvh, 0.69rem);
  }

  .puzzle-meta span + span::before {
    margin-right: 3px;
  }

  .puzzle-tab span {
    font-size: clamp(1rem, 2.2dvh, 1.28rem);
  }

  .puzzle-tab small {
    font-size: clamp(0.46rem, 0.94dvh, 0.58rem);
  }

  .play-more-panel {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

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

  .primary-action,
  .secondary-action {
    min-width: 0;
    width: 100%;
  }

  .board-wrap {
    --board-max: clamp(240px, 42dvh, 300px);
  }

  .tile {
    font-size: clamp(1.72rem, 5.15dvh, 2.28rem);
  }
}
