/* ============================================================
   UnscrambleWords — global stylesheet
   Brand is a placeholder: find-and-replace "UnscrambleWords" + "unscramblewordsfast.net"
   Motif: letter tiles on a game table. Signature: results ARE tiles.
   ============================================================ */

:root {
  --ink: #212837;            /* slate ink */
  --ink-soft: #5b6577;
  --paper: #f3f5f8;          /* cool table felt, light */
  --card: #ffffff;
  --line: #dde2ea;
  --board: #3457c4;          /* board blue (actions, links) */
  --board-deep: #2743a0;
  --tile-bg: #f8dd86;        /* honey tile */
  --tile-edge: #d9b74f;
  --tile-ink: #4a3a10;
  --ok: #2e9e63;
  --warn: #d08b12;
  --bad: #c04b42;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(33, 40, 55, .06), 0 8px 24px rgba(33, 40, 55, .08);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #e9edf4;
    --ink-soft: #a2adc0;
    --paper: #12161f;
    --card: #1b2230;
    --line: #2c3648;
    --board: #7d9bf0;
    --board-deep: #9cb3f4;
    --tile-bg: #e3c65e;
    --tile-edge: #b8983a;
    --tile-ink: #3a2e0c;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--paper);
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--board); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 3px solid var(--tile-edge); outline-offset: 2px; border-radius: 4px; }

.container { max-width: 1080px; margin: 0 auto; padding: 0 1rem; }

/* ---------- Header / nav ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--paper) 90%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.nav { display: flex; align-items: center; gap: 1rem; min-height: 3.5rem; }
.brand {
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -.02em;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: .5rem;
  white-space: nowrap;
}
.brand:hover { text-decoration: none; }
.brand .mark {
  width: 1.2rem; height: 1.2rem;
  border-radius: 4px;
  background: var(--tile-bg);
  border: 1px solid var(--tile-edge);
  color: var(--tile-ink);
  font-size: .8rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.nav-toggle {
  margin-left: auto;
  display: none;
  background: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: .4rem .6rem;
  font-size: 1.1rem;
  color: var(--ink);
  cursor: pointer;
}
.nav-links { margin-left: auto; display: flex; gap: .25rem; list-style: none; padding: 0; flex-wrap: wrap; }
.nav-links a {
  display: block;
  padding: .45rem .7rem;
  border-radius: 8px;
  color: var(--ink-soft);
  font-weight: 600;
  font-size: .92rem;
}
.nav-links a:hover { color: var(--ink); background: var(--line); text-decoration: none; }
.nav-links a[aria-current="page"] { color: var(--board); background: color-mix(in srgb, var(--board) 12%, transparent); }

@media (max-width: 920px) {
  .nav-toggle { display: block; }
  .nav-links {
    display: none;
    position: absolute;
    left: 0; right: 0; top: 100%;
    margin: 0;
    padding: .5rem 1rem 1rem;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
    flex-direction: column;
  }
  .nav-links.open { display: flex; }
}

/* ---------- Hero ---------- */
.hero {
  color: #eef1f8;
  padding: 2.25rem 0 2.5rem;
  background: linear-gradient(165deg, #212837 0%, #2c3852 70%, #3457c4 160%);
}
.hero .eyebrow {
  text-transform: uppercase;
  letter-spacing: .14em;
  font-size: .75rem;
  font-weight: 700;
  opacity: .85;
  margin: 0 0 .25rem;
}
.hero h1 { margin: 0 0 .35rem; font-size: clamp(1.6rem, 4vw, 2.3rem); letter-spacing: -.02em; line-height: 1.15; }
.hero p.lede { margin: 0; max-width: 46rem; opacity: .92; font-size: 1.02rem; }

main { padding: 1.75rem 0 3rem; }

/* ---------- Cards ---------- */
.grid { display: grid; gap: 1rem; }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.1rem 1.2rem;
}
.card h2, .card h3 { margin-top: 0; }
.section-title { font-size: 1.35rem; letter-spacing: -.01em; margin: 2rem 0 .9rem; }
.muted { color: var(--ink-soft); }
.small { font-size: .85rem; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ---------- Forms ---------- */
label { font-weight: 600; font-size: .9rem; display: block; margin-bottom: .3rem; }
input[type="text"], input[type="search"], input[type="number"], select {
  width: 100%;
  padding: .6rem .7rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  color: var(--ink);
  font: inherit;
}
input:focus, select:focus { border-color: var(--board); }

/* Big letters input */
.letters-input {
  font-size: 1.5rem !important;
  letter-spacing: .35em;
  text-transform: uppercase;
  font-weight: 700;
  text-align: center;
  font-family: var(--mono);
}

.btn {
  display: inline-block;
  border: 0;
  border-radius: 10px;
  padding: .62rem 1.1rem;
  background: var(--board);
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.btn:hover { background: var(--board-deep); }
.btn.ghost { background: transparent; color: var(--board); border: 1px solid var(--board); }
.btn.small { padding: .35rem .7rem; font-size: .85rem; }
.field-row { display: flex; gap: .75rem; flex-wrap: wrap; align-items: end; }
.field-row > div { flex: 1 1 150px; }

details.filters { margin-top: .9rem; }
details.filters summary { cursor: pointer; font-weight: 600; color: var(--board); }
details.filters .field-row { margin-top: .75rem; }

/* ---------- Letter tiles (signature) ---------- */
.tile-word {
  display: inline-flex;
  gap: 3px;
  margin: .3rem .55rem .3rem 0;
  align-items: center;
  text-decoration: none;
}
.tile {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.7rem; height: 1.9rem;
  background: linear-gradient(180deg, var(--tile-bg), color-mix(in srgb, var(--tile-bg) 82%, #a5761d));
  border: 1px solid var(--tile-edge);
  border-bottom-width: 3px;
  border-radius: 5px;
  color: var(--tile-ink);
  font-weight: 800;
  font-size: 1.05rem;
  text-transform: uppercase;
  font-family: var(--mono);
}
.tile-word .pts {
  font-size: .72rem;
  font-weight: 700;
  color: var(--ink-soft);
  margin-left: .3rem;
  font-variant-numeric: tabular-nums;
}
.tile-word:hover .tile { border-color: var(--board); }

/* Wordle-style tiles */
.tile.green { background: #4c9e63; border-color: #3a7a4c; color: #fff; }
.wordle-slots { display: flex; gap: .4rem; }
.wordle-slots input {
  width: 3rem; height: 3rem;
  text-align: center;
  font-size: 1.4rem;
  font-weight: 800;
  text-transform: uppercase;
  font-family: var(--mono);
}

/* Results */
.len-group { margin: 1.25rem 0; }
.len-group h3 {
  font-size: .95rem;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: .08em;
  border-bottom: 1px solid var(--line);
  padding-bottom: .3rem;
}
.result-meta {
  margin: 1rem 0 0;
  font-weight: 600;
}
.dict-status { font-size: .85rem; color: var(--ink-soft); }

/* ---------- Ad slots (Google AdSense placeholders) ---------- */
.ad-slot {
  margin: 1.5rem auto;
  min-height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed var(--line);
  border-radius: 10px;
  color: var(--ink-soft);
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .12em;
  background: color-mix(in srgb, var(--card) 60%, transparent);
}
.ad-slot.leaderboard { min-height: 90px; }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 1.75rem 0 2.25rem;
  color: var(--ink-soft);
  font-size: .88rem;
}
.site-footer .cols { display: flex; gap: 2rem; flex-wrap: wrap; justify-content: space-between; }
.site-footer ul { list-style: none; padding: 0; margin: .4rem 0 0; }
.site-footer li { margin: .25rem 0; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}
