/* ── Design Tokens ─────────────────────────────────────────────── */
:root {
  --bg:        #f8f7f4;
  --surface:   #ffffff;
  --surface2:  #f3f2ef;
  --border:    #e2e0da;
  --text:      #1a1917;
  --muted:     #8a8680;
  --accent:    #4f46e5;
  --accent-h:  #4338ca;
  --accent-bg: #eeedfb;
  --accent-fg: #3730a3;
  --radius:    9px;
  --radius-lg: 14px;
  --shadow:    0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.06);
  --shadow-lg: 0 4px 20px rgba(0,0,0,.14);
  --teal:      #4f46e5;
  --teal-dark: #3730a3;
  --green:     #2d7a4a;
  --yellow:    #b07a00;
  --purple:    #6b3fa0;
  --btn-primary:   #4f46e5;
  --btn-primary-h: #3730a3;
  --mono:      'Courier New', Courier, monospace;
}

/* ── Reset ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: 'Space Grotesk', system-ui, sans-serif; background: var(--bg); color: var(--text); line-height: 1.6; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Header ────────────────────────────────────────────────────── */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 56px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.site-logo { font-size: 1.15rem; font-weight: 700; color: var(--text); letter-spacing: -.5px; text-decoration: none; }
.site-nav { display: flex; align-items: center; gap: 6px; }
.nav-link {
  display: none;
  align-items: center;
  justify-content: center;
  min-width: 108px;
  font-size: .875rem;
  font-weight: 600;
  padding: 8px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  background: transparent;
  text-decoration: none;
  transition: background .18s, border-color .18s, color .18s, transform .1s;
}
.nav-link:hover { background: var(--accent); border-color: var(--accent); color: #fff; text-decoration: none; transform: translateY(-1px); }
.nav-link:active { transform: scale(.97); }
.nav-link.active { background: var(--accent); border-color: var(--accent); color: #fff; }
@media (min-width: 680px) {
  .site-nav .nav-link { display: inline-flex; }
  .nav-hamburger { display: none; }
  .nav-mobile-menu { display: none !important; }
}
.nav-hamburger { display: flex; align-items: center; gap: 6px; background: none; border: 1px solid var(--border); cursor: pointer; padding: 6px 12px; border-radius: var(--radius); font-size: .85rem; font-weight: 600; letter-spacing: .06em; color: var(--text); transition: background .2s; }
.nav-hamburger:hover { background: rgba(0,0,0,.07); }
.nav-mobile-menu { display: none; flex-direction: column; background: var(--surface); border-bottom: 1px solid var(--border); padding: 10px 16px 14px; gap: 8px; }
.nav-mobile-menu.open { display: flex; }
.nav-mobile-link { display: block; text-align: center; text-decoration: none; font-size: 1rem; font-weight: 600; color: var(--text); background: var(--surface2); border: 1.5px solid var(--border); border-radius: var(--radius); padding: 13px 16px; transition: background .18s, border-color .18s, color .18s; }
.nav-mobile-link:hover { background: var(--accent); border-color: var(--accent); color: #fff; text-decoration: none; }
.nav-mobile-link.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ── Layout ────────────────────────────────────────────────────── */
.container { max-width: 860px; margin: 0 auto; padding: 0 20px; }
.page-main { padding: 36px 0 72px; }

/* ── Page Hero ─────────────────────────────────────────────────── */
.dict-hero { margin-bottom: 32px; }
.dict-hero h1 { font-size: 2rem; font-weight: 800; color: var(--text); margin-bottom: 8px; line-height: 1.2; }
.dict-subtitle { color: var(--muted); font-size: 1rem; margin-bottom: 20px; }
.dict-divider { border: none; border-top: 1px solid var(--border); margin: 20px 0 28px; }

/* ── Search / Input ────────────────────────────────────────────── */
.search-row { display: flex; gap: 8px; margin-bottom: 28px; }
.search-row input {
  flex: 1;
  font-family: inherit;
  font-size: 1rem;
  padding: 12px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.search-row input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79,70,229,.12); }
.btn-primary {
  font-family: inherit;
  font-size: .95rem;
  font-weight: 700;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: var(--radius);
  padding: 12px 24px;
  cursor: pointer;
  transition: background .15s;
  white-space: nowrap;
}
.btn-primary:hover { background: var(--accent-h); }

/* ── Word Entry ────────────────────────────────────────────────── */
.word-entry { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); padding: 28px 28px 24px; margin-bottom: 16px; }
.word-entry h2 { font-size: 1.6rem; font-weight: 800; color: var(--text); margin-bottom: 4px; }
.word-pos { display: inline-block; font-size: .78rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--accent-fg); background: var(--accent-bg); padding: 2px 10px; border-radius: 999px; margin-bottom: 14px; }
.word-def { font-size: .95rem; color: var(--text); line-height: 1.65; margin-bottom: 10px; }
.word-example { font-size: .875rem; color: var(--muted); font-style: italic; border-left: 3px solid var(--accent-bg); padding-left: 12px; }

/* ── Synonym Pills ─────────────────────────────────────────────── */
.syn-group { margin-top: 14px; }
.syn-label { font-size: .75rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.syn-pills { display: flex; flex-wrap: wrap; gap: 7px; }
.syn-pill { font-size: .85rem; font-weight: 600; color: var(--accent-fg); background: var(--accent-bg); padding: 5px 12px; border-radius: 999px; cursor: pointer; transition: background .15s, color .15s; text-decoration: none; }
.syn-pill:hover { background: var(--accent); color: #fff; text-decoration: none; }

/* ── Info sections ─────────────────────────────────────────────── */
.info-section { margin-bottom: 28px; }
.info-section h2 { font-size: 1.1rem; font-weight: 700; margin-bottom: 8px; }
.info-section p { font-size: .95rem; color: var(--muted); line-height: 1.65; }
.info-section a { color: var(--accent); }

/* ── Articles list ─────────────────────────────────────────────── */
.articles-list { list-style: none; display: flex; flex-direction: column; gap: 14px; margin-bottom: 36px; }
.articles-list a {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px 24px;
  box-shadow: var(--shadow);
  transition: border-color .18s, transform .12s;
  text-decoration: none;
}
.articles-list a:hover { border-color: var(--accent); transform: translateY(-2px); text-decoration: none; }
.articles-list .art-title { font-size: 1.05rem; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.articles-list .art-desc { font-size: .875rem; color: var(--muted); line-height: 1.5; }
.art-tag { display: inline-block; font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--accent-fg); background: var(--accent-bg); padding: 2px 9px; border-radius: 999px; margin-bottom: 8px; }

/* ── Article body ──────────────────────────────────────────────── */
.article-body { max-width: 680px; }
.article-body h1 { font-size: 1.9rem; font-weight: 800; line-height: 1.2; margin-bottom: 10px; }
.article-body .article-meta { font-size: .85rem; color: var(--muted); margin-bottom: 24px; }
.article-body h2 { font-size: 1.2rem; font-weight: 700; margin: 28px 0 10px; }
.article-body p { font-size: .975rem; color: var(--text); line-height: 1.7; margin-bottom: 16px; }
.article-body ul { padding-left: 20px; margin-bottom: 16px; }
.article-body ul li { font-size: .975rem; color: var(--text); line-height: 1.7; margin-bottom: 8px; }
.article-body a { color: var(--accent); }
.article-cta { background: var(--accent-bg); border: 1px solid var(--accent-fg); border-radius: 12px; padding: 20px 24px; margin: 32px 0; }
.article-cta p { color: var(--accent-fg); font-weight: 600; margin-bottom: 10px; }
.article-cta a { display: inline-block; background: var(--accent); color: #fff; padding: 10px 22px; border-radius: var(--radius); font-weight: 700; font-size: .9rem; text-decoration: none; }
.article-cta a:hover { background: var(--accent-h); text-decoration: none; }

/* ── Footer ────────────────────────────────────────────────────── */
.site-footer { border-top: 1px solid var(--border); padding: 24px 20px; text-align: center; font-size: .8rem; color: var(--muted); }
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--text); text-decoration: none; }

/* ── Button variants (games) ───────────────────────────────────── */
.btn { display: inline-block; padding: 10px 20px; border-radius: var(--radius); font-family: inherit; font-size: .9rem; font-weight: 700; cursor: pointer; border: none; transition: background .15s; }
.btn-sm { padding: 8px 16px; font-size: .85rem; }
.btn-green  { background: #2d7a4a; color: #fff; } .btn-green:hover  { background: #1f5c35; }
.btn-yellow { background: #b07a00; color: #fff; } .btn-yellow:hover { background: #8a5f00; }
.btn-purple { background: var(--purple); color: #fff; } .btn-purple:hover { background: #532e7a; }
.btn-teal   { background: var(--teal); color: #fff; } .btn-teal:hover   { background: var(--teal-dark); }
.btn-outline { background: transparent; color: var(--accent); border: 2px solid var(--accent); } .btn-outline:hover { background: var(--accent); color: #fff; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }

/* ── Stat box ──────────────────────────────────────────────────── */
.stat-box { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.stat-val { font-size: 1.6rem; font-weight: 800; color: var(--text); }
.stat-label { font-size: .75rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }

/* ── Games page ────────────────────────────────────────────────── */
.games-hero { margin-bottom: 32px; }
.games-hero h1 { font-size: 2rem; font-weight: 800; margin-bottom: 6px; }
.games-hero p { color: var(--muted); }
.featured-games { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin-bottom: 40px; }
.game-card { border-radius: var(--radius-lg); padding: 24px; }
.game-card-green  { background: #d4edda; }
.game-card-yellow { background: #fff3cd; }
.game-card-purple { background: #e8d5f5; }
.game-card-icon { font-size: 2rem; margin-bottom: 8px; }
.game-card h3 { font-size: 1.15rem; font-weight: 800; margin-bottom: 6px; }
.game-card p { font-size: .88rem; color: #444; margin-bottom: 16px; line-height: 1.5; }
.section-title { font-size: 1.5rem; font-weight: 800; margin-bottom: 6px; }
.section-sub { color: var(--muted); font-size: .95rem; margin-bottom: 20px; }
.game-tabs { display: flex; border-bottom: 2px solid var(--border); margin-bottom: 24px; overflow-x: auto; }
.tab-btn { background: none; border: none; padding: 10px 20px; font-size: .95rem; font-weight: 600; cursor: pointer; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -2px; transition: color .2s, border-color .2s; white-space: nowrap; font-family: inherit; }
.tab-btn.tab-active { color: var(--teal); border-bottom-color: var(--teal); }
.tab-btn:hover { color: var(--teal); }
.game-section { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 32px 24px; margin-bottom: 32px; box-shadow: var(--shadow); }
.game-section.hidden { display: none; }

/* Wordle */
.wordle-wrap { max-width: 380px; margin: 0 auto; }
#wordle-message { text-align: center; font-size: 1rem; font-weight: 600; min-height: 26px; color: var(--btn-primary); margin-bottom: 12px; }
#wordle-grid { display: grid; grid-template-columns: repeat(5, 52px); gap: 6px; justify-content: center; margin-bottom: 20px; }
.wordle-cell { width: 52px; height: 52px; border: 2px solid var(--border); border-radius: 4px; display: flex; align-items: center; justify-content: center; font-size: 1.4rem; font-weight: 800; text-transform: uppercase; transition: background .3s, border-color .3s, color .3s; }
.wordle-cell.pop { animation: pop .1s ease; }
.wordle-cell.correct { background: #538d4e; border-color: #538d4e; color: #fff; }
.wordle-cell.present { background: #b59f3b; border-color: #b59f3b; color: #fff; }
.wordle-cell.absent  { background: #3a3a3c; border-color: #3a3a3c; color: #fff; }
@keyframes pop { 0%,100% { transform: scale(1); } 50% { transform: scale(1.1); } }
#wordle-keyboard { max-width: 420px; margin: 0 auto; }
.kb-row { display: flex; justify-content: center; gap: 4px; margin-bottom: 6px; }
.kb-key { min-width: 36px; height: 48px; border: none; border-radius: 4px; background: #d3d6da; color: #1a1a1b; font-size: .85rem; font-weight: 700; cursor: pointer; padding: 0 4px; transition: background .15s; font-family: inherit; }
.kb-key.kb-wide { min-width: 56px; font-size: .75rem; }
.kb-key:hover { background: #bbb; }
.kb-key.correct { background: #538d4e; color: #fff; }
.kb-key.present { background: #b59f3b; color: #fff; }
.kb-key.absent  { background: #3a3a3c; color: #fff; }
.wordle-actions { display: flex; justify-content: center; gap: 10px; margin-top: 16px; }

/* Word Scramble */
.scramble-wrap { max-width: 480px; margin: 0 auto; text-align: center; }
.scramble-stats { display: flex; justify-content: center; gap: 32px; margin-bottom: 24px; }
#scramble-word { font-size: 2.2rem; font-weight: 800; letter-spacing: 4px; color: var(--btn-primary); margin-bottom: 24px; font-family: var(--mono); }
.scramble-input-row { display: flex; gap: 8px; justify-content: center; margin-bottom: 12px; }
.scramble-input-row input { padding: 12px 16px; font-size: 1.1rem; border: 2px solid var(--border); border-radius: var(--radius); outline: none; width: 200px; text-align: center; letter-spacing: 1px; font-family: inherit; }
.scramble-input-row input:focus { border-color: var(--teal); }
#scramble-feedback { min-height: 24px; font-size: .95rem; font-weight: 600; color: var(--green); margin-bottom: 12px; }

/* Anagram Blast */
.anagram-wrap { max-width: 560px; margin: 0 auto; }
#anagram-letters { font-size: 2rem; font-weight: 800; letter-spacing: 6px; color: var(--teal); text-align: center; margin-bottom: 8px; font-family: var(--mono); }
.anagram-timer-row { text-align: center; color: var(--muted); font-size: .9rem; margin-bottom: 16px; }
.anagram-stats { display: flex; justify-content: center; gap: 24px; margin-bottom: 20px; }
.anagram-input-row { display: flex; gap: 8px; justify-content: center; margin-bottom: 10px; }
.anagram-input-row input { padding: 11px 14px; font-size: 1rem; border: 2px solid var(--border); border-radius: var(--radius); outline: none; width: 180px; font-family: inherit; }
.anagram-input-row input:focus { border-color: var(--teal); }
#anagram-feedback { min-height: 22px; text-align: center; font-size: .9rem; font-weight: 600; color: var(--green); margin-bottom: 16px; }
#anagram-found-list { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; max-height: 180px; overflow-y: auto; }
.found-word { background: var(--teal); color: #fff; padding: 4px 12px; border-radius: 20px; font-size: .85rem; font-family: var(--mono); text-transform: uppercase; }

/* Hints section */
.hints-section { margin-top: 48px; padding-top: 32px; border-top: 1px solid var(--border); }
.hints-section-header { margin-bottom: 24px; }
.hints-section-header h2 { font-size: 1.6rem; font-weight: 800; color: var(--text); margin-bottom: 4px; }
.hints-section-header p  { font-size: .95rem; color: var(--muted); }
.hints-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.hint-card-featured { grid-row: span 2; }
.hint-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; box-shadow: var(--shadow); transition: box-shadow .2s, transform .2s; cursor: pointer; }
.hint-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.hint-card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.hint-card-text { flex: 1; }
.hint-card-text h3 { font-size: 1.05rem; font-weight: 700; color: var(--text); margin-bottom: 6px; line-height: 1.3; }
.hint-card-featured .hint-card-text h3 { font-size: 1.2rem; }
.hint-card-text p  { font-size: .88rem; color: var(--muted); line-height: 1.45; margin: 0; }
.hint-date { font-size: .78rem; color: var(--muted); margin-top: 12px; }
.hint-icon { width: 48px; height: 48px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; flex-shrink: 0; }
.hint-card-featured .hint-icon { width: 64px; height: 64px; font-size: 1.9rem; border-radius: 14px; }
.hint-icon-purple { background: #e8d5f5; }
.hint-icon-pink   { background: #fde8f0; }
.hint-icon-blue   { background: #dbeafe; }
.hint-icon-green  { background: #d4edda; }
.hint-icon-indigo { background: var(--accent-bg); }
.hint-icon-yellow { background: #fff3cd; }
.hint-icon-teal   { background: #ccfbf1; }
.hint-icon-orange { background: #ffedd5; }

@media (max-width: 680px) {
  .hints-grid { grid-template-columns: 1fr 1fr; }
  .hint-card-featured { grid-row: span 1; }
}
@media (max-width: 400px) {
  .hints-grid { grid-template-columns: 1fr; }
  #wordle-grid { grid-template-columns: repeat(5, 44px); }
  .wordle-cell { width: 44px; height: 44px; font-size: 1.2rem; }
  .kb-key { min-width: 30px; padding: 12px 5px; font-size: .75rem; }
  .kb-key.kb-wide { min-width: 46px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
