:root {
  --cream: #fbf6ee;
  --paper: #fffdf9;
  --ink: #2a2622;
  --muted: #5e564d;
  --line: #e6dccd;
  --teal: #1d6a66;
  --teal-dark: #134c49;
  --rose: #a84a5f;
  --gold: #c58a2c;
  --ok: #2f7d3b;
  --no: #b03a2e;
  --radius: 14px;
}
* { box-sizing: border-box; }
html { font-size: 112.5%; }
body { margin: 0; background: var(--cream); color: var(--ink); font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; line-height: 1.65; }
h1, h2, h3, .brand { font-family: Georgia, "Times New Roman", serif; line-height: 1.25; }
h1 { font-size: 2.1rem; margin: .2em 0 .4em; }
h2 { font-size: 1.5rem; margin: 1.8em 0 .5em; }
h3 { font-size: 1.15rem; margin: 1.4em 0 .3em; }
a { color: var(--teal); }
a:hover { color: var(--teal-dark); }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
.wrap { max-width: 860px; margin: 0 auto; padding: 0 20px; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 10px; top: 10px; background: #fff; padding: 8px 12px; z-index: 9; }

header.site { background: var(--paper); border-bottom: 1px solid var(--line); }
header.site .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 12px; padding-bottom: 12px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 1.35rem; color: var(--ink); text-decoration: none; font-weight: bold; }
.brand img { width: 40px; height: 40px; }
nav.top a { margin-left: 18px; text-decoration: none; font-weight: 600; }
nav.top a:first-child { margin-left: 0; }

main { padding: 18px 0 40px; }
.lede { font-size: 1.15rem; color: var(--muted); }
.crumbs { font-size: .9rem; color: var(--muted); margin-top: 14px; }
.crumbs a { color: var(--muted); }

.game { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin: 22px 0 10px; box-shadow: 0 2px 10px rgba(60, 40, 20, .05); }
.g-bar { display: flex; flex-wrap: wrap; gap: 10px 22px; font-size: 1rem; color: var(--muted); border-bottom: 1px dashed var(--line); padding-bottom: 10px; }
.g-stat strong { color: var(--ink); }
.g-msg { font-size: 1.1rem; font-weight: 600; min-height: 1.7em; margin: 12px 0; }
.g-stage { min-height: 120px; }
.g-ctl { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.g-center { display: flex; justify-content: center; gap: 12px; margin: 16px 0 4px; flex-wrap: wrap; }

.btn { font: inherit; font-weight: 700; font-size: 1.05rem; min-height: 52px; padding: 10px 22px; border-radius: 12px; border: 2px solid var(--teal); background: var(--teal); color: #fff; cursor: pointer; }
.btn:hover { background: var(--teal-dark); border-color: var(--teal-dark); }
.btn-soft { background: #fff; color: var(--teal); }
.btn-soft:hover { background: #eef6f5; color: var(--teal-dark); }
.btn-soft[aria-pressed="true"] { background: #e1efed; border-color: var(--teal-dark); }
.btn-alt { background: #fff; color: var(--rose); border-color: var(--rose); }
.btn-alt:hover { background: #fbeef1; color: var(--rose); }

.cards { display: grid; gap: 10px; max-width: 620px; margin: 0 auto; }
.cols-3 { grid-template-columns: repeat(3, 1fr); max-width: 420px; }
.cols-4 { grid-template-columns: repeat(4, 1fr); }
.cols-5 { grid-template-columns: repeat(5, 1fr); }
.card { position: relative; aspect-ratio: 4 / 5; border: 0; padding: 0; border-radius: 12px; cursor: pointer; background: transparent; }
.card span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; border-radius: 12px; backface-visibility: hidden; transition: transform .35s; }
.card-back { background: var(--teal) repeating-linear-gradient(45deg, rgba(255,255,255,.08) 0 8px, transparent 8px 16px); border: 3px solid var(--teal-dark); }
.card-face { background: #fff; border: 3px solid var(--line); font-size: clamp(1.8rem, 7vw, 3rem); transform: rotateY(180deg); }
.card.up .card-back { transform: rotateY(180deg); }
.card.up .card-face { transform: rotateY(0); }
.card.done .card-face { border-color: var(--ok); background: #f0f8f0; }

.pads { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; max-width: 420px; margin: 8px auto; }
.pad { aspect-ratio: 1; border-radius: 22px; border: 4px solid rgba(0,0,0,.15); font-size: 2.6rem; color: rgba(255,255,255,.85); cursor: pointer; opacity: .55; transition: opacity .12s, transform .12s; }
.pad:disabled { cursor: default; }
.pad.lit { opacity: 1; transform: scale(1.04); box-shadow: 0 0 0 6px rgba(197, 138, 44, .55); }
.pad:not(:disabled):hover { opacity: .8; }
.pad-green { background: #2e8b57; }
.pad-red { background: #c0392b; }
.pad-yellow { background: #d4a017; }
.pad-blue { background: #2f5fa8; }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.tile { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 6px; background: #fff; border: 2px solid var(--line); border-radius: 12px; font: inherit; font-size: .95rem; }
.tile-ico { font-size: 2.3rem; line-height: 1.1; }
.tile.pick { cursor: pointer; }
.tile.pick:hover { border-color: var(--teal); }
.tile.ok { border-color: var(--ok); background: #eef8ef; }
.tile.no { border-color: var(--no); background: #fbefed; }

.big-num { font-family: Georgia, serif; font-size: clamp(2.4rem, 10vw, 4.2rem); letter-spacing: .12em; text-align: center; min-height: 1.6em; font-variant-numeric: tabular-nums; }
.num-form { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin: 10px 0; }
.num-in { font: inherit; font-size: 1.6rem; padding: 8px 14px; width: min(320px, 100%); border: 2px solid var(--line); border-radius: 12px; text-align: center; letter-spacing: .08em; }
.num-in:focus { border-color: var(--teal); }
.answer { text-align: center; font-size: 1.1rem; }

.sq { display: grid; gap: 8px; margin: 6px auto; max-width: 440px; }
.sq-3 { grid-template-columns: repeat(3, 1fr); max-width: 330px; }
.sq-4 { grid-template-columns: repeat(4, 1fr); }
.sq-5 { grid-template-columns: repeat(5, 1fr); }
.sq-6 { grid-template-columns: repeat(6, 1fr); }
.cell { aspect-ratio: 1; border-radius: 10px; border: 2px solid var(--line); background: #efe6d8; cursor: pointer; }
.cell.lit { background: var(--gold); border-color: #9c6b1c; }
.cell.ok { background: var(--teal); border-color: var(--teal-dark); }
.cell.no { background: #f3d3cf; border-color: var(--no); }
.cell.miss { border: 4px dashed var(--teal); }

.wordlist { columns: 2; font-size: 1.35rem; list-style: none; padding: 0; max-width: 420px; margin: 8px auto; }
.wordlist li { padding: 4px 0; }
.big-word { font-family: Georgia, serif; font-size: 2.4rem; text-align: center; margin: 14px 0; }
.letters { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin: 8px 0 14px; }
.letter { width: 52px; height: 58px; display: flex; align-items: center; justify-content: center; background: #fff; border: 2px solid var(--gold); border-radius: 10px; font-family: Georgia, serif; font-size: 1.7rem; font-weight: bold; }

.grid-games { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; margin: 18px 0; padding: 0; list-style: none; }
.grid-games a { display: block; height: 100%; padding: 16px 18px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--ink); }
.grid-games a:hover { border-color: var(--teal); box-shadow: 0 3px 12px rgba(29, 106, 102, .12); }
.grid-games .ico { font-size: 2rem; display: block; }
.grid-games strong { display: block; font-size: 1.1rem; color: var(--teal); margin: 4px 0; }
.grid-games span.d { color: var(--muted); font-size: .95rem; }

.note { background: #f6efe2; border-left: 5px solid var(--gold); padding: 12px 16px; border-radius: 8px; margin: 20px 0; }
.faq h3 { margin-top: 1.2em; }
table.simple { border-collapse: collapse; width: 100%; margin: 10px 0; font-size: .98rem; }
table.simple th, table.simple td { border-bottom: 1px solid var(--line); padding: 8px 6px; text-align: left; vertical-align: top; }

footer.site { border-top: 1px solid var(--line); background: var(--paper); padding: 22px 0 30px; font-size: .92rem; color: var(--muted); }
footer.site nav a { margin-right: 16px; }
footer.site p { margin: .6em 0; }

@media (max-width: 560px) {
  html { font-size: 106%; }
  h1 { font-size: 1.7rem; }
  nav.top a { margin-left: 12px; font-size: .95rem; }
  .cols-5 { grid-template-columns: repeat(4, 1fr); }
  .wordlist { columns: 1; }
}
@media (prefers-reduced-motion: reduce) { .card span, .pad { transition: none; } }
