/* ===== Разминка ума — общие стили ===== */
:root {
  --bg: #f6f5f1;
  --surface: #ffffff;
  --surface-2: #efede6;
  --text: #1d1d1f;
  --muted: #6b6b70;
  --line: #dedbd2;
  --accent: #3b5bdb;
  --accent-soft: #e3e8fc;
  --ok: #2b8a3e;
  --ok-soft: #d3f0da;
  --bad: #c92a2a;
  --bad-soft: #fde2e2;
  --warn: #e8890c;
  --cell-hl: #eef1fb;
  --cell-same: #d6defa;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 4px 16px rgba(0,0,0,.05);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #15161a;
  --surface: #1f2026;
  --surface-2: #2a2b33;
  --text: #ececf1;
  --muted: #9b9ca6;
  --line: #34353e;
  --accent: #7b93ff;
  --accent-soft: #2b3156;
  --ok: #5fcf7a;
  --ok-soft: #1f3a27;
  --bad: #ff6b6b;
  --bad-soft: #452326;
  --warn: #ffb347;
  --cell-hl: #262a3a;
  --cell-same: #343c66;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15161a; --surface: #1f2026; --surface-2: #2a2b33; --text: #ececf1; --muted: #9b9ca6;
    --line: #34353e; --accent: #7b93ff; --accent-soft: #2b3156; --ok: #5fcf7a; --ok-soft: #1f3a27;
    --bad: #ff6b6b; --bad-soft: #452326; --warn: #ffb347; --cell-hl: #262a3a; --cell-same: #343c66;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--accent); }
img, svg { max-width: 100%; }
button { font: inherit; color: inherit; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: clamp(1.6rem, 4vw, 2.2rem); }
h2 { font-size: 1.35rem; }

.wrap { width: 100%; max-width: 1100px; margin: 0 auto; padding: 0 16px; }

/* ----- Шапка ----- */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.site-header .wrap { display: flex; align-items: center; gap: 12px; height: 56px; }
.logo { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1.1rem; color: var(--text); text-decoration: none; white-space: nowrap; }
.logo svg { width: 28px; height: 28px; }
.nav { display: flex; gap: 4px; margin-left: auto; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a { padding: 6px 10px; border-radius: 8px; text-decoration: none; color: var(--muted); font-size: .95rem; white-space: nowrap; }
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }
.theme-btn { border: 0; background: transparent; cursor: pointer; padding: 6px; border-radius: 8px; color: var(--muted); display: flex; }
.theme-btn:hover { background: var(--surface-2); color: var(--text); }
.theme-btn svg { width: 20px; height: 20px; }
@media (max-width: 560px) {
  .logo span { display: none; }
  .nav a { padding: 6px 8px; font-size: .9rem; }
}

main { flex: 1; padding: 20px 0 40px; }

/* ----- Футер ----- */
.site-footer { border-top: 1px solid var(--line); padding: 20px 0; color: var(--muted); font-size: .9rem; }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: space-between; }
.site-footer a { color: var(--muted); }

/* ----- Реклама РСЯ ----- */
.ad-slot { margin: 16px auto; text-align: center; overflow: hidden; max-width: 100%; }
.ad-slot:empty { display: none; }
.ad-slot.ad-debug {
  display: flex; align-items: center; justify-content: center;
  min-height: 90px; border: 2px dashed var(--line); border-radius: var(--radius);
  color: var(--muted); font-size: .85rem; padding: 8px;
}

/* ----- Карточки на главной ----- */
.hero { text-align: center; padding: 16px 0 8px; }
.hero p { color: var(--muted); max-width: 640px; margin: 0 auto; }
.today { display: inline-flex; gap: 8px; align-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 600; padding: 4px 12px; border-radius: 99px; font-size: .9rem; margin-bottom: 12px; }
.games { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; margin: 24px 0; }
.game-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; text-decoration: none; color: var(--text); box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 8px; transition: transform .15s, border-color .15s;
}
.game-card:hover { transform: translateY(-2px); border-color: var(--accent); }
.game-card .icon { width: 52px; height: 52px; border-radius: 12px; background: var(--accent-soft); display: flex; align-items: center; justify-content: center; font-size: 28px; }
.game-card h2 { margin: 4px 0 0; font-size: 1.25rem; }
.game-card p { margin: 0; color: var(--muted); font-size: .95rem; }
.game-card .status { margin-top: auto; padding-top: 8px; font-size: .88rem; font-weight: 600; color: var(--accent); }
.game-card .status.done { color: var(--ok); }

.stats-row { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin: 8px 0 0; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 16px; min-width: 120px; text-align: center; }
.stat b { display: block; font-size: 1.4rem; }
.stat span { font-size: .82rem; color: var(--muted); }

/* ----- Текстовые блоки (SEO) ----- */
.article { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 24px; margin-top: 24px; }
.article h2 { margin-top: .6em; }
.article p, .article li { color: var(--text); }
.article ul, .article ol { padding-left: 1.3em; }
.prose { max-width: 760px; margin: 0 auto; }

/* ----- Общая раскладка игровой страницы ----- */
.game-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.game-head h1 { margin: 0; }
.tabs { display: inline-flex; background: var(--surface-2); border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.tabs button { border: 0; background: transparent; padding: 6px 12px; border-radius: 8px; cursor: pointer; font-size: .92rem; color: var(--muted); }
.tabs button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); font-weight: 600; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.pill { background: var(--surface); border: 1px solid var(--line); padding: 4px 10px; border-radius: 99px; font-size: .9rem; font-variant-numeric: tabular-nums; }
.btn {
  border: 1px solid var(--line); background: var(--surface); padding: 8px 14px; border-radius: 10px;
  cursor: pointer; font-size: .95rem; display: inline-flex; align-items: center; gap: 6px;
  -webkit-tap-highlight-color: transparent; user-select: none;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.btn:disabled { opacity: .45; cursor: default; }
.spacer { flex: 1; }

.layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; align-items: start; }
.side .ad-slot { position: sticky; top: 72px; margin-top: 0; }
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .side { display: none; }
}

/* ----- Модальное окно результата ----- */
.modal-back { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: none; align-items: center; justify-content: center; z-index: 50; padding: 16px; }
.modal-back.show { display: flex; }
.modal { background: var(--surface); border-radius: 18px; padding: 24px; max-width: 420px; width: 100%; text-align: center; box-shadow: 0 10px 40px rgba(0,0,0,.3); max-height: 90vh; overflow: auto; }
.modal h2 { font-size: 1.5rem; }
.modal .big { font-size: 48px; line-height: 1; margin-bottom: 8px; }
.modal .actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 16px; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(120%); background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 10px; font-size: .95rem; transition: transform .25s; z-index: 60; pointer-events: none; max-width: calc(100% - 32px); }
.toast.show { transform: translateX(-50%) translateY(0); }

/* ----- Плашка про cookies ----- */
.cookie { position: fixed; left: 16px; right: 16px; bottom: 16px; max-width: 560px; margin: 0 auto; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); border-radius: 14px; padding: 12px 16px; display: flex; gap: 12px; align-items: center; z-index: 40; font-size: .9rem; }
.cookie p { margin: 0; flex: 1; color: var(--muted); }

/* ===== СУДОКУ ===== */
.sudoku-wrap { max-width: 520px; margin: 0 auto; }
.sudoku {
  display: grid; grid-template-columns: repeat(9, 1fr);
  aspect-ratio: 1; width: 100%;
  border: 2px solid var(--text); border-radius: 8px; overflow: hidden;
  background: var(--surface); user-select: none; touch-action: manipulation;
}
.sudoku .c {
  position: relative; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  font-size: clamp(18px, 5.4vw, 28px); cursor: pointer; font-variant-numeric: tabular-nums;
  color: var(--accent);
}
.sudoku .c.given { color: var(--text); font-weight: 600; }
.sudoku .c:nth-child(9n) { border-right: 0; }
.sudoku .c.br { border-right: 2px solid var(--text); }
.sudoku .c.bb { border-bottom: 2px solid var(--text); }
.sudoku .c.hl { background: var(--cell-hl); }
.sudoku .c.same { background: var(--cell-same); }
.sudoku .c.sel { background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--accent); }
.sudoku .c.err { color: var(--bad); background: var(--bad-soft); }
.sudoku .notes { position: absolute; inset: 2px; display: grid; grid-template-columns: repeat(3, 1fr); font-size: clamp(8px, 2vw, 11px); color: var(--muted); line-height: 1; }
.sudoku .notes span { display: flex; align-items: center; justify-content: center; }
.sudoku.won .c { animation: pop .5s ease both; }
@keyframes pop { 50% { background: var(--ok-soft); } }
.numpad { display: grid; grid-template-columns: repeat(9, 1fr); gap: 6px; margin-top: 12px; }
.numpad button { border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 10px 0; font-size: 1.35rem; cursor: pointer; -webkit-tap-highlight-color: transparent; position: relative; }
.numpad button:hover { border-color: var(--accent); }
.numpad button.full { opacity: .3; }
.numpad button small { position: absolute; top: 2px; right: 5px; font-size: .6rem; color: var(--muted); }
.actions-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 8px; }
.actions-row .btn { justify-content: center; flex-direction: column; gap: 0; padding: 6px 4px; font-size: .8rem; }
.actions-row .btn .ico { font-size: 1.25rem; line-height: 1.2; }

/* ===== СЛОВО ДНЯ ===== */
.slovo-wrap { max-width: 560px; margin: 0 auto; }
.progress { display: flex; gap: 6px; justify-content: center; margin-bottom: 16px; }
.progress i { width: 34px; height: 8px; border-radius: 4px; background: var(--surface-2); }
.progress i.cur { background: var(--accent); }
.progress i.ok { background: var(--ok); }
.progress i.skip { background: var(--warn); }
.word-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 16px; text-align: center; box-shadow: var(--shadow); }
.category { display: inline-block; font-size: .85rem; font-weight: 600; color: var(--accent); background: var(--accent-soft); border-radius: 99px; padding: 3px 12px; margin-bottom: 14px; }
.answer, .letters { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.answer { min-height: 54px; margin-bottom: 18px; }
.answer .slot { width: 44px; height: 50px; border-bottom: 3px solid var(--line); display: flex; align-items: center; justify-content: center; font-size: 1.6rem; font-weight: 700; text-transform: uppercase; cursor: pointer; }
.answer .slot.filled { border-color: var(--accent); }
.answer .slot.fixed { color: var(--ok); border-color: var(--ok); cursor: default; }
.answer.shake { animation: shake .4s; }
.answer.solved .slot { color: var(--ok); border-color: var(--ok); }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.letters button { width: 48px; height: 52px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); font-size: 1.5rem; font-weight: 700; text-transform: uppercase; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.letters button:hover { border-color: var(--accent); }
.letters button.used { visibility: hidden; }
@media (max-width: 420px) {
  .answer .slot { width: 34px; height: 44px; font-size: 1.3rem; }
  .letters button { width: 40px; height: 46px; font-size: 1.3rem; }
}
.word-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 18px; }
.score-line { text-align: center; color: var(--muted); margin-top: 12px; font-size: .95rem; }
.summary { list-style: none; padding: 0; margin: 12px 0; text-align: left; }
.summary li { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--line); }
.summary li b { text-transform: uppercase; letter-spacing: .05em; }

/* ===== САПЁР ===== */
.mines-scroll { overflow-x: auto; padding-bottom: 6px; -webkit-overflow-scrolling: touch; }
.mines { display: grid; gap: 2px; margin: 0 auto; width: max-content; user-select: none; touch-action: manipulation; background: var(--line); padding: 2px; border-radius: 8px; }
.mines .m {
  width: var(--cs, 32px); height: var(--cs, 32px); background: var(--surface-2);
  display: flex; align-items: center; justify-content: center; font-weight: 700;
  font-size: calc(var(--cs, 32px) * .55); cursor: pointer; border-radius: 3px;
  -webkit-tap-highlight-color: transparent;
}
.mines .m:hover { filter: brightness(.96); }
.mines .m.open { background: var(--surface); cursor: default; }
.mines .m.boom { background: var(--bad); }
.mines .m.wrong { background: var(--bad-soft); }
.mines .n1 { color: #1c7ed6; } .mines .n2 { color: #2b8a3e; } .mines .n3 { color: #e03131; }
.mines .n4 { color: #5f3dc4; } .mines .n5 { color: #c2255c; } .mines .n6 { color: #0c8599; }
.mines .n7 { color: var(--text); } .mines .n8 { color: var(--muted); }
:root[data-theme="dark"] .mines .n1 { color: #74c0fc; }
:root[data-theme="dark"] .mines .n2 { color: #8ce99a; }
:root[data-theme="dark"] .mines .n3 { color: #ff8787; }
:root[data-theme="dark"] .mines .n4 { color: #b197fc; }
:root[data-theme="dark"] .mines .n5 { color: #f783ac; }
:root[data-theme="dark"] .mines .n6 { color: #66d9e8; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .mines .n1 { color: #74c0fc; }
  :root:not([data-theme="light"]) .mines .n2 { color: #8ce99a; }
  :root:not([data-theme="light"]) .mines .n3 { color: #ff8787; }
  :root:not([data-theme="light"]) .mines .n4 { color: #b197fc; }
  :root:not([data-theme="light"]) .mines .n5 { color: #f783ac; }
  :root:not([data-theme="light"]) .mines .n6 { color: #66d9e8; }
}
.mine-face { font-size: 1.3rem; padding: 4px 10px; }
.hint-text { color: var(--muted); font-size: .88rem; text-align: center; margin-top: 8px; }

/* ----- Доработки под телефоны ----- */
.layout:has(.side .ad-slot:empty) { grid-template-columns: minmax(0, 1fr); max-width: 820px; margin: 0 auto; }
.layout:has(.side .ad-slot:empty) .side { display: none; }
@media (max-width: 560px) {
  .nav a[href="/"] { display: none; }
  .site-header .wrap { gap: 6px; }
  .tabs { display: flex; width: 100%; flex-wrap: nowrap; }
  .tabs button { flex: 1; padding: 6px 4px; font-size: .85rem; white-space: nowrap; }
  .cookie { padding: 10px 12px; font-size: .8rem; left: 8px; right: 8px; bottom: 8px; }
  .cookie .btn { padding: 6px 10px; }
  main { padding-top: 12px; }
  .toolbar { gap: 6px; }
}

/* ===== ГОРОД ДНЯ ===== */
.gorod-wrap { max-width: 640px; margin: 0 auto; }
.map-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; box-shadow: var(--shadow); }
.map-box svg { display: block; width: 100%; height: auto; }
.map-box .dots circle { fill: var(--line); }
.map-box .mark { stroke: var(--surface); stroke-width: 2; }
.map-box .mark.far { fill: #e03131; } .map-box .mark.mid { fill: #f76707; }
.map-box .mark.near { fill: #f2c200; } .map-box .mark.ok { fill: #2b8a3e; }
.map-box .mark-n { fill: #fff; font-size: 11px; font-weight: 700; text-anchor: middle; }
.city-field { position: relative; margin: 14px 0 10px; }
.city-row { display: flex; gap: 8px; }
.city-row input {
  flex: 1; min-width: 0; font: inherit; font-size: 1.05rem; padding: 10px 14px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text); outline: none;
}
.city-row input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.suggest { position: absolute; left: 0; right: 0; top: 100%; margin: 4px 0 0; padding: 4px; list-style: none; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); z-index: 30; max-height: 300px; overflow: auto; }
.suggest li { padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.suggest li small { color: var(--muted); }
.suggest li.act, .suggest li:hover { background: var(--accent-soft); }
.guesses { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.guesses li { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto 30px; grid-template-rows: auto 4px; column-gap: 8px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px 6px; min-height: 46px; }
.guesses li.empty { background: transparent; border-style: dashed; }
.guesses li.hit { border-color: var(--ok); background: var(--ok-soft); }
.g-n { color: var(--muted); font-size: .85rem; }
.g-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.g-dist { font-variant-numeric: tabular-nums; white-space: nowrap; }
.g-dir svg { width: 22px; height: 22px; fill: var(--accent); display: block; }
.g-bar { grid-column: 2 / 5; height: 4px; background: var(--surface-2); border-radius: 2px; overflow: hidden; margin-top: 4px; }
.g-bar i { display: block; height: 100%; background: var(--accent); border-radius: 2px; }
.guesses li.hit .g-bar i { background: var(--ok); }
.hints { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 12px 0; }
.hint { background: var(--surface-2); border-radius: 10px; padding: 8px 10px; font-size: .8rem; color: var(--muted); }
.hint b { display: block; font-size: .78rem; font-weight: 500; margin-top: 2px; }
.hint.open { background: var(--accent-soft); color: var(--accent); }
.hint.open b { color: var(--text); font-size: .95rem; font-weight: 700; }
@media (max-width: 480px) { .hints { grid-template-columns: 1fr; } .hint b { display: inline; margin-left: 6px; } }
.done-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; text-align: center; margin: 14px 0 10px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: center; }
.nav .short { display: none; }
@media (max-width: 560px) { .nav .full { display: none; } .nav .short { display: inline; } }
@media (max-width: 380px) { .nav a { padding: 6px 5px; font-size: .84rem; } .logo svg { width: 24px; height: 24px; } .site-header .wrap { gap: 2px; } }

/* ===== Режимы города, подсказки, топ ===== */
.mode-help { text-align: center; color: var(--muted); font-size: .92rem; margin: 0 0 10px; }
.round-actions { display: flex; gap: 8px; justify-content: center; margin-top: 8px; flex-wrap: wrap; }
.hint-list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px; box-shadow: var(--shadow); margin-top: 10px; }
.hint-row { display: grid; grid-template-columns: 26px 150px minmax(0, 1fr); gap: 8px; align-items: center; padding: 9px 8px; border-radius: 8px; color: var(--muted); }
.hint-row + .hint-row { border-top: 1px solid var(--line); }
.hint-row .hn { width: 22px; height: 22px; border-radius: 50%; background: var(--surface-2); display: flex; align-items: center; justify-content: center; font-size: .75rem; }
.hint-row.open { color: var(--text); }
.hint-row.open .hn { background: var(--accent); color: #fff; }
.hint-row .hl { font-size: .88rem; }
.hint-row b { font-weight: 600; }
.wrong-list { margin: 8px; font-size: .88rem; color: var(--bad); }
@media (max-width: 480px) { .hint-row { grid-template-columns: 24px minmax(0, 1fr); } .hint-row b { grid-column: 2; } }
.top-msg { margin: 10px 0 4px; font-size: .95rem; }
.name-form { text-align: left; margin: 8px 0; }
.name-form label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: 4px; }
.name-form input { flex: 1; min-width: 0; font: inherit; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--text); }
.name-msg { display: block; margin-top: 4px; color: var(--muted); min-height: 1em; }
.slovo-top { margin-top: 12px; text-align: center; }
.mode-tabs { margin: 0 0 12px; }
.top-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; box-shadow: var(--shadow); }
.top-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.top-table th { text-align: left; font-size: .8rem; color: var(--muted); font-weight: 500; padding: 6px; border-bottom: 1px solid var(--line); }
.top-table td { padding: 8px 6px; border-bottom: 1px solid var(--line); }
.top-table tr.me td { background: var(--accent-soft); }
.top-table td:first-child { width: 40px; }
@media (max-width: 560px) { .mode-tabs { flex-wrap: wrap; } .mode-tabs button { flex: 1 1 30%; } }
@media (max-width: 400px) { .site-header .logo { display: none; } .nav { margin-left: 0; } }

/* ===== Слово из 5 букв ===== */
.five-wrap { max-width: 480px; margin: 0 auto; }
.five-board { display: grid; gap: 6px; justify-content: center; margin: 0 auto 14px; }
.five-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.five-row.shake { animation: shake .4s; }
.five-cell { width: clamp(48px, 15vw, 60px); aspect-ratio: 1; border: 2px solid var(--line); border-radius: 10px; background: var(--surface); display: flex; align-items: center; justify-content: center; font-size: clamp(1.5rem, 6vw, 1.9rem); font-weight: 700; text-transform: uppercase; }
.five-cell.typed { border-color: var(--muted); }
.five-cell.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.five-cell.in { background: var(--warn); border-color: var(--warn); color: #fff; }
.five-cell.no { background: var(--surface-2); border-color: var(--surface-2); color: var(--muted); }
.five-after { text-align: center; margin: 0 0 14px; }
.five-after p { margin: 0 0 8px; }
.five-after b { text-transform: uppercase; letter-spacing: .05em; }
.kb { display: grid; gap: 6px; user-select: none; touch-action: manipulation; }
.kb-row { display: flex; gap: 4px; justify-content: center; }
.kb button { flex: 1 1 0; min-width: 0; max-width: 44px; height: 52px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); font-size: 1.1rem; font-weight: 600; text-transform: uppercase; cursor: pointer; padding: 0; -webkit-tap-highlight-color: transparent; }
.kb button.wide { max-width: 70px; flex-grow: 1.6; font-size: .85rem; text-transform: none; }
.kb button.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.kb button.in { background: var(--warn); border-color: var(--warn); color: #fff; }
.kb button.no { background: var(--surface-2); color: var(--muted); opacity: .6; }
@media (max-width: 420px) { .kb-row { gap: 3px; } .kb button { height: 48px; font-size: 1rem; } }

/* ===== Филворд ===== */
.fil-wrap { max-width: 520px; margin: 0 auto; }
.fsel { text-align: center; font-size: 1.4rem; line-height: 1.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; min-height: 1.8rem; margin-bottom: 6px; color: var(--accent); }
.fgrid { --n: 5; display: grid; grid-template-columns: repeat(var(--n), 1fr); gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px; box-shadow: var(--shadow); user-select: none; -webkit-user-select: none; touch-action: none; }
.fgrid.shake { animation: shake .4s; }
.fc { aspect-ratio: 1; display: flex; align-items: center; justify-content: center; border-radius: 8px; background: var(--surface-2); font-weight: 700; font-size: clamp(1.1rem, calc(26vw / var(--n)), 1.8rem); text-transform: uppercase; cursor: pointer; transition: background .12s; }
.fc.sel { background: var(--accent); color: #fff; }
.fc.hint { box-shadow: inset 0 0 0 3px var(--warn); }
.fc.done { cursor: default; color: #1d1d1f; }
.f0 { background: #b2f2bb !important; } .f1 { background: #a5d8ff !important; } .f2 { background: #ffd8a8 !important; } .f3 { background: #eebefa !important; }
.f4 { background: #ffec99 !important; } .f5 { background: #96f2d7 !important; } .f6 { background: #ffc9c9 !important; } .f7 { background: #d0bfff !important; }
.flist { list-style: none; padding: 0; margin: 14px 0 0; display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.flist li { padding: 3px 10px; border-radius: 99px; font-size: .9rem; color: #1d1d1f; }
.flist li.unk { background: var(--surface); border: 1px dashed var(--line); color: var(--muted); }

/* ===== Слова из слова и помощник ===== */
.iz-wrap { max-width: 600px; margin: 0 auto; }
.iz-base { display: flex; flex-wrap: wrap; justify-content: center; gap: 5px; }
.iz-base button { width: 42px; height: 50px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); font-size: 1.45rem; font-weight: 700; text-transform: uppercase; cursor: pointer; padding: 0; -webkit-tap-highlight-color: transparent; }
.iz-base button.used { background: var(--accent); border-color: var(--accent); color: #fff; }
@media (max-width: 420px) { .iz-base button { width: 34px; height: 44px; font-size: 1.2rem; } }
.iz-input { margin-top: 14px; min-height: 2.2rem; font-size: 1.6rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; border-bottom: 3px solid var(--accent-soft); }
.iz-msg { min-height: 1.5em; margin: 10px 0 4px; font-size: .95rem; color: var(--muted); }
.iz-msg.ok { color: var(--ok); font-weight: 600; } .iz-msg.bad { color: var(--bad); }
.iz-progress { height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.iz-progress i { display: block; height: 100%; width: 0; background: var(--ok); transition: width .3s; }
.iz-found, .h-result { margin-top: 16px; }
.iz-group { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.iz-group b { width: 100%; font-size: .85rem; color: var(--muted); font-weight: 600; }
.iz-group span { background: var(--accent-soft); color: var(--text); border-radius: 99px; padding: 2px 10px; font-size: .95rem; }
.iz-missed { text-align: left; font-size: .9rem; color: var(--muted); max-height: 180px; overflow: auto; }
.h-form { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); max-width: 640px; margin: 0 auto; }
.h-form > label { display: block; font-weight: 600; margin-bottom: 6px; }
.h-opts { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-top: 12px; font-size: .95rem; color: var(--muted); }
.h-opts select { font: inherit; padding: 2px 6px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--text); }
.h-two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.h-two label { display: flex; flex-direction: column; gap: 4px; font-size: .9rem; color: var(--muted); }
.h-two input { font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text); }
@media (max-width: 480px) { .h-two { grid-template-columns: 1fr; } }
.h-result { max-width: 640px; margin-left: auto; margin-right: auto; }
.h-total { color: var(--muted); font-size: .92rem; }

/* ===================== Обновлённый интерфейс (шапка-меню, плитки, «Город дня») ===================== */
/* Кнопка «Игры» и выпадающее меню со всеми играми */
.games-btn { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 10px; padding: 6px 12px; font-weight: 600; font-size: .95rem; cursor: pointer; white-space: nowrap; }
.games-btn:hover, .games-btn[aria-expanded="true"] { border-color: var(--accent); color: var(--accent); }
.games-btn svg { width: 16px; height: 16px; }
.site-header .nav { margin-left: auto; }
.site-header .nav + .games-btn { margin-left: 4px; }
@media (max-width: 1060px) { .site-header .nav { display: none; } .site-header .nav + .games-btn { margin-left: auto; } }
/* на узких экранах логотип теперь не прячем */
@media (max-width: 560px) { .logo span { display: inline; font-size: 1rem; } }
@media (max-width: 400px) { .site-header .logo { display: flex; } }
@media (max-width: 340px) { .logo span { display: none; } }
.games-menu { position: absolute; top: 100%; left: 0; right: 0; z-index: 30; display: none; }
.games-menu.open { display: block; }
.games-menu .pn { background: var(--surface); border: 1px solid var(--line); border-top: 0; border-radius: 0 0 18px 18px; box-shadow: 0 12px 30px rgba(0,0,0,.18); padding: 14px; max-width: 560px; margin-left: auto; }
.games-menu .gl { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.games-menu a { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 4px; border-radius: 12px; text-decoration: none; color: var(--text); font-size: .86rem; text-align: center; background: var(--surface-2); line-height: 1.2; }
.games-menu a:hover { outline: 2px solid var(--line); }
.games-menu a[aria-current="page"] { outline: 2px solid var(--accent); }
.games-menu a .e { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-size: 22px; }
.games-back { position: fixed; inset: 56px 0 0; background: rgba(0,0,0,.3); z-index: 19; display: none; }
.games-back.open { display: block; }
@media (max-width: 560px) { .games-menu .pn { border-radius: 0 0 16px 16px; border-left: 0; border-right: 0; } }

/* Цвета игр (светлая тема; в тёмной чуть приглушены) */
.g-blue { background: linear-gradient(135deg, #dbe7ff, #c3d4ff); }
.g-green { background: linear-gradient(135deg, #d9f5e5, #b9ebcf); }
.g-yellow { background: linear-gradient(135deg, #fff1cc, #ffe08a); }
.g-red { background: linear-gradient(135deg, #ffe0e0, #ffc4c4); }
.g-violet { background: linear-gradient(135deg, #ece2ff, #d6c6ff); }
.g-teal { background: linear-gradient(135deg, #d5f5f6, #a8e6e9); }
.g-orange { background: linear-gradient(135deg, #ffe8d6, #ffd0a8); }
.g-pink { background: linear-gradient(135deg, #ffe3f1, #ffc2df); }
.g-gray { background: linear-gradient(135deg, #eeeeee, #dddddd); }
:root[data-theme="dark"] [class*="g-"] .art-in, :root[data-theme="dark"] .tile-art, :root[data-theme="dark"] .games-menu .e { filter: saturate(.8) brightness(.85); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tile-art, :root:not([data-theme="light"]) .games-menu .e { filter: saturate(.8) brightness(.85); } }

/* Главная: заголовок, баннер «Город дня», плитки */
.home-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 6px 16px; margin: 6px 0 14px; }
.home-head h1 { margin: 0; font-size: clamp(1.35rem, 3.6vw, 1.9rem); }
.home-head p { margin: 2px 0 0; color: var(--muted); font-size: .95rem; }
.chip { display: inline-flex; align-items: center; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; font-size: .88rem; white-space: nowrap; }
.feat { display: grid; grid-template-columns: 1.25fr 1fr; border-radius: 18px; overflow: hidden; background: linear-gradient(120deg, #3b5bdb, #5f3dc4); color: #fff; margin: 0 0 22px; box-shadow: var(--shadow); }
.feat .t { padding: 22px 24px; }
.feat .lbl { display: inline-block; background: rgba(255,255,255,.18); border-radius: 999px; padding: 3px 10px; font-size: .8rem; font-weight: 600; }
.feat h2 { margin: 10px 0 6px; font-size: 1.6rem; color: #fff; }
.feat p { margin: 0 0 14px; opacity: .92; font-size: .95rem; }
.feat .btns { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.feat .b1 { background: #fff; color: #3b5bdb; font-weight: 700; padding: 10px 20px; border-radius: 12px; text-decoration: none; }
.feat .b1:hover { filter: brightness(.96); }
.feat .note { opacity: .88; font-size: .9rem; }
.feat .week { display: flex; gap: 6px; margin-top: 14px; }
.feat .week i { width: 28px; height: 28px; border-radius: 8px; background: rgba(255,255,255,.18); display: grid; place-items: center; font-style: normal; font-size: .75rem; font-weight: 600; }
.feat .week i.ok { background: #51cf66; }
.feat .week i.miss { background: rgba(255,255,255,.08); opacity: .7; }
.feat .week i.td { outline: 2px solid #fff; }
.feat .more { margin-top: 12px; font-size: .85rem; opacity: .9; }
.feat .more a { color: #fff; }
.feat .art { display: grid; place-items: center; background: rgba(255,255,255,.07); padding: 10px; }
.feat .art svg { width: 100%; max-height: 220px; }
@media (max-width: 640px) { .feat { grid-template-columns: 1fr; } .feat .art { display: none; } .feat h2 { font-size: 1.3rem; } .feat .t { padding: 18px; } }
.sec-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 0 12px; }
.sec-head h2 { margin: 0; font-size: 1.15rem; }
.tiles { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; }
@media (max-width: 1000px) { .tiles { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 560px) { .tiles { grid-template-columns: repeat(2, 1fr); gap: 10px; } }
.tile { position: relative; border-radius: 16px; overflow: hidden; text-decoration: none; color: var(--text); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); display: flex; flex-direction: column; transition: transform .15s, border-color .15s; }
.tile:hover { transform: translateY(-2px); border-color: var(--accent); }
.tile-art { aspect-ratio: 16 / 10; display: grid; place-items: center; position: relative; font-size: 44px; }
.tile-art svg { width: 80%; height: 80%; }
.tile-body { padding: 10px 12px 12px; }
.tile-body h3 { margin: 0; font-size: 1rem; }
.tile-body p { margin: 3px 0 0; font-size: .82rem; color: var(--muted); line-height: 1.35; }
.tile .badge { position: absolute; top: 8px; left: 8px; background: #fff; color: #1d1d1f; font-size: .72rem; font-weight: 700; padding: 3px 8px; border-radius: 999px; box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.tile .badge.new { background: #ffd43b; }
.tile .rec { font-size: .78rem; color: var(--ok); margin-top: 6px; font-weight: 600; }
.tile .rec:empty { display: none; }

/* Блок «Сыграйте ещё» под игрой */
.more-games { margin: 22px 0 6px; }
.more-games .tiles { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 560px) { .more-games .tiles { gap: 8px; } .more-games .tile-body p { display: none; } .more-games .tile-body { padding: 7px 9px 9px; } .more-games .tile-body h3 { font-size: .85rem; } .more-games .tile-art { font-size: 34px; } }

/* Страница игры на телефоне: компактнее заголовок, поле выше */
@media (max-width: 560px) {
  main { padding-top: 12px; }
  .game-head { margin-bottom: 8px; gap: 8px; }
  .game-head h1 { font-size: 1.35rem; }
  .mode-help { font-size: .88rem; margin: 0 0 8px; }
}

/* Плашка cookies: тоньше, чтобы не закрывать игру */
.cookie { padding: 8px 8px 8px 14px; font-size: .82rem; max-width: 520px; }
.cookie .btn { padding: 6px 12px; font-size: .85rem; }
@media (max-width: 560px) { .cookie { font-size: .76rem; padding: 6px 6px 6px 12px; } }
.chip[hidden] { display: none; }
.site-header .games-menu .wrap { height: auto; display: block; }
