/* Своя воля · Лукоморье — интерфейс по принятому макету (шаг 5, 13.11.2026).
   CSP: только этот файл, без inline-стилей. Шрифты — /fonts.css (npm run fonts:fetch). */
:root {
  --linen: #f2ebdd; --paper: #fbf7ef; --ink: #1f1a14; --ink2: #3e362c; --muted: #5e554a;
  --line: #dcd2c0; --line2: #e2d7c4; --red: #a52a1f; --red-dark: #7a1e16; --green: #2e5a4c;
  --gold: #e7c46a; --gold2: #c9a24b; --night: #17120d;
  --display: "Ruslan Display", "Kurale", Georgia, serif;
  --story: "Kurale", Georgia, "Times New Roman", serif;
  --ui: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --telegram-top: 0px; --telegram-bottom: 0px;
}
* { box-sizing: border-box; }
html { background: var(--linen); }
body {
  margin: 0; color: var(--ink); font: 16px/1.5 var(--ui); -webkit-font-smoothing: antialiased;
  background-color: var(--linen);
  background-image: repeating-linear-gradient(0deg, rgba(110, 90, 60, .045) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(90deg, rgba(110, 90, 60, .045) 0 1px, transparent 1px 3px);
  min-height: 100vh;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; }
h1, h2, h3 { margin: 0; font-weight: 700; }
p { margin: 0; }
.rus { font-family: var(--display); font-weight: 400; letter-spacing: .01em; }
.kur { font-family: var(--story); }
.muted, .secondary { color: var(--muted); }
.small { font-size: 13px; line-height: 1.45; }
.center { text-align: center; }
.eyebrow { font-size: 11px; letter-spacing: .16em; text-transform: uppercase; font-weight: 700; color: var(--red); }
.eyebrow.light { color: #f0d9a8; }
.eyebrow.gold { color: var(--gold); }
.accent { color: var(--red); font-weight: 700; font-size: 14px; }
.row-between { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.row-start { display: flex; gap: 14px; align-items: flex-start; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 12px; top: 12px; z-index: 50; background: var(--paper); padding: 8px 12px; }
:focus-visible { outline: 2px solid var(--gold2); outline-offset: 2px; }

main#page { max-width: 480px; margin: 0 auto; min-height: 100vh; padding-bottom: calc(96px + var(--telegram-bottom)); position: relative; outline: none; }
body[data-tab="word"] main#page, body[data-tab="birth"] main#page { padding-bottom: 0; }
.loading { padding: 40vh 24px 0; text-align: center; font-family: var(--display); font-size: 28px; }
.loading span { display: block; font: 15px var(--story); color: var(--muted); margin-top: 8px; }
.welcome { padding: 72px 24px; display: grid; gap: 14px; }

/* Орнамент */
.band { display: block; }
.rosette { width: 32px; height: 32px; overflow: visible; }
.rosette .r-dots { fill: none; stroke: var(--gold2); stroke-width: .6; stroke-dasharray: .7 .8; }
.rosette .r-ring { fill: var(--paper); stroke: var(--red); stroke-width: .8; }
.rosette .r-petals { fill: rgba(165, 42, 31, .12); stroke: var(--red); stroke-width: .8; }
.rosette .r-core { fill: var(--red); }
.rosette.emblem { width: 92px; height: 92px; flex: 0 0 92px; }
.rosette.mini { width: 26px; height: 26px; }
.rosette.bg { position: absolute; width: 220px; height: 220px; right: -60px; top: -20px; opacity: .1; pointer-events: none; }
.rosette.bg .r-ring, .rosette.bg .r-petals { fill: none; }
.turn { animation: turn 40s linear infinite; transform-origin: 50% 50%; }
@keyframes turn { to { transform: rotate(360deg); } }
.rhomb { width: 10px; height: 10px; flex: 0 0 10px; }
.rhomb .fill { fill: var(--red); }
.rhomb .line { fill: none; stroke: var(--red); stroke-width: 1.5; }
.ico { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.ico .solid, .solid { fill: currentColor; stroke: none; }
.red-fill { fill: var(--red); } .red-line { fill: none; stroke: var(--red); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ink-fill { fill: var(--ink); } .ink-line { fill: none; stroke: var(--ink); stroke-width: 1.2; stroke-linecap: round; }
.paper-fill { fill: var(--linen); }

/* Общие блоки */
.page-head { padding: calc(48px + var(--telegram-top)) 22px 14px; display: flex; justify-content: space-between; align-items: flex-end; gap: 14px; }
.page-head h1 { font-size: 40px; line-height: 1; margin-top: 6px; }
.page-body { padding: 16px 22px 28px; display: grid; gap: 20px; position: relative; overflow: hidden; }
.avatar { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; border: 2px solid var(--red); flex: 0 0 64px; }
.card { background: var(--paper); border: 1.5px solid var(--line2); border-radius: 20px; padding: 18px; display: grid; gap: 10px; }
.card.dark { background: var(--ink); border-color: var(--ink); color: var(--linen); }
.card.dark p { color: #d9cdb8; }
.card.dashed { background: transparent; border-style: dashed; border-color: #bfaf96; }
.card h2 { font-size: 16px; }
.mid { font-size: 21px; line-height: 1.2; }
.big { font-size: 32px; line-height: 1; }
.big small { font-size: 16px; color: var(--muted); font-family: var(--ui); }
.lead { font-size: 17px; line-height: 1.5; color: var(--ink2); }
.duo { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
progress { width: 100%; height: 6px; appearance: none; border: 0; border-radius: 3px; background: #e2dacb; overflow: hidden; }
progress::-webkit-progress-bar { background: #e2dacb; }
progress::-webkit-progress-value { background: linear-gradient(90deg, var(--gold), var(--red)); }
progress::-moz-progress-bar { background: linear-gradient(90deg, var(--gold), var(--red)); }
.primary, .ghost { min-height: 52px; border-radius: 26px; padding: 0 22px; font-weight: 700; font-size: 16px; }
.primary { border: 0; background: var(--ink); color: var(--linen); }
.primary.red { background: var(--red); color: #fbf4e8; }
.primary:disabled { opacity: .45; cursor: not-allowed; }
.ghost { border: 1.5px solid #cdbfa8; background: transparent; }
.wide { width: 100%; }
.segments { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: 14px; background: #e6dcc9; }
.segments button { min-height: 44px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-weight: 700; font-size: 14px; display: flex; align-items: center; justify-content: center; gap: 8px; }
.segments button[aria-selected="true"] { background: var(--paper); color: var(--ink); box-shadow: inset 0 -2px 0 var(--red), 0 1px 0 rgba(31, 26, 20, .08); }
.count { min-width: 22px; height: 22px; border-radius: 11px; background: var(--red); color: #fbf4e8; font-size: 12px; line-height: 22px; text-align: center; padding: 0 6px; }
.know { padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; border: 1.5px dashed #9c8f7a; color: var(--muted); }
.know[data-k="met"] { border: 1.5px solid var(--red); color: var(--red-dark); }
.know[data-k="own"] { border: 1.5px solid var(--red); background: var(--red); color: #fbf4e8; }

/* Мир — трансляция (шаг 6) */
.strip { position: relative; height: calc(168px + var(--telegram-top)); overflow: hidden; background: #2b2a20; }
.strip-photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; animation: drift 60s ease-in-out infinite alternate; transform-origin: 50% 60%; }
@keyframes drift { from { transform: scale(1.06) translateX(-2%); } to { transform: scale(1.14) translateX(2%); } }
.strip-shade { position: absolute; inset: 0; background: linear-gradient(to bottom, rgba(20, 15, 10, .62), rgba(20, 15, 10, .1) 70%); }
.strip.tikh::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to bottom, rgba(70, 105, 120, .35), rgba(150, 180, 190, .45)); }
.strip-head { position: absolute; left: 20px; right: 20px; top: calc(36px + var(--telegram-top)); display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; z-index: 2; }
.strip-head h1 { color: #fbf4e8; font-size: 30px; line-height: 1; margin-top: 4px; }
.scene-actions { display: flex; gap: 8px; align-items: center; }
.round { width: 44px; height: 44px; border-radius: 22px; border: 1px solid rgba(246, 231, 194, .4); background: rgba(24, 18, 12, .5); color: #f6eedf; display: grid; place-items: center; }
.round.dark { border-color: rgba(242, 235, 221, .25); background: transparent; color: var(--linen); }
.pill { height: 36px; line-height: 34px; padding: 0 12px; border-radius: 18px; border: 1px solid rgba(246, 231, 194, .4); background: rgba(24, 18, 12, .5); color: #f6eedf; font-size: 12px; font-weight: 600; white-space: nowrap; }
.sheet { position: relative; margin-top: -22px; background: var(--linen); border-radius: 24px 24px 0 0; box-shadow: 0 -10px 30px rgba(0, 0, 0, .2); overflow: hidden; z-index: 4; padding-top: 8px; }
.sheet-body { padding: 10px 20px 20px; display: grid; gap: 16px; }
.route svg { width: 100%; height: 14px; display: block; }
.route-line { fill: none; stroke: #b9ab92; stroke-width: 1.4; stroke-dasharray: 2 2; vector-effect: non-scaling-stroke; }
.route-done { fill: none; stroke: var(--green); stroke-width: 2.4; vector-effect: non-scaling-stroke; }
.route-end { fill: var(--green); } .route-end.open { fill: var(--linen); stroke: var(--green); stroke-width: 1; vector-effect: non-scaling-stroke; }
.route-dot { fill: var(--red); stroke: var(--linen); stroke-width: 1.2; vector-effect: non-scaling-stroke; }
.route-names { display: flex; justify-content: space-between; }
.route-names button, .inline { border: 0; background: transparent; padding: 2px 0; font-size: 13px; color: var(--muted); font-weight: 600; }
.route-names button.on { color: var(--green); }
.inline { color: var(--green); text-decoration: underline; text-underline-offset: 3px; font-size: inherit; }
.route-note { font-size: 13px; color: var(--ink2); }
.route-note b { color: var(--green); }
.plate { background: var(--paper); border: 1.5px solid var(--line2); border-radius: 18px; padding: 14px 16px 12px; display: grid; gap: 8px; }
.plate-title { font-family: var(--story); font-weight: 400; font-size: 21px; line-height: 1.2; }
#ticker { min-height: 48px; }
.tick { font-size: 16px; line-height: 1.45; color: var(--ink); display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; }
.tick.fresh { animation: fadein .5s ease-out both; }
.tick .kur, .beat .kur { font-family: var(--story); }
.tick[data-role="thought"] .kur, .tick[data-role="reply"] .kur, .tick[data-role="verdict"] .kur { font-size: 18px; }
.world-clock { height: 3px; background: repeating-linear-gradient(90deg, #cdbfa8 0 6px, transparent 6px 10px); border-radius: 2px; overflow: hidden; }
.world-clock span { display: block; height: 100%; background: repeating-linear-gradient(90deg, var(--red) 0 6px, transparent 6px 10px); transform-origin: left; transform: scaleX(0); }
.who { font-size: 12px; font-weight: 700; letter-spacing: .04em; color: var(--muted); }
[data-role="word"] .who { color: #2f5f86; }
.quote { font-family: var(--story); color: #2f5f86; }
.tag { font-size: 10px; letter-spacing: .14em; text-transform: uppercase; font-weight: 700; color: var(--red); border: 1px solid rgba(165, 42, 31, .35); border-radius: 8px; padding: 1px 6px; }
.setup-title { font-weight: 600; }
.badge { font-size: 11px; font-weight: 700; border-radius: 10px; padding: 1px 8px; background: #e7dcc6; color: var(--ink2); }
.badge[data-v="послушалась"], .badge[data-v="совпало"] { background: var(--green); color: #f4ecdc; }
.badge[data-v="по-своему"] { background: var(--red); color: #fbf4e8; }
.badge[data-v="не дошло"], .badge[data-v="не к месту"] { background: transparent; border: 1px dashed #a39784; }
details.why { border: 1.5px solid #cdbfa8; border-radius: 14px; background: transparent; }
details.why summary { min-height: 44px; padding: 11px 14px; font-weight: 600; font-size: 14px; cursor: pointer; list-style: none; display: flex; justify-content: space-between; }
details.why summary::after { content: "⌄"; color: var(--muted); }
details.why[open] summary::after { content: "⌃"; }
details.why p { padding: 0 14px 14px; color: var(--ink2); font-size: 14px; }
#live-scene { display: grid; gap: 10px; }
.feed { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.beat { display: grid; grid-template-columns: 42px 1fr; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.beat time { font-size: 12px; color: var(--muted); padding-top: 2px; }
.beat p { font-size: 14px; line-height: 1.45; color: var(--ink2); display: flex; flex-wrap: wrap; gap: 3px 8px; align-items: baseline; }
.beat[data-role="thought"] p, .beat[data-role="reply"] p { color: var(--ink); font-size: 16px; }
.beat[data-role="word"] { border-left: 3px solid #2f5f86; padding-left: 8px; margin-left: -11px; }
.beat[data-role="reply"] { border-left: 3px solid var(--gold2); padding-left: 8px; margin-left: -11px; }

/* Летопись */
.recap { background: var(--green); color: #f4ecdc; border-radius: 22px; padding: 20px; display: grid; gap: 12px; }
.recap-lead { font-size: 17px; line-height: 1.5; }
.bukva { float: left; width: 50px; height: 54px; margin: 4px 10px 2px 0; border: 1.5px solid var(--gold); border-radius: 4px; box-shadow: inset 0 0 0 3px var(--green), inset 0 0 0 4px rgba(231, 196, 106, .5); font-size: 40px; line-height: 54px; text-align: center; color: var(--gold); background: #24493d; }
.recap ul { margin: 0; padding-left: 18px; display: grid; gap: 4px; font-size: 14px; color: #d6e2da; }
.recap-cat { font-size: 14px; color: #d6e2da; }
.diary-update { display: flex; justify-content: center; }
#diary-new { border: 0; border-radius: 18px; padding: 8px 16px; background: var(--red); color: #fbf4e8; font-weight: 700; }
.chronicle { display: grid; gap: 18px; }
.chronicle .intro { font-size: 16px; }
.day { display: flex; align-items: center; gap: 10px; color: var(--red); }
.day span { flex: 1; height: 1px; background: #cdbfa8; }
.day b { font-size: 12px; letter-spacing: .16em; text-transform: uppercase; }
.entry { display: grid; grid-template-columns: 44px 1fr; gap: 12px; }
.entry time { font-size: 12px; color: var(--muted); padding-top: 3px; }
.entry > div { display: grid; gap: 6px; font-size: 15px; line-height: 1.5; color: var(--ink2); }
.entry.word > div { border-left: 2px dashed var(--red); padding-left: 14px; }
.entry.word .kur { font-size: 18px; color: var(--ink); }
.place { justify-self: start; border: 0; background: transparent; padding: 0; color: var(--muted); font-size: 13px; }
.empty { color: var(--muted); font-family: var(--story); }

/* Ива */
.portrait { position: relative; height: 360px; overflow: hidden; }
.portrait > img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 25%; display: block; }
.portrait-fade { position: absolute; inset: 0; background: linear-gradient(to bottom, rgba(242, 235, 221, 0) 50%, var(--linen) 98%); }
.nalichnik { position: absolute; left: 0; top: 0; width: 100%; height: 44px; }
.portrait-name { position: absolute; left: 22px; right: 22px; bottom: 8px; display: grid; gap: 6px; }
.portrait-name h1 { font-size: 54px; line-height: .95; }
.portrait-name p { font-size: 13px; font-weight: 600; color: var(--ink2); }
.traits { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.trait { background: var(--paper); border: 1.5px solid var(--line2); border-radius: 16px; padding: 12px 8px; display: grid; justify-items: center; gap: 6px; text-align: center; }
.trait b { font-size: 13px; line-height: 1.25; }
.trait small { font-size: 12px; color: var(--muted); }
.sign { width: 38px; height: 34px; }
.people { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.person { display: flex; gap: 10px; align-items: center; padding: 10px; border-radius: 16px; background: #e9e0ce; border: 0; text-align: left; min-height: 64px; }
.person span:last-child { display: grid; min-width: 0; }
.person b { font-size: 13px; } .person small { font-size: 12px; color: #4f473c; }
.initial { width: 44px; height: 44px; flex: 0 0 44px; border-radius: 50%; background: #e5d9c3; border: 1.5px solid #cdbfa8; display: grid; place-items: center; font-size: 22px; color: var(--red); }
.folds { border-top: 1px solid var(--line); }
.fold { border-bottom: 1px solid var(--line); }
.fold summary { min-height: 52px; display: flex; justify-content: space-between; align-items: center; font-size: 15px; cursor: pointer; list-style: none; }
.fold summary small { color: var(--muted); font-size: 13px; }
.fold-body { padding: 0 0 14px; display: grid; gap: 10px; }
.personality h3 { font-size: 15px; } .personality p, .personality small { font-size: 14px; color: var(--ink2); }
.ledger { display: flex; justify-content: space-between; font-size: 14px; }
.list-row { display: flex; justify-content: space-between; width: 100%; min-height: 44px; align-items: center; border: 0; border-bottom: 1px solid var(--line); background: transparent; text-align: left; }
.why-link { border: 0; background: transparent; padding: 0; color: var(--red); font-size: 13px; font-weight: 600; }

/* Доля */
.actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.actions button { background: var(--paper); border: 1.5px solid var(--line2); border-radius: 16px; padding: 12px 8px; display: grid; justify-items: center; gap: 4px; text-align: center; min-height: 104px; }
.actions button:disabled { opacity: .45; }
.actions strong { font-size: 14px; } .actions small { font-size: 11px; color: var(--muted); line-height: 1.3; }

/* Слово */
body[data-tab="word"] { background: var(--night); }
.word-screen { min-height: 100vh; background: var(--night); color: var(--linen); display: flex; flex-direction: column; padding: calc(36px + var(--telegram-top)) 0 calc(22px + var(--telegram-bottom)); }
.word-body { flex: 1; padding: 14px 24px 22px; display: grid; gap: 16px; align-content: start; position: relative; overflow: hidden; }
.word-body .rosette.bg .r-dots, .word-body .rosette.bg .r-ring, .word-body .rosette.bg .r-petals { stroke: var(--gold); }
.word-body .rosette.bg { opacity: .14; top: 40px; }
.word-body h1 { font-size: 36px; line-height: 1.05; color: #f6e7c2; margin-top: 24px; }
.light-muted { color: #d9cdb8; }
#word-form { display: grid; gap: 14px; }
#word-form label { font-size: 12px; font-weight: 600; color: #d9cdb8; }
#word { min-height: 96px; resize: vertical; border-radius: 16px; border: 1px solid rgba(242, 235, 221, .24); background: rgba(242, 235, 221, .06); color: #fbf4e8; font-size: 17px; padding: 14px 16px; }
#word::placeholder { color: #a39784; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 40px; padding: 0 14px; border-radius: 20px; border: 1px solid rgba(231, 196, 106, .4); background: transparent; color: #f6e7c2; font-size: 15px; }
.command-recovery { border: 1px solid rgba(231, 196, 106, .5); border-radius: 14px; padding: 12px; display: grid; gap: 8px; font-size: 14px; }
.command-recovery button { justify-self: start; border-radius: 18px; border: 1px solid var(--gold); background: transparent; color: var(--gold); padding: 6px 14px; }
.word-hint { margin: 0; padding: 10px 12px; border-left: 3px solid #c9332a; background: rgba(201, 51, 42, .14); color: #f6e7c2; font-size: 14px; line-height: 1.45; border-radius: 0 10px 10px 0; }

/* Атлас */
.back-link { border: 0; background: transparent; padding: 0; color: var(--muted); font-weight: 600; min-height: 32px; }
.big-book .ico { width: 56px; height: 56px; stroke: var(--red); stroke-width: 1.2; }
#search { width: 100%; min-height: 48px; border-radius: 14px; border: 1.5px solid #cdbfa8; background: var(--paper); padding: 0 14px; }
.legend { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 12px; color: var(--muted); }
#atlas-list { display: grid; gap: 10px; }
.entry-card { display: flex; gap: 12px; align-items: center; text-align: left; min-height: 76px; padding: 12px; border-radius: 18px; background: var(--paper); border: 1.5px solid var(--line2); }
.entry-card[data-k="rumor"] { background: transparent; border-style: dashed; }
.entry-card img, .glyph { width: 56px; height: 56px; flex: 0 0 56px; border-radius: 14px; object-fit: cover; }
.glyph { display: grid; place-items: center; background: #e9e0ce; border: 1.5px solid #cdbfa8; font-size: 26px; color: var(--red); }
.entry-text { flex: 1; display: grid; gap: 3px; min-width: 0; }
.entry-text small { color: var(--muted); font-size: 13px; }

/* Рождение */
.birth-photo { position: relative; height: 300px; overflow: hidden; }
.birth-photo img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; }
.birth h1 { font-size: 34px; line-height: 1.05; }
#registration { display: grid; gap: 10px; }
#registration label { font-size: 13px; font-weight: 600; color: var(--ink2); }
#registration input { min-height: 52px; border-radius: 14px; border: 1.5px solid #cdbfa8; background: var(--paper); padding: 0 16px; font-size: 17px; }
#registration .primary { margin-top: 8px; }

/* Навигация */
#navigation { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--linen); padding-bottom: var(--telegram-bottom); }
.nav-band { display: block; }
.nav-row { max-width: 480px; margin: 0 auto; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: start; padding: 4px 0 8px; }
.nav-row > button { border: 0; background: transparent; min-height: 56px; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 11px; font-weight: 600; color: var(--muted); }
.nav-row > button .rhomb { opacity: 0; width: 6px; height: 6px; }
.nav-row > button[aria-current="page"] { color: var(--red); }
.nav-row > button[aria-current="page"] .rhomb { opacity: 1; }
.nav-row > button:active .ico { transform: scale(.88); }
.nav-row .ico { transition: transform .15s ease; }
.nav-row .spindle { width: 64px; height: 64px; min-height: 64px; justify-self: center; margin-top: -26px; border-radius: 50%; border: 2px solid var(--gold2); background: var(--ink); display: grid; place-items: center; animation: glow 4s ease-in-out infinite; }
.nav-row .spindle .rosette { width: 40px; height: 40px; }
.nav-row .spindle .r-ring { fill: none; stroke: var(--gold); }
.nav-row .spindle .r-petals { fill: rgba(201, 51, 42, .35); stroke: var(--gold); }
.nav-row .spindle .r-dots { stroke: var(--gold); }
.nav-row .spindle .r-core { fill: #c9332a; }
@keyframes glow { 0%, 100% { box-shadow: 0 0 0 0 rgba(165, 42, 31, 0), 0 8px 20px rgba(31, 26, 20, .35); } 50% { box-shadow: 0 0 0 7px rgba(165, 42, 31, .16), 0 8px 20px rgba(31, 26, 20, .35); } }
/* Анимации иконок при выборе раздела */
[aria-current="page"] .i-page path { stroke-dasharray: 8; animation: write .6s ease-out both; }
[aria-current="page"] .i-rh { transform-origin: 15.5px 15px; animation: pop .5s .35s ease-out both; }
[aria-current="page"] .i-field { transform-origin: 12px 12px; animation: field .6s ease-out both; }
.i-seed { transform-box: fill-box; transform-origin: center; }
[aria-current="page"] .i-seed { animation: pop .4s ease-out both; }
[aria-current="page"] .s2 { animation-delay: .1s; } [aria-current="page"] .s3 { animation-delay: .2s; } [aria-current="page"] .s4 { animation-delay: .3s; }
[aria-current="page"] .i-arm-l { transform-origin: 12px 11px; animation: arml .6s ease-out both; }
[aria-current="page"] .i-arm-r { transform-origin: 12px 11px; animation: armr .6s ease-out both; }
[aria-current="page"] .i-ros { transform-origin: 0 0; animation: ros .9s cubic-bezier(.3, .7, .3, 1) both; }
@keyframes write { from { stroke-dashoffset: 8; } to { stroke-dashoffset: 0; } }
@keyframes pop { 0% { transform: scale(0); } 60% { transform: scale(1.5); } 100% { transform: scale(1); } }
@keyframes field { from { transform: rotate(-90deg) scale(.6); } to { transform: none; } }
@keyframes arml { from { transform: rotate(-90deg); } to { transform: none; } }
@keyframes armr { from { transform: rotate(90deg); } to { transform: none; } }
@keyframes ros { from { transform: rotate(-180deg) scale(.5); } to { transform: none; } }
@keyframes fadein { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Служебное */
#connection { max-width: 480px; margin: 0 auto; padding: 8px 16px; background: #eee5d4; display: flex; gap: 12px; align-items: center; justify-content: space-between; font-size: 14px; }
#connection[hidden] { display: none; }
#connection button { border: 1px solid var(--red); color: var(--red); background: transparent; border-radius: 16px; padding: 4px 12px; }
#notice { position: fixed; bottom: calc(96px + var(--telegram-bottom)); left: 16px; right: 16px; max-width: 448px; margin: auto; background: var(--ink); color: var(--linen); padding: 12px 16px; border-radius: 14px; z-index: 30; font-size: 14px; box-shadow: 0 8px 24px rgba(0, 0, 0, .25); }
#notice:empty { display: none; }
body[data-tab="word"] #notice { bottom: calc(24px + var(--telegram-bottom)); background: #2b241b; border: 1px solid rgba(231, 196, 106, .4); }
dialog#detail { width: min(440px, calc(100vw - 24px)); max-height: 86vh; border: 0; border-radius: 22px; padding: 0; background: var(--linen); color: var(--ink); box-shadow: 0 20px 60px rgba(0, 0, 0, .35); }
dialog#detail::backdrop { background: rgba(23, 18, 13, .55); }
dialog#detail .back { position: sticky; top: 0; margin: 12px; border: 0; background: var(--paper); border-radius: 18px; padding: 8px 14px; font-weight: 600; z-index: 1; }
.detail-body { padding: 0 20px 22px; display: grid; gap: 12px; }
.detail-body h2 { font-size: 28px; line-height: 1.05; }
.detail-photo { width: 100%; height: 180px; object-fit: cover; border-radius: 16px; }
.detail-meta { display: flex; gap: 10px; align-items: center; }
@media (prefers-reduced-motion: reduce) {
  .turn, .nav-row .spindle, .bubble, [aria-current="page"] * { animation: none !important; }
}

/* Летопись (шаг 6): весы / око, голос Ивы */
.lens { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.lens button { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; border-radius: 14px; border: 1.5px solid var(--line2); background: var(--paper); font-weight: 600; font-size: 14px; color: var(--muted); }
.lens button[aria-selected="true"] { border-color: var(--red); color: var(--red); background: #f7eadf; }
.entry .voice { font-size: 18px; line-height: 1.35; color: var(--ink); }
.entry .fact { font-size: 14px; color: var(--muted); }
.entry .reply { font-size: 16px; color: var(--ink); }
.entry .reply b { font-family: var(--ui); font-size: 13px; color: var(--muted); }
.entry.imp > div { border-left: 2px solid var(--red); padding-left: 12px; }
.entry-meta { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.entry-meta .eye .ico { width: 18px; height: 18px; color: var(--red); vertical-align: middle; }

/* Ива (шаг 6): длинные имена, знаки ведут в Азбуковник */
.portrait-name h1 { overflow-wrap: anywhere; hyphens: auto; }
.portrait-name h1.name-long { font-size: 40px; line-height: 1; }
.portrait-name h1.name-xl { font-size: 30px; line-height: 1.05; }
button.trait { color: inherit; font: inherit; }
button.trait b { font-size: 13px; }

/* Азбуковник */
.segments.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.segments.four button { font-size: 13px; padding: 0 4px; }
.glyph .sign { width: 34px; height: 30px; }
.detail-sign { display: grid; place-items: center; padding: 10px; }
.detail-sign .sign { width: 96px; height: 84px; }

/* Лист Доли (шаг 6): паспорт + Слово + вмешательства поверх Мира */
.veil { position: fixed; inset: 0; background: rgba(23, 18, 13, .45); z-index: 40; animation: veil .25s ease-out both; }
.dolya-sheet { position: fixed; left: 0; right: 0; bottom: 0; max-width: 480px; margin: 0 auto; max-height: calc(88vh - var(--telegram-top)); overflow-y: auto; z-index: 41; background: var(--night); color: var(--linen); border-radius: 24px 24px 0 0; padding-bottom: calc(18px + var(--telegram-bottom)); animation: rise .32s cubic-bezier(.2, .8, .2, 1) both; box-shadow: 0 -20px 50px rgba(0, 0, 0, .4); }
.dolya-sheet .band:first-child { border-radius: 24px 24px 0 0; }
body[data-sheet="open"] { overflow: hidden; }
.dolya-sheet .word-body { padding: 14px 22px 8px; gap: 14px; }
.passport { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; }
.passport h1 { font-size: 32px; line-height: 1; color: #f6e7c2; }
.nit { font-size: 12px; font-weight: 700; border-radius: 12px; padding: 4px 10px; border: 1px solid rgba(231, 196, 106, .45); color: var(--gold); white-space: nowrap; }
.nit[data-rel="strained"] { color: #f0b072; border-color: rgba(240, 176, 114, .5); }
.nit[data-rel="defiant"] { color: #ff8c7a; border-color: rgba(255, 140, 122, .5); }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.stats div { border: 1px solid rgba(242, 235, 221, .14); border-radius: 12px; padding: 8px 4px; display: grid; justify-items: center; }
.stats b { font-size: 22px; color: #f6e7c2; line-height: 1.1; }
.stats small { font-size: 11px; color: #bfb29c; }
.yarn { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; }
.yarn b { color: var(--gold); }
.reply-now { padding: 10px 12px; border-left: 3px solid var(--gold); background: rgba(231, 196, 106, .1); border-radius: 0 10px 10px 0; color: #fbf4e8; font-size: 17px; animation: fadein .4s ease-out both; }
.reply-now b { font-family: var(--ui); font-size: 13px; color: var(--gold); }
.actions.dark button { background: rgba(242, 235, 221, .05); border-color: rgba(242, 235, 221, .16); color: var(--linen); min-height: 92px; }
.actions.dark small { color: #bfb29c; }
.locked { opacity: .8; } .locked .ico { color: var(--gold); flex: 0 0 22px; }
/* Веретено: нить с летящими буквами вместо крутящегося колеса */
.spin { display: none; position: relative; height: 92px; }
#word-form.sending .spin { display: block; }
#word-form.sending .chips, #word-form.sending #word { display: none; }
#word-form.sending .spin { height: 120px; }
.spindle-ico { position: absolute; left: 50%; bottom: 0; width: 52px; height: 78px; margin-left: -26px; animation: twirl .5s linear infinite; transform-origin: 20px 40px; }
.sp-thread { stroke: var(--gold); stroke-width: 1.4; fill: none; }
.sp-body { fill: #8a5a2e; stroke: var(--gold2); stroke-width: 1; }
.sp-whorl { stroke: #c9332a; stroke-width: 3; stroke-linecap: round; }
.letters { position: absolute; left: 0; right: 0; bottom: 34px; height: 60px; text-align: center; }
.letters .l { position: absolute; left: 50%; bottom: 0; font-family: var(--story); color: #f6e7c2; font-size: 18px; animation: fly 1.6s ease-in infinite both; opacity: 0; }
.letters .d1 { animation-delay: .15s; } .letters .d2 { animation-delay: .3s; } .letters .d3 { animation-delay: .45s; }
.letters .d4 { animation-delay: .6s; } .letters .d5 { animation-delay: .75s; } .letters .d6 { animation-delay: .9s; }
.letters .d7 { animation-delay: 1.05s; } .letters .d8 { animation-delay: 1.2s; }
@keyframes twirl { from { transform: scaleX(1); } 50% { transform: scaleX(-1); } to { transform: scaleX(1); } }
@keyframes fly { 0% { opacity: 0; transform: translate(-50%, 0); } 20% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -70px) scale(.6); } }
@keyframes rise { from { transform: translateY(100%); } to { transform: none; } }
@keyframes veil { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .strip-photo, .dolya-sheet, .veil, .spindle-ico, .letters .l, .tick.fresh { animation: none !important; }
  .letters .l { opacity: 1; position: static; }
}
body[data-sheet="open"] #notice { z-index: 50; bottom: calc(24px + var(--telegram-bottom)); background: #2b241b; border: 1px solid rgba(231, 196, 106, .4); }
.nav-label { display: block; max-width: 100%; padding: 0 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.beat[data-role="verdict"] p .kur { font-size: 15px; color: var(--ink); }
.nav-row > button { font-size: 10.5px; letter-spacing: -.005em; }

/* Шаг 7: Доля читается как высшая сила */
.rosette.tiny { width: 15px; height: 15px; margin-right: 4px; vertical-align: -3px; }
.rosette.crest { width: 46px; height: 46px; flex: 0 0 46px; }
.dolya-sheet .rosette.crest .r-ring { fill: none; stroke: var(--gold); }
.dolya-sheet .rosette.crest .r-petals { fill: rgba(201, 51, 42, .35); stroke: var(--gold); }
.dolya-sheet .rosette.crest .r-dots { stroke: var(--gold); }
.who.god { color: #2f5f86; font-size: 12px; font-weight: 700; letter-spacing: .02em; display: inline-flex; align-items: center; }
.entry .who.god { margin: 0; }
.entry .quote { font-size: 18px; }

/* Шаг 7: лист Доли помещается без прокрутки до Воплощения */
.dolya-sheet { max-height: calc(100vh - 24px - var(--telegram-top)); }
.dolya-sheet .word-body { gap: 12px; padding-top: 10px; }
.sheet-head { display: flex; align-items: center; gap: 12px; }
.sheet-id { flex: 1; min-width: 0; }
.sheet-id h1 { font-size: 30px; line-height: 1; color: #f6e7c2; overflow-wrap: anywhere; }
.sheet-id .eyebrow { letter-spacing: .1em; }
.yarn { grid-template-columns: auto 1fr auto auto; }
.dolya-sheet #word-form { gap: 10px; }
.dolya-sheet #word { min-height: 64px; font-size: 16px; padding: 10px 14px; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -22px; padding: 0 22px; }
.chips.scroll::-webkit-scrollbar { display: none; }
.chips.scroll .chip { flex: 0 0 auto; min-height: 36px; font-size: 14px; }
.dolya-sheet .actions { margin-top: 0; }
.dolya-sheet .actions.dark button { min-height: 76px; padding: 8px 6px; }
.picker { display: grid; gap: 10px; }
.link-light { border: 0; background: transparent; color: var(--gold); font-size: 13px; font-weight: 600; padding: 4px 0; }
.options { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.options button { min-height: 76px; border-radius: 14px; border: 1px solid rgba(231, 196, 106, .35); background: rgba(242, 235, 221, .05); color: var(--linen); display: grid; gap: 4px; align-content: center; text-align: left; padding: 10px 12px; }
.options button:disabled { opacity: .45; }
.options strong { font-family: var(--story); font-weight: 400; font-size: 17px; color: #f6e7c2; line-height: 1.15; }
.options small { font-size: 12px; color: #bfb29c; }
/* Воплощение — кнопка с узором, пока закрыта */
.voplo { position: relative; width: 100%; border: 1px solid rgba(231, 196, 106, .4); border-radius: 16px; background: #221a12; color: #f6e7c2; padding: 0; overflow: hidden; display: grid; cursor: not-allowed; }
.voplo .band { height: 14px; opacity: .55; }
.voplo-face { display: flex; align-items: center; justify-content: center; gap: 12px; min-height: 46px; font-size: 22px; opacity: .65; }
.voplo-face .ico { width: 18px; height: 18px; color: var(--gold); }
.dolya-sheet .stats { margin-top: -4px; }

/* Шаг 7: анкета «Стань Долей» */
.quiz { display: grid; gap: 14px; }
.quiz h1 { font-size: 36px; line-height: 1.05; }
.quiz label[for] { font-size: 13px; font-weight: 600; color: var(--muted); }
.quiz input[type="text"], .quiz input:not([type]) { min-height: 50px; border-radius: 14px; border: 1.5px solid var(--line2); background: var(--paper); padding: 0 14px; font-size: 17px; }
.quiz-dots { display: flex; gap: 6px; }
.quiz-dots span { width: 26px; height: 4px; border-radius: 2px; background: var(--line2); }
.quiz-dots span.on { background: var(--red); }
.choices { display: grid; gap: 8px; }
.choices.two { grid-template-columns: 1fr 1fr; }
.choice { position: relative; display: block; cursor: pointer; }
.choice input { position: absolute; opacity: 0; }
.choice > span { display: grid; gap: 3px; border: 1.5px solid var(--line2); border-radius: 14px; background: var(--paper); padding: 12px 14px; min-height: 64px; }
.choice b { font-size: 16px; } .choice small { font-size: 13px; color: var(--muted); line-height: 1.35; }
.choice input:checked + span { border-color: var(--red); background: #f7eadf; box-shadow: inset 0 0 0 1px var(--red); }
.choice input:focus-visible + span { outline: 2px solid var(--gold2); outline-offset: 2px; }
.choice.off { cursor: not-allowed; opacity: .5; }
.quiz-nav { display: flex; gap: 10px; }
.quiz-nav .ghost { flex: 0 0 auto; padding: 0 18px; }
.birth-photo.compact { height: 130px; }
.dolya-sheet { min-height: calc(100vh - 24px - var(--telegram-top)); }

#word-trace { margin: .5rem 0; padding: .5rem .8rem; border-inline-start: 2px solid #a52a1f; overflow-wrap: anywhere; }
#word-trace p { margin: .2rem 0; }

/* The SDK updates its safe-area variables on orientation and Telegram chrome changes. */
:root {
  --telegram-top: max(env(safe-area-inset-top, 0px), calc(var(--tg-safe-area-inset-top, 0px) + var(--tg-content-safe-area-inset-top, 0px)));
  --telegram-bottom: max(env(safe-area-inset-bottom, 0px), calc(var(--tg-safe-area-inset-bottom, 0px) + var(--tg-content-safe-area-inset-bottom, 0px)));
  --inset-left: max(env(safe-area-inset-left, 0px), calc(var(--tg-safe-area-inset-left, 0px) + var(--tg-content-safe-area-inset-left, 0px)));
  --inset-right: max(env(safe-area-inset-right, 0px), calc(var(--tg-safe-area-inset-right, 0px) + var(--tg-content-safe-area-inset-right, 0px)));
  --game-height: 100dvh;
}
body, #navigation { padding-inline: var(--inset-left) var(--inset-right); }
main#page { min-height: var(--game-height); }
.dolya-sheet { min-height: calc(var(--game-height) - 24px - var(--telegram-top)); max-height: calc(var(--game-height) - 24px - var(--telegram-top)); left: var(--inset-left); right: var(--inset-right); }
.dolya-entry { padding: var(--telegram-top) 0 var(--telegram-bottom); min-height: var(--game-height); background: var(--paper); }
.dolya-entry > img { width: 100%; height: clamp(180px, 43vh, 390px); object-fit: cover; object-position: 50% 28%; display: block; }
.entry-thread { display: grid; place-items: center; background: linear-gradient(transparent 47%,var(--red) 48% 53%,transparent 54%); }
.entry-intro { padding: 18px 26px 36px; display: grid; gap: 18px; }
.entry-intro h1 { font-size: clamp(38px, 11vw, 60px); line-height: 1; }
.entry-intro p { font-size: 20px; line-height: 1.45; }
[data-telegram-theme="dark"] .dolya-entry, [data-telegram-theme="dark"] .welcome { background: #201b16; color: #f2ebdd; }

@media (max-width: 400px) {
  .atlas .page-head h1 { font-size: clamp(28px, 8.5vw, 34px); }
}

.ledger { margin: 0 auto; max-width: 30rem; padding: clamp(30px,12vh,100px) 24px; text-align: center; color: #493422; background: #f2ebdd; font-family: Georgia, serif; }
.ledger h1 { margin: 12px 0 4px; }
.ledger p { margin: 0; }
@media (prefers-reduced-motion: no-preference) {
  .ledger-thread { stroke-dasharray: 100; animation: thread-page 2.2s ease-in-out infinite alternate; }
  @keyframes thread-page { from { stroke-dashoffset: 90; } to { stroke-dashoffset: 0; } }
}
.dolya-entry { padding-inline: 18px; padding-top: calc(var(--telegram-top) + 16px); }
.dolya-entry > img { height: clamp(85px, 24vh, 180px); border-radius: 48% 48% 0 0; background: #b3a17a; }
.entry-intro { padding: 12px 6px 20px; gap: 12px; }
