/* Тренажёр стран и столиц. Шрифты локально, без CDN: Manrope (текст) и Montserrat (заголовки), оба SIL OFL 1.1 (../fonts/OFL.txt, ../fonts/OFL-Montserrat.txt) */
@font-face{font-family:'Manrope';font-style:normal;font-weight:400 700;font-display:swap;src:url(../fonts/manrope-cyrillic.woff2) format('woff2');unicode-range:U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116}
@font-face{font-family:'Manrope';font-style:normal;font-weight:400 700;font-display:swap;src:url(../fonts/manrope-latin.woff2) format('woff2');unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}
@font-face{font-family:'Montserrat';font-style:normal;font-weight:400 800;font-display:swap;src:url(../fonts/montserrat-var.woff2) format('woff2')}

/* оформление по образцу, который дал Миша (TimeGuessr), цвета — Баухаус (синий, красный, жёлтый, чёрный, бумага): почти чёрный нейтральный фон с едва заметной картой, чёрно-белые карточки,
   тёмные плашки с тонкой рамкой, красно-коралловая кнопка «Играть», светлый бежевый итог со счётом в красных прямоугольниках */
:root{--bg:#111214;--panel:#1c1d21;--panel2:#16171a;--edge:#2e2f35;--edge2:#45464e;--ink:#f4f4f6;--muted:#9b9ca4;
  --accent:#b3341f;--onacc:#fff;--ok:#3fae5a;--bad:#e0553f;
  --paper:#f1ece4;--paper-ink:#1d1b19;--paper-mut:#6f6a62;
  --t-data:#7fd1a8;--t-calc:#ffcf7a;--t-schema:#b9a6ff;
  --font:'Manrope',system-ui,-apple-system,'Segoe UI',Roboto,sans-serif;--head:'Montserrat','Manrope',system-ui,sans-serif;color-scheme:dark}
*,*::before,*::after{box-sizing:border-box}
html,body{height:100%;margin:0}
body{background:var(--bg);color:var(--ink);font-family:var(--font);-webkit-tap-highlight-color:transparent}
body::before{content:"";position:fixed;inset:0;z-index:-1;background:url(img/bg-map.jpg) center/cover no-repeat;opacity:.5;pointer-events:none}
button{font:inherit;color:inherit;cursor:pointer}
.screen[hidden],.optrow[hidden],.zoom[hidden],.bigq[hidden],.tbar[hidden],.typed[hidden],.fb[hidden],.answers:empty{display:none!important}

/* ---- меню: только крупные карточки ---- */
#menu{max-width:560px;margin:0 auto;padding:calc(env(safe-area-inset-top,0px) + 12px) 12px calc(env(safe-area-inset-bottom,0px) + 24px)}
.mtop{display:flex;justify-content:space-between;align-items:center;gap:8px}
.pill{display:inline-flex;align-items:center;gap:6px;height:40px;padding:0 14px;border-radius:10px;background:var(--panel);border:1px solid var(--edge);color:var(--ink);text-decoration:none;font:500 13.5px var(--font)}
.mhead h1{margin:20px 4px 4px;font:800 32px/1 var(--head);letter-spacing:-.01em;text-transform:uppercase}
.lead{margin:0 4px 14px;color:var(--muted);font-size:13.5px;line-height:1.5}
.sets{display:flex;gap:6px;overflow-x:auto;margin:0 0 12px;padding:0 0 2px;scrollbar-width:none}
.sets::-webkit-scrollbar{display:none}
.sets button{flex:none;height:36px;padding:0 14px;border-radius:999px;border:1px solid var(--edge);background:var(--panel2);color:var(--muted);font:600 13px var(--font)}
.sets button[aria-pressed="true"]{background:#f2c230;color:#111;border-color:#f2c230}
.cards{display:flex;flex-direction:column;gap:10px}
.card:active{filter:brightness(1.15)}
.card.off{opacity:.45}

/* ---- окно «Настройки игры» (как «Ajustes de la partida» в образце) ---- */
dialog{border:1px solid var(--edge);border-radius:14px;background:var(--panel);color:var(--ink);padding:0;width:min(420px,calc(100% - 24px));max-height:calc(100% - 32px)}
dialog::backdrop{background:rgba(0,0,0,.65)}
.dlg{padding:22px 18px 18px}
.dlg h2{margin:0 0 16px;font:500 22px var(--head);text-align:center}
.optrow{display:flex;flex-direction:column;gap:6px;margin-bottom:12px}
.ol{font-size:11px;font-weight:700;letter-spacing:.08em;text-transform:uppercase;color:var(--muted)}
.seg{display:grid;grid-auto-flow:column;grid-auto-columns:1fr;gap:1px;border:1px solid var(--edge2);border-radius:6px;overflow:hidden;background:var(--edge2)}
.seg.g3{grid-auto-flow:row;grid-template-columns:repeat(3,1fr)}
.seg button{background:var(--panel2);border:0;padding:10px 6px;font-size:13px;font-weight:600;color:var(--muted)}
.seg button[aria-pressed="true"]{background:#2a2b31;color:var(--ink);box-shadow:inset 0 0 0 1px #6b6c75}
.lvlnote{margin:-4px 0 12px;font-size:12px;color:var(--muted);line-height:1.45}
.chk{display:flex;align-items:center;gap:9px;font-size:13.5px;font-weight:500;margin:0 0 16px}
.chk input{width:18px;height:18px;accent-color:var(--accent)}
.play{display:block;margin:0 auto;height:46px;min-width:170px;border:0;border-radius:999px;background:var(--accent);color:#fff;font:500 18px var(--head)}
.play:disabled{opacity:.4}
.dlgx{position:absolute;right:12px;top:12px;width:34px;height:34px;border-radius:50%;border:1px solid var(--edge2);background:none;color:var(--ink);font-size:15px}

/* ---- игра ---- */
#game{position:fixed;inset:0;display:flex;flex-direction:column}
.gtop{position:relative;display:flex;align-items:center;gap:12px;padding:calc(env(safe-area-inset-top,0px) + 10px) 12px 10px;z-index:2;background:var(--bg);border-bottom:1px solid var(--edge)}
.x{width:38px;height:38px;border-radius:10px;border:1px solid var(--edge);background:var(--panel);font-size:15px}
.tbar{position:absolute;left:0;right:0;bottom:-1px;height:3px;background:var(--panel)}
.tbar i{display:block;height:100%;width:100%;background:var(--ok);transform-origin:left;transition:background .3s}
.prog{flex:1;height:4px;border-radius:2px;background:var(--panel);overflow:hidden}
.prog i{display:block;height:100%;width:0;background:var(--accent);transition:width .3s}
.score{min-width:52px;text-align:right;font-variant-numeric:tabular-nums}
.score b{font:600 18px var(--head)}
.score span{display:block;font-size:10.5px;color:var(--accent);font-weight:700;min-height:13px}
.stage{position:relative;flex:1;min-height:0;background:#2c5ba8}
.stage.plain{background:transparent}
#cv{position:absolute;inset:0;width:100%;height:100%;display:block;touch-action:none}
#flag{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:min(78%,440px);border-radius:4px;box-shadow:0 10px 40px rgba(0,0,0,.6)}
.bigq{position:absolute;inset:0;display:grid;place-items:center;text-align:center;padding:16px;font:500 clamp(30px,8vw,50px)/1.1 var(--head)}
.bigq small{display:block;font:500 14px var(--font);color:var(--muted);margin-bottom:10px}
.zoom{position:absolute;right:12px;top:10px;display:flex;flex-direction:column;gap:6px}
.zoom button{width:40px;height:40px;border-radius:10px;border:1px solid var(--edge);background:var(--panel);font-size:18px}
.qpanel{background:var(--bg);border-top:1px solid var(--edge);padding:14px 14px calc(env(safe-area-inset-bottom,0px) + 14px)}
@media(min-width:760px){.qpanel{width:600px;margin:0 auto 16px;border:1px solid var(--edge);border-radius:14px;background:var(--panel)}}
.qtext{margin:0 0 10px;font-size:16.5px;font-weight:600;line-height:1.3}
.answers{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.answers button{min-height:48px;padding:10px;border-radius:8px;border:1px solid var(--edge2);background:var(--panel);color:var(--ink);font-size:14.5px;font-weight:600;line-height:1.2}
.answers button.ok{background:rgba(63,174,90,.22);border-color:var(--ok)}
.answers button.bad{background:rgba(224,85,63,.2);border-color:var(--bad)}
.answers button:disabled{cursor:default}
.typed{display:flex;gap:8px;flex-wrap:wrap}
.typed input{flex:1 1 200px;min-width:0;height:48px;border-radius:8px;border:1px solid var(--edge2);background:var(--panel);color:var(--ink);padding:0 14px;font:600 16px var(--font)}
.typed input:focus{outline:2px solid var(--accent);outline-offset:0}
.typed button,.fb button{height:48px;border-radius:999px;border:0;background:var(--accent);color:var(--onacc);font:500 16px var(--head);padding:0 22px}
button.ghost{background:transparent!important;color:var(--ink)!important;border:1px solid var(--edge2)!important}
.fb{display:flex;gap:12px;align-items:center;margin-top:10px}
.fb p{flex:1;margin:0;font-size:14px;line-height:1.4}
.fb p b.ok{color:var(--ok)}.fb p b.bad{color:var(--bad)}
.fb p small{display:block;color:var(--muted);font-size:12.5px;margin-top:3px}

/* ---- итог: бежевый, красный текст, счёт в красных прямоугольниках ---- */
#result{min-height:100vh;min-height:100dvh;padding:calc(env(safe-area-inset-top,0px) + 22px) 14px 24px;background:var(--paper);color:var(--paper-ink)}
.res{width:min(520px,100%);margin:0 auto}
.resMode:empty{display:none}
.resMode{margin:0;font:600 12px var(--font);letter-spacing:.06em;text-transform:uppercase;color:var(--paper-mut)}
.resHead{margin:4px 0 12px;font:600 28px/1.2 var(--head);color:var(--paper-ink)}
.tiles{display:flex;gap:14px;align-items:flex-end;margin:6px 0 4px}
.tile{display:flex;flex-direction:column;gap:3px}
.tile small{font:600 13px var(--font);color:var(--paper-ink)}
.tile div{display:flex;align-items:baseline;gap:4px;font-size:12.5px;color:var(--paper-mut)}
.resBig{margin:0;padding:6px 12px;background:#8e2b1d;color:#fff;font:600 26px/1.1 var(--head);border-radius:2px}
.resSub{margin:10px 0 16px;color:var(--paper-mut);font-size:14px}
.resList{display:flex;flex-direction:column;gap:5px;margin-bottom:18px}
.resList .mut{color:var(--paper-mut);margin:0 0 2px}
.resList div{background:#fff;border-radius:4px;padding:9px 12px;font-size:14px;font-weight:600}
.resList div span{color:var(--paper-mut);font-weight:500}
.resBtns{display:flex;flex-direction:column;gap:8px}
.resBtns button{height:46px;border-radius:999px;border:1.5px solid var(--paper-ink);background:var(--paper-ink);color:#fff;font:600 15px var(--font)}
.resBtns button.ghost{background:transparent!important;color:var(--paper-ink)!important;border:1.5px solid rgba(29,27,25,.35)!important}

/* ---- ⓘ ---- */
.src{list-style:none;margin:0 0 12px;padding:0;display:flex;flex-direction:column;gap:6px;font-size:13px;line-height:1.45}
.src li{background:var(--panel2);border:1px solid var(--edge);border-radius:8px;padding:9px 11px}
.tag{display:inline-block;font:700 9.5px/1 var(--font);letter-spacing:.04em;padding:3px 6px 2px;border-radius:4px;margin-right:6px;vertical-align:1px;border:1px solid currentColor}
.tag.data{color:var(--t-data)}.tag.calc{color:var(--t-calc)}.tag.schema{color:var(--t-schema)}
.mut{color:var(--muted);font-size:12.5px}
#dlgInfo .dlg h2{text-align:left}
#dlgInfo form button{height:44px;border-radius:999px;border:0;background:var(--accent);color:#fff;font:500 16px var(--head);padding:0 24px}

/* ---- окно «Настройки игры», 08.11.2026: плитки частей света с числом вопросов, сложность карточками, длина игры, переключатели, прогресс «знаешь N из M» ---- */
.play-dlg{padding:20px 16px 16px}
.play-dlg h2{margin:0;text-align:left;font:600 24px var(--head)}
.play-sub{margin:4px 0 14px;color:var(--muted);font-size:13px}
.know{margin:0 0 16px}
.know-t{display:flex;justify-content:space-between;align-items:baseline;gap:8px;font-size:13px;font-weight:600;margin-bottom:6px}
.know-bar{height:6px;border-radius:3px;background:var(--panel2);overflow:hidden}
.know-bar i{display:block;height:100%;width:0;background:var(--accent);border-radius:3px;transition:width .4s}
.know.paper{margin:4px 0 18px}.know.paper .know-t{color:var(--paper-ink)}.know.paper .know-bar{background:rgba(29,27,25,.12)}.know.paper .know-bar i{background:#2c5ba8}
.link{background:none;border:0;padding:0;color:var(--muted);font-size:12px;text-decoration:underline;text-underline-offset:3px}
.link[hidden]{display:none}
.tiles3{display:grid;grid-template-columns:repeat(3,1fr);gap:6px}
.tiles3 button{display:flex;flex-direction:column;align-items:flex-start;gap:2px;padding:9px 10px;border-radius:8px;border:1px solid var(--edge);background:var(--panel2);color:var(--ink);font:600 13.5px var(--font);text-align:left}
.tiles3 button small{font-size:11px;font-weight:500;color:var(--muted)}
.tiles3 button[aria-pressed="true"],.lvls button[aria-pressed="true"]{border-color:var(--accent);box-shadow:inset 0 0 0 1px var(--accent)}
.lvls{display:flex;flex-direction:column;gap:6px}
.lvls button{display:flex;justify-content:space-between;align-items:baseline;gap:10px;padding:11px 12px;border-radius:8px;border:1px solid var(--edge);background:var(--panel2);color:var(--ink);text-align:left}
.lvls b{font:600 14.5px var(--font)}.lvls small{font-size:12px;color:var(--muted);text-align:right}
.sw{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:10px 0;border-top:1px solid var(--edge);cursor:pointer}
.sw[hidden]{display:none}
.sw span{display:flex;flex-direction:column;gap:2px}.sw b{font:600 14px var(--font)}.sw small{font-size:12px;color:var(--muted)}
.sw input{position:absolute;opacity:0;pointer-events:none}
.sw i{flex:none;position:relative;width:44px;height:26px;border-radius:13px;background:var(--edge2);transition:background .2s}
.sw i::after{content:"";position:absolute;left:3px;top:3px;width:20px;height:20px;border-radius:50%;background:#fff;transition:transform .2s}
.sw input:checked+i{background:var(--accent)}.sw input:checked+i::after{transform:translateX(18px)}
.play-dlg .play{width:100%;margin-top:12px;height:50px}

/* вариант оформления «как в атласе»: тёмно-синий фон, рыжий акцент (?theme=atlas) — для сравнения */
:root[data-theme="atlas"]{--bg:#081129;--panel:#0f1d3d;--panel2:#0b1631;--edge:#1f3360;--edge2:#2d4475;--muted:#94a6c6;--accent:#ffb44a;--onacc:#1a1206}
:root[data-theme="atlas"] .play,:root[data-theme="atlas"] .typed button,:root[data-theme="atlas"] .fb button{color:#1a1206}

/* ---- карточки игр: картинка рисуется из контуров (cardArt), плитки по группам ---- */
.card{position:relative;overflow:hidden;text-align:left;border:0;border-radius:10px;padding:0;display:block;color:var(--ink);background:#2c5ba8;font:inherit;cursor:pointer}
.card .art{position:absolute;inset:0;background:center/cover no-repeat}
.card .art svg{display:block;width:100%;height:100%}
.card .cap{position:absolute;left:0;right:0;bottom:0;padding:10px 12px 12px;display:flex;flex-direction:column;gap:2px}
.card b{font:600 19px/1.15 var(--head);letter-spacing:-.005em}
.card span{font-size:12px;line-height:1.3;opacity:.85}
.card .best{font:600 11px var(--font);font-style:normal;opacity:.9;margin-top:4px}
.card .cbar{display:block;height:3px;border-radius:2px;background:rgba(127,127,127,.35);overflow:hidden;margin-top:4px}
.card .cbar i{display:block;height:100%;background:currentColor}
.card:active{filter:brightness(1.12)}
.card:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
/* 1 — по группам, плитки 2 в ряд, подпись под картинкой */
.cards.m1{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.cards .grp{grid-column:1/-1;margin:12px 2px -2px;font:700 11.5px var(--font);letter-spacing:.09em;text-transform:uppercase;color:var(--muted)}
.cards .grp:first-child{margin-top:2px}
.m1 .card{height:196px}
.m1 .card .art{bottom:70px}
.m1 .card .cap{height:70px;background:var(--panel);color:var(--ink);justify-content:flex-start}
.m1 .card b{font-size:17px}
.m1 .card .best{position:absolute;right:10px;top:-24px;background:var(--panel);color:var(--ink);padding:3px 7px;border-radius:6px;margin:0}
.m1 .card .cbar{position:absolute;left:12px;right:12px;bottom:8px;margin:0}
@media (min-width:900px){
  #menu{max-width:900px}
  .cards.m1{grid-template-columns:repeat(4,1fr)}
}

/* размеры и зазоры кнопок — docs/UX-RULES.md §1: на телефоне зона нажатия ≥ 44 px, мелкие кнопки — через ≥ 8 px */
.pill{height:44px}
.sets button{height:44px}
.sets{gap:8px}
.x{width:44px;height:44px}
.zoom{gap:8px}.zoom button{width:44px;height:44px}
.seg button{min-height:44px}
.dlgx{width:44px;height:44px;right:8px;top:8px}
.lvls button{min-height:46px}
.sets{flex-wrap:wrap;overflow:visible}
