:root {
  --bg: #faf8f4; --surface: #fff; --text: #1d1b18; --muted: #6b665e; --line: #e6e1d8;
  --accent: #c2410c; --accent-ink: #fff; --tile: #f3e6cf; --tile-ink: #5a3d12;
  --green: #4d8f4a; --yellow: #c9a227; --gray: #8a857c; --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #161513; --surface: #201e1b; --text: #ece8e1; --muted: #a39d93; --line: #34312c;
    --accent: #f97316; --accent-ink: #1a0d03; --tile: #3a3022; --tile-ink: #f3dfb8;
  }
}
:root[data-theme="dark"] {
  --bg: #161513; --surface: #201e1b; --text: #ece8e1; --muted: #a39d93; --line: #34312c;
  --accent: #f97316; --accent-ink: #1a0d03; --tile: #3a3022; --tile-ink: #f3dfb8;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); }
.wrap { max-width: 980px; margin: 0 auto; padding: 0 16px; }
h1 { font-size: clamp(1.7rem, 4vw, 2.4rem); line-height: 1.15; margin: 1.2rem 0 .6rem; letter-spacing: -.01em; }
h2 { font-size: 1.3rem; margin: 2rem 0 .7rem; }
h3 { font-size: 1.05rem; margin: 1.4rem 0 .5rem; }
h3 a, h3 small { font-weight: 400; font-size: .9rem; }
.lead { font-size: 1.08rem; color: var(--muted); max-width: 70ch; }
.note { color: var(--muted); }
kbd { background: var(--tile); color: var(--tile-ink); border-radius: 4px; padding: 0 .35em; font-family: inherit; font-weight: 700; }

.top { border-bottom: 1px solid var(--line); background: var(--surface); }
.top .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 58px; flex-wrap: wrap; }
.logo { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1.15rem; color: var(--text); text-decoration: none; }
.tile { display: inline-grid; place-items: center; width: 30px; height: 30px; background: var(--tile); color: var(--tile-ink); border-radius: 6px; box-shadow: inset 0 -3px 0 rgba(0,0,0,.12); }
nav a { margin-left: 16px; color: var(--text); text-decoration: none; font-weight: 500; }
nav a:hover { color: var(--accent); }
@media (max-width: 520px) { nav a { margin: 0 14px 0 0; font-size: .95rem; } .top .wrap { padding-bottom: 8px; } }
.crumbs { font-size: .9rem; color: var(--muted); margin-top: 1rem; }
.crumbs a { color: var(--muted); }

.hero { padding: .5rem 0 1rem; }
.search { display: flex; flex-wrap: wrap; gap: 8px; margin: 1rem 0; }
.search input[name="letras"] { flex: 1 1 260px; font-size: 1.25rem; letter-spacing: .08em; text-transform: uppercase; }
.search.compact input[name="letras"] { font-size: 1rem; }
input, select { font: inherit; color: var(--text); background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--radius); padding: .7rem .85rem; min-width: 0; }
input:focus, select:focus { outline: none; border-color: var(--accent); }
button { font: inherit; font-weight: 700; border: 0; border-radius: var(--radius); padding: .7rem 1.2rem; background: var(--accent); color: var(--accent-ink); cursor: pointer; }
button.ghost { background: transparent; color: var(--accent); border: 1.5px solid var(--line); }
.filters { flex-basis: 100%; }
.filters summary { cursor: pointer; color: var(--muted); font-size: .95rem; }
.filters .grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-top: 10px; }
.filters label { display: flex; flex-direction: column; font-size: .85rem; color: var(--muted); gap: 4px; }
.hint { font-size: .9rem; color: var(--muted); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-block; padding: .3rem .7rem; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--text); text-decoration: none; font-size: .92rem; }
.chip.sq { min-width: 2.2rem; text-align: center; border-radius: 6px; font-weight: 700; }
.chip:hover, .chip.on { border-color: var(--accent); color: var(--accent); }

.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 6px; }
.stat { display: flex; flex-direction: column; align-items: center; padding: .45rem; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text); text-decoration: none; }
.stat b { font-size: 1.1rem; }
.stat span { font-size: .8rem; color: var(--muted); }
a.stat:hover { border-color: var(--accent); }

.words { list-style: none; padding: 0; margin: .3rem 0 1rem; display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 4px 10px; }
.words li { padding: .15rem 0; border-bottom: 1px dashed var(--line); overflow-wrap: anywhere; }
.words.best li { font-weight: 700; color: var(--accent); }
.res-title { margin-top: 1rem; }
.group h3 small { color: var(--muted); }

.five .row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 10px 0; }
.five .tag { min-width: 220px; font-weight: 600; font-size: .95rem; padding-left: 10px; border-left: 6px solid; }
.tag.green { border-color: var(--green); } .tag.yellow { border-color: var(--yellow); } .tag.gray { border-color: var(--gray); }
.cells { display: flex; gap: 6px; }
.cell { width: 52px; height: 52px; text-align: center; font-size: 1.2rem; font-weight: 700; text-transform: uppercase; padding: 0; }
input[name^="y"].cell { font-size: .9rem; }
.wide { flex: 1 1 200px; text-transform: uppercase; }
.actions { margin-top: 12px; }
@media (max-width: 420px) { .cell { width: 15vw; height: 15vw; } }

.ad { margin: 1.5rem 0; min-height: 100px; }
.ad-placeholder { display: grid; place-items: center; border: 1.5px dashed var(--line); border-radius: var(--radius); color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .1em; }

.prose { max-width: 72ch; }
.foot { border-top: 1px solid var(--line); margin-top: 3rem; padding: 1.5rem 0; color: var(--muted); font-size: .92rem; }

/* ---- La palabra del día ---- */
.daily { max-width: 520px; margin: 0 auto; text-align: center; position: relative; }
.daily .lead { margin: 0 auto 1rem; }
.daily .num { color: var(--muted); font-weight: 500; font-size: .6em; vertical-align: middle; }
.board { display: grid; gap: 6px; justify-content: center; margin: 0 auto 1rem; }
.brow { display: grid; grid-template-columns: repeat(5, 58px); gap: 6px; }
.btile { width: 58px; height: 58px; display: grid; place-items: center; border: 2px solid var(--line); border-radius: 6px;
  font-size: 1.8rem; font-weight: 800; text-transform: uppercase; background: var(--surface); }
.btile.filled { border-color: var(--muted); animation: pop .1s; }
.btile.correct, .key.correct, .sw.correct { background: var(--green); border-color: var(--green); color: #fff; }
.btile.present, .key.present, .sw.present { background: var(--yellow); border-color: var(--yellow); color: #fff; }
.btile.absent, .key.absent, .sw.absent { background: var(--gray); border-color: var(--gray); color: #fff; }
.brow.shake { animation: shake .35s; }
@keyframes pop { 50% { transform: scale(1.08); } }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.keyboard { display: grid; gap: 6px; margin: 0 auto 1rem; max-width: 500px; }
.krow { display: flex; gap: 5px; justify-content: center; }
.key { flex: 1 1 0; min-width: 0; height: 54px; padding: 0; border-radius: 6px; background: var(--tile); color: var(--tile-ink);
  font-size: 1.05rem; font-weight: 700; text-transform: uppercase; }
.key.wide { flex: 1.6 1 0; font-size: .75rem; }
.toast { position: absolute; left: 50%; top: 5.5rem; transform: translateX(-50%); z-index: 5; background: var(--text); color: var(--bg);
  padding: .55rem 1rem; border-radius: 8px; font-weight: 700; opacity: 0; pointer-events: none; transition: opacity .2s; }
.toast.show { opacity: 1; }
.hints ul { list-style: none; padding: 0; text-align: left; }
.hints li { padding: .4rem .7rem; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 6px; background: var(--surface); }
.end { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 1rem; margin: 1rem 0; }
.end h2 { margin-top: .3rem; }
.answer { color: var(--accent); letter-spacing: .08em; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 1rem 0; }
.kpis b { display: block; font-size: 1.6rem; }
.kpis span { font-size: .75rem; color: var(--muted); }
.dist { text-align: left; margin: 0 auto 1rem; max-width: 360px; }
.drow { display: flex; align-items: center; gap: 6px; margin: 3px 0; font-size: .85rem; }
.dbar { background: var(--gray); color: #fff; text-align: right; padding: 0 6px; border-radius: 3px; font-weight: 700; }
.dbar.on { background: var(--green); }
.sw { display: inline-block; width: 1em; height: 1em; border-radius: 3px; vertical-align: -2px; }
@media (max-width: 400px) {
  .brow { grid-template-columns: repeat(5, 52px); }
  .btile { width: 52px; height: 52px; font-size: 1.5rem; }
  .key { height: 50px; font-size: .95rem; }
  .krow { gap: 4px; }
}
