:root {
  --bg: #efeff2;
  --tile: #ffffff;
  --tile-border: #d7dae2;
  --text: #3f465b;
  --key: #d3d8e3;
  --green: #6aa961;
  --yellow: #c7b45d;
  --gray: #7f848b;
}

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

.hidden {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  color: var(--text);
  scroll-behavior: smooth;
}

body.length-dark {
  --bg: #0f172a;
  --tile: #1f2937;
  --tile-border: #374151;
  --text: #e5e7eb;
  --key: #334155;
}

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

.length-page {
  max-width: 760px;
  margin: 0 auto;
  padding: 0.9rem 1rem 1.2rem;
}

.length-home-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.9rem;
  margin-bottom: 0.8rem;
}

.length-brand {
  font-size: clamp(1.8rem, 5.5vw, 3rem);
  font-weight: 900;
  color: #0b25ff;
  line-height: 0.95;
  max-width: 340px;
}

.length-home-actions {
  display: flex;
  gap: 0.6rem;
}

.length-action-btn {
  border: 0;
  text-decoration: none;
  border-radius: 999px;
  padding: 0.62rem 1.2rem;
  font-weight: 800;
  cursor: pointer;
}

.length-action-btn.settings {
  background: #15b8ff;
  color: #063b57;
}

.length-action-btn.new-game {
  background: #2f73ff;
  color: #eaf2ff;
}

.length-stats-panel {
  background: #020b24;
  border: 1px solid #334155;
  border-radius: 16px;
  padding: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.length-stats-panel p {
  margin: 0;
  color: #98a3b8;
  font-size: 1.05rem;
}

.length-stats-actions {
  display: flex;
  gap: 0.55rem;
}

.length-pill {
  border: 0;
  border-radius: 999px;
  padding: 0.52rem 1rem;
  font-weight: 800;
  cursor: pointer;
}

.length-pill.stats {
  background: #7e3af2;
  color: #efe9ff;
}

.length-pill.share {
  background: #159a55;
  color: #042c17;
}

.length-modes-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.65rem;
}

.length-mode-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 1px solid #334155;
  border-radius: 999px;
  padding: 0.38rem 0.7rem;
  background: #121a2f;
  color: #e5e7eb;
  font-weight: 800;
}

body:not(.length-dark) .length-mode-chip {
  background: #d1d5db;
  border-color: #475569;
  color: #111827;
}

.game-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.35rem;
}

.grid {
  display: grid;
  gap: 0.45rem;
}

.tile {
  width: 62px;
  height: 62px;
  border-radius: 8px;
  border: 2px solid var(--tile-border);
  background: var(--tile);
  display: grid;
  place-items: center;
  font-size: 1.65rem;
  font-weight: 900;
  text-transform: uppercase;
  color: var(--text);
}

.tile.correct,
.tile.present,
.tile.absent {
  color: #fff;
}

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

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

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

.keyboard {
  width: 100%;
  max-width: 660px;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.kb-row {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 0.45rem;
}

.kb-row.last {
  grid-template-columns: 1.35fr repeat(7, minmax(0, 1fr)) 1.35fr;
}

.key {
  border: 0;
  border-radius: 6px;
  background: var(--key);
  color: #43495f;
  min-height: 52px;
  font-weight: 700;
  font-size: 1.05rem;
  cursor: pointer;
}

body.length-dark .key {
  background: #334155;
  color: #e5e7eb;
}

.hint {
  margin: 0.15rem 0 0;
  min-height: 1.4rem;
  color: #5e6476;
}

.length-seo-content {
  width: 100%;
  margin-top: 1rem;
}

.length-seo-wrap {
  border: 1px solid #334155;
  border-radius: 14px;
  background: #0f172a;
  padding: 1rem;
  line-height: 1.62;
}

.length-seo-wrap h1 {
  margin: 0 0 0.65rem;
  font-size: clamp(1.35rem, 4vw, 1.65rem);
  font-weight: 900;
  line-height: 1.25;
  color: var(--text);
}

.length-seo-wrap h2 {
  margin: 0 0 0.5rem;
  font-size: 1.35rem;
}

.length-seo-wrap h3 {
  margin: 0.95rem 0 0.35rem;
  font-size: 1.08rem;
}

.length-seo-wrap h3.examples-title {
  margin: 1rem 0 0.45rem;
  font-size: 2rem;
  line-height: 1.08;
  letter-spacing: -0.02em;
  font-weight: 900;
  color: var(--text);
}

.length-seo-wrap h4 {
  margin: 0.75rem 0 0.22rem;
  font-size: 0.98rem;
}

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

/* High-contrast internal links (dark + light) for SEO / accessibility */
.length-seo-wrap a,
.length-seo-faq-item a {
  color: #7dd3fc;
  font-weight: 600;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.length-seo-wrap a:visited,
.length-seo-faq-item a:visited {
  color: #a5b4fc;
}

.length-seo-wrap a:hover,
.length-seo-faq-item a:hover {
  color: #e0f2fe;
}

.length-seo-wrap a:focus-visible,
.length-seo-faq-item a:focus-visible {
  outline: 2px solid #38bdf8;
  outline-offset: 2px;
  border-radius: 2px;
}

.length-seo-lead {
  font-size: 1.03rem;
}

.length-seo-chip-row {
  margin: 0.75rem 0 0.25rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.length-seo-chip {
  border: 1px solid #334155;
  background: #0b1220;
  color: #cbd5e1;
  border-radius: 999px;
  padding: 0.28rem 0.62rem;
  font-size: 0.8rem;
  font-weight: 700;
}

.length-seo-steps {
  margin: 0.15rem 0 0.6rem 1.15rem;
  padding: 0;
}

.length-seo-steps li {
  margin-bottom: 0.3rem;
}

.length-seo-tips li {
  margin-bottom: 0.28rem;
}

.length-clue-examples {
  margin: 0.15rem 0 0.8rem;
  padding: 0.9rem;
  border: 1px solid #d1d5db;
  border-radius: 12px;
  background: #ffffff;
  display: grid;
  gap: 0.7rem;
}

.length-clue-row p {
  margin: 0.3rem 0 0;
  color: #111827;
  font-weight: 600;
}

.length-clue-word {
  display: flex;
  gap: 0.35rem;
}

.length-clue-box {
  width: 42px;
  height: 42px;
  border: 2px solid #9ca3af;
  background: #ffffff;
  color: #111827;
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.length-clue-box.is-correct {
  border-color: var(--green);
  background: var(--green);
  color: #ffffff;
}

.length-clue-box.is-present {
  border-color: var(--yellow);
  background: var(--yellow);
  color: #ffffff;
}

.length-clue-box.is-absent {
  border-color: var(--gray);
  background: var(--gray);
  color: #ffffff;
}

.length-seo-wrap h3 + .length-clue-examples {
  box-shadow: 0 4px 18px rgba(15, 23, 42, 0.08);
}

.length-seo-faq-grid {
  margin-top: 0.3rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
}

.length-seo-faq-item {
  border: 1px solid #334155;
  border-radius: 10px;
  background: #0b1220;
  padding: 0.62rem 0.68rem;
}

.length-seo-faq-item h4 {
  margin: 0 0 0.2rem;
}

.length-seo-faq-item p {
  margin: 0;
}

.length-seo-wrap ul {
  margin: 0.2rem 0 0.55rem 1.15rem;
  padding: 0;
}

body:not(.length-dark) .length-seo-wrap {
  border-color: #d5d9e3;
  background: #ffffff;
}

body:not(.length-dark) .length-seo-wrap h1,
body:not(.length-dark) .length-seo-wrap h2 {
  color: #0f172a;
}

body:not(.length-dark) .length-seo-wrap a,
body:not(.length-dark) .length-seo-faq-item a {
  color: #1d4ed8;
}

body:not(.length-dark) .length-seo-wrap a:visited,
body:not(.length-dark) .length-seo-faq-item a:visited {
  color: #5b21b6;
}

body:not(.length-dark) .length-seo-wrap a:hover,
body:not(.length-dark) .length-seo-faq-item a:hover {
  color: #1e3a8a;
}

body:not(.length-dark) .length-seo-wrap p,
body:not(.length-dark) .length-seo-wrap li {
  color: #374151;
}

body:not(.length-dark) .length-seo-chip {
  border-color: #d5d9e3;
  background: #f8fafc;
  color: #374151;
}

body:not(.length-dark) .length-seo-faq-item {
  border-color: #d5d9e3;
  background: #f8fafc;
}

.length-extra-play-content,
.length-rating-content {
  width: 100%;
  margin-top: 1.1rem;
}

.length-extra-wrap {
  border-top: 1px solid #cfd4de;
  padding-top: 1rem;
}

.length-extra-wrap h2 {
  margin: 0 0 0.2rem;
  text-align: center;
  font-size: clamp(1.2rem, 2.6vw, 2rem);
  letter-spacing: 0.02em;
}

.length-extra-wrap p {
  margin: 0 0 0.8rem;
  text-align: center;
  color: #677085;
}

.length-select-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.6rem;
}

.length-select-card {
  text-decoration: none;
  background: #fff;
  border: 1px solid #d5d9e3;
  border-radius: 12px;
  color: #121829;
  text-align: center;
  padding: 0.85rem 0.55rem;
}

.length-select-card strong {
  display: block;
  font-size: 2rem;
  line-height: 1;
}

.length-select-card span {
  display: block;
  margin-top: 0.3rem;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: #5e6477;
}

.length-rating-wrap {
  width: 100%;
  text-align: center;
  padding: 0.95rem 0 0.6rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.length-rate-badge {
  display: inline-block;
  background: #84cc16;
  color: #fff;
  font-weight: 800;
  border-radius: 14px;
  padding: 0.52rem 1.25rem;
}

.length-stars-row {
  margin-top: 0.85rem;
  display: flex;
  justify-content: center;
  gap: 0.25rem;
}

.length-star-btn {
  border: 0;
  background: transparent;
  color: #374151;
  font-size: 2.25rem;
  line-height: 1;
  cursor: pointer;
  transition: transform 120ms ease, color 150ms ease;
}

.length-star-btn:hover {
  transform: scale(1.06);
  color: #facc15;
}

.length-star-btn.active {
  color: #facc15;
}

.length-rating-submit-btn {
  margin-top: 0.65rem;
  border: 1px solid #2b3d63;
  background: #f8fafc;
  color: #111827;
  border-radius: 999px;
  padding: 0.42rem 0.92rem;
  font-weight: 700;
  cursor: pointer;
}

.length-rating-submit-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.length-rating-score {
  margin: 0.35rem 0 0;
  font-size: 2rem;
  font-weight: 900;
  color: #f8fafc;
}

.length-rating-votes {
  margin: 0;
  color: #cbd5e1;
}

.length-comment-wrap {
  background: #fff;
  border: 1px solid #d6dae3;
  border-radius: 10px;
  padding: 0.95rem;
}

.length-comment-wrap h2 {
  margin: 0 0 0.55rem;
  color: #111827;
}

.length-comment-form {
  display: grid;
  gap: 0.6rem;
}

.length-comment-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
}

.length-comment-form input,
.length-comment-form textarea {
  width: 100%;
  border: 1px solid #d4d7df;
  border-radius: 8px;
  padding: 0.65rem 0.7rem;
  font: inherit;
  color: #111827;
  background: #fafafa;
}

.length-comment-counter {
  margin: 0;
  text-align: right;
  color: #6b7280;
  font-size: 0.85rem;
}

.length-comment-submit {
  justify-self: start;
  border: 0;
  border-radius: 8px;
  background: #2563eb;
  color: #fff;
  font-weight: 700;
  padding: 0.65rem 1.05rem;
  cursor: pointer;
}

.length-comment-submit:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.length-site-footer {
  margin-top: 0.75rem;
  text-align: center;
}

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

.length-footer-links a {
  color: #334155;
  text-decoration: none;
}

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

body.length-dark .length-footer-links a {
  color: #7dd3fc;
}

body.length-dark .length-footer-links a:hover {
  color: #e0f2fe;
  text-decoration: underline;
}

.length-copyright,
.length-disclaimer {
  margin: 0.2rem 0 0;
  color: #6b7280;
  font-size: 0.92rem;
}

/* Win / overlay modal (used on 5-Letter-Words-Starting-With-A and similar) */
.modal.length-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: grid;
  place-items: center;
  padding: 1rem;
  z-index: 40;
}

.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.15rem;
  font-weight: 800;
  color: var(--text);
}

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

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

.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;
}

.win-card {
  width: min(100%, 460px);
}

.win-text {
  margin: 0.4rem 0 0.1rem;
  color: #94a3b8;
  font-size: 1rem;
}

body:not(.length-dark) .modal.length-modal {
  background: rgba(15, 23, 42, 0.35);
}

body:not(.length-dark) .modal-card {
  background: #ffffff;
  border-color: #d1d5db;
}

body:not(.length-dark) .modal-head h2 {
  color: #0f172a;
}

body:not(.length-dark) .icon-close {
  background: #e5e7eb;
  color: #1f2937;
}

body:not(.length-dark) .win-text {
  color: #475569;
}

body:not(.length-dark) .modal-copy-btn {
  background: #475569;
  color: #f8fafc;
}

@media (max-width: 760px) {
  .length-home-head {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .length-stats-panel {
    flex-direction: column;
    align-items: flex-start;
  }

  .tile {
    width: 52px;
    height: 52px;
    font-size: 1.4rem;
  }

  .key {
    min-height: 48px;
    font-size: 1rem;
  }

  .length-select-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .length-seo-faq-grid {
    grid-template-columns: 1fr;
  }

  .length-clue-box {
    width: 36px;
    height: 36px;
    font-size: 1.65rem;
  }

  .length-comment-row {
    grid-template-columns: 1fr;
  }
}
.non-game{
    max-width:820px;
}