:root {
  --bg: #171b18;
  --bg-soft: #202622;
  --panel: rgba(30, 36, 31, 0.88);
  --border: rgba(190, 204, 188, 0.15);
  --text: #f4efe7;
  --muted: #b9b2a7;
  --sage: #7da87b;
  --ochre: #dca86a;
  --charcoal: #3a3a3c;
  --accent: #a9c6a4;
  --danger: #d88f8f;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
}

html[data-theme="light"] {
  --bg: #edf3eb;
  --bg-soft: #f8fbf7;
  --panel: rgba(255, 255, 255, 0.9);
  --border: rgba(41, 74, 45, 0.18);
  --text: #1c2b1f;
  --muted: #526257;
  --sage: #7da87b;
  --ochre: #e8bb73;
  --charcoal: #ced4cf;
  --accent: #3f7745;
  --danger: #b74e4e;
  --shadow: 0 18px 48px rgba(38, 62, 42, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Avenir Next", "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top, rgba(125, 168, 123, 0.16), transparent 28%),
    radial-gradient(circle at bottom right, rgba(220, 168, 106, 0.1), transparent 22%),
    linear-gradient(180deg, #111513 0%, var(--bg) 50%, #101312 100%);
}

html[data-theme="light"] body {
  background:
    radial-gradient(circle at top, rgba(103, 152, 102, 0.18), transparent 30%),
    radial-gradient(circle at bottom right, rgba(203, 139, 66, 0.14), transparent 24%),
    linear-gradient(180deg, #fbfdf9 0%, var(--bg) 52%, #e3ece0 100%);
}

button {
  font: inherit;
  cursor: pointer;
  transition: transform 120ms ease, filter 120ms ease, box-shadow 120ms ease;
}

button:active:not(:disabled),
button.button-flash:not(:disabled) {
  filter: brightness(1.28) saturate(1.08);
  box-shadow: 0 0 0 2px rgba(244, 239, 231, 0.22), 0 0 18px rgba(169, 198, 164, 0.34);
  transform: scale(0.97);
}

.app-shell {
  width: min(825px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0 36px;
}

.hero,
.game-layout {
  animation: rise-in 500ms ease both;
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.hero-actions .tries-badge {
  align-self: center;
  margin-left: auto;
}

.hero-copy {
  flex: 1;
  min-width: 0;
}

.brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.settings-button {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  color: var(--text);
  text-decoration: none;
  line-height: 1;
}

.settings-icon {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.settings-icon-dark {
  display: none;
}

html[data-theme="dark"] .settings-icon-light {
  display: none;
}

html[data-theme="dark"] .settings-icon-dark {
  display: block;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.68rem;
}

h1,
h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 700;
}

h1 {
  font-size: clamp(2.25rem, 6vw, 3.4rem);
  line-height: 0.95;
}

.subtitle {
  max-width: 390px;
  color: var(--muted);
  margin-top: 9px;
  font-size: 0.92rem;
}

.game-layout {
  display: grid;
  grid-template-columns: 1.3fr 0.9fr;
  gap: 15px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 22px;
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
}

.board-panel {
  padding: 18px;
  display: flex;
  flex-direction: column;
}

.stats-panel {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.board-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
  margin-bottom: 18px;
}

.tries-badge {
  min-width: 72px;
  padding: 9px 11px;
  border-radius: 14px;
  background: rgba(125, 168, 123, 0.08);
  border: 1px solid rgba(125, 168, 123, 0.2);
  text-align: center;
}

.tries-badge span {
  display: block;
  font-size: 1.35rem;
  font-weight: 700;
}

#status-line {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.grid {
  display: grid;
  gap: 6px;
  width: 100%;
}

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

.tile {
  aspect-ratio: 1 / 1;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  display: grid;
  place-items: center;
  font-size: clamp(1rem, 2.7vw, 1.35rem);
  font-weight: 700;
  text-transform: uppercase;
  transition: transform 200ms ease, border-color 200ms ease, background 200ms ease;
  transform-style: preserve-3d;
}

.tile.filled {
  border-color: rgba(220, 168, 106, 0.3);
}

.tile.reveal {
  animation: flip 600ms ease forwards;
}

.tile.correct {
  background: var(--sage);
  border-color: transparent;
}

.tile.present {
  background: var(--ochre);
  border-color: transparent;
}

.tile.absent {
  background: var(--charcoal);
  border-color: transparent;
}

.message {
  min-height: 24px;
  margin: 12px 0 0;
  color: var(--accent);
  font-size: 0.9rem;
}

.message.success-message {
  color: var(--sage) !important;
  font-weight: 800;
  letter-spacing: 0.01em;
  text-align: center;
}

.hint-box {
  margin-top: 12px;
  padding: 11px 12px;
  border-radius: 12px;
  background: rgba(220, 168, 106, 0.1);
  border: 1px solid rgba(220, 168, 106, 0.2);
  color: #f7dec1;
  font-size: 0.9rem;
}

.hidden {
  display: none !important;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
}

.stats > div {
  min-width: 0;
  padding: 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.stats span {
  display: block;
  font-size: 1.28rem;
  font-weight: 700;
  margin-bottom: 3px;
}

.stats small {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.keyboard {
  display: grid;
  gap: 8px;
}

.keyboard-row {
  display: flex;
  gap: 6px;
}

.key {
  flex: 1;
  min-height: 38px;
  border: 0;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  transition: transform 150ms ease, background 150ms ease;
  font-size: 0.86rem;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.key[data-key="BACK"] {
  font-size: 1.32rem;
  line-height: 1;
}

.key:hover {
  transform: translateY(-1px);
}

.key.wide {
  flex: 1.7;
}

.key.correct {
  background: var(--sage);
}

.key.present {
  background: var(--ochre);
}

.key.absent {
  background: #444447;
  color: rgba(244, 239, 231, 0.52);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  opacity: 0.82;
}

.ghost-button,
.primary-button {
  border: 0;
  border-radius: 999px;
  padding: 9px 14px;
  font-size: 0.88rem;
}

.ghost-button {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.primary-button {
  background: linear-gradient(135deg, var(--sage), #92c18f);
  color: #102012;
  font-weight: 700;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(5, 7, 6, 0.7);
  display: grid;
  place-items: center;
  padding: 24px;
}

.modal-card {
  width: min(405px, 100%);
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 21px;
  padding: 21px;
  box-shadow: var(--shadow);
}

.definition-word {
  appearance: none;
  border: 0;
  border-radius: 0;
  padding: 0;
  color: var(--accent);
  background: transparent;
  font: inherit;
  font-weight: 700;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

.word-definition {
  margin: 12px 0 0;
  padding: 10px 12px;
  border: 1px solid rgba(125, 168, 123, 0.28);
  border-radius: 12px;
  background: rgba(125, 168, 123, 0.09);
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.45;
}

.definition-loading-dots {
  display: inline-flex;
  min-width: 1.3em;
  justify-content: flex-start;
}

.definition-loading-dots span {
  animation: definition-dot-pulse 0.9s ease-in-out infinite;
  animation-delay: var(--dot-delay);
  opacity: 0.24;
}

@keyframes definition-dot-pulse {
  0%, 100% { opacity: 0.24; }
  40% { opacity: 1; }
}

.emoji-grid {
  padding: 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  font-size: 1.05rem;
  line-height: 1.35;
}

.guess-summary {
  display: grid;
  gap: 8px;
  margin: 14px 0 16px;
}

.guess-chip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.9rem;
}

.guess-chip-details {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 9px;
}

.guess-tile-strip {
  display: grid;
  grid-template-columns: repeat(5, 12px);
  gap: 3px;
}

.guess-mini-tile {
  aspect-ratio: 1;
  border: 1px solid rgba(244, 239, 231, 0.24);
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.05);
}

.guess-mini-tile.correct {
  background: var(--sage);
  border-color: var(--sage);
}

.guess-mini-tile.present {
  background: var(--ochre);
  border-color: var(--ochre);
}

.guess-mini-tile.absent {
  background: var(--charcoal);
  border-color: var(--charcoal);
}

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

.modal-actions .primary-button,
.modal-actions .ghost-button {
  width: 100%;
  min-height: 42px;
  padding: 8px;
}

.app-footer {
  padding: 16px 0 4px;
  text-align: center;
  font-size: 0.82rem;
}

.app-footer a,
.footer-button,
.consent-card a,
.privacy-page a {
  color: var(--accent);
}

.footer-button {
  appearance: none;
  border: 0;
  background: transparent;
  cursor: pointer;
  font: inherit;
  padding: 0;
}

.consent-notice {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(5, 7, 6, 0.78);
}

.consent-card {
  width: min(430px, 100%);
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 21px;
  background: var(--bg-soft);
  box-shadow: var(--shadow);
}

.consent-card p:not(.eyebrow) {
  color: var(--muted);
  line-height: 1.5;
}

.privacy-page {
  max-width: 760px;
  margin: 0 auto;
  padding: 36px 20px 48px;
  line-height: 1.55;
}

.privacy-page h1 {
  margin-bottom: 12px;
}

.privacy-page h2 {
  margin-top: 28px;
}

.privacy-page p,
.privacy-page li {
  color: var(--muted);
}

.privacy-page .panel {
  margin-top: 24px;
  padding: 20px;
}

@keyframes flip {
  0% {
    transform: rotateX(0deg);
  }
  50% {
    transform: rotateX(90deg);
  }
  100% {
    transform: rotateX(0deg);
  }
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

  .hero {
    flex-direction: column;
  }

  .hero-actions {
    justify-content: flex-start;
    width: 100%;
  }
}

/* Keep the board and keyboard together on portrait tablets instead of letting
   the board grow to the full iPad width. */
@media (min-width: 641px) and (orientation: portrait) {
  .app-shell {
    width: min(760px, calc(100vw - 40px));
    padding: max(32px, env(safe-area-inset-top)) env(safe-area-inset-right)
      calc(18px + env(safe-area-inset-bottom)) env(safe-area-inset-left);
  }

  .hero {
    margin-bottom: 10px;
  }

  .game-layout {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  .board-panel {
    padding: 14px;
  }

  .grid {
    align-self: center;
    width: min(100%, 560px, calc((100dvh - 21rem) * 5 / 6));
  }

  .stats-panel {
    display: contents;
  }

  .keyboard {
    order: 1;
    gap: 6px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: var(--panel);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
  }

  .stats-panel > h2 {
    order: 2;
    margin-top: 4px;
  }

  .stats {
    order: 3;
  }
}

@media (min-width: 1000px) and (min-aspect-ratio: 4/3) {
  .app-shell {
    min-height: 100dvh;
    width: min(930px, calc(100vw - 40px));
    padding: 16px 0 18px;
  }

  .hero {
    margin-bottom: 12px;
  }

  .subtitle {
    max-width: 465px;
  }

  .game-layout {
    grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
    gap: 12px;
    align-items: start;
  }

  .board-panel,
  .stats-panel {
    padding: 15px;
  }

  .board-header {
    margin-bottom: 12px;
  }

  .grid,
  .grid-row {
    gap: 6px;
  }

  .grid {
    align-self: center;
    width: min(100%, calc((100dvh - 16rem) * 5 / 6));
  }

  .tile {
    border-radius: 12px;
    font-size: clamp(0.95rem, 1.6vw, 1.35rem);
  }

  .stats-panel {
    gap: 14px;
  }

  .stats > div {
    padding: 11px;
  }

  .key {
    min-height: 33px;
  }
}

@media (max-width: 640px) {
  .app-shell {
    width: min(100vw - 20px, 100%);
    padding:
      max(62px, calc(env(safe-area-inset-top) + 6px))
      env(safe-area-inset-right)
      calc(24px + env(safe-area-inset-bottom))
      env(safe-area-inset-left);
  }

  .hero {
    gap: 7px;
    margin-bottom: 10px;
  }

  .eyebrow {
    margin-bottom: 4px;
    font-size: 0.58rem;
  }

  h1 {
    font-size: clamp(1.6rem, 8vw, 2rem);
    line-height: 0.92;
  }

  .subtitle {
    margin: 5px 0 0;
    font-size: 0.76rem;
    line-height: 1.28;
  }

  .hero-actions {
    gap: 5px;
  }

  .ghost-button,
  .primary-button {
    padding: 7px 10px;
    font-size: 0.78rem;
  }

  .panel,
  .modal-card {
    border-radius: 22px;
  }

  .board-panel,
  .modal-card {
    padding: 12px;
  }

  .board-header {
    margin-bottom: 8px;
  }

  .board-header h2 {
    font-size: 1.15rem;
  }

  #status-line {
    margin-top: 3px;
    font-size: 0.75rem;
  }

  .tries-badge {
    min-width: 56px;
    padding: 5px 7px;
    border-radius: 10px;
  }

  .tries-badge span {
    font-size: 1rem;
  }

  .grid-row,
  .grid {
    gap: 4px;
  }

  .grid {
    align-self: center;
    width: min(100%, 340px);
  }

  .tile {
    border-radius: 8px;
    font-size: clamp(1rem, 5.6vw, 1.24rem);
  }

  .message {
    min-height: 18px;
    margin-top: 7px;
    font-size: 0.78rem;
  }

  .hint-box {
    margin-top: 7px;
    padding: 8px 10px;
    font-size: 0.78rem;
  }

  .game-layout {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .stats-panel {
    display: contents;
  }

  .keyboard {
    order: 1;
    gap: 4px;
    padding: 7px 9px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--panel);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
  }

  .stats-panel > h2 {
    order: 2;
    margin-top: 4px;
  }

  .stats {
    order: 3;
    margin-bottom: 8px;
  }

  .stats-panel > h2 {
    font-size: 0.78rem;
  }

  .stats > div {
    padding: 3px 5px;
    border-radius: 7px;
  }

  .stats span {
    display: inline;
    font-size: 0.78rem;
    margin: 0 3px 0 0;
  }

  .stats small {
    font-size: 0.58rem;
  }

  .keyboard-row {
    gap: 4px;
  }

  .key {
    min-height: 34px;
    border-radius: 8px;
    font-size: 0.92rem;
  }
}


/* Keep the full game visible on older, short Android phone displays. */
@media (max-width: 640px) and (max-height: 760px) {
  .app-shell {
    padding-top: max(48px, calc(env(safe-area-inset-top) + 12px));
    padding-bottom: 14px;
  }

  .hero {
    gap: 4px;
    margin-bottom: 6px;
  }

  .subtitle {
    display: none;
  }

  h1 {
    font-size: clamp(1.5rem, 7vw, 1.8rem);
  }

  .hero-actions {
    gap: 4px;
  }

  .ghost-button,
  .primary-button {
    padding: 6px 9px;
    font-size: 0.72rem;
  }

  .tries-badge {
    min-width: 52px;
    padding: 4px 6px;
  }

  .board-panel {
    padding: 9px 10px;
  }

  .grid {
    width: min(100%, 280px, calc((100dvh - 19rem) * 5 / 6));
  }

  .grid,
  .grid-row {
    gap: 3px;
  }

  .tile {
    border-radius: 7px;
    font-size: clamp(0.95rem, 5.4vw, 1.12rem);
  }

  .message {
    min-height: 16px;
    margin-top: 5px;
    font-size: 0.72rem;
  }

  .hint-box {
    margin-top: 5px;
    padding: 7px 9px;
    font-size: 0.72rem;
  }

  .game-layout {
    gap: 6px;
  }

  .keyboard {
    gap: 3px;
    padding: 6px 8px;
  }

  .keyboard-row {
    gap: 3px;
  }

  .key {
    min-height: 30px;
    font-size: 0.84rem;
  }

  .stats {
    margin-bottom: 4px;
  }

  .app-footer {
    padding: 8px 0 2px;
    font-size: 0.72rem;
  }
}


.settings-page {
  width: min(680px, calc(100vw - 40px));
  margin: 0 auto;
  padding: max(36px, env(safe-area-inset-top)) 0 calc(48px + env(safe-area-inset-bottom));
}

.back-link {
  display: inline-block;
  margin-bottom: 28px;
  color: var(--accent);
  text-decoration: none;
}

.settings-page h1 {
  font-size: clamp(2.2rem, 7vw, 3.4rem);
}

.settings-intro,
.settings-note {
  color: var(--muted);
  line-height: 1.5;
}

.settings-intro {
  max-width: 520px;
  margin: 10px 0 26px;
}

.settings-section {
  margin-top: 18px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.settings-options {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.setting-option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  cursor: pointer;
}

.setting-option:has(input:checked) {
  border-color: var(--sage);
  background: color-mix(in srgb, var(--sage) 14%, transparent);
}

.setting-option input {
  width: 1.08rem;
  height: 1.08rem;
  margin: 3px 0 0;
  accent-color: var(--sage);
}

.setting-option strong,
.setting-option small {
  display: block;
}

.setting-option small {
  margin-top: 3px;
  color: var(--muted);
  line-height: 1.35;
}

.settings-note {
  margin: 16px 0 0;
  font-size: 0.88rem;
}

html[data-theme="light"] .key.absent {
  background: #d8ddd8;
  color: rgba(28, 43, 31, 0.56);
}

html[data-theme="light"] .hint-box {
  color: #694215;
}


html[data-theme="light"] .tile {
  border-color: #a9c6a4;
  background: #edf3eb;
}

html[data-theme="light"] .tile.filled {
  border-color: #8cb889;
}

html[data-theme="light"] .keyboard {
  border-color: #a9c6a4;
}

html[data-theme="light"] .key {
  border: 1px solid #a9c6a4;
  background: #edf3eb;
}

html[data-theme="light"] .key.correct,
html[data-theme="light"] .tile.correct {
  border-color: #7da87b;
  background: #7da87b;
}

html[data-theme="light"] .key.present,
html[data-theme="light"] .tile.present {
  border-color: #e8bb73;
  background: #e8bb73;
}


/* Keep the complete game visible on modern iPhone portrait displays. */
@media (max-width: 640px) and (min-height: 761px) and (max-height: 900px) {
  .app-shell {
    padding-top: max(50px, calc(env(safe-area-inset-top) + 6px));
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
  }

  .hero {
    gap: 5px;
    margin-bottom: 7px;
  }

  h1 {
    font-size: clamp(1.55rem, 7.5vw, 1.9rem);
  }

  .subtitle {
    margin-top: 4px;
    font-size: 0.72rem;
    line-height: 1.22;
  }

  .ghost-button,
  .primary-button {
    padding: 6px 9px;
    font-size: 0.73rem;
  }

  .tries-badge {
    min-width: 52px;
    padding: 4px 6px;
  }

  .settings-button {
    width: 28px;
    height: 28px;
  }

  .settings-icon {
    width: 20px;
    height: 20px;
  }

  .board-panel {
    padding: 9px 10px;
  }

  .grid {
    width: min(100%, 306px, calc((100dvh - 21.25rem) * 5 / 6));
  }

  .grid,
  .grid-row {
    gap: 3px;
  }

  .tile {
    border-radius: 7px;
    font-size: clamp(0.95rem, 5.2vw, 1.14rem);
  }

  .message {
    min-height: 16px;
    margin-top: 5px;
    font-size: 0.72rem;
  }

  .hint-box {
    margin-top: 5px;
    padding: 7px 9px;
    font-size: 0.72rem;
  }

  .game-layout {
    gap: 6px;
  }

  .keyboard {
    gap: 3px;
    padding: 6px 8px;
  }

  .keyboard-row {
    gap: 3px;
  }

  .key {
    min-height: 30px;
    font-size: 0.84rem;
  }

  .stats {
    margin-bottom: 4px;
  }

  .app-footer {
    padding: 7px 0 2px;
    font-size: 0.7rem;
  }
}


/* Scored feedback must remain solid in Light theme, even after responsive rules. */
html[data-theme="light"] .grid .tile.correct,
html[data-theme="light"] .keyboard .key.correct {
  background-color: #7da87b !important;
  border-color: #7da87b !important;
}

html[data-theme="light"] .grid .tile.present,
html[data-theme="light"] .keyboard .key.present {
  background-color: #e8bb73 !important;
  border-color: #e8bb73 !important;
}


/* Make typing and tap feedback visible across the whole control in Light theme. */
html[data-theme="light"] .grid .tile.filled:not(.correct):not(.present):not(.absent) {
  background: #dcebd9;
  border-color: #8cb889;
}

html[data-theme="light"] .keyboard .key.button-flash:not(.correct):not(.present):not(.absent),
html[data-theme="light"] .keyboard .key:active:not(.correct):not(.present):not(.absent) {
  background: #dcebd9;
  border-color: #8cb889;
}


/* Keep the Light-theme finish grid on the same pale-green game surface. */
html[data-theme="light"] .emoji-grid {
  padding: 14px;
  border: 1px solid #a9c6a4;
  border-radius: 14px;
  background: var(--bg);
  color: var(--text);
  box-shadow: inset 0 0 0 1px rgba(125, 168, 123, 0.12);
  letter-spacing: 0.08em;
  line-height: 1.5;
}

html[data-theme="light"] .guess-chip {
  border: 1px solid #a9c6a4;
  background: var(--bg);
}

html[data-theme="light"] .guess-mini-tile {
  border-color: #a9c6a4;
  background: #edf3eb;
}

html[data-theme="light"] .guess-mini-tile.correct {
  background: #7da87b;
  border-color: #7da87b;
}

html[data-theme="light"] .guess-mini-tile.present {
  background: #e8bb73;
  border-color: #e8bb73;
}

html[data-theme="light"] .guess-mini-tile.absent {
  background: #3a3a3c;
  border-color: #3a3a3c;
}

/* Keep the main Light-theme controls as clearly defined pale-green buttons. */
html[data-theme="light"] #new-game-button,
html[data-theme="light"] #retry-button,
html[data-theme="light"] #hint-button {
  border: 1px solid #a9c6a4;
  background: var(--bg);
  box-shadow: inset 0 0 0 1px rgba(125, 168, 123, 0.08);
}


.how-to-play-section p,
.how-to-play-copy {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.how-to-play-link {
  display: inline-flex;
  gap: 7px;
  margin-top: 15px;
  color: var(--accent);
  font-weight: 800;
  text-decoration: none;
}

.tile-guide {
  display: grid;
  gap: 11px;
  margin-top: 15px;
}

.tile-guide-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.tile-guide-row strong,
.tile-guide-row small {
  display: block;
}

.tile-guide-row small {
  margin-top: 2px;
  color: var(--muted);
  line-height: 1.35;
}

.guide-tile {
  width: 34px;
  aspect-ratio: 1;
  flex: 0 0 auto;
  border-radius: 8px;
}

.guide-tile.correct {
  background: var(--sage);
}

.guide-tile.present {
  background: var(--ochre);
}

.guide-tile.absent {
  background: var(--charcoal);
  border: 1px solid var(--border);
}

html[data-theme="light"] .guide-tile.absent {
  background: #3a3a3c;
  border-color: #3a3a3c;
}


.settings-how-to-play-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel);
  color: var(--accent);
  text-decoration: none;
}

.settings-how-to-play-link span {
  color: var(--muted);
  font-size: 0.86rem;
}

@media (max-width: 640px) and (min-height: 761px) and (max-height: 900px) {
  .settings-page {
    width: min(100vw - 24px, 100%);
    padding: max(46px, calc(env(safe-area-inset-top) + 6px)) 0 calc(12px + env(safe-area-inset-bottom));
  }

  .back-link {
    margin-bottom: 14px;
    font-size: 0.82rem;
  }

  .settings-page h1 {
    font-size: 1.95rem;
  }

  .settings-intro {
    margin: 5px 0 11px;
    font-size: 0.8rem;
    line-height: 1.32;
  }

  .settings-section {
    margin-top: 13px;
    padding: 17px;
    border-radius: 18px;
  }

  .settings-section h2 {
    font-size: 1.12rem;
  }

  .settings-options {
    gap: 8px;
    margin-top: 12px;
  }

  .setting-option {
    gap: 10px;
    padding: 12px;
    border-radius: 13px;
  }

  .setting-option input {
    width: 0.96rem;
    height: 0.96rem;
    margin-top: 2px;
  }

  .setting-option small {
    margin-top: 1px;
    font-size: 0.71rem;
    line-height: 1.24;
  }

  .settings-note {
    margin: 12px 0 0;
    font-size: 0.71rem;
    line-height: 1.24;
  }

  .settings-how-to-play-link {
    margin-top: 12px;
    padding: 12px 14px;
    border-radius: 14px;
    font-size: 0.82rem;
  }

  .settings-how-to-play-link span {
    font-size: 0.75rem;
  }
}
