:root {
  --bg: #0f172a;
  --panel: #111827;
  --tile: #1f2937;
  --tile-border: #374151;
  --text: #e5e7eb;
  --muted: #9ca3af;
  --key: #334155;
  --key-text: #f1f5f9;
  --green: #22c55e;
  --yellow: #eab308;
  --gray: #475569;
  --danger: #f97316;
}

.light-mode {
  --bg: #f1f5f9;
  --panel: #ffffff;
  --tile: #e2e8f0;
  --tile-border: #cbd5e1;
  --text: #0f172a;
  --muted: #475569;
  --key: #cbd5e1;
  --key-text: #0f172a;
  --gray: #94a3b8;
}

.color-blind-mode {
  --green: #3b82f6;
  --yellow: #f97316;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: radial-gradient(circle at top, #1e293b, var(--bg));
  color: var(--text);
  min-height: 100vh;
}

.app {
  max-width: 520px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1rem 1rem 1.5rem;
  gap: 1rem;
}

.topbar {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.brand {
  margin: 0;
  font-size: clamp(1.4rem, 4.2vw, 2rem);
  font-weight: 800;
  letter-spacing: 0.03em;
}

.settings-btn {
  background: #475569;
  border: 0;
  color: #f8fafc;
  border-radius: 999px;
  padding: 0.55rem 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 140ms ease, filter 180ms ease, background 180ms ease;
}

.settings-btn:hover {
  filter: brightness(1.1);
}

.settings-btn:active {
  transform: scale(0.96);
}

.settings-btn.icon-only {
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 50%;
  padding: 0;
  display: grid;
  place-items: center;
  font-size: 1.1rem;
  line-height: 1;
}

.new-game-btn {
  background: #2563eb;
  border: 0;
  color: #fff;
  border-radius: 999px;
  padding: 0.55rem 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 120ms ease, background 180ms ease;
}

.new-game-btn:hover {
  background: #1d4ed8;
}

.new-game-btn:active {
  transform: scale(0.97);
}

.meta-panel {
  width: 100%;
  background: color-mix(in oklab, var(--panel) 88%, #000);
  border: 1px solid #374151;
  border-radius: 12px;
  padding: 0.65rem 0.75rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 0.85rem;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.95rem;
  color: var(--text);
}

.stats-line {
  font-size: 0.86rem;
  color: var(--muted);
}

.share-btn {
  background: #16a34a;
  border: 0;
  color: #052e16;
  border-radius: 999px;
  padding: 0.45rem 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 120ms ease, filter 180ms ease, opacity 180ms ease;
}

.share-btn:hover {
  filter: brightness(1.08);
}

.share-btn:active {
  transform: scale(0.97);
}

.share-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.stats-btn {
  background: #7c3aed;
  border: 0;
  color: #f5f3ff;
  border-radius: 999px;
  padding: 0.45rem 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 120ms ease, filter 180ms ease;
}

.stats-btn:hover {
  filter: brightness(1.08);
}

.stats-btn:active {
  transform: scale(0.97);
}

.status-wrap {
  width: 100%;
  min-height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.status-message {
  margin: 0;
  color: var(--muted);
  text-align: center;
}

.status-message.error {
  color: var(--danger);
}

.status-message.good {
  color: #4ade80;
}

.letter-hints-line {
  width: 100%;
  margin: -0.3rem 0 0.2rem;
  font-size: 0.88rem;
  color: #93c5fd;
  text-align: center;
}

.grid {
  width: min(100%, 360px);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.4rem;
}

.tile {
  width: 100%;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 10px;
  border: 2px solid var(--tile-border);
  background: color-mix(in oklab, var(--tile) 84%, #000);
  font-size: clamp(1.2rem, 7vw, 1.8rem);
  font-weight: 800;
  text-transform: uppercase;
  transition: transform 220ms ease, background-color 220ms ease, border-color 220ms ease;
  user-select: none;
}

.tile.filled {
  border-color: #94a3b8;
  transform: scale(1.02);
}

.tile.flip {
  animation: flip 480ms ease;
}

.tile.pop {
  animation: pop 130ms ease;
}

.tile.correct {
  background: var(--green);
  border-color: var(--green);
  color: #052e16;
}

.tile.present {
  background: var(--yellow);
  border-color: var(--yellow);
  color: #3f2c00;
}

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

.tile.reveal-word {
  outline: 2px dashed #facc15;
  outline-offset: 2px;
}

.keyboard {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-top: auto;
}

.keyboard-row {
  display: flex;
  justify-content: center;
  gap: 0.35rem;
}

.key {
  border: 0;
  border-radius: 8px;
  background: var(--key);
  color: var(--key-text);
  min-height: 48px;
  min-width: 0;
  padding: 0 0.5rem;
  flex: 1;
  max-width: 42px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 100ms ease, filter 180ms ease, background-color 180ms ease;
}

.key.wide {
  flex: 1.5;
  max-width: 74px;
  font-size: 0.78rem;
}

.key:hover {
  filter: brightness(1.1);
}

.key:active {
  transform: scale(0.96);
}

.key.correct {
  background: var(--green);
  color: #052e16;
}

.key.present {
  background: var(--yellow);
  color: #3f2c00;
}

.key.absent {
  background: var(--gray);
}

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

@keyframes pop {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.08);
  }
  100% {
    transform: scale(1);
  }
}

.hidden {
  display: none !important;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  background: #0b1220;
  color: #e5e7eb;
  border: 1px solid #334155;
  border-radius: 999px;
  padding: 0.45rem 0.85rem;
  font-size: 0.9rem;
  z-index: 30;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.35);
}

.toast.good {
  border-color: #16a34a;
}

.toast.error {
  border-color: #f97316;
}

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

.modal-card {
  width: min(100%, 420px);
  background: #0b1220;
  border: 1px solid #374151;
  border-radius: 14px;
  padding: 0.8rem 0.9rem 1rem;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}

.modal-head h2 {
  margin: 0;
  font-size: 1.1rem;
}

.icon-close {
  border: 0;
  background: #1f2937;
  color: #e5e7eb;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  cursor: pointer;
}

.modal-metrics {
  margin-top: 0.6rem;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.35rem;
}

.metric {
  text-align: center;
  background: #111827;
  border: 1px solid #1f2937;
  border-radius: 8px;
  padding: 0.4rem 0.2rem;
}

.metric span {
  display: block;
  font-size: 1.05rem;
  font-weight: 800;
}

.metric small {
  font-size: 0.7rem;
  color: var(--muted);
}

.dist-title {
  margin: 0.85rem 0 0.45rem;
  font-size: 0.95rem;
}

.distribution {
  display: grid;
  gap: 0.35rem;
}

.dist-row {
  display: grid;
  grid-template-columns: 18px 1fr 28px;
  align-items: center;
  gap: 0.45rem;
}

.dist-bar {
  min-height: 24px;
  background: #1f2937;
  border-radius: 6px;
  overflow: hidden;
}

.dist-fill {
  min-height: 24px;
  background: #334155;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 0.45rem;
  font-size: 0.8rem;
  color: #e5e7eb;
  font-weight: 700;
  transition: width 200ms ease;
}

.dist-fill.highlight {
  background: #16a34a;
}

.modal-actions {
  margin-top: 0.85rem;
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

.modal-copy-btn,
.modal-play-btn {
  border: 0;
  border-radius: 999px;
  padding: 0.45rem 0.85rem;
  font-weight: 700;
  cursor: pointer;
}

.modal-copy-btn {
  background: #334155;
  color: #e2e8f0;
}

.modal-play-btn {
  background: #16a34a;
  color: #052e16;
}

.settings-card {
  width: min(100%, 580px);
}

.settings-list {
  margin-top: 0.25rem;
  display: grid;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.9rem;
  padding: 0.78rem 0.15rem;
  border-bottom: 1px solid #334155;
}

.setting-row:last-child {
  border-bottom: 0;
}

.setting-row h3 {
  margin: 0;
  font-size: 1rem;
}

.setting-row p {
  margin: 0.15rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.setting-row .setting-subline {
  margin-top: 0.2rem;
  color: var(--text);
  font-weight: 700;
}

.switch {
  position: relative;
  display: inline-block;
  width: 52px;
  height: 30px;
  flex: 0 0 auto;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: #cbd5e1;
  border-radius: 999px;
  transition: background 220ms ease, box-shadow 220ms ease;
}

.slider::before {
  content: "";
  position: absolute;
  height: 24px;
  width: 24px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.35);
  transition: transform 220ms cubic-bezier(0.22, 1, 0.36, 1), box-shadow 220ms ease;
}

.switch input:checked + .slider {
  background: #4caf50;
  box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.2) inset;
}

.switch input:checked + .slider::before {
  transform: translateX(22px);
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.35);
}

.seo-content {
  max-width: 900px;
  margin: 0 auto;
  padding: 1.25rem 1rem 0.5rem;
}

.seo-wrap {
  background: color-mix(in oklab, var(--panel) 84%, #000);
  border: 1px solid #374151;
  border-radius: 14px;
  padding: 1rem 1rem 1.15rem;
  line-height: 1.65;
}

.seo-wrap h1 {
  margin: 0 0 0.85rem;
  font-size: clamp(1.35rem, 3vw, 2rem);
  line-height: 1.25;
}

.seo-wrap h2 {
  margin: 1.05rem 0 0.4rem;
  font-size: 1.15rem;
}

.seo-wrap h3 {
  margin: 0.85rem 0 0.3rem;
  font-size: 1rem;
}

.seo-wrap p,
.seo-wrap li {
  color: #d1d5db;
}

.seo-wrap ol,
.seo-wrap ul {
  margin: 0.2rem 0 0.55rem 1.2rem;
  padding: 0;
}

.site-footer {
  max-width: 900px;
  margin: 0.4rem auto 1.2rem;
  padding: 0 1rem;
  text-align: center;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

.footer-links a {
  color: #93c5fd;
  text-decoration: none;
}

.footer-links a:hover {
  text-decoration: underline;
}

.copyright {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

@media (max-width: 500px) {
  .app {
    padding: 0.9rem 0.55rem 1rem;
  }

  .grid {
    gap: 0.32rem;
  }

  .keyboard-row {
    gap: 0.22rem;
  }

  .meta-panel {
    padding: 0.55rem 0.6rem;
    gap: 0.45rem 0.6rem;
  }

  .stats-line {
    width: 100%;
    font-size: 0.8rem;
  }

  .modal-card {
    padding: 0.7rem 0.7rem 0.9rem;
  }

  .modal-actions {
    justify-content: stretch;
  }

  .modal-copy-btn,
  .modal-play-btn {
    flex: 1;
  }

  .seo-wrap {
    padding: 0.85rem 0.8rem 1rem;
  }

  .seo-wrap h1 {
    font-size: 1.22rem;
  }

  .key {
    min-height: 44px;
    font-size: 0.85rem;
    max-width: none;
  }

  .setting-row {
    padding: 0.7rem 0;
  }
}
.non-game{
    max-width:820px;
}