:root, [data-theme="dark"] {
  color-scheme: dark;
  --bg: #121211;
  --surface-1: #1a1a19;
  --surface-2: #222220;
  --surface-3: #2c2c2a;
  --line: #34342f;
  --text-primary: #f0efec;
  --text-secondary: #c3c2b7;
  --text-muted: #8f8e86;
  --gold: #d4b062;
  --gold-dim: #8a7240;
  --on-gold: #1a1a19;
  --accent-bg: #3a3220;
  --hero-tint: #2a2618;
  --boss-tint: #2a1a1a;
  --pop-bg: #0e0e0d;
  --tabs-bg: var(--tabs-bg);
  --cell-num: rgba(240,239,236,.72);
  --series-1: #3987e5;
  --series-2: #d95926;
  --series-3: #199e70;
  --series-4: #c98500;
  --series-8: #e0577f;
  --good: #0ca30c;
  /* цвета данных для графиков и календарей (читаются из JS) */
  --c-muted: #8f8e86; --c-neutral: #5d5c57; --c-grid: #2c2c2a; --c-text2: #c3c2b7; --c-surface: #1a1a19;
  --c-s1: #3987e5; --c-s2: #d95926; --c-s3: #199e70; --c-s4: #c98500; --c-s8: #e0577f;
  --c-gold: #d4b062; --c-gold-dim: #8a7240; --c-good: #0ca30c; --c-emblem: #1f1d17;
  --c-seq0: #1f3a5c; --c-seq1: #1f4f88; --c-seq2: #2a68b4; --c-seq3: #3987e5; --c-seq4: #6da7ec;
  --c-div1: #d95926; --c-div2: #8f5a44; --c-div3: #5d5c57; --c-div4: #2f5f9a; --c-div5: #3987e5;
  --c-alc0: #5a3322; --c-alc1: #7f3f22; --c-alc2: #a74a24; --c-alc3: #d95926; --c-alc4: #f08a5c;
  --c-cell-good: #16503a; --c-cell-mid: #6b5a1e; --c-cell-bad1: #8f3a2c; --c-cell-bad2: #c2412b;
  --c-cell-over: #a74a24; --c-cell-sober: #16341f; --c-cell-done: #0a7a0a; --c-cell-early: #5a4a22;
  --radius: 14px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
[data-theme="light"] {
  color-scheme: light;
  --bg: #f6f4ef;
  --surface-1: #ffffff;
  --surface-2: #f2efe8;
  --surface-3: #e6e2d8;
  --line: #e3dfd5;
  --text-primary: #1d1c1a;
  --text-secondary: #4a4842;
  --text-muted: #77746b;
  --gold: #9a7426;
  --gold-dim: #d2bb86;
  --on-gold: #ffffff;
  --accent-bg: #f5ecd6;
  --hero-tint: #f4ead2;
  --boss-tint: #f8e4e1;
  --pop-bg: #ffffff;
  --tabs-bg: rgba(246,244,239,.94);
  --cell-num: rgba(29,28,26,.62);
  --series-1: #2b74d1;
  --series-2: #c4501f;
  --series-3: #12855d;
  --series-4: #b07400;
  --series-8: #b8323f;
  --good: #0b8f0b;
  --c-muted: #8a877e; --c-neutral: #cfcbc0; --c-grid: #e6e2d8; --c-text2: #4a4842; --c-surface: #ffffff;
  --c-s1: #2b74d1; --c-s2: #c4501f; --c-s3: #12855d; --c-s4: #b07400; --c-s8: #b8323f;
  --c-gold: #b08a35; --c-gold-dim: #d2bb86; --c-good: #0b8f0b; --c-emblem: #fbf6e9;
  --c-seq0: #dde9f8; --c-seq1: #b7d3f5; --c-seq2: #7fb0ec; --c-seq3: #3f86dc; --c-seq4: #1f5fb5;
  --c-div1: #e0703f; --c-div2: #f2c0a6; --c-div3: #dcd8ce; --c-div4: #a9c9f0; --c-div5: #3f86dc;
  --c-alc0: #fbe3d6; --c-alc1: #f6c3a6; --c-alc2: #ef9b6f; --c-alc3: #e0703f; --c-alc4: #b9481c;
  --c-cell-good: #b5e2c9; --c-cell-mid: #f1e2a8; --c-cell-bad1: #f5b9ae; --c-cell-bad2: #e8806e;
  --c-cell-over: #f0a37a; --c-cell-sober: #dcefe1; --c-cell-done: #86d38c; --c-cell-early: #eedcab;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text-primary); font-family: var(--sans);
  font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--gold); }

.app { max-width: 760px; margin: 0 auto; padding: 16px 14px 96px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; letter-spacing: .01em; margin: 0; }
h2 { font-size: 20px; margin: 22px 2px 10px; }
h3 { font-size: 16px; }
.muted { color: var(--text-muted); }
.secondary { color: var(--text-secondary); }
.small { font-size: 13px; }
.row { display: flex; gap: 10px; align-items: center; }
.spacer { flex: 1; }

.card { background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; }

/* ---------- hero ---------- */
.hero { display: grid; grid-template-columns: 84px 1fr; gap: 14px; align-items: center;
  background: radial-gradient(120% 140% at 0% 0%, var(--hero-tint) 0%, var(--surface-1) 55%); }
.emblem { width: 84px; height: 84px; position: relative; }
.emblem svg { width: 100%; height: 100%; }
.emblem .lvl { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--serif);
  font-size: 24px; font-weight: 700; color: var(--gold); padding-top: 4px; }
.hero .name { font-family: var(--serif); font-size: 21px; }
.hero .title { color: var(--gold); font-size: 14px; letter-spacing: .06em; text-transform: uppercase; }
.bar { height: 8px; background: var(--surface-3); border-radius: 99px; overflow: hidden; margin: 8px 0 4px; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold-dim), var(--gold)); border-radius: 99px;
  transition: width .6s ease; }
.hero .meta { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--text-secondary); }
.flame { color: var(--text-primary); font-weight: 600; }
.warn { color: var(--series-4); }

.quote { font-family: var(--serif); font-size: 16.5px; line-height: 1.5; color: var(--text-secondary); border-left: 2px solid var(--gold-dim);
  padding: 2px 0 2px 14px; margin: 4px 0 4px; }
.quote b { display: block; font-family: var(--sans); font-weight: 500; font-size: 12px; letter-spacing: .08em;
  text-transform: uppercase; color: var(--text-muted); margin-top: 6px; }

/* ---------- quests ---------- */
.quests { list-style: none; margin: 0; padding: 0; }
.quests li { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px solid var(--line); cursor: pointer; }
.quests li:last-child { border-bottom: 0; }
.quests li:hover { background: var(--surface-2); border-radius: 10px; }
.check { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--text-muted); display: grid; place-items: center;
  flex: none; font-size: 13px; }
.done .check { background: var(--gold); border-color: var(--gold); color: var(--on-gold); font-weight: 700; }
.done .qname { color: var(--text-muted); text-decoration: line-through; text-decoration-color: var(--line); }
.qtag { font-size: 11px; color: var(--gold); border: 1px solid var(--gold-dim); border-radius: 99px; padding: 1px 8px; margin-left: auto; white-space: nowrap; }
.perfect { text-align: center; color: var(--gold); font-family: var(--serif); padding-top: 8px; }

/* ---------- quick grid ---------- */
.grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
@media (max-width: 480px) { .grid { grid-template-columns: repeat(3, 1fr); } }
.tile { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px 6px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 13px; color: var(--text-secondary); transition: transform .08s, border-color .2s; }
.tile .ico { font-size: 22px; }
.tile:hover { border-color: var(--gold-dim); color: var(--text-primary); }
.tile:active { transform: scale(.96); }

/* ---------- entries ---------- */
.entries { list-style: none; padding: 0; margin: 0; }
.entries li { display: grid; grid-template-columns: 46px 1fr auto; gap: 10px; padding: 9px 2px; border-bottom: 1px solid var(--line); align-items: start; }
.entries li:last-child { border-bottom: 0; }
.entries .t { color: var(--text-muted); font-variant-numeric: tabular-nums; font-size: 13px; padding-top: 1px; }
.entries .xp { color: var(--gold); font-size: 13px; font-variant-numeric: tabular-nums; text-align: right; }
.del { background: none; border: 0; color: var(--text-muted); font-size: 12px; padding: 0 0 0 8px; cursor: pointer; }
.del.sure { color: var(--series-8); }
.daylabel { font-family: var(--serif); color: var(--text-secondary); margin: 18px 2px 6px; font-size: 15px; display: flex; justify-content: space-between; }

/* ---------- tabs ---------- */
.tabs { position: fixed; bottom: 0; left: 0; right: 0; background: var(--tabs-bg); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line); display: flex; justify-content: center; padding-bottom: env(safe-area-inset-bottom); z-index: 20; }
.tabs button { flex: 1; max-width: 150px; background: none; border: 0; padding: 9px 0 10px; color: var(--text-muted); font-size: 11px;
  display: flex; flex-direction: column; align-items: center; gap: 2px; }
.tabs button .ico { font-size: 20px; filter: grayscale(1) opacity(.7); }
.tabs button.on { color: var(--gold); }
.tabs button.on .ico { filter: none; }

/* ---------- sheet ---------- */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 40; display: flex; align-items: flex-end; justify-content: center;
  animation: fade .15s; }
.sheet { background: var(--surface-1); border: 1px solid var(--line); border-bottom: 0; width: 100%; max-width: 560px; border-radius: 20px 20px 0 0;
  padding: 18px 18px calc(18px + env(safe-area-inset-bottom)); max-height: 92vh; overflow: auto; animation: up .2s ease; }
@media (min-width: 700px) { .overlay { align-items: center; } .sheet { border-radius: 20px; border-bottom: 1px solid var(--line); } }
@keyframes up { from { transform: translateY(30px); opacity: 0 } }
@keyframes fade { from { opacity: 0 } }
.sheet h3 { font-size: 20px; margin-bottom: 4px; }
.field { margin: 14px 0; }
.field > label { display: block; font-size: 13px; color: var(--text-secondary); margin-bottom: 6px; }
.input { width: 100%; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; outline: none; }
.input:focus { border-color: var(--gold-dim); }
textarea.input { min-height: 74px; resize: vertical; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: var(--surface-2); border: 1px solid var(--line); border-radius: 99px; padding: 8px 13px; font-size: 14px; }
.chip.on { background: var(--accent-bg); border-color: var(--gold); color: var(--text-primary); }
.rating { display: flex; gap: 6px; }
.rating button { flex: 1; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 0; font-size: 18px; }
.rating button.on { background: var(--accent-bg); border-color: var(--gold); }
.range { display: flex; align-items: center; gap: 12px; }
.range input { flex: 1; accent-color: var(--gold); }
.range output { width: 26px; text-align: right; font-variant-numeric: tabular-nums; color: var(--gold); font-weight: 600; }
.btn { background: var(--gold); color: var(--on-gold); border: 0; border-radius: 12px; padding: 13px 18px; font-weight: 650; width: 100%; font-size: 16px; }
.btn.ghost { background: var(--surface-2); color: var(--text-primary); border: 1px solid var(--line); font-weight: 500; }
.btn:disabled { opacity: .5; }
.hint { font-size: 13px; color: var(--text-muted); }

/* ---------- toast ---------- */
.toasts { position: fixed; top: 12px; left: 0; right: 0; display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 60; pointer-events: none; }
.toast { background: var(--surface-2); border: 1px solid var(--gold-dim); border-radius: 14px; padding: 12px 16px; max-width: 92vw; width: 440px;
  box-shadow: 0 10px 30px rgba(0,0,0,.45); animation: drop .25s ease; pointer-events: auto; }
.toast div + div { margin-top: 4px; }
.toast .xp { color: var(--gold); font-weight: 650; }
.toast.levelup { border-color: var(--gold); background: linear-gradient(135deg, var(--accent-bg), var(--surface-2)); }
.toast.err { border-color: var(--series-8); }
@keyframes drop { from { transform: translateY(-16px); opacity: 0 } }

/* ---------- progress ---------- */
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 99px; padding: 3px; }
.seg button { background: none; border: 0; border-radius: 99px; padding: 6px 14px; color: var(--text-secondary); font-size: 13px; }
.seg button.on { background: var(--surface-3); color: var(--text-primary); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0; }
@media (max-width: 480px) { .stats { grid-template-columns: repeat(2, 1fr); } }
.stat { background: var(--surface-1); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.stat .v { font-size: 22px; font-weight: 650; font-variant-numeric: tabular-nums; }
.stat .l { font-size: 12px; color: var(--text-muted); }
.stat .d { font-size: 12px; color: var(--text-secondary); }
.chart-card h3 { margin-bottom: 2px; }
.chart-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--text-secondary); margin: 6px 0 4px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { display: inline-block; width: 14px; height: 3px; border-radius: 2px; }
.legend i.box { width: 10px; height: 10px; border-radius: 3px; }
.legend i.dot { width: 8px; height: 8px; border-radius: 50%; }
.chart { position: relative; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart text { fill: var(--text-muted); font-size: 11px; font-family: var(--sans); }
.tip { position: absolute; pointer-events: none; background: var(--pop-bg); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font-size: 12px;
  min-width: 130px; z-index: 5; box-shadow: 0 6px 18px rgba(0,0,0,.5); }
.tip .h { color: var(--text-muted); margin-bottom: 4px; }
.tip .r { display: flex; align-items: center; gap: 8px; }
.tip .r i { width: 12px; height: 3px; border-radius: 2px; display: inline-block; }
.tip .r strong { font-variant-numeric: tabular-nums; color: var(--text-primary); }
.tip .r span { color: var(--text-secondary); }
.tbl-toggle { background: none; border: 0; color: var(--text-muted); font-size: 12px; padding: 4px 0; text-decoration: underline dotted; }
table.data { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 6px; font-variant-numeric: tabular-nums; }
table.data th, table.data td { padding: 4px 6px; border-bottom: 1px solid var(--line); text-align: right; }
table.data th:first-child, table.data td:first-child { text-align: left; }
.tbl-wrap { max-height: 240px; overflow: auto; }
.heat { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 13px); grid-auto-columns: 13px; justify-content: start; gap: 3px; overflow-x: auto; padding-bottom: 4px; }
.heat i { width: 13px; height: 13px; border-radius: 3px; background: var(--surface-3); display: block; }

/* ---------- hero page ---------- */
.attrs { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (max-width: 480px) { .attrs { grid-template-columns: 1fr; } }
.attr { background: var(--surface-1); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.attr .top { display: flex; align-items: baseline; gap: 8px; }
.attr .top .n { font-weight: 600; }
.attr .top .lv { margin-left: auto; font-family: var(--serif); color: var(--gold); font-size: 18px; }
.attr .bar { height: 6px; }
.ladder { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.ladder li { font-size: 13px; padding: 5px 10px; border-radius: 99px; border: 1px solid var(--line); color: var(--text-muted); }
.ladder li.got { color: var(--text-secondary); border-color: var(--gold-dim); }
.ladder li.cur { color: var(--on-gold); background: var(--gold); border-color: var(--gold); font-weight: 600; }
.ach { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
@media (max-width: 480px) { .ach { grid-template-columns: repeat(2, 1fr); } }
.ach > div { background: var(--surface-1); border: 1px solid var(--line); border-radius: 12px; padding: 12px; text-align: center; }
.ach .i { font-size: 28px; }
.ach .n { font-weight: 600; font-size: 13px; margin-top: 2px; }
.ach .d { font-size: 11.5px; color: var(--text-muted); }
.ach > .locked .i { filter: grayscale(1) opacity(.35); }
.ach .locked .n { color: var(--text-muted); }
.ach .got { border-color: var(--gold-dim); }
.ach .bar { height: 4px; margin: 8px 0 0; }

/* ---------- settings ---------- */
.set-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
@media (max-width: 480px) { .set-grid { grid-template-columns: 1fr; } }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; }
.toggle input { width: 44px; height: 26px; accent-color: var(--gold); }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; background: var(--surface-2); padding: 2px 6px; border-radius: 6px; word-break: break-all; }
pre.mono { white-space: pre-wrap; padding: 10px; display: block; }

.login { max-width: 360px; margin: 18vh auto; text-align: center; }
.login .emblem { margin: 0 auto 12px; }
.empty { text-align: center; color: var(--text-muted); padding: 18px 0; }
.tabs[hidden] { display: none; }

/* ---------- бой ---------- */
.bstrip { display: flex; gap: 12px; align-items: center; cursor: pointer; padding: 12px 14px; }
.bstrip .bicon { font-size: 34px; width: 44px; text-align: center; }
.bstrip .row { gap: 12px; }
.bar.hp { height: 7px; margin: 6px 0; }
.bar.hp.big { height: 12px; }
.bar.enemy > i { background: linear-gradient(90deg, #9c3b3b, #e66767); }
.bar.me > i { background: linear-gradient(90deg, #0a7a0a, #2fbf2f); }
.bar.gold > i { background: linear-gradient(90deg, var(--gold-dim), var(--gold)); }
.boss { background: radial-gradient(120% 100% at 50% 0%, var(--boss-tint) 0%, var(--surface-1) 60%); }
.bossicon { font-size: 76px; text-align: center; line-height: 1.1; margin-top: 6px; filter: drop-shadow(0 6px 18px rgba(230,103,103,.25)); }
.chip.weak { border-color: #7a3b3b; color: var(--text-primary); }
.relics { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; margin-top: 12px; }
.relics > div { display: flex; gap: 10px; align-items: center; background: var(--surface-2); border: 1px solid var(--gold-dim); border-radius: 10px; padding: 8px 10px; }
.relics > div > span { font-size: 24px; }
.shop { list-style: none; padding: 0; margin: 0; }
.shop li { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.shop li:last-child { border-bottom: 0; }
.shop .si { font-size: 22px; width: 30px; text-align: center; }
.chip.buy { color: var(--gold); border-color: var(--gold-dim); white-space: nowrap; }
.chip.buy:disabled { opacity: .4; cursor: default; }
.chip.buy.sure { background: var(--gold); color: var(--on-gold); }
.rw-row { display: flex; gap: 6px; margin-bottom: 6px; }
.trophies { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.trophies > div { background: var(--surface-1); border: 1px solid var(--gold-dim); border-radius: 12px; padding: 10px 6px; text-align: center; }
.trophies span { font-size: 28px; }

/* ---------- страницы, дневник, календарь, навыки ---------- */
.pages2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 480px) { .pages2 { grid-template-columns: 1fr; } }
.pagecard { display: flex; gap: 12px; align-items: center; text-align: left; margin: 0; cursor: pointer; }
.pagecard .pi { font-size: 28px; }
.pagecard.filled { border-color: var(--gold-dim); }
.pagecard:hover { border-color: var(--gold); }
.evlist { list-style: none; margin: 0; padding: 0; }
.evlist li { display: flex; gap: 10px; padding: 5px 0; font-size: 14px; }
.evlist .t { color: var(--text-muted); min-width: 52px; font-variant-numeric: tabular-nums; font-size: 13px; }
.pg { padding: 4px 0; }
.pg-row { margin-top: 8px; white-space: pre-wrap; }
hr.sep { border: 0; border-top: 1px solid var(--line); margin: 12px 0; }
.mgrid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-top: 10px; }
.mgrid .mh { font-size: 11px; color: var(--text-muted); text-align: center; }
.mgrid .mc { aspect-ratio: 1; border-radius: 6px; display: flex; align-items: flex-start; justify-content: flex-end; padding: 3px 5px; }
.mgrid .mc span { font-size: 10px; color: var(--cell-num); }
.chip.sm { padding: 2px 8px; font-size: 12px; }
.wk { display: grid; grid-template-columns: 92px 1fr; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.wk:last-child { border-bottom: 0; }
.wd { color: var(--text-secondary); font-size: 13px; }
.wd.today { color: var(--gold); font-weight: 600; }
.skill { padding: 14px; }
.ladder2 { list-style: none; padding: 0; margin: 8px 0 0; }
.ladder2 li { display: flex; gap: 10px; align-items: center; padding: 6px 0; font-size: 14px; color: var(--text-muted); }
.ladder2 .dot { width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--line); display: grid; place-items: center; font-size: 11px; flex: none; }
.ladder2 .tt { flex: 1; }
.ladder2 li.done { color: var(--text-secondary); }
.ladder2 li.done .dot { background: var(--gold); border-color: var(--gold); color: var(--on-gold); font-weight: 700; }
.ladder2 li.next { color: var(--text-primary); }
.ladder2 li.next .dot { border-color: var(--gold); color: var(--gold); }
details summary { cursor: pointer; color: var(--text-secondary); }
.quests li.sure .qtag { background: var(--gold); color: var(--on-gold); }
.del.sure, .chip.sure { color: var(--series-8); }

/* ---------- итоги дня, календари, напоминания ---------- */
.daycard { padding: 6px 14px; }
.dc-row { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.dc-row:last-child { border-bottom: 0; }
.dc-i { font-size: 22px; width: 28px; text-align: center; }
.dc-main { flex: 1; min-width: 0; }
.dc-main .row { gap: 8px; flex-wrap: wrap; }
.dc-main .chips { margin-top: 6px; }
.bar.water > i, .bar.steps > i { background: linear-gradient(90deg, #1f4f88, #3987e5); }
.mealline { display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: 13px; color: var(--text-secondary); margin-top: 4px; }
.cgrid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-top: 10px; }
.cgrid .mh { font-size: 11px; color: var(--text-muted); text-align: center; }
.cc { aspect-ratio: 1; border-radius: 8px; border: 1px solid transparent; background: var(--surface-2); display: flex; flex-direction: column;
  justify-content: space-between; align-items: stretch; padding: 3px 5px; min-width: 0; }
.cc .n { font-size: 10.5px; color: var(--cell-num); text-align: right; }
.cc .v { font-size: 11.5px; font-weight: 600; color: var(--text-primary); text-align: left; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; }
.cc.today { border-color: var(--gold); }
.cc.sel { outline: 2px solid var(--text-primary); }
.cc:disabled { opacity: .35; cursor: default; }
.csel { margin-top: 10px; padding: 10px 12px; background: var(--surface-2); border-radius: 10px; font-size: 14px; }
.rem-row { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.rem-row input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--gold); }
.rem-edit { background: var(--surface-2); border-radius: 12px; padding: 12px; margin: 8px 0; }

/* ---------- КБЖУ и голодание ---------- */
.macros4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.macros4 label span { display: block; font-size: 11.5px; color: var(--text-muted); margin-bottom: 3px; }
.macros4 input[readonly] { opacity: .75; }
.foodbox { display: flex; flex-direction: column; gap: 6px; }
.fb-search { position: relative; }
.fb-res { position: absolute; left: 0; right: 0; top: 100%; z-index: 5; background: var(--pop-bg); border: 1px solid var(--line); border-radius: 10px; margin-top: 4px; max-height: 280px; overflow: auto; box-shadow: 0 10px 24px rgba(0,0,0,.5); }
.fb-r { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; width: 100%; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--line); padding: 8px 10px; }
.fb-r:hover { background: var(--surface-2); }
.fb-r.more { color: var(--gold); }
.fb-it { display: grid; grid-template-columns: 1fr 74px 14px 46px 22px; gap: 6px; align-items: center; font-size: 14px; }
.fb-it .g { padding: 6px 8px; text-align: right; }
.fb-it .u { color: var(--text-muted); font-size: 12px; }
.fb-it .kc { text-align: right; color: var(--gold); font-variant-numeric: tabular-nums; font-size: 13px; }
.fb-more summary { color: var(--text-secondary); cursor: pointer; margin-top: 4px; }
.fb-more textarea { min-height: 54px; margin-top: 6px; }
.macros-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; }
.mb .row { gap: 4px; }
.bar.kb > i { background: linear-gradient(90deg, #0a7a0a, #2fbf2f); }
.bar.over > i { background: linear-gradient(90deg, #a74a24, #d95926); }
.mb .bar { height: 5px; margin: 3px 0 2px; }
.fastcard { cursor: pointer; }
.fastcard.active { border-color: var(--gold-dim); background: radial-gradient(120% 140% at 0% 0%, var(--hero-tint) 0%, var(--surface-1) 60%); }
.mini-ring { position: relative; width: 64px; height: 64px; }
.mini-ring span { position: absolute; inset: 0; display: grid; place-items: center; font-size: 12px; color: var(--gold); font-weight: 600; }
.fast-el { font-size: 34px; font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.fast-el.big { font-size: 24px; }
.fast-hero { position: relative; display: grid; place-items: center; margin-top: 8px; }
.fast-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.phases { list-style: none; padding: 0; margin: 8px 0; }
.phases li { display: flex; gap: 10px; padding: 8px 6px; border-radius: 10px; color: var(--text-muted); }
.phases li.past { color: var(--text-secondary); }
.phases li.cur { background: var(--hero-tint); color: var(--text-primary); border: 1px solid var(--gold-dim); }
.ph-i { font-size: 20px; width: 26px; text-align: center; }
.fast-center [data-left], .fast-center .secondary { max-width: 160px; line-height: 1.3; }

/* ---------- темы ---------- */
html { transition: background .2s; }
.theme-seg { display: inline-flex; }
[data-theme="light"] .tile:hover, [data-theme="light"] .pagecard:hover { border-color: var(--gold); }
[data-theme="light"] .card, [data-theme="light"] .stat, [data-theme="light"] .attr, [data-theme="light"] .tile { box-shadow: 0 1px 2px rgba(60,50,30,.05); }
[data-theme="light"] .bossicon { filter: drop-shadow(0 6px 18px rgba(184,50,63,.18)); }
[data-theme="light"] .toast { box-shadow: 0 10px 30px rgba(60,50,30,.18); }
.limgrid { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 6px 8px; align-items: center; margin-top: 8px; }
.lim { font-size: 11px; }
.lim.over { color: var(--series-2); }
.lim.under { color: var(--series-1); }
.lim.ok { color: var(--good); }
.bar.under > i { background: linear-gradient(90deg, var(--c-seq2), var(--c-seq3)); }
.minmark { position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--text-primary); opacity: .55; border-radius: 1px; }

/* ---------- сводка дня ---------- */
:root, [data-theme="dark"] {
  --t-teal-bg: #15302c; --t-teal-fill: #1f4d46; --t-teal-ink: #a3eadf; --t-teal-ic: #0f2522;
  --t-violet-bg: #231c35; --t-violet-fill: #3b2d5e; --t-violet-ink: #d2c0fa; --t-violet-ic: #1a1428;
  --t-blue-bg: #16243a; --t-blue-fill: #22426e; --t-blue-ink: #b0cff8; --t-blue-ic: #101b2c;
  --t-orange-bg: #33201a; --t-orange-fill: #5c3624; --t-orange-ink: #f7bfa1; --t-orange-ic: #26170f;
  --t-green-bg: #182c19; --t-green-fill: #2a4f2b; --t-green-ink: #b9e6ab; --t-green-ic: #112012;
  --t-gold-bg: #2d2716; --t-gold-fill: #55461e; --t-gold-ink: #efd795; --t-gold-ic: #211c0f;
  --t-rose-bg: #33181e; --t-rose-fill: #5c2a37; --t-rose-ink: #f5b8c6; --t-rose-ic: #261116;
  --ring-track: #2c2c2a; --ring-done: #d4b062;
  /* кольца дня: категориальные, проверены валидатором (соседние пары, CVD) */
  --rg-orange: #d95926; --rg-violet: #9085e9; --rg-green: #0ca30c; --rg-rose: #d55181; --rg-gold: #c98500; --rg-blue: #3987e5;
  --rg-track: #2a2a28;
}
[data-theme="light"] {
  --t-teal-bg: #dcf5f1; --t-teal-fill: #ade9df; --t-teal-ink: #0f4f47; --t-teal-ic: #f2fcfa;
  --t-violet-bg: #eee7fc; --t-violet-fill: #d5c5f7; --t-violet-ink: #44307a; --t-violet-ic: #faf7ff;
  --t-blue-bg: #e2ecfc; --t-blue-fill: #bfd6f8; --t-blue-ink: #1c4d8c; --t-blue-ic: #f6f9ff;
  --t-orange-bg: #fde9df; --t-orange-fill: #f8cbb3; --t-orange-ink: #7a3412; --t-orange-ic: #fff8f4;
  --t-green-bg: #e3f4de; --t-green-fill: #c1e6b7; --t-green-ink: #21521a; --t-green-ic: #f7fdf5;
  --t-gold-bg: #f7eed6; --t-gold-fill: #ecd69f; --t-gold-ink: #5c4710; --t-gold-ic: #fffbf1;
  --t-rose-bg: #fce3e8; --t-rose-fill: #f6c2cd; --t-rose-ink: #7a2338; --t-rose-ic: #fff7f9;
  --ring-track: #e3dfd5; --ring-done: #b08a35;
  --rg-orange: #eb6834; --rg-violet: #6250d6; --rg-green: #0ca30c; --rg-rose: #e87ba4; --rg-gold: #eda100; --rg-blue: #2a78d6;
  --rg-track: #ebe7de;
}
.dash { margin: 4px 0 14px; }
.dscroll { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; gap: 0; border-radius: var(--radius); }
.dscroll::-webkit-scrollbar { display: none; }
.dpage { flex: 0 0 100%; scroll-snap-align: start; padding: 2px; }
.dpage.p1 { display: grid; grid-template-columns: minmax(0, 1.12fr) minmax(0, 1fr); gap: 10px; align-items: center; }
.dpage.pg { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-content: start; }
.dcol { display: flex; flex-direction: column; gap: 10px; }
.ring2 { position: relative; cursor: pointer; }
.ring2 svg { width: 100%; height: auto; display: block; overflow: visible; }
.rseg { stroke: var(--ring-track); transition: stroke .3s; }
.rseg.done { stroke: var(--ring-done); animation: rgrow .6s ease both; animation-delay: var(--d); }
@keyframes rgrow { from { stroke-dasharray: 0 400; } to { stroke-dasharray: 400 0; } }
.ricon { font-size: 15px; opacity: .45; filter: grayscale(1); }
.ricon.done { opacity: 1; filter: none; }
.rcap { font-size: 13px; fill: var(--text-secondary); font-family: var(--serif); letter-spacing: .04em; }
.rpct { font-size: 40px; font-weight: 700; fill: var(--text-primary); font-variant-numeric: tabular-nums; }
.rsub { font-size: 12.5px; fill: var(--text-muted); }
.rbadge { position: absolute; left: 6%; bottom: 8%; width: 30px; height: 30px; border-radius: 50%; background: var(--accent-bg); border: 1px solid var(--gold-dim);
  display: grid; place-items: center; font-size: 15px; }
.rbadge.star { left: auto; right: 6%; }
.tile2 { position: relative; overflow: hidden; display: flex; align-items: center; gap: 10px; text-align: left; border: 0; border-radius: 22px; padding: 10px 12px 10px 10px;
  min-height: 74px; cursor: pointer; transition: transform .08s; }
.tile2:active { transform: scale(.98); }
.tile2 .t2-fill { position: absolute; inset: 0 auto 0 0; width: var(--p); transition: width .6s ease; }
.tile2 > *:not(.t2-fill) { position: relative; }
.t2-ic { width: 40px; height: 40px; border-radius: 14px; display: grid; place-items: center; font-size: 20px; flex: none; }
.t2-tx { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.t2-n { font-size: 12.5px; font-weight: 600; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t2-v { font-size: 21px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.t2-s { font-size: 11.5px; opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dpage.pg .tile2 { min-height: 84px; }
.dpage.pg .t2-v { font-size: 19px; }
.tile2.warn2 .t2-s { font-weight: 700; }
.hue-teal { background: var(--t-teal-bg); color: var(--t-teal-ink); } .hue-teal .t2-fill { background: var(--t-teal-fill); } .hue-teal .t2-ic { background: var(--t-teal-ic); }
.hue-violet { background: var(--t-violet-bg); color: var(--t-violet-ink); } .hue-violet .t2-fill { background: var(--t-violet-fill); } .hue-violet .t2-ic { background: var(--t-violet-ic); }
.hue-blue { background: var(--t-blue-bg); color: var(--t-blue-ink); } .hue-blue .t2-fill { background: var(--t-blue-fill); } .hue-blue .t2-ic { background: var(--t-blue-ic); }
.hue-orange { background: var(--t-orange-bg); color: var(--t-orange-ink); } .hue-orange .t2-fill { background: var(--t-orange-fill); } .hue-orange .t2-ic { background: var(--t-orange-ic); }
.hue-green { background: var(--t-green-bg); color: var(--t-green-ink); } .hue-green .t2-fill { background: var(--t-green-fill); } .hue-green .t2-ic { background: var(--t-green-ic); }
.hue-gold { background: var(--t-gold-bg); color: var(--t-gold-ink); } .hue-gold .t2-fill { background: var(--t-gold-fill); } .hue-gold .t2-ic { background: var(--t-gold-ic); }
.hue-rose { background: var(--t-rose-bg); color: var(--t-rose-ink); } .hue-rose .t2-fill { background: var(--t-rose-fill); } .hue-rose .t2-ic { background: var(--t-rose-ic); }
.ddots { display: flex; justify-content: center; gap: 8px; margin: 10px auto 0; padding: 6px 10px; background: var(--surface-2); border-radius: 99px; width: max-content; }
.ddots i { width: 8px; height: 8px; border-radius: 50%; background: var(--text-muted); opacity: .45; cursor: pointer; }
.ddots i.on { opacity: 1; background: var(--text-primary); }
.dbtns { display: grid; grid-template-columns: 1fr 1fr 48px; gap: 8px; margin-top: 12px; }
.dbtn { border: 0; border-radius: 99px; padding: 12px 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: var(--accent-bg); color: var(--text-primary); font-weight: 600; font-size: 15px; }
.dbtn.icon { padding: 0; background: var(--surface-2); }
.delist { list-style: none; padding: 0; margin: 10px 0 0; }
.delist li { display: flex; align-items: center; gap: 6px; padding: 7px 0; border-bottom: 1px solid var(--line); }
@media (max-width: 380px) { .t2-v { font-size: 18px; } .t2-ic { width: 34px; height: 34px; font-size: 17px; } .rpct { font-size: 34px; } }

/* ---------- кольцо голодания и «＋» ---------- */
.dpage.pfast { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 18px 2px 2px; }
.fwrap { position: relative; width: min(260px, 72vw); }
.fring { width: 100%; height: auto; display: block; overflow: visible; }
.ftrack { stroke: var(--ring-track); }
.fmark circle { fill: var(--surface-2); stroke: var(--ring-track); stroke-width: 2; }
.fmark text { font-size: 15px; opacity: .5; filter: grayscale(1); }
.fmark.on circle { fill: var(--accent-bg); stroke: var(--gold); }
.fmark.on text { opacity: 1; filter: none; }
.fcenter { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.fst { font-size: 13px; color: var(--text-secondary); font-family: var(--serif); letter-spacing: .03em; }
.fel { font-size: 38px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: .01em; }
.fsub { font-size: 13px; color: var(--text-muted); }
.fph { font-size: 12.5px; color: var(--text-secondary); margin-top: 4px; }
.fmeta { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: 100%; }
.fm { display: flex; flex-direction: column; align-items: flex-start; position: relative; background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; padding: 8px 12px; text-align: left; }
.fm span { font-size: 11.5px; color: var(--text-muted); }
.fm b { font-size: 15px; }
.fm i { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font-style: normal; font-size: 13px; opacity: .6; }
.fbtn { border-radius: 99px; }
.fpresets { justify-content: center; }
.qprev { margin-top: 8px; }
.qlist { list-style: none; padding: 0; margin: 0 0 6px; }
.qlist li { display: grid; grid-template-columns: 1fr auto 50px; gap: 8px; padding: 4px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.qlist b { text-align: right; color: var(--gold); font-variant-numeric: tabular-nums; }

[data-qnote] { white-space: nowrap; }

/* ---------- виджеты главной и функции ---------- */
.edit-today { text-align: center; margin: 22px 0 6px; }
.edit-head { display: flex; align-items: center; gap: 10px; margin: 10px 0 6px; }
.dl { list-style: none; padding: 0; margin: 10px 0 0; display: flex; flex-direction: column; gap: 8px; }
.dl-item { display: flex; align-items: center; gap: 10px; background: var(--surface-1); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px;
  transition: box-shadow .15s, transform .15s; user-select: none; -webkit-user-select: none; }
.dl-item.dragging { box-shadow: 0 10px 28px rgba(0,0,0,.35); transform: scale(1.02); border-color: var(--gold); z-index: 2; position: relative; }
.dl.is-dragging .dl-item:not(.dragging) { opacity: .8; }
.dl-item.hid .dl-n, .dl-item.hid .dl-i { opacity: .4; text-decoration: line-through; }
.dl-item.off { opacity: .55; }
.dl-item.top3 { border-color: var(--gold-dim); }
.dl-h { font-size: 22px; line-height: 1; padding: 6px 8px; margin: -6px 0 -6px -6px; cursor: grab; touch-action: none; color: var(--text-muted); }
.dl-h:active { cursor: grabbing; }
.dl-i { font-size: 20px; }
.dl-n { flex: 1; min-width: 0; }
.dl-eye { background: var(--surface-2); border: 1px solid var(--line); border-radius: 99px; width: 38px; height: 34px; font-size: 15px; }
.feats { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; margin-top: 10px; }
@media (max-width: 520px) { .feats { grid-template-columns: 1fr; } }
.feat { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.feat .fi { font-size: 20px; width: 26px; text-align: center; }
.feat .ft { flex: 1; display: flex; flex-direction: column; line-height: 1.25; }
.feat input { width: 22px; height: 22px; accent-color: var(--gold); }
.tabs button[hidden] { display: none; }

/* ---------- кольца дня ---------- */
.rg-track { stroke: var(--rg-track); }
.rg-fill { opacity: .5; }
.rg-fill.done { opacity: 1; }
.rg-fill.done { animation: rgpop .5s ease both; animation-delay: var(--d); }
@keyframes rgpop { from { opacity: .4; } to { opacity: 1; } }
.rg-ic { opacity: .5; filter: grayscale(.8); pointer-events: none; }
.rg-ic.done { opacity: 1; filter: none; }
.rg-num { font-size: 34px; font-weight: 700; fill: var(--text-primary); font-variant-numeric: tabular-nums; }
.rg-num.big { font-size: 52px; }
.rg-of { font-size: 12px; fill: var(--text-muted); }
.rg-of.big { font-size: 14px; }
.rg-star { font-size: 13px; fill: var(--gold); }
.rcard { padding: 14px 14px 10px; }
.rc-top { display: flex; gap: 14px; align-items: center; }
.rc-ring { flex: 0 0 132px; padding: 0; border: 0; background: none; cursor: pointer; border-radius: 50%; }
.rc-ring svg, .rday svg, .dv-ring svg, .cring svg { display: block; width: 100%; height: auto; overflow: visible; }
.rc-side { flex: 1; min-width: 0; }
.rc-kick { font-family: var(--serif); font-size: 12.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--text-secondary); }
.rc-n { font-size: 20px; font-weight: 700; margin: 2px 0 2px; }
.rc-msg { font-size: 13px; color: var(--text-secondary); line-height: 1.35; }
.rc-legend { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 9px; }
.rchip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px 3px 6px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface-2); color: var(--text-secondary); font: inherit; font-size: 12px; cursor: pointer; }
.rchip .rc-dot { width: 8px; height: 8px; border-radius: 50%; box-shadow: inset 0 0 0 2px var(--rc); }
.rchip.done { color: var(--text-primary); }
.rchip.done .rc-dot { background: var(--rc); }
.rchip .rc-cn { display: none; }
@media (min-width: 420px) { .rchip .rc-cn { display: inline; } }
.rweek { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.rday { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 4px 0 3px; border: 0; background: none; color: var(--text-muted);
  font: inherit; cursor: pointer; border-radius: 10px; }
.rday svg { width: 36px; }
.rday .rd-w { font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; }
.rday .rd-d { font-size: 11.5px; font-variant-numeric: tabular-nums; }
.rday.today { background: var(--surface-2); color: var(--text-primary); }
.rday.today .rd-d { font-weight: 700; }
.rday:focus-visible, .rc-ring:focus-visible, .rchip:focus-visible, .dgoal:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.daysheet { max-width: 560px; }
.dv-ring { width: 220px; max-width: 70%; margin: 6px auto 0; }
.dv-msg { text-align: center; color: var(--text-secondary); margin: 8px 0 4px; font-size: 14px; }
.dv-h { font-family: var(--serif); font-size: 12.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-secondary); margin: 16px 0 8px; font-weight: 600; }
.dv-goals { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.dgoal { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; text-align: left; padding: 11px 12px 10px; border-radius: 14px;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--text-primary); font: inherit; cursor: pointer; position: relative; }
.dgoal:disabled { cursor: default; color: var(--text-primary); }
.dgoal.done { border-color: var(--rc); }
.dg-top { display: flex; width: 100%; align-items: center; justify-content: space-between; margin-bottom: 2px; }
.dg-ic { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-size: 16px; box-shadow: inset 0 0 0 3px var(--rc); }
.dgoal.done .dg-ic { background: var(--rc); }
.dg-ok { width: 22px; height: 22px; border-radius: 50%; background: var(--rc); color: #fff; display: grid; place-items: center; font-size: 13px; font-weight: 700; }
.dg-pct { font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.dgoal b { font-size: 14px; }
.dg-goal { font-size: 12px; color: var(--text-secondary); line-height: 1.3; }
.dg-bar { width: 100%; height: 4px; border-radius: 2px; background: var(--rg-track); margin-top: 5px; overflow: hidden; }
.dg-bar i { display: block; height: 100%; background: var(--rc); border-radius: 2px; }
.dg-val { font-size: 12px; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.tl { list-style: none; margin: 0; padding: 0; }
.tl li { display: grid; grid-template-columns: 42px 12px 1fr auto; gap: 8px; align-items: start; padding: 7px 0; position: relative; }
.tl li + li::before { content: ""; position: absolute; left: 55px; top: -9px; height: 16px; width: 2px; background: var(--line); }
.tl time { font-size: 12.5px; color: var(--text-muted); font-variant-numeric: tabular-nums; padding-top: 1px; }
.tl .tl-dot { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--gold); margin-top: 4px; }
.tl b { font-size: 13.5px; font-weight: 600; }
.tl-xp { font-size: 12px; color: var(--gold); font-variant-numeric: tabular-nums; }
.cc.ringcell { background: none; padding: 2px; }
.cc .cring { display: block; width: 78%; margin: -2px auto 0; }
.feat .fi { border-radius: 50%; }
.feat .rset { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-secondary); margin-top: 4px; }
.feat .rset input.input { width: 70px; height: auto; padding: 4px 8px; accent-color: auto; }

/* =====================================================================
   Комикс-оформление: «День» (светлая) и «Ночной поход» (тёмная).
   Жирные чернильные контуры, тени-плашки, растровые точки, реплики в пузырях.
   Данные-цвета (графики, кольца) проверены валидатором отдельно.
   ===================================================================== */
:root, [data-theme="dark"] {
  --ink: #0c0918;
  --bg: #1b1530; --surface-1: #2a2147; --surface-2: #342a57; --surface-3: #43386b; --line: #4d4278; --line-2: #0c0918;
  --text-primary: #f7f3ff; --text-secondary: #d6cdf2; --text-muted: #b0a6d4;
  --gold: #ffd23f; --gold-dim: #a8851a; --on-gold: #1d1a2e; --crimson: #d93a22; --crimson-ink: #ff9475; --on-crimson: #ffffff;
  --hl: rgba(255, 210, 63, .28); --purple: #5d41b8; --purple-2: #6f52d0;
  --accent-bg: #3d2f68; --hero-tint: #2f2552; --boss-tint: #3a2246; --pop-bg: #221a3d; --tabs-bg: #241c40;
  --cell-num: rgba(247,243,255,.8);
  --c-surface: #2a2147; --c-grid: #43386b; --c-emblem: #2f2552; --c-muted: #b0a6d4; --c-text2: #d6cdf2;
  --ring-track: #43386b; --rg-track: #43386b; --mana: #79adff; --mana-fill: #3b7bff; --hp-fill: #ef4b35; --xp-fill: #ffcc33; --enemy-fill: #b24bd1;
  --serif: "Balsamiq Sans", "Nunito", system-ui, sans-serif;
  --body: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Rubik", "Nunito", system-ui, sans-serif;
  --dm: "Pangolin", "Nunito", system-ui, sans-serif;
  --dots: radial-gradient(circle, rgba(255,255,255,.05) 1.3px, transparent 1.7px) 0 0 / 14px 14px;
  --shadow: 4px 4px 0 var(--ink); --shadow-s: 2px 2px 0 var(--ink);
}
[data-theme="light"] {
  --ink: #1d1a2e;
  --bg: #fff1cc; --surface-1: #ffffff; --surface-2: #fff8e6; --surface-3: #f1e6c8; --line: #e7dbbb; --line-2: #1d1a2e;
  --text-primary: #1d1a2e; --text-secondary: #463f5c; --text-muted: #625b78;
  --gold: #8f5c00; --gold-dim: #e0b54a; --on-gold: #1d1a2e; --crimson: #d93a22; --crimson-ink: #b8291a; --on-crimson: #ffffff;
  --hl: rgba(255, 204, 51, .55); --purple: #5b3fa8; --purple-2: #7a5bd6;
  --accent-bg: #f3ecff; --hero-tint: #efe8ff; --boss-tint: #fbe6f3; --pop-bg: #ffffff; --tabs-bg: #ffffff;
  --cell-num: rgba(29,26,46,.7);
  --c-surface: #ffffff; --c-grid: #efe6cc; --c-emblem: #ffffff; --c-neutral: #cfc4a5; --c-muted: #625b78; --c-text2: #463f5c;
  --ring-track: #efe6cc; --rg-track: #efe6cc; --mana: #1f5bc4; --mana-fill: #3b7bff; --hp-fill: #ef4b35; --xp-fill: #ffcc33; --enemy-fill: #a23fb6;
  --dots: radial-gradient(circle, rgba(217,58,34,.10) 1.3px, transparent 1.7px) 0 0 / 14px 14px;
}
html, body { font-family: var(--body); font-size: 16px; }
body { background: var(--dots), var(--bg); background-attachment: fixed; min-height: 100vh; }
h1, h2, h3 { font-family: var(--serif); font-weight: 700; }
h2 { font-family: var(--display); font-weight: 900; font-size: 22px; color: var(--text-primary); letter-spacing: .005em; }
.app > h2, .app > .row > h2 { display: inline-block; background: linear-gradient(transparent 58%, var(--hl) 58%); padding: 0 4px; margin-left: -4px; }
h3 { color: var(--text-primary); font-size: 18px; }
.card { background: var(--surface-1); border: 2.5px solid var(--ink); border-radius: 18px; box-shadow: var(--shadow); }
.card .card { box-shadow: var(--shadow-s); }
.btn { background: var(--crimson); color: var(--on-crimson); border: 2.5px solid var(--ink); border-radius: 14px; box-shadow: var(--shadow-s);
  font-family: var(--display); font-weight: 700; font-size: 17px; letter-spacing: .01em; min-height: 48px; }
.btn:active { transform: translate(2px, 2px); box-shadow: none; }
.btn.ghost { background: var(--surface-2); color: var(--text-primary); }
.btn:disabled { opacity: .5; }
.chip { font-family: var(--body); font-weight: 700; min-height: 44px; border: 2px solid var(--ink); background: var(--surface-1); color: var(--text-primary);
  box-shadow: var(--shadow-s); border-radius: 99px; }
.chip:active { transform: translate(1px, 1px); box-shadow: none; }
.chip.sm { min-height: 36px; font-size: 14px; }
.chip.on, .chip.buy { background: var(--gold-dim); color: var(--ink); }
[data-theme="dark"] .chip.on, [data-theme="dark"] .chip.buy { background: var(--gold); }
.input { background: var(--surface-2); border: 2px solid var(--ink); border-radius: 12px; font-family: var(--body); color: var(--text-primary); }
.input:focus { outline: 3px solid var(--gold-dim); outline-offset: 1px; }
.hint, .small { font-size: 14px; }
.muted { color: var(--text-muted); }
.tabs { background: var(--tabs-bg); border-top: 2.5px solid var(--ink); box-shadow: none; backdrop-filter: none; }
.tabs button { font-family: var(--serif); font-size: 12.5px; color: var(--text-muted); }
.tabs button .ico { filter: none; opacity: .75; display: inline-grid; place-items: center; width: 38px; height: 30px; border-radius: 99px; transition: background .2s; }
.tabs button.on { color: var(--text-primary); }
.tabs button.on .ico { opacity: 1; background: var(--gold-dim); box-shadow: inset 0 0 0 2px var(--ink); }
[data-theme="dark"] .tabs button.on .ico { background: var(--purple); }
.sheet { background: var(--surface-1); border: 2.5px solid var(--ink); border-bottom: 0; border-radius: 22px 22px 0 0; }
.sheet h3 { font-family: var(--display); font-weight: 900; }
.overlay { background: rgba(12, 9, 24, .55); }
/* реплики — как пузыри в комиксе */
.toast { font-family: var(--dm); font-size: 16px; background: var(--surface-1); color: var(--text-primary); border: 2.5px solid var(--ink);
  border-radius: 20px; box-shadow: var(--shadow); }
.toast::after { content: ""; position: absolute; left: 28px; bottom: -13px; width: 20px; height: 20px; background: var(--surface-1);
  border-right: 2.5px solid var(--ink); border-bottom: 2.5px solid var(--ink); transform: skewX(-25deg) rotate(45deg); border-radius: 0 0 4px 0; }
.toast .roll { color: var(--crimson-ink); }
.toast .warnl { color: var(--crimson-ink); }
.toast.magic { border-color: var(--ink); background: linear-gradient(var(--surface-1), var(--surface-1)) padding-box; box-shadow: 4px 4px 0 var(--purple); }
.quote { font-family: var(--dm); font-size: 17px; border-left: 4px solid var(--crimson); }
/* полосы как в RPG: толстые, с контуром */
.bar { height: 14px; background: var(--surface-3); border: 2px solid var(--ink); border-radius: 99px; box-shadow: none; overflow: hidden; }
.bar > i { background: var(--xp-fill); border-radius: 0; }
.bar.me > i { background: var(--hp-fill); }
.bar.mana > i { background: var(--mana-fill); }
.bar.enemy > i { background: var(--enemy-fill); }
.bar.gold > i { background: var(--xp-fill); }
/* шапка героя в духе RPG-трекеров: фиолетовая плашка */
.card.hero { background: linear-gradient(135deg, var(--purple), var(--purple-2)); color: #fff; }
.card.hero .name { font-family: var(--display); font-weight: 900; font-size: 24px; color: #fff; text-transform: none; }
.card.hero .title { font-family: var(--serif); color: #ffe49a; font-size: 15px; text-transform: none; letter-spacing: 0; }
.card.hero .meta, .card.hero .vn, .card.hero .small { color: #efe9ff; }
.card.hero .strikes, .card.hero .eff { background: rgba(255,255,255,.14); border-color: rgba(255,255,255,.55); color: #fff; }
.card.hero .chip { color: var(--ink); }
.emblem .lvl { font-family: var(--display); font-weight: 900; }
.logo { font-family: var(--display); font-weight: 900; font-size: 38px; color: var(--crimson-ink); letter-spacing: .01em; margin: 10px 0 4px; }
.login form { display: grid; gap: 10px; margin-top: 14px; }
.login .d20.big { width: 110px; height: 110px; margin: 0 auto; display: block; }

/* ----- характеристики героя ----- */
.vitals { margin-top: 10px; display: grid; gap: 2px; }
.vit { display: grid; grid-template-columns: 22px 1fr auto; gap: 8px; align-items: center; }
.vit .bar { margin: 3px 0; height: 9px; }
.vitals.big .vit .bar { height: 12px; }
.vit .vl { font-size: 14px; text-align: center; }
.vit .vn { font-size: 13px; color: var(--text-secondary); min-width: 54px; text-align: right; font-variant-numeric: tabular-nums lining-nums; }
.vrow { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 6px; }
.strikes { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; color: var(--text-secondary); padding: 3px 9px 3px 8px;
  border: 1px solid var(--line); border-radius: 99px; background: var(--surface-2); }
.strikes .sl { margin-right: 2px; font-family: var(--serif); }
.strikes i { width: 11px; height: 11px; border-radius: 3px; border: 1.5px solid var(--line-2); transform: rotate(45deg); margin: 0 2px; }
.strikes i.on { background: var(--crimson); border-color: var(--crimson); }
.strikes.cursed { border-color: var(--crimson); color: var(--crimson-ink); }
.eff { font-size: 12.5px; padding: 3px 9px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); color: var(--text-secondary); }
.eff.insp { border-color: var(--gold); color: var(--gold); }

/* ----- книга заклинаний ----- */
.spells { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 10px 0 8px; }
.spell { display: grid; grid-template-columns: 28px minmax(0, 1fr); align-items: center; column-gap: 8px; row-gap: 1px; text-align: left;
  padding: 9px 10px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--surface-2); color: var(--text-primary); }
.spell .sp-i { font-size: 20px; grid-row: span 3; text-align: center; align-self: start; padding-top: 2px; }
.spell .sp-n { font-family: var(--serif); font-size: 15px; line-height: 1.12; overflow-wrap: anywhere; hyphens: auto; }
.spell .sp-c { font-size: 12.5px; color: var(--mana); }
.spell .sp-why { font-size: 11.5px; color: var(--text-muted); line-height: 1.2; }
.spell.off { opacity: .62; }
.spell.locked { border-style: dashed; }
.spell:not(.off):hover { border-color: var(--mana); box-shadow: 0 0 0 2px color-mix(in srgb, var(--mana) 25%, transparent); }
.classcall { display: grid; grid-template-columns: 84px 1fr; gap: 14px; align-items: center; }
.classcall .d20 { width: 80px; height: 80px; }
.tlist { display: grid; gap: 8px; margin-top: 10px; }
.tgt { display: flex; gap: 10px; align-items: center; text-align: left; color: var(--text-primary); margin: 0; }
.tgt .ti { font-size: 26px; }
.classes { display: grid; gap: 10px; margin-top: 10px; }
@media (min-width: 640px) { .classes { grid-template-columns: 1fr 1fr; } .sheet.wide { max-width: 900px; } }
.cls { margin: 0; display: flex; flex-direction: column; }
.cls .ci { font-size: 34px; width: 46px; text-align: center; }
.cls.cur { border-color: var(--gold); }
.cls .btn { margin-top: auto; }
.cspells { list-style: none; padding: 0; margin: 8px 0 12px; display: grid; gap: 6px; }
.cspells li { display: grid; grid-template-columns: 24px 1fr; column-gap: 6px; font-size: 14px; }
.cspells li .muted, .cspells li .small { grid-column: 2; }
.cspells li b { font-family: var(--serif); font-weight: 700; }

/* ----- испытания недели ----- */
.wlist { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 8px; }
.wlist li { display: flex; gap: 10px; align-items: center; }
.wlist .wi { width: 28px; height: 28px; display: grid; place-items: center; font-size: 16px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--line); flex: none; }
.wlist li.done .wi { background: var(--gold); color: var(--on-gold); border-color: var(--gold); font-weight: 700; }
.wlist .wn { font-size: 14.5px; }
.wlist .bar { margin: 4px 0 0; height: 6px; }
.wlist .wv { font-size: 12.5px; color: var(--text-muted); white-space: nowrap; font-variant-numeric: tabular-nums lining-nums; }
.wparty { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line); }
.wstrikes { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line); }

/* ----- лист персонажа ----- */
.sheethead .sh-top { display: flex; gap: 14px; align-items: center; }
.sh-cls { font-family: var(--serif); color: var(--gold); font-size: 16px; }
.sh-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 12px; }
.sh-stats > div { text-align: center; border: 1px solid var(--line); border-radius: 8px; padding: 6px 2px; background: var(--surface-2); }
.sh-stats b { display: block; font-family: var(--display); font-size: 18px; color: var(--text-primary); font-weight: 900; }
.sh-stats span { font-size: 11.5px; color: var(--text-muted); }
.abil { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 640px) { .abil { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.ab { position: relative; text-align: center; padding: 10px 6px 10px; border: 2px solid var(--line-2); border-radius: 12px 12px 26px 26px;
  background: var(--tex), var(--surface-1); }
.ab-s { font-family: var(--serif); font-size: 13px; color: var(--crimson-ink); letter-spacing: .08em; }
.ab-v { font-family: var(--display); font-weight: 900; font-size: 30px; line-height: 1.05; }
.ab-m { display: inline-block; min-width: 44px; padding: 1px 8px; border: 1.5px solid var(--line-2); border-radius: 99px; background: var(--surface-2);
  font-weight: 700; font-size: 14px; margin-top: 2px; }
.ab-n { font-size: 12px; color: var(--text-secondary); margin-top: 5px; }
.ab-n .sv { color: var(--crimson-ink); }
.ab .bar { height: 4px; margin: 6px 6px 2px; }
.ab-d { font-size: 11px; color: var(--text-muted); line-height: 1.25; }

/* ----- отряд ----- */
.party { display: grid; gap: 10px; }
@media (min-width: 640px) { .party { grid-template-columns: 1fr 1fr; } }
.member { margin: 0; }
.member.me { border-color: var(--gold); }
.member .mi { font-size: 28px; width: 38px; text-align: center; }
.mstat { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; color: var(--text-secondary); }
.bossname { font-family: var(--display); font-weight: 900; text-align: center; margin: 4px 0 6px; color: var(--crimson-ink); letter-spacing: .03em; }
.statline { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px 14px; font-size: 13.5px; color: var(--text-secondary); margin-top: 6px;
  padding: 6px 0; border-top: 2px solid var(--crimson); border-bottom: 2px solid var(--crimson); }
.statline b { font-family: var(--serif); color: var(--crimson-ink); }
.bstrip .bname { font-family: var(--serif); }
.invcode { font-family: var(--display); font-weight: 900; font-size: 34px; letter-spacing: .18em; text-align: center; margin: 14px 0 8px; color: var(--crimson-ink); }
.mlist { list-style: none; padding: 0; margin: 6px 0 0; }
.mlist li { display: flex; align-items: center; gap: 8px; padding: 5px 0; border-top: 1px dashed var(--line); }

/* ----- кубик ----- */
.d20 .d20-o { fill: var(--crimson); stroke: color-mix(in srgb, var(--crimson) 50%, black); stroke-width: 2.5; stroke-linejoin: round; }
.d20 .d20-i { fill: rgba(255,255,255,.14); }
.d20 .d20-l { stroke: rgba(0,0,0,.32); stroke-width: 1.4; fill: none; }
.d20 .d20-n { font-family: var(--display); font-size: 24px; fill: #fff3dc; }
.dicefx { position: fixed; inset: 0; z-index: 70; display: grid; place-content: center; justify-items: center; gap: 8px;
  background: radial-gradient(circle at 50% 50%, rgba(0,0,0,.28), transparent 55%); cursor: pointer; }
.dicefx .die { width: 132px; height: 132px; animation: dieroll .55s cubic-bezier(.2,.8,.2,1) both; filter: drop-shadow(0 8px 14px rgba(0,0,0,.45)); }
.dicefx .die svg { width: 100%; height: 100%; }
.dicefx .adv { font-family: var(--dm); color: #fff3dc; background: rgba(0,0,0,.55); padding: 3px 10px; border-radius: 99px; font-size: 13px; }
.dicefx.landed .die { animation: dieland .3s ease both; }
.dicefx.crit .d20-o { fill: #d9a43a; }
.dicefx.crit .die { filter: drop-shadow(0 0 18px rgba(240,190,80,.9)); }
.dicefx.fumble .d20-o { fill: #5d5249; }
@keyframes dieroll { from { transform: rotate(-260deg) scale(.3); opacity: 0; } to { transform: rotate(0) scale(1); opacity: 1; } }
@keyframes dieland { 0% { transform: scale(1); } 45% { transform: scale(1.18); } 100% { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .dicefx .die, .dicefx.landed .die { animation: none; } }

/* ----- карточка заклинания ----- */
.spd-meta { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 10px; }
.spd-meta span { font-size: 12.5px; padding: 3px 9px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); color: var(--text-secondary); }
.spd-fx { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.spd-fx li { font-size: 15.5px; line-height: 1.35; padding: 9px 12px; border-radius: 8px; background: var(--surface-2); border-left: 3px solid var(--mana); }
.spd-when { margin-top: 10px; font-size: 14.5px; color: var(--text-secondary); }
.spd-when b { font-family: var(--serif); color: var(--crimson-ink); }
.spd-no { margin-top: 10px; color: var(--crimson-ink); font-size: 14.5px; }
.spd-gloss { margin-top: 14px; }
.spd-gloss summary { cursor: pointer; color: var(--text-muted); font-size: 13.5px; }
.spd-gloss p { margin: 6px 0; }

/* =====================================================================
   Комикс: компоненты и правки удобства (размеры ≥13 px, касание ≥44 px)
   ===================================================================== */
.app { padding-bottom: 170px; }
.tabs button { font-size: 13px; min-height: 58px; }
/* плавающая кнопка записи */
.fab { position: fixed; right: max(16px, calc(50vw - 380px + 16px)); bottom: calc(80px + env(safe-area-inset-bottom)); z-index: 25;
  width: 66px; height: 66px; border-radius: 50%; border: 3px solid var(--ink); background: var(--crimson); color: #fff;
  box-shadow: var(--shadow); display: grid; place-items: center; cursor: pointer; }
.fab span { font-family: var(--display); font-weight: 900; font-size: 38px; line-height: 1; margin-top: -3px; }
.fab:active { transform: translate(3px, 3px); box-shadow: none; }
body:has(.overlay) .fab { display: none; }
/* герой: эмблема уровня — жёлтый «значок» */
.card.hero .bar { border-color: var(--ink); background: rgba(12,9,24,.35); }
.vit .bar { height: 14px; }
.vit .vn { font-size: 13.5px; font-weight: 800; }
.card.hero .vn { color: #fff; }
.strikes { font-size: 13px; min-height: 32px; border: 2px solid var(--ink); background: var(--surface-1); color: var(--text-primary); }
.strikes i { border: 2px solid var(--ink); border-radius: 3px; }
.strikes i.on { background: var(--crimson); border-color: var(--ink); }
.eff { font-size: 13px; border: 2px solid var(--ink); background: var(--surface-1); color: var(--text-primary); font-weight: 700; }
.eff.insp { background: var(--xp-fill); color: var(--ink); border-color: var(--ink); }
/* кольца дня */
.rchip { min-height: 36px; padding: 4px 10px 4px 8px; border: 2px solid var(--ink); background: var(--surface-1); font-size: 13.5px; font-weight: 700; }
.rchip.done { background: color-mix(in srgb, var(--rc) 22%, var(--surface-1)); }
.rchip .rc-dot { width: 11px; height: 11px; box-shadow: inset 0 0 0 2.5px var(--rc); }
.rday .rd-w, .rday .rd-d { font-size: 13px; }
.rday.today { background: var(--xp-fill); color: var(--ink); box-shadow: inset 0 0 0 2px var(--ink); }
.rg-cnt { font-family: var(--display); font-weight: 900; font-size: 13px; fill: var(--text-primary); }
.rc-kick { font-family: var(--serif); font-size: 14px; color: var(--text-muted); letter-spacing: .03em; }
.rc-n { font-family: var(--display); font-weight: 900; font-size: 22px; }
/* компактные полосы на главной */
.strip { display: block; width: 100%; padding: 12px 14px; color: var(--text-primary); text-align: left; cursor: pointer; font: inherit; }
.strip .row { gap: 10px; }
.strip.wk { display: flex; align-items: center; gap: 10px; }
.st-i { font-size: 24px; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; background: var(--surface-2); border: 2px solid var(--ink); flex: none; }
.chev { font-family: var(--display); font-weight: 900; font-size: 26px; color: var(--text-muted); margin-left: auto; padding-left: 6px; transition: transform .2s; }
.wdots { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 6px; }
.wd { font-style: normal; line-height: 1; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--ink); background: var(--surface-2); font-size: 15px; }
.wd.on { background: var(--xp-fill); color: var(--ink); font-weight: 900; }
.wk-close { float: right; }
.sp-row { display: flex; gap: 8px; overflow-x: auto; margin-top: 10px; padding-bottom: 4px; scrollbar-width: none; }
.sp-mini { flex: none; display: grid; justify-items: center; gap: 1px; min-width: 76px; min-height: 76px; padding: 8px 6px; border-radius: 14px;
  border: 2px solid var(--ink); background: var(--surface-2); color: var(--text-primary); box-shadow: var(--shadow-s); cursor: pointer; }
.sp-mini span { font-size: 24px; }
.sp-mini small { font-size: 13px; font-weight: 700; }
.sp-mini em { font-style: normal; font-size: 13px; color: var(--mana); font-weight: 800; }
.sp-mini.off { opacity: .55; box-shadow: none; }
.bstrip { cursor: pointer; }
.bstrip .threat { color: var(--crimson-ink); font-weight: 800; }
/* квесты */
.check { width: 28px; height: 28px; border: 2.5px solid var(--ink); background: var(--surface-1); }
.done .check { background: #1f8a3a; border-color: var(--ink); color: #fff; }
.qtag { font-size: 13px; border: 2px solid var(--ink); color: var(--text-primary); background: var(--xp-fill); font-weight: 800; padding: 2px 9px; }
[data-theme="dark"] .qtag { color: var(--ink); }
.quests li { min-height: 48px; }
/* записи: удаление крупнее, отмена в пузыре */
.del { min-width: 44px; min-height: 44px; display: grid; place-items: center; font-size: 17px; padding: 0; margin: -10px -8px -10px 2px; border-radius: 12px; opacity: .7; }
.del:hover { opacity: 1; background: var(--surface-2); }
.toast-act { margin-top: 8px; font-family: var(--body); }
.btn.more { margin: 8px 0 18px; }
/* настройки: сворачиваемые разделы */
.card.fold { padding-top: 6px; padding-bottom: 6px; }
.card.fold:not(.open) > :not(:first-child) { display: none !important; }
.card.fold.open { padding-bottom: 14px; }
.fold-t { display: flex; align-items: center; width: 100%; min-height: 48px; background: none; border: 0; padding: 4px 0; color: var(--text-primary);
  font-family: var(--serif); font-weight: 700; font-size: 18px; text-align: left; cursor: pointer; }
.fold-t > span:first-child { flex: 1; }
.card.fold.open .fold-t .chev { transform: rotate(90deg); }
.fold-head { display: flex; }
.savebar { position: sticky; bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 5; }
/* графики: подпись линии цели с подложкой */
.reflabel { font-weight: 800; paint-order: stroke; stroke-width: 4px; stroke-linejoin: round; }
/* лист героя */
.ab { border: 2.5px solid var(--ink); border-radius: 16px 16px 28px 28px; background: var(--surface-1); box-shadow: var(--shadow-s); }
.ab-s { font-family: var(--display); font-weight: 900; font-size: 14px; color: var(--crimson-ink); letter-spacing: .06em; }
.ab-m { border: 2px solid var(--ink); background: var(--xp-fill); color: var(--ink); font-weight: 900; font-size: 14px; }
.ab-n { font-size: 13px; font-weight: 700; }
.ab .sv { font-size: 13px; color: var(--crimson-ink); font-weight: 800; margin-top: 2px; }
.ab-d { font-size: 13px; line-height: 1.3; }
.ab .bar { height: 8px; border-width: 1.5px; }
.sh-stats > div { border: 2px solid var(--ink); background: var(--surface-2); border-radius: 12px; }
.sh-stats span { font-size: 13px; }
.sh-cls { font-family: var(--serif); font-weight: 700; color: var(--crimson-ink); }
.sh-name { font-family: var(--display); font-weight: 900; font-size: 24px; }
/* заклинания */
.spell { border: 2.5px solid var(--ink); border-radius: 14px; background: var(--surface-2); box-shadow: var(--shadow-s); }
.spell .sp-n { font-family: var(--serif); font-weight: 700; font-size: 15.5px; }
.spell .sp-c { font-size: 13px; font-weight: 800; color: var(--mana); }
.spell .sp-why { font-size: 13px; }
.spell.off { box-shadow: none; }
.spd-fx li { border: 2px solid var(--ink); border-left: 6px solid var(--mana-fill); background: var(--surface-2); }
.spd-meta span { border: 2px solid var(--ink); font-size: 13px; font-weight: 700; color: var(--text-primary); }
.spd-when b { color: var(--crimson-ink); }
/* испытания */
.wlist .wi { border: 2px solid var(--ink); width: 32px; height: 32px; }
.wlist li.done .wi { background: #1f8a3a; color: #fff; border-color: var(--ink); }
.wlist .wv { font-size: 13px; font-weight: 700; }
.wlist .bar { height: 10px; }
/* отряд и босс */
.member.me { box-shadow: 4px 4px 0 var(--purple); }
.statline { border-top: 2.5px solid var(--ink); border-bottom: 2.5px solid var(--ink); font-size: 14px; }
.statline b { font-family: var(--display); color: var(--crimson-ink); }
.bossname { color: var(--text-primary); }
.card.boss { background: var(--boss-tint); }
.mstat { font-size: 13.5px; font-weight: 700; }
/* кубик — красный пластик с чернильным контуром */
.d20 .d20-o { fill: var(--crimson); stroke: var(--ink); stroke-width: 3.5; }
.d20 .d20-l { stroke: rgba(12,9,24,.45); stroke-width: 1.8; }
.d20 .d20-n { font-family: var(--display); font-weight: 900; font-size: 26px; fill: #fff; }
.dicefx.crit .d20-o { fill: #ffcc33; }
.dicefx.crit .d20-n { fill: var(--ink); }
/* плитки сводки — в комиксном стиле */
.tile2 { border: 2.5px solid var(--ink); box-shadow: var(--shadow-s); border-radius: 18px; }
.dbtn { border: 2px solid var(--ink); box-shadow: var(--shadow-s); font-weight: 800; }
/* сетка «Записать» и мелочи */
.tile { border: 2px solid var(--ink); box-shadow: var(--shadow-s); border-radius: 16px; font-weight: 700; }
.seg { border: 2px solid var(--ink); }
.seg button.on { background: var(--xp-fill); color: var(--ink); font-weight: 800; }
.daylabel { font-family: var(--serif); font-weight: 700; font-size: 15px; }
.entries .t { font-size: 13px; font-weight: 700; }
.entries .xp, .xp { font-size: 13px; font-weight: 800; }
.chart-head h3 { font-size: 17px; }
.chart svg text { font-size: 12.5px; font-family: var(--body); font-weight: 700; }
/* компактная шапка героя */
.card.hero { padding: 14px 16px; gap: 12px; align-items: center; }
.card.hero .emblem { width: 66px; height: 66px; }
.card.hero .name { font-size: 22px; line-height: 1.1; }
.card.hero .title { font-size: 14.5px; line-height: 1.25; }
.card.hero .meta { font-size: 13.5px; gap: 4px 12px; flex-wrap: wrap; }
.card.hero .bar { margin: 8px 0 4px; }
.card.hero .vitals { margin-top: 6px; }
@media (max-width: 520px) { .rc-legend { display: none; } .rc-msg { margin-top: 4px; } }
.card.hero { grid-template-columns: 66px 1fr; }
body[data-tab="settings"] .fab { display: none; }
.sp-mini { width: 92px; }
.sp-mini small { width: 100%; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wd.wd-party { border-style: dashed; }
body[data-tab="options"] .fab { display: none; }
.seg button { min-height: 40px; font-weight: 700; }
.stat .l, .stat .d { font-size: 13px; }
.stat { border: 2px solid var(--ink); box-shadow: var(--shadow-s); }
.tbl-toggle { font-size: 13px; min-height: 40px; padding: 8px 2px; }
.legend { font-size: 13px; }
.ach .d { font-size: 13px; }
.ach > div { border: 2px solid var(--ink); box-shadow: var(--shadow-s); }
.ladder2 .dot { width: 28px; height: 28px; font-size: 13px; border: 2px solid var(--ink); }
.ladder2 li.done .dot { background: #1f8a3a; border-color: var(--ink); color: #fff; }
.ladder2 li.next .dot { border-color: var(--ink); background: var(--xp-fill); color: var(--ink); }
.feat .rset { font-size: 13px; }
.ladder li { border: 2px solid var(--ink); }
.ladder li.cur { background: var(--xp-fill); color: var(--ink); }
input[type="file"] { font-family: var(--body); font-size: 14px; color: var(--text-secondary); }
input[type="file"]::file-selector-button { font-family: var(--body); font-weight: 800; border: 2px solid var(--ink); border-radius: 99px; padding: 8px 14px;
  background: var(--surface-1); color: var(--text-primary); box-shadow: var(--shadow-s); margin-right: 10px; cursor: pointer; }

/* =====================================================================
   Ритм и выравнивание: одинаковые отступы между блоками, ровные карточки
   ===================================================================== */
.card { margin-bottom: 18px; }
.app > h2 { margin: 28px 2px 12px; }
.sec-head { margin: 28px 0 12px; align-items: center; }
.sec-head h2 { margin: 0; }
.party, .abil, .relics2, .gallery, .classes, .trophies, .spells { margin-bottom: 18px; }
.party { gap: 16px; align-items: stretch; }
.member { margin: 0; display: flex; flex-direction: column; gap: 4px; }
.member.me { border-color: var(--ink); box-shadow: var(--shadow); background: var(--hero-tint); }
.member .row { align-items: flex-start; }
.member .vrow { margin-top: auto; padding-top: 6px; }
.mstat { min-width: 52px; }
.app > .hint { margin: -6px 2px 18px; }
.seg.hseg, .seg.achf { margin-bottom: 18px; display: flex; width: 100%; }
.seg.hseg button, .seg.achf button { flex: 1; }
/* характеристики: все строки на одной высоте */
.abil { gap: 12px; }
.ab { display: grid; grid-template-rows: auto auto auto auto auto auto 1fr; justify-items: center; align-content: start; padding: 12px 8px 14px; gap: 3px; }
.ab .bar { width: 82%; margin: 6px 0 4px; }
.ab-n { min-height: 2.5em; display: flex; align-items: center; justify-content: center; text-align: center; line-height: 1.2; overflow-wrap: anywhere; margin-top: 0; }
.ab .sv.none { visibility: hidden; }
.ab-d { margin-top: 2px; }
/* заклинания: содержимое сверху, иконки в одну линию */
.spells { gap: 12px; }
.spell { align-content: start; align-items: start; padding: 12px; min-height: 104px; }
.spell .sp-i { align-self: start; font-size: 24px; padding-top: 0; }
/* полоса испытаний */
.strip.wk { align-items: center; }
.wdots { gap: 8px; }
.wdots .strikes { margin-left: 2px; }
.wd.wd-party { border-style: dashed; }
.wd.wd-party.on { background: var(--xp-fill); }
/* сумка */
.purse { display: flex; align-items: center; gap: 14px; }
.purse .pi { font-size: 36px; width: 56px; height: 56px; display: grid; place-items: center; border-radius: 50%; background: var(--xp-fill); border: 2.5px solid var(--ink); }
.purse-n { font-family: var(--display); font-weight: 900; font-size: 30px; line-height: 1; }
.relics2 { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.relic { display: flex; gap: 12px; align-items: center; margin: 0; padding: 12px 14px; }
.relic .ri { font-size: 30px; }
.shop li { min-height: 56px; }
/* галерея наград */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 14px 10px; }
.badge { display: grid; justify-items: center; align-content: start; gap: 4px; padding: 8px 4px; border: 0; background: none; color: var(--text-primary); cursor: pointer; font: inherit; }
.medal { --p: 0; position: relative; width: 78px; height: 78px; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--xp-fill) calc(var(--p) * 1%), var(--surface-3) 0); border: 2.5px solid var(--ink); box-shadow: var(--shadow-s); }
.medal::before { content: ""; position: absolute; inset: 7px; border-radius: 50%; background: var(--surface-1); border: 2px solid var(--ink); }
.medal .mi { position: relative; font-size: 32px; line-height: 1; }
.badge.got .medal::before { background: radial-gradient(circle at 35% 30%, #fff6c9, var(--xp-fill)); }
.badge.locked .medal .mi { filter: grayscale(1); opacity: .45; }
.medal .lock { position: absolute; right: -4px; bottom: -4px; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 13px;
  background: var(--surface-1); border: 2px solid var(--ink); }
.b-n { font-weight: 800; font-size: 13.5px; text-align: center; line-height: 1.2; }
.b-s { font-size: 13px; color: var(--text-muted); font-weight: 700; }
.badge.got .b-s { color: var(--gold); }
.badge:active .medal { transform: translate(2px, 2px); box-shadow: none; }
.ach-big { display: grid; place-items: center; margin-top: 6px; }
.medal.xl { width: 132px; height: 132px; }
.medal.xl .mi { font-size: 56px; }
.ach-big.got .medal.xl::before { background: radial-gradient(circle at 35% 30%, #fff6c9, var(--xp-fill)); }
.ach-big.locked .medal.xl .mi { filter: grayscale(1); opacity: .45; }

.party > .member:last-child:nth-child(odd) { grid-column: 1 / -1; }
.sheethead [data-classpick] { margin-top: 14px; }
.sh-stats { margin-top: 14px; }
.medal .mi { color: var(--ink); }
.seg.hseg button, .seg.achf button { white-space: nowrap; font-size: 14px; padding: 8px 6px; }
.seg.hseg { overflow-x: auto; scrollbar-width: none; }
@media (max-width: 400px) { .seg.hseg button { font-size: 13px; padding: 8px 4px; } }
.abil { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
.ab-n { overflow-wrap: normal; hyphens: auto; }
