/* ============================================================
   Unlimited Wordle — shared stylesheet
   Used by every page on the site (game pages + content pages)
   ============================================================ */

:root {
  --bg: #0d0d0d;
  --surface: #181818;
  --surface-2: #141414;
  --border: #2a2a2a;
  --text: #f0ece4;
  --text-soft: #cfc9bd;
  --muted: #8a8a8a;
  --correct: #4caf7d;
  --present: #e5a84b;
  --absent: #3a3a3a;
  --absent-text: #666;
  --accent: #e5a84b;
  --accent2: #4caf7d;
  --link: #e5a84b;
  --tile-size: 52px;
  --tile-gap: clamp(4px, 1.2vw, 7px);
  --key-bg: #2c2c2c;
  --key-color: #f0ece4;
  --max-w: 560px;
  --content-w: 760px;
  --danger: #e05252;
}

[data-theme="light"] {
  --bg: #f5f0e8;
  --surface: #fff;
  --surface-2: #efe9df;
  --border: #c8c0b4;
  --text: #1a1a1a;
  --text-soft: #3a352d;
  --muted: #706a5f;
  --absent: #ccc;
  --absent-text: #555;
  --key-bg: #d4cfc8;
  --key-color: #1a1a1a;
  --link: #a5751f;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { height: 100%; height: 100dvh; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Nunito', sans-serif;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  overflow-y: auto;
}

a { color: var(--link); }
img { max-width: 100%; }

/* ── SITE HEADER / NAV ── */
.site-header {
  width: 100%;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  flex-shrink: 0;
}

.site-nav {
  max-width: 1080px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  gap: 12px;
}

.site-brand {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.35rem;
  letter-spacing: 0.06em;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}

.site-brand span { color: var(--accent); }

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: 'DM Mono', monospace;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.nav-item { position: relative; }

.nav-link {
  display: block;
  padding: 8px 10px;
  color: var(--text-soft);
  text-decoration: none;
  border-radius: 5px;
  transition: background 0.15s, color 0.15s;
}

.nav-link:hover, .nav-link.active { color: var(--accent); background: rgba(229,168,75,0.1); }

.nav-dropdown { position: relative; }

.nav-dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  min-width: 200px;
  padding: 6px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
  z-index: 50;
}

.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown:focus-within .nav-dropdown-menu { display: block; }

.nav-dropdown-menu .nav-link { padding: 9px 12px; border-radius: 6px; }

.nav-right { display: flex; align-items: center; gap: 6px; }

.theme-toggle-btn {
  font-family: 'DM Mono', monospace;
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  padding: 6px 12px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s;
  text-transform: uppercase;
  white-space: nowrap;
}
.theme-toggle-btn:hover { border-color: var(--accent); color: var(--accent); }

.nav-toggle {
  display: none;
  background: none;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 1.1rem;
  padding: 5px 10px;
  cursor: pointer;
}

@media (max-width: 780px) {
  .nav-links { display: none; position: absolute; top: 100%; left: 0; right: 0; flex-direction: column; align-items: stretch; background: var(--surface); border-bottom: 1px solid var(--border); padding: 8px; gap: 2px; }
  .nav-links.open { display: flex; }
  .nav-dropdown-menu { position: static; display: block; border: none; box-shadow: none; padding-left: 12px; background: transparent; }
  .nav-dropdown > .nav-link::after { content: ''; }
  .nav-toggle { display: block; }
  .site-nav { position: relative; flex-wrap: wrap; }
}

/* ── GAME SHELL (the actual puzzle UI) ── */
.game-shell {
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: clamp(6px, 2vh, 18px) 20px clamp(4px, 1vh, 10px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.logo {
  font-family: 'Bebas Neue', sans-serif;
  font-size: clamp(1.5rem, 6vw, 2.6rem);
  letter-spacing: 0.08em;
  background: linear-gradient(135deg, #e5a84b 0%, #f0ece4 50%, #4caf7d 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
  text-align: center;
}

.logo-sub {
  font-family: 'DM Mono', monospace;
  font-size: clamp(0.5rem, 1.5vw, 0.65rem);
  color: var(--muted);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-top: 1px;
  text-align: center;
}

.mode-picker {
  display: flex;
  gap: 8px;
  margin: clamp(6px, 1.5vh, 14px) 0 clamp(4px, 1vh, 8px);
}

.mode-btn {
  font-family: 'DM Mono', monospace;
  font-size: clamp(0.65rem, 2vw, 0.78rem);
  font-weight: 500;
  letter-spacing: 0.12em;
  padding: 5px 14px;
  border-radius: 4px;
  border: 1.5px solid var(--border);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s;
  text-transform: uppercase;
}

.mode-btn:hover { border-color: var(--accent); color: var(--accent); }

.mode-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #0d0d0d;
  font-weight: 700;
}

main {
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: clamp(4px, 1.2vh, 14px) 12px clamp(4px, 1vh, 10px);
  gap: clamp(4px, 1.2vh, 12px);
  overflow-x: hidden;
}

#toast {
  position: fixed;
  top: 90px;
  left: 50%;
  transform: translateX(-50%) translateY(-10px);
  background: var(--text);
  color: var(--bg);
  font-family: 'DM Mono', monospace;
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  padding: 10px 22px;
  border-radius: 6px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  z-index: 999;
  white-space: nowrap;
  text-transform: uppercase;
}

#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

#grid { display: flex; flex-direction: column; gap: var(--tile-gap); }
.row { display: flex; gap: var(--tile-gap); }

.tile {
  width: var(--tile-size);
  height: var(--tile-size);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Bebas Neue', sans-serif;
  font-size: clamp(1.2rem, 5vw, 2rem);
  letter-spacing: 0.05em;
  color: var(--text);
  background: transparent;
  transition: border-color 0.1s;
  position: relative;
  user-select: none;
}

.tile.filled { border-color: var(--muted); animation: pop 0.1s ease; }
.tile.correct { background: var(--correct); border-color: var(--correct); color: #fff; }
.tile.present { background: var(--present); border-color: var(--present); color: #fff; }
.tile.absent  { background: var(--absent);  border-color: var(--absent);  color: var(--absent-text); }
.tile.reveal { animation: flip 0.5s ease forwards; }
.tile.shake  { animation: shake 0.5s ease; }
.tile.bounce { animation: bounce 0.5s ease forwards; }

@keyframes pop { 0% { transform: scale(0.9); } 50% { transform: scale(1.12); } 100% { transform: scale(1); } }
@keyframes flip { 0% { transform: rotateX(0deg); } 49%,50% { transform: rotateX(90deg); } 100% { transform: rotateX(0deg); } }
@keyframes shake { 0%,100% { transform: translateX(0); } 20% { transform: translateX(-6px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(4px); } }
@keyframes bounce { 0%,100% { transform: translateY(0); } 40% { transform: translateY(-18px); } 70% { transform: translateY(-6px); } }

#keyboard {
  width: 100%;
  max-width: 500px;
  display: flex;
  flex-direction: column;
  gap: clamp(4px, 1vh, 7px);
  padding: 0 4px;
  flex-shrink: 0;
}

.kb-row { display: flex; justify-content: center; gap: clamp(3px, 1vw, 5px); }

.key {
  font-family: 'DM Mono', monospace;
  font-size: clamp(0.6rem, 2.5vw, 0.78rem);
  font-weight: 500;
  padding: 0;
  height: clamp(36px, 7vh, 54px);
  min-width: 0;
  flex: 1;
  border-radius: 5px;
  border: none;
  background: var(--key-bg);
  color: var(--key-color);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s, transform 0.08s;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.key:active { transform: scale(0.93); }
.key.wide { flex: 1.6; font-size: clamp(0.5rem, 2vw, 0.65rem); letter-spacing: 0.04em; }
.key.correct { background: var(--correct); color: #fff; }
.key.present { background: var(--present); color: #fff; }
.key.absent  { background: #1e1e1e; color: var(--muted); }
[data-theme="light"] .key { background: var(--key-bg); color: var(--key-color); }
[data-theme="light"] .key.correct { background: var(--correct); color: #fff; }
[data-theme="light"] .key.present { background: var(--present); color: #fff; }
[data-theme="light"] .key.absent { background: #b0a89e; color: #555; }

.key.enter-key {
  flex: 0 0 80%;
  max-width: 340px;
  height: clamp(40px, 8vh, 56px);
  font-size: clamp(0.75rem, 2.5vw, 0.95rem);
  font-weight: 700;
  letter-spacing: 0.14em;
  background: var(--accent2);
  color: #fff;
  border-radius: 8px;
}
.key.enter-key:hover { filter: brightness(1.1); }

#end-screen {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: clamp(6px, 1.5vh, 14px);
  padding: clamp(10px, 2vh, 18px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  width: 100%;
  max-width: 360px;
  text-align: center;
  animation: fadeIn 0.4s ease;
  flex-shrink: 0;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
#end-screen.visible { display: flex; }

.end-title { font-family: 'Bebas Neue', sans-serif; font-size: 2.4rem; letter-spacing: 0.1em; }
.end-title.win  { color: var(--correct); }
.end-title.lose { color: var(--danger); }

.end-word { font-family: 'DM Mono', monospace; font-size: 0.8rem; color: var(--muted); letter-spacing: 0.18em; text-transform: uppercase; }
.end-word span { font-size: 1.1rem; color: var(--text); font-weight: 500; display: block; margin-top: 3px; letter-spacing: 0.22em; }

#stats-row { display: flex; gap: 20px; }
.stat { display: flex; flex-direction: column; align-items: center; }
.stat-num { font-family: 'Bebas Neue', sans-serif; font-size: 2.2rem; color: var(--accent); }
.stat-label { font-family: 'DM Mono', monospace; font-size: 0.6rem; color: var(--muted); letter-spacing: 0.15em; text-transform: uppercase; }

.play-again-btn {
  font-family: 'DM Mono', monospace;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 12px 28px;
  background: var(--accent2);
  color: #0d0d0d;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: filter 0.2s, transform 0.1s;
}
.play-again-btn:hover { filter: brightness(1.15); }
.play-again-btn:active { transform: scale(0.96); }

.hint-text { font-family: 'DM Mono', monospace; font-size: clamp(0.52rem, 1.6vw, 0.65rem); color: var(--muted); letter-spacing: 0.08em; text-align: center; margin-top: 2px; }

.color-legend { display: flex; gap: 10px; align-items: center; margin-top: 4px; flex-wrap: wrap; justify-content: center; }
.legend-item { display: flex; align-items: center; gap: 5px; font-family: 'DM Mono', monospace; font-size: clamp(0.5rem, 1.4vw, 0.6rem); color: var(--muted); letter-spacing: 0.06em; text-transform: uppercase; }
.legend-dot { width: 12px; height: 12px; border-radius: 3px; flex-shrink: 0; }
.legend-dot.correct { background: var(--correct); }
.legend-dot.present { background: var(--present); }
.legend-dot.absent  { background: var(--absent); border: 1px solid var(--border); }

.divider { width: 40px; height: 1px; background: var(--border); }

@media (max-height: 680px) { .logo-sub { display: none; } }
@media (max-height: 580px) { .logo { font-size: 1.2rem; } .mode-picker { margin: 3px 0; } }

/* ============================================================
   CONTENT PAGES (guides, tools, about, faq, etc.)
   ============================================================ */

.content-wrap {
  width: 100%;
  max-width: var(--content-w);
  margin: 0 auto;
  padding: 28px 20px 60px;
  flex: 1;
}

.breadcrumbs {
  font-family: 'DM Mono', monospace;
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 18px;
  text-transform: uppercase;
}
.breadcrumbs a { color: var(--muted); text-decoration: none; }
.breadcrumbs a:hover { color: var(--accent); }

.page-hero { margin-bottom: 28px; }
.page-hero h1 {
  font-family: 'Bebas Neue', sans-serif;
  font-size: clamp(2rem, 6vw, 3rem);
  letter-spacing: 0.03em;
  line-height: 1.1;
  margin-bottom: 10px;
}
.page-hero .lede { font-size: 1.05rem; color: var(--text-soft); line-height: 1.6; max-width: 62ch; }

.content-wrap h2 {
  font-family: 'Bebas Neue', sans-serif;
  font-size: clamp(1.4rem, 3.5vw, 1.9rem);
  letter-spacing: 0.02em;
  margin: 36px 0 14px;
}
.content-wrap h3 {
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-size: 1.15rem;
  margin: 22px 0 8px;
}
.content-wrap p { line-height: 1.75; color: var(--text-soft); margin-bottom: 14px; max-width: 72ch; }
.content-wrap ul, .content-wrap ol { margin: 0 0 16px 22px; color: var(--text-soft); line-height: 1.75; max-width: 72ch; }
.content-wrap li { margin-bottom: 6px; }
.content-wrap strong { color: var(--text); }
.content-wrap a { text-decoration: underline; text-underline-offset: 2px; }
.content-wrap a:hover { color: var(--accent2); }

.example-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
  margin: 16px 0 20px;
  font-family: 'DM Mono', monospace;
  font-size: 0.85rem;
  line-height: 2;
}
.example-box .ex-label { color: var(--muted); text-transform: uppercase; font-size: 0.65rem; letter-spacing: 0.1em; display: block; margin-bottom: 8px; }
.example-word { letter-spacing: 0.15em; }
.ex-tile { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 4px; font-weight: 700; margin-right: 3px; }
.ex-tile.correct { background: var(--correct); color: #fff; }
.ex-tile.present { background: var(--present); color: #fff; }
.ex-tile.absent { background: var(--absent); color: var(--absent-text); }

.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin: 18px 0 28px; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px;
  text-decoration: none;
  color: var(--text);
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color 0.15s, transform 0.15s;
}
.card:hover { border-color: var(--accent); transform: translateY(-2px); }
.card h3 { margin: 0; font-size: 1.05rem; }
.card p { margin: 0; font-size: 0.88rem; color: var(--muted); max-width: none; }
.card .card-tag { font-family: 'DM Mono', monospace; font-size: 0.62rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); }

.cta-box {
  background: linear-gradient(135deg, rgba(229,168,75,0.12), rgba(76,175,125,0.12));
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 22px;
  margin: 24px 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.cta-box .cta-text h3 { margin: 0 0 4px; }
.cta-box .cta-text p { margin: 0; color: var(--muted); font-size: 0.9rem; }
.btn {
  display: inline-block;
  font-family: 'DM Mono', monospace;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 12px 22px;
  background: var(--accent2);
  color: #fff;
  border: none;
  border-radius: 7px;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: filter 0.15s, transform 0.1s;
}
.btn:hover { filter: brightness(1.12); }
.btn:active { transform: scale(0.97); }
.btn.btn-outline { background: transparent; border: 1.5px solid var(--border); color: var(--text); }
.btn.btn-outline:hover { border-color: var(--accent); color: var(--accent); }

.faq-item { border-bottom: 1px solid var(--border); padding: 14px 0; }
.faq-item summary { font-weight: 800; cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: '+'; font-family: 'DM Mono', monospace; color: var(--accent); font-size: 1.2rem; flex-shrink: 0; }
.faq-item[open] summary::after { content: '\2212'; }
.faq-item p { margin-top: 10px; }

.guide-meta { font-family: 'DM Mono', monospace; font-size: 0.68rem; color: var(--muted); letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 6px; }

/* ── SOLVER / WORD FINDER TOOL ── */
.solver-panel { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 20px; margin-bottom: 24px; }
.solver-row-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.solver-tiles { display: flex; gap: 6px; }
.solver-tile {
  width: 42px; height: 42px;
  border: 2px solid var(--border);
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.3rem;
  text-align: center;
  text-transform: uppercase;
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, border-color 0.15s;
}
.solver-tile.correct { background: var(--correct); border-color: var(--correct); color: #fff; }
.solver-tile.present { background: var(--present); border-color: var(--present); color: #fff; }
.solver-tile.absent { background: var(--absent); border-color: var(--absent); color: var(--absent-text); }
.solver-tile input { display: none; }
.solver-remove-row { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 1.1rem; padding: 0 8px; }
.solver-remove-row:hover { color: var(--danger); }
.solver-controls { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.solver-hint { font-family: 'DM Mono', monospace; font-size: 0.7rem; color: var(--muted); margin-top: 10px; line-height: 1.6; }
.solver-length-toggle { display: flex; gap: 8px; margin-bottom: 14px; }
.solver-results { margin-top: 4px; }
.solver-count { font-family: 'DM Mono', monospace; font-size: 0.78rem; color: var(--muted); margin-bottom: 10px; }
.word-chip-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.word-chip {
  font-family: 'DM Mono', monospace;
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 5px 9px;
  text-transform: uppercase;
  color: var(--text);
}
.browse-filters { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.browse-filters input, .browse-filters select {
  font-family: 'DM Mono', monospace;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 0.8rem;
}
.browse-filters input { flex: 1; min-width: 140px; }

/* ── SITE FOOTER ── */
.site-footer {
  width: 100%;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  flex-shrink: 0;
  margin-top: auto;
}
.footer-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 32px 20px 20px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 24px;
}
.footer-col h4 {
  font-family: 'DM Mono', monospace;
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}
.footer-col a { display: block; color: var(--text-soft); text-decoration: none; font-size: 0.85rem; margin-bottom: 8px; }
.footer-col a:hover { color: var(--accent); }
.footer-bottom {
  max-width: 1080px;
  margin: 0 auto;
  padding: 14px 20px 24px;
  font-family: 'DM Mono', monospace;
  font-size: 0.62rem;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-top: 1px solid var(--border);
}
.footer-bottom a { color: var(--muted); }
.footer-bottom a:hover { color: var(--accent); }

@media (max-width: 640px) {
  .content-wrap { padding: 20px 16px 44px; }
  .cta-box { flex-direction: column; align-items: flex-start; }
}
