:root { --bg: #1c1f29; --card: #262a36; --ink: #f3efe8; --muted: #a9adb8; --accent: #e08868; --blue: #4f86b8; --red: #c4553a; --ok: #6fae7c; }
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
main { max-width: 640px; margin: 0 auto; padding: 18px 16px 60px; }
h1 { font: 700 30px/1.15 Georgia, serif; margin: 8px 0 6px; }
h2 { font: 700 22px/1.2 Georgia, serif; margin: 4px 0 10px; }
.kicker { color: var(--accent); letter-spacing: .12em; font-size: 12px; text-transform: uppercase; font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.card { background: var(--card); border-radius: 14px; padding: 14px 16px; margin: 12px 0; }
.adv { margin: 6px 0; }
.adv b { color: var(--muted); font-weight: 600; }
button.opt { display: block; width: 100%; text-align: left; background: #f3efe8; color: #1c1f29; border: 0; border-radius: 12px; padding: 12px 14px; margin: 8px 0; font-size: 16px; cursor: pointer; }
button.opt:hover { background: #fff; }
button.opt .hint { display: block; color: #555b66; font-size: 13px; margin-top: 2px; }
button.opt.locked { background: #3a3f4c; color: var(--muted); cursor: not-allowed; }
button.main { background: var(--accent); color: #1c1f29; border: 0; border-radius: 12px; padding: 12px 18px; font-size: 16px; font-weight: 600; cursor: pointer; margin-top: 8px; }
button.link { background: none; border: 0; color: var(--accent); cursor: pointer; padding: 0; font-size: 14px; text-decoration: underline; }
.bars { display: grid; grid-template-columns: 110px 1fr; gap: 6px 10px; align-items: center; font-size: 14px; }
.bar { height: 8px; background: #3a3f4c; border-radius: 4px; position: relative; overflow: hidden; }
.bar i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--red); border-radius: 4px; }
.bar.edge i { background: #f0c24b; }
.dice { font-variant-numeric: tabular-nums; }
.tag { display: inline-block; font-size: 11px; border-radius: 6px; padding: 1px 6px; margin-left: 6px; vertical-align: 1px; }
.tag.fact { background: #2f5d3a; } .tag.analog { background: #5b4a24; } .tag.assumption { background: #4a3a52; }
.report { display: grid; grid-template-columns: 1fr auto auto; gap: 4px 12px; font-size: 14px; }
.report .h { color: var(--muted); font-size: 12px; }
.galina { border-left: 3px solid var(--blue); padding-left: 12px; }
.stripe { display: flex; gap: 3px; margin: 8px 0; } .stripe span { width: 18px; height: 18px; border-radius: 3px; background: #3a3f4c; } .stripe span.m { background: var(--blue); } .stripe span.d { background: var(--accent); }
table.rt { width: 100%; border-collapse: collapse; font-size: 14px; } table.rt td, table.rt th { padding: 5px 4px; border-bottom: 1px solid #343846; text-align: left; vertical-align: top; } table.rt th { color: var(--muted); font-weight: 500; font-size: 12px; }
canvas { width: 100%; border-radius: 12px; margin-top: 8px; }
.ev { margin: 8px 0; } .ev .y { color: var(--accent); font-weight: 600; margin-right: 6px; }
a { color: var(--accent); }
.warn { border: 1px solid #6b4d2a; background: #2e271d; }
.bar.blue i { background: var(--blue); }
.eff { margin: 8px 0 10px; }
details summary { cursor: pointer; color: var(--accent); }
details { margin-top: 2px; }
canvas { width: 100%; height: auto; }
.forces { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 8px 0 12px; font-size: .8em; }
.force .bar { position: relative; } .force .bar::before, .force .bar::after { content: ''; position: absolute; top: 0; bottom: 0; width: 1px; background: currentColor; opacity: .4; }
.force .bar::before { left: 15%; } .force .bar::after { left: 85%; } .force.edge { color: #f0c24b; font-weight: 600; }
.opt .dots { float: right; } .opt .dots i { display: inline-block; width: 6px; height: 6px; margin-left: 4px; border-radius: 50%; border: 1px solid currentColor; opacity: .35; }
.opt .dots i.on { background: currentColor; opacity: .8; } .opt .dots i.big { width: 10px; height: 10px; background: currentColor; opacity: 1; }
.opt .risk { display: block; color: #b9541f; font-size: .85em; margin-top: 4px; } .opt .for { display: block; font-size: .75em; opacity: .6; }
.opt.locked { opacity: .55; } .adv.yes { font-style: italic; opacity: .7; } .adv.odds { font-size: .9em; border-left: 3px solid #b9541f; padding-left: 8px; }
.die { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; } .die i { width: 30px; height: 14px; border: 1px solid #999; border-radius: 7px; opacity: .5; }
.die i.on { background: var(--accent); border-color: var(--accent); opacity: 1; transform: scale(1.15); } .die .lo, .die .hi { font-size: .75em; opacity: .6; } .die b { flex-basis: 100%; margin-top: 4px; }
.eff .up { color: #7cc48a; } .eff .down { color: #e0705a; }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; } .tile { display: grid; padding: 8px; border: 1px solid #3a3f4c; border-radius: 6px; } .tile b { font-size: 1.6em; }
.row { display: flex; gap: 8px; margin: 8px 0; } .row button, #same { background: #3a3f4c; color: var(--ink); border: 0; border-radius: 10px; padding: 10px 14px; cursor: pointer; margin-top: 8px; }

/* ── Рисованные сцены (sketch.mjs) и шрифты к ним; шрифты OFL, лежат в fonts/ */
@font-face { font-family: Caveat; font-weight: 500; font-display: swap; src: url(fonts/caveat-cyr.woff2) format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: Caveat; font-weight: 500; font-display: swap; src: url(fonts/caveat-lat.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215; }
@font-face { font-family: 'PT Mono'; font-display: swap; src: url(fonts/ptmono-cyr.woff2) format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'PT Mono'; font-display: swap; src: url(fonts/ptmono-lat.woff2) format('woff2'); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2212; }
svg.sk { width: 100%; height: auto; display: block; border-radius: 10px; margin: 6px 0 10px; background: #fbfbf6; }
.sk .ln { fill: none; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1 1; stroke-dashoffset: 1; }
.sk.go .ln { animation: sk-draw var(--d, .6s) ease-in-out var(--t, 0s) forwards; }
.sk .fl, .sk .tx { opacity: 0; }
.sk.go .fl, .sk.go .tx { animation: sk-fade .7s ease var(--t, 0s) forwards; }
.sk.still .ln { stroke-dashoffset: 0; } .sk.still .fl, .sk.still .tx { opacity: var(--o, 1); } .sk.still .pc { opacity: 1; }
@keyframes sk-draw { to { stroke-dashoffset: 0; } }
@keyframes sk-fade { to { opacity: var(--o, 1); } }
.sk-A .ln { stroke: #3a3a3a; stroke-width: 1.7; } .sk-A .ln.thin { stroke-width: 1.1; stroke: #666; }
.sk .hand, .sk-A text { font-family: Caveat, 'Comic Sans MS', cursive; fill: #2b4a8a; }
.sk-C text { font-family: 'PT Mono', 'Courier New', monospace; }
.sk .snow { fill: #fff; } .sk.go .snow { animation: sk-fall var(--s, 5s) linear var(--t, 0s) infinite; }
@keyframes sk-fall { from { transform: translateY(-20px); } to { transform: translateY(140px); } }
.sk .flame { transform-box: fill-box; transform-origin: 50% 100%; } .sk.go .flame { animation: sk-flick .18s steps(2) infinite alternate; }
@keyframes sk-flick { to { transform: scaleY(.75) scaleX(1.1); } }
.sk .pc { opacity: 0; transform-box: fill-box; transform-origin: center; }
.sk.go .pc { animation: sk-land .7s steps(5) var(--t, 0s) forwards, sk-jit .5s steps(2) calc(var(--t, 0s) + .7s) infinite; }
@keyframes sk-land { 0% { opacity: 1; transform: translate(var(--x, 0px), -260px) rotate(var(--r, 25deg)); } 100% { opacity: 1; transform: translate(0, 0) rotate(var(--rr, 0deg)); } }
@keyframes sk-jit { 0% { opacity: 1; transform: translate(0, 0) rotate(var(--rr, 0deg)); } 100% { opacity: 1; transform: translate(.6px, -.6px) rotate(calc(var(--rr, 0deg) + .4deg)); } }

/* ── Кадровый состав (cabinet.mjs) */
.cab-post { margin: 14px 0 6px; } .cab-post > b { display: block; margin-bottom: 4px; }
.cands { display: grid; gap: 6px; }
.cand { display: block; background: #2f3442; border: 2px solid transparent; border-radius: 10px; padding: 8px 10px; cursor: pointer; font-size: 14px; }
.cand.on { border-color: var(--accent); background: #3a3528; } .cand input { display: none; } .cand small { display: block; color: var(--muted); }
.presets { display: flex; gap: 6px; flex-wrap: wrap; } .presets button { background: #3a3f4c; color: var(--ink); border: 0; border-radius: 16px; padding: 7px 12px; cursor: pointer; font-size: 14px; }
.presets button.on { background: var(--accent); color: #1c1f29; } .presets small { opacity: .7; }
input[type=range] { width: 100%; accent-color: var(--accent); }
.feed { border-left: 3px solid var(--accent); } .feed p { margin: 6px 0; font-size: 14px; }
.cab select { width: 100%; padding: 6px; border-radius: 8px; background: #2f3442; color: var(--ink); border: 1px solid #444a58; margin: 2px 0 8px; }
.cost { color: #e0705a; font-size: 13px; }

/* ── Ролик-инструкция (tutorial.mjs) */
.tut { position: fixed; inset: 0; background: #000c; display: flex; align-items: center; justify-content: center; z-index: 10; padding: 12px; }
.tut .box { background: #fbfbf6; color: #222; border-radius: 14px; padding: 12px; max-width: 620px; width: 100%; }
.tut svg.sk { margin: 0; cursor: pointer; max-height: none; }
.tut .prog { display: flex; gap: 4px; margin: 10px 0 4px; } .tut .prog i { flex: 1; height: 4px; border-radius: 2px; background: #ddd; overflow: hidden; position: relative; }
.tut .prog i b { position: absolute; inset: 0; background: var(--accent); transform-origin: left; transform: scaleX(0); }
.tut .prog i.done b { transform: scaleX(1); } .tut .prog i.now b { animation: tut-bar var(--dur) linear forwards; }
@keyframes tut-bar { to { transform: scaleX(1); } }
.tut .row button { background: #e9e6df; color: #222; }
.tut .tilt { transform-box: fill-box; transform-origin: 80% 100%; }
.sk.go .tilt { animation: tut-tilt .6s cubic-bezier(.5,0,.7,1.6) var(--t2, 2.4s) forwards; }
@keyframes tut-tilt { to { transform: rotate(9deg) translateY(6px); } }
button.ghost { background: none; border: 1px solid var(--accent); color: var(--accent); border-radius: 12px; padding: 10px 14px; font-size: 15px; cursor: pointer; margin: 8px 8px 0 0; }

/* ── Светлая тема и размер шрифта (переключатели #tools в app.mjs) */
:root { --chip: #3a3f4c; --chip2: #2f3442; --z: 1; }
html[data-size=s] { --z: .9; } html[data-size=l] { --z: 1.18; }
main { zoom: var(--z); }
.tag { color: #f3efe8; }
html[data-theme=light] { --bg: #f4f1ea; --card: #ffffff; --ink: #1f2330; --muted: #676c7a; --accent: #c2603c; --blue: #3a6fa3; --chip: #e7e2d8; --chip2: #f6f3ed; color-scheme: light; }
html[data-theme=light] button.opt { background: #fff; border: 1px solid #ddd6ca; } html[data-theme=light] button.opt:hover { background: #fbf8f2; }
html[data-theme=light] button.opt.locked { background: #ece8e0; color: #8a8f99; }
html[data-theme=light] .bar { background: #e4dfd5; } html[data-theme=light] .warn { background: #fbf1e4; border-color: #e5c79c; }
html[data-theme=light] .tile { border-color: #e0dbd0; } html[data-theme=light] table.rt td, html[data-theme=light] table.rt th { border-color: #e6e1d8; }
html[data-theme=light] .row button, html[data-theme=light] #same, html[data-theme=light] .presets button { background: #e9e4da; color: var(--ink); }
html[data-theme=light] .cand { background: #f1ede5; } html[data-theme=light] .cand.on { background: #fbeee6; }
html[data-theme=light] .cab select { background: #fff; border-color: #d6d0c4; }
html[data-theme=light] .eff .up, html[data-theme=light] .ind .up { color: #2f8a46; } html[data-theme=light] .eff .down, html[data-theme=light] .ind .down { color: #c0452c; }
html[data-theme=light] .gauge.edge span, html[data-theme=light] .force.edge { color: #b07a00; }
html[data-theme=light] .card { box-shadow: 0 1px 3px #0001; }
.tools { max-width: 640px; margin: 0 auto; padding: 10px 16px 0; display: flex; justify-content: flex-end; gap: 6px; align-items: center; }
.tools button { background: var(--chip); color: var(--ink); border: 0; border-radius: 8px; min-width: 32px; height: 30px; cursor: pointer; padding: 0 8px; line-height: 1; }
.tools button.on { background: var(--accent); color: #1c1f29; } .tools .sep { width: 8px; }

/* ── Панель «Положение дел» */
.dash .tabs-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.seg { display: inline-flex; background: var(--chip); border-radius: 10px; padding: 2px; }
.seg button { background: none; border: 0; color: var(--muted); padding: 5px 12px; border-radius: 8px; cursor: pointer; font-size: 13px; }
.seg button.on { background: var(--accent); color: #1c1f29; }
.gauges { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 10px 0 4px; }
.gauge { text-align: center; font-size: 12px; } .gauge svg { width: 100%; max-width: 110px; display: block; margin: 0 auto; }
.gauge small.up { color: #7cc48a; } .gauge small.down { color: #e0705a; }
.g-bg { fill: none; stroke: var(--chip); stroke-width: 8; stroke-linecap: round; } .g-danger { fill: none; stroke: #c4553a66; stroke-width: 8; }
.g-val { fill: none; stroke-width: 8; stroke-linecap: round; } .gauge text { fill: var(--ink); font-size: 15px; font-weight: 700; }
.gauge.edge span { color: #f0c24b; font-weight: 600; }
.inds { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 8px; }
.ind { background: var(--chip2); border-radius: 10px; padding: 8px 10px; display: grid; } .ind span { font-size: 12px; color: var(--muted); }
.ind b { font-size: 20px; } .ind small { font-size: 11px; color: var(--muted); } .ind .up { color: #7cc48a; } .ind .down { color: #e0705a; }
.spark { width: 100%; height: 28px; margin-top: 4px; }
.s-me { fill: none; stroke: var(--accent); stroke-width: 2; vector-effect: non-scaling-stroke; } .s-real { fill: none; stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; vector-effect: non-scaling-stroke; }
.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px; margin-top: 10px; } .chart { margin: 0; } .chart svg { width: 100%; height: auto; }
.c-title { fill: var(--ink); font-size: 12px; font-weight: 600; } .c-ax { fill: var(--muted); font-size: 10px; } .c-grid { stroke: var(--chip); stroke-width: 1; }
.c-band { fill: #c4553a22; } .c-me { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; } .c-real { fill: none; stroke: var(--muted); stroke-width: 1.5; stroke-dasharray: 4 4; }
.c-force { fill: none; stroke-width: 2; stroke-linejoin: round; }
.legend i { display: inline-block; width: 14px; height: 3px; vertical-align: middle; margin: 0 4px 0 10px; } .legend i:first-child { margin-left: 0; }
.l-me { background: var(--accent); } .l-real { background: repeating-linear-gradient(90deg, var(--muted) 0 4px, transparent 4px 7px); }
.galina svg.sk { margin-top: 4px; }
.feed .dep { padding: 8px 0; border-top: 1px solid var(--chip); } .feed .dep:first-of-type { border-top: 0; }
.feed .dep p { margin: 4px 0; } .feed .dep-h { margin-bottom: 2px; }
