:root {
  --enamel: #1d3f8f; --ink: #1a2030; --muted: #626b7e; --line: #e4e8ef; --paper: #fff; --soft: #f3f5f9;
  --gas: #ffc52e; --gas-deep: #f2b200; --alarm: #d93a3f; --ok: #23875a; --ok-soft: #e3f4ea; --alarm-soft: #fdeaea;
  --r: 16px; --shadow: 0 1px 2px rgba(20, 30, 60, .16), 0 8px 24px rgba(20, 30, 60, .18);
  --gap: max(12px, env(safe-area-inset-left));
  --font: "Golos Text", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; overflow: hidden; background: #99d9ea; }
body { font: 14px/1.4 var(--font); color: var(--ink); -webkit-font-smoothing: antialiased; font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }
body:not(.online) .online-only, body.guest .online-only, body:not(.admin):not(.local) .admin-only { display: none !important; }
body.guest #corner { display: none; }
body.readonly #dock, body.readonly .acts, body.readonly form { display: none; }

/* ================= сцена ================= */
#scene { position: fixed; inset: 0; overflow: hidden; isolation: isolate; cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; }
#scene.dragging { cursor: grabbing; }
#scene svg:not(.ico) { position: absolute; left: 0; top: 0; display: block; pointer-events: none; will-change: transform; overflow: hidden; }
#scene svg.lamp-in-sky { left: auto; right: 0; overflow: visible; transform-origin: 100% 0; transition: transform .6s linear, opacity .6s linear, filter .6s linear; }
#scene svg [data-hint] { pointer-events: auto; cursor: pointer; }
#layer-light { mix-blend-mode: multiply; }
#scene text { font-family: "Comic Sans MS", "Balsamiq Sans", cursive; }

#weather { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }

.leaf { transform-box: fill-box; transition: transform .35s ease-in-out; }
.leaf.hinge-l { transform-origin: 0% 100%; }
.leaf.hinge-r { transform-origin: 100% 100%; }
.open > .leaf.hinge-l { transform: scaleX(.3) skewY(7deg); }
.open > .leaf.hinge-r { transform: scaleX(.3) skewY(-7deg); }
.curtain-shut { display: none; }
.shut > .curtain-shut { display: inline; }
.shut > .curtain-open { display: none; }
.dim { transition: opacity .25s; }
.lit { transition: opacity .25s; opacity: 0; }
.lit.on { opacity: 1; }
.lit.tv.on { animation: tv 2.3s steps(1) infinite; }
@keyframes tv { 0% { opacity: 1 } 20% { opacity: .7 } 35% { opacity: .95 } 60% { opacity: .6 } 75% { opacity: .9 } }
/* качается из js/yard.js (tickWind), редкими кадрами */
.sway { transform-box: fill-box; transform-origin: 50% 0; }
.breeze { transform-box: fill-box; transform-origin: 50% 100%; }
.tail { transform-box: fill-box; transform-origin: 0 100%; }
.boil-a { animation: boil .9s steps(1) infinite; }
.boil-b { animation: boil .9s steps(1) -.45s infinite; }
.strobe-a { animation: strobe 1.4s steps(1) infinite; }
.strobe-b { animation: strobe 1.4s steps(1) -.7s infinite; }
@keyframes strobe { 0% { visibility: visible } 14% { visibility: hidden } 22% { visibility: visible } 36% { visibility: hidden } }
.shine { mix-blend-mode: lighten; }   /* свет только добавляет: днём его не видно, в сумерках он ничего не темнит */
@keyframes boil { 0% { visibility: visible } 50% { visibility: hidden } }
.night-only { display: none; }
.person.behind { display: none; }                 /* ушли вглубь квартиры за задёрнутые шторы */
.night .night-only { display: inline; }
.money { animation: money 2.6s ease-out forwards; }
@keyframes money { from { transform: translateY(0); opacity: 1 } 70% { opacity: 1 } to { transform: translateY(-110px); opacity: 0 } }

/* ================= основа интерфейса ================= */
button, input, textarea { font: inherit; color: inherit; }
button { border: 0; background: none; padding: 0; cursor: pointer; text-align: inherit; }
:focus-visible { outline: 3px solid var(--gas); outline-offset: 2px; }
.ico { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.card { background: var(--paper); border-radius: var(--r); box-shadow: var(--shadow); }
.chip { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px; background: var(--paper); border-radius: 20px; box-shadow: var(--shadow); font-weight: 600; white-space: nowrap; }
.chip.icon { padding: 0 9px; }
.cap { font-size: 12px; color: var(--muted); margin: 0; }
h2, h3 { margin: 0; line-height: 1.2; text-wrap: balance; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 16px; border-radius: 12px; font-weight: 600; background: var(--soft); transition: background .15s; white-space: nowrap; }
.btn:hover { background: #e8ecf3; }
.btn.main { background: var(--gas); }
.btn.main:hover { background: var(--gas-deep); }
.btn:disabled { opacity: .5; cursor: default; }
.field { width: 100%; min-width: 0; min-height: 42px; padding: 10px 14px; border: 1.5px solid var(--line); border-radius: 12px; background: #fff; }
.field::placeholder { color: #6f7789; }
.field:focus { border-color: var(--enamel); outline: none; }
.row { display: flex; gap: 8px; align-items: center; }

/* ================= табличка ================= */
#hud { position: fixed; left: var(--gap); top: var(--gap); display: flex; align-items: stretch; background: var(--paper); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; z-index: 3; }
.plate { background: var(--enamel); color: #fff; padding: 6px 13px 5px; text-align: center; position: relative; min-width: 76px; }
.plate::after { content: ""; position: absolute; inset: 3px; border: 1.5px solid rgba(255, 255, 255, .85); border-radius: 10px 4px 4px 10px; }
.plate small { display: block; font-size: 9.5px; font-weight: 500; line-height: 1; margin-top: 5px; white-space: nowrap; }
.plate b { display: block; font-size: 27px; line-height: 1.05; font-weight: 800; }
.metric { padding: 7px 16px 8px; min-width: 88px; border-left: 1px solid var(--line); display: flex; flex-direction: column; justify-content: center; }
.metric:first-of-type { border-left: 0; min-width: 124px; }
.metric:hover { background: var(--soft); }
.metric:focus-visible { outline-offset: -3px; }
.metric b { font-size: 18px; font-weight: 700; line-height: 1.15; white-space: nowrap; }
.metric .cap { line-height: 1.2; }
.metric .sub { font-size: 12px; color: var(--ok); line-height: 1.2; white-space: nowrap; }
.bar { display: block; height: 4px; border-radius: 2px; background: var(--line); margin-top: 4px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 50%; border-radius: 2px; background: var(--enamel); transition: width .6s; }
.bar i.low { background: var(--alarm); }
.bar i.high { background: var(--ok); }

#corner { position: fixed; right: var(--gap); top: var(--gap); display: flex; gap: 8px; z-index: 7; }
#clock-ico { color: var(--gas-deep); fill: var(--gas); }
#menu { position: absolute; right: 0; top: 48px; width: 250px; padding: 8px; display: grid; gap: 2px; }
#menu button { display: block; width: 100%; padding: 9px 12px; border-radius: 10px; font-weight: 500; }
#menu button:hover { background: var(--soft); }
.sandbox { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 8px; }
.sandbox .cap { padding: 2px 12px 4px; }
#event-form { display: flex; gap: 4px; padding: 4px; }
#event-form input { flex: 1; min-width: 0; padding: 7px 10px; border: 1.5px solid var(--line); border-radius: 10px; }
#menu #event-form button { width: auto; background: var(--gas); }

.shake { animation: shake .26s linear; }
@keyframes shake { 20% { transform: translate(3px, -2px); } 40% { transform: translate(-3px, 2px); } 60% { transform: translate(2px, 1px); } 80% { transform: translate(-2px, -1px); } }
@keyframes pulse { 50% { opacity: .3 } }
#toast { position: fixed; top: calc(var(--gap) + 62px); left: 50%; transform: translateX(-50%); width: max-content; max-width: min(440px, calc(100vw - 24px)); background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 14px; box-shadow: var(--shadow); z-index: 12; font-weight: 500; text-align: center; }
#tip { position: fixed; left: 0; top: 0; max-width: 260px; background: var(--ink); color: #fff; font-size: 13px; padding: 5px 10px; border-radius: 9px; pointer-events: none; z-index: 7; will-change: transform; }
#ticker { position: fixed; left: var(--gap); bottom: calc(var(--gap) + 4px); max-width: min(330px, calc(50vw - 270px)); background: var(--paper); box-shadow: var(--shadow); border-radius: 14px; padding: 9px 14px; font-size: 13px; line-height: 1.35; z-index: 3; }
#ticker b { display: block; font-size: 12px; font-weight: 500; color: var(--muted); }

/* ================= нижняя панель ================= */
#dock { position: fixed; left: 50%; bottom: var(--gap); transform: translateX(-50%); display: flex; gap: 2px; padding: 6px; background: var(--paper); border-radius: 20px; box-shadow: var(--shadow); z-index: 5; }
#dock button { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 92px; padding: 7px 8px 6px; border-radius: 14px; font-size: 12px; font-weight: 500; color: #3b4356; transition: background .15s; }
#dock button:hover { background: var(--soft); }
#dock button.on { background: var(--gas); color: var(--ink); }
#dock em { position: absolute; top: 3px; left: calc(50% + 7px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--alarm); color: #fff; font: 700 11px/18px var(--font); text-align: center; }

/* ================= окно справа ================= */
#sheet { position: fixed; right: var(--gap); top: calc(var(--gap) + 52px); bottom: calc(var(--gap) + 82px); width: 384px; display: flex; flex-direction: column; z-index: 6; animation: slide .22s ease-out; }
@keyframes slide { from { transform: translateX(24px); opacity: 0 } }
.sheet-head { display: flex; align-items: center; gap: 8px; padding: 14px 10px 10px 20px; }
.sheet-head h2 { flex: 1; font-size: 20px; font-weight: 700; }
.sheet-head button { padding: 8px; border-radius: 10px; color: var(--muted); }
.sheet-head button:hover { background: var(--soft); }
#sheet-back { margin-left: -10px; }
#sheet-body { flex: 1; min-height: 0; overflow-y: auto; padding: 2px 20px 20px; scrollbar-width: thin; }
.group { font-size: 13px; font-weight: 600; color: var(--muted); margin: 18px 0 8px; }
.group:first-child { margin-top: 2px; }
.item { display: flex; gap: 12px; align-items: center; width: 100%; padding: 10px 0; border-bottom: 1px solid var(--line); }
.item:last-child { border-bottom: 0; }
button.item:hover .ttl { color: var(--enamel); }
.item .txt { flex: 1; min-width: 0; }
.item .ttl { font-weight: 600; line-height: 1.3; }
.item .cap { margin-top: 1px; }
.glyph { width: 42px; height: 42px; border-radius: 12px; background: var(--soft); display: grid; place-items: center; flex: none; color: var(--enamel); }
.glyph.hot { background: var(--alarm-soft); color: var(--alarm); }
.glyph.done { background: var(--ok-soft); color: var(--ok); }
.face { width: 44px; height: 44px; border-radius: 50%; overflow: hidden; flex: none; background: #dbe7f5; }
.face svg { width: 100%; height: 100%; display: block; }
.faces { display: inline-flex; }
.faces .face { width: 24px; height: 24px; margin-left: -6px; box-shadow: 0 0 0 2px #fff; }
.faces .face:first-child { margin-left: 0; }
.price { font-weight: 700; white-space: nowrap; }
.tag { display: inline-block; font-size: 12px; font-weight: 500; padding: 3px 10px; border-radius: 10px; background: var(--soft); margin: 0 4px 4px 0; }
.tag.bad { background: var(--alarm-soft); color: var(--alarm); }
.empty { padding: 22px 0; color: var(--muted); text-align: center; text-wrap: balance; }
.news { padding: 9px 0; border-bottom: 1px solid var(--line); line-height: 1.4; }
.news.complaint { color: var(--alarm); }
.news.chore { color: var(--ok); }
.news time { display: block; font-size: 12px; color: var(--muted); }
.mark { text-align: center; font-size: 12px; color: var(--muted); padding: 10px 0; }
.sheet-note { border: 1.5px solid var(--line); border-radius: 14px; padding: 14px; background: #fffdf3; }
.sheet-note textarea { width: 100%; min-height: 110px; border: 0; background: none; resize: none; font: 500 17px/1.45 "Comic Sans MS", "Balsamiq Sans", var(--font); outline: none; }
.sheet-note:focus-within { border-color: var(--enamel); }
.ideas { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 14px; }
.ideas button { font-size: 13px; padding: 6px 12px; border-radius: 12px; background: var(--soft); }
.ideas button:hover { background: #e8ecf3; }
.who { display: flex; gap: 14px; align-items: center; margin-bottom: 12px; }
.who .face { width: 78px; height: 78px; }
.who h3 { font-size: 19px; }
.about { margin: 10px 0; }
.kv { margin: 0; }
.talkbox { margin-top: 12px; }
/* домофон: что сказал управдом, что ответили */
.call { display: grid; gap: 7px; max-height: 190px; overflow-y: auto; margin-bottom: 10px; padding: 2px; }
.call p { margin: 0; }
.call-me { justify-self: end; max-width: 86%; padding: 7px 12px 8px; border-radius: 15px 15px 4px 15px; background: #e4edff; animation: ring-in .28s cubic-bezier(.3, 1.4, .6, 1); }
.call-me small { display: block; margin-bottom: 1px; font-size: 11px; font-weight: 700; color: var(--enamel); }
.call-them { display: flex; gap: 8px; align-items: flex-end; max-width: 92%; animation: ring-in .28s ease-out; }
.call-them p { padding: 7px 12px 8px; border-radius: 15px 15px 15px 4px; background: var(--soft); }
.call-them .face { flex: none; width: 30px; height: 30px; }
.call-them .face svg { position: static; width: 100%; height: 100%; }
.call-note { justify-self: center; font-size: 13px; color: var(--muted); }
.call-wait { display: flex; gap: 6px; align-items: center; font-size: 13px; color: var(--muted); }
.dots { display: inline-flex; gap: 3px; }
.dots i { width: 5px; height: 5px; border-radius: 50%; background: currentColor; animation: dot 1.1s infinite; }
.dots i:nth-child(2) { animation-delay: .15s; } .dots i:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 0%, 60%, 100% { transform: none; opacity: .4; } 30% { transform: translateY(-3px); opacity: 1; } }
@keyframes ring-in { from { opacity: 0; transform: translateY(6px) scale(.96); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .call-me, .call-them, .dots i { animation: none; } }
.kv dt { font-size: 12px; color: var(--muted); }
.kv dd { margin: 1px 0 10px; }
.grow { flex: 1; }

/* ================= карточка над панелью ================= */
#card { position: fixed; left: 50%; bottom: calc(var(--gap) + 84px); transform: translateX(-50%); width: min(460px, calc(100vw - 24px)); padding: 14px 16px; z-index: 5; animation: rise .18s ease-out; }
@keyframes rise { from { transform: translate(-50%, 10px); opacity: 0 } }
#card .top { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; }
#card .top .txt { flex: 1; min-width: 0; }
#card h3 { font-size: 16px; }
#card .x { padding: 6px; border-radius: 9px; color: var(--muted); align-self: flex-start; }
#card .x:hover { background: var(--soft); }
#card .more { font-size: 13px; font-weight: 600; color: var(--enamel); white-space: nowrap; }
#card .acts { display: flex; flex-wrap: wrap; gap: 8px; }
#card .acts .btn { flex: 1 1 auto; }
.helpers { display: grid; gap: 2px; margin-top: 10px; border-top: 1px solid var(--line); padding-top: 8px; }
.helpers button { display: flex; gap: 10px; align-items: center; padding: 6px; border-radius: 12px; }
.helpers button:hover { background: var(--soft); }
.helpers .face { width: 36px; height: 36px; }
.helpers .txt { flex: 1; }
.helpers b { font-weight: 600; display: block; line-height: 1.25; }

/* ================= метки поломок ================= */
#pins { position: absolute; inset: 0; pointer-events: none; }
.pin { position: absolute; left: 0; top: 0; width: 40px; height: 46px; margin: -50px 0 0 -20px; pointer-events: auto; will-change: transform; }
.pin span { position: absolute; inset: 0 0 6px; border-radius: 50%; background: #fff; border: 3px solid var(--gas); box-shadow: 0 2px 8px rgba(20, 30, 60, .35); display: grid; place-items: center; animation: bob 2.4s ease-in-out infinite; color: var(--ink); }
.pin span::after { content: ""; position: absolute; left: 50%; bottom: -8px; margin-left: -6px; border: 6px solid transparent; border-top: 7px solid var(--gas); border-bottom: 0; }
.pin.hot span { border-color: var(--alarm); color: var(--alarm); }
.pin.hot span::after { border-top-color: var(--alarm); }
.pin.busy span { border-color: var(--ok); color: var(--ok); }
.pin.busy span::after { border-top-color: var(--ok); }
.pin .ico { width: 20px; height: 20px; }
.pin:hover span { background: #fff7dc; }
@keyframes bob { 50% { transform: translateY(-4px) } }

.pin.clue span { border-color: var(--enamel); color: #fff; background: var(--enamel); animation: clue 1.1s ease-in-out infinite; }
.pin.clue span::after { border-top-color: var(--enamel); }
.pin.clue:hover span { background: #2b55b8; }
@keyframes clue { 50% { transform: scale(1.14); box-shadow: 0 0 0 9px rgba(29, 63, 143, .28) } }

/* ================= тайны и споры ================= */
.tag.hot { background: var(--gas); margin: 0; font-weight: 600; }
.item .tag { margin: 0; white-space: nowrap; }
.progress { display: flex; justify-content: space-between; padding: 11px 14px; border-radius: 12px; background: var(--soft); margin-bottom: 6px; }
.slot { font-size: 14px; line-height: 1.4; }
.slot.no { color: var(--muted); }
.slot.no .glyph { color: #8b93a5; }
.secret { font-size: 16px; font-weight: 600; line-height: 1.4; margin: 2px 0 8px; text-wrap: pretty; }
.ask { margin: 14px 0 8px !important; font-size: 13px; font-weight: 600; }
.choice { display: flex; gap: 12px; align-items: center; width: 100%; padding: 11px 14px; margin-bottom: 6px; border-radius: 12px; border: 1.5px solid var(--line); transition: border-color .15s, background .15s; }
.choice:hover:not(:disabled) { border-color: var(--gas-deep); background: #fffaea; }
.choice:disabled { opacity: .55; cursor: default; }
.choice .txt { flex: 1; }
.choice b { font-weight: 600; display: block; line-height: 1.3; }
.choice b.no { text-decoration: line-through; }
.btn.wide { width: 100%; margin-top: 10px; white-space: normal; }
.clue-text { margin: 0 0 12px; font-size: 16px; line-height: 1.4; text-wrap: pretty; }
.side { display: flex; gap: 10px; align-items: flex-end; margin-bottom: 14px; }
.side.right { flex-direction: row-reverse; }
.side .face { width: 64px; height: 64px; }
.side .say { flex: 1; background: var(--soft); border-radius: 16px 16px 16px 4px; padding: 10px 14px; line-height: 1.4; }
.side.right .say { border-radius: 16px 16px 4px 16px; background: #fff6dc; }
.side .say b { display: block; font-size: 12px; font-weight: 600; color: var(--muted); }
.news.secret, .news.rule { color: var(--enamel); }
.news.holiday { color: #a8480f; }
.glyph.fest { background: #fff3d1; color: #b06a00; }
.sb { padding: 4px 8px; }
.sb select { flex: 1; min-width: 0; padding: 6px; border: 1.5px solid var(--line); border-radius: 9px; background: #fff; font: inherit; }
#clock { cursor: pointer; }

/* ================= вестник ================= */
#paper { position: fixed; inset: 0; background: rgba(20, 28, 50, .5); display: grid; place-items: center; padding: 16px; z-index: 10; }
#paper article { width: min(520px, 100%); max-height: calc(100dvh - 32px); overflow-y: auto; padding: 26px 28px 24px; }
#paper h2 { font-size: 30px; font-weight: 800; text-align: center; }
#paper .date { text-align: center; color: var(--muted); border-bottom: 3px double var(--ink); padding-bottom: 12px; margin: 4px 0 14px; }
#paper ul { list-style: none; margin: 0 0 18px; padding: 0; }
#paper li { padding: 9px 0; border-bottom: 1px solid var(--line); line-height: 1.45; }
#paper li:first-child { font-size: 18px; font-weight: 600; line-height: 1.35; }
#paper .sum { display: flex; gap: 24px; margin-bottom: 18px; }
#paper .sum b { display: block; font-size: 20px; }
#paper .btn { width: 100%; }

/* ================= вход ================= */
#auth { position: fixed; inset: 0; z-index: 20; display: grid; align-items: center; justify-items: start; padding: 16px clamp(16px, 7vw, 120px); overflow-y: auto; }
#auth .card { width: min(400px, 100%); padding: 26px 28px; }
.brand { display: flex; gap: 16px; align-items: center; margin-bottom: 18px; }
.brand .plate { border-radius: 12px; flex: none; padding: 9px 14px 8px; }
.brand .plate::after { border-radius: 9px; }
.brand h1 { margin: 0; font-size: 26px; font-weight: 800; line-height: 1.15; }
.brand p { margin: 3px 0 0; color: var(--muted); line-height: 1.4; text-wrap: pretty; overflow-wrap: anywhere; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; background: var(--soft); border-radius: 14px; margin-bottom: 16px; }
.tabs button { padding: 9px; border-radius: 11px; text-align: center; font-weight: 600; color: var(--muted); }
.tabs button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(20, 30, 60, .18); }
.frow { display: block; position: relative; margin-bottom: 12px; }
.frow .cap { display: block; margin-bottom: 4px; font-size: 13px; }
.eye { position: absolute; right: 8px; bottom: 6px; padding: 5px; color: var(--muted); border-radius: 8px; }
.eye.on { color: var(--enamel); }
#auth form .btn { width: 100%; min-height: 46px; margin-top: 4px; }
#auth .more { display: block; margin: 14px auto 0; font-weight: 600; color: var(--enamel); padding: 4px; }
#auth .note { margin-top: 14px; text-wrap: pretty; }
.err { margin: 0 0 12px; color: var(--alarm); background: var(--alarm-soft); padding: 9px 13px; border-radius: 10px; }
.stack .btn { width: 100%; }
.btn.danger { background: var(--alarm-soft); color: var(--alarm); }
a.btn { text-decoration: none; color: inherit; }
details { margin-top: 22px; }
summary { cursor: pointer; padding: 6px 0; }
details .cap { margin-bottom: 8px; }
#watching { position: fixed; left: 50%; bottom: var(--gap); transform: translateX(-50%); z-index: 6; background: var(--enamel); color: #fff; }
#watching a { color: var(--gas); }

/* ================= телефон ================= */
@media (max-width: 1000px) { #ticker { max-width: min(330px, calc(100vw - 24px)); bottom: calc(var(--gap) + 84px); } }
@media (max-width: 760px) {
  #hud { right: var(--gap); }
  .plate { min-width: 0; padding: 6px 10px; }
  .plate small { display: none; }
  .plate b { font-size: 24px; line-height: 46px; }
  .metric, .metric:first-of-type { flex: 1; min-width: 0; padding: 7px 10px; }
  .metric b { font-size: 15px; }
  .metric .sub { font-size: 11px; }
  #corner { top: calc(var(--gap) + 70px); }
  #dock { left: var(--gap); right: var(--gap); transform: none; justify-content: space-between; }
  #dock button { min-width: 0; flex: 1; padding: 7px 2px 6px; font-size: 11px; }
  #sheet { left: 0; right: 0; bottom: 0; top: auto; width: auto; height: min(76dvh, 640px); border-radius: 22px 22px 0 0; animation-name: up; z-index: 9; }
  @keyframes up { from { transform: translateY(40px); opacity: 0 } }
  #paper article { padding: 20px 18px; }
}
@media (prefers-reduced-motion: reduce) {
  .boil-a, .strobe-a, .strobe-b, .lit.tv.on, .pin span, .pin.clue span, .shake, #sheet, #card { animation: none; }
  .boil-b { display: none; }
}

/* ---- живой двор: цензура, досье ---- */
.news.fight { color: #b3261e; }
.news.affair { color: #a3366b; }
.news.prank { color: #7a5a00; }
.swrow { align-items: flex-start; gap: 14px; }
.swrow .txt { flex: 1; min-width: 0; }
.switch { flex: none; width: 48px; height: 28px; border-radius: 14px; border: 0; padding: 3px; background: #c9ced6; cursor: pointer; transition: background .15s; }
.switch i { display: block; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px #0005; transition: transform .15s; }
.switch.on { background: var(--alarm); }
.switch.on i { transform: translateX(20px); }
.agebox { margin-top: 10px; padding: 12px 14px; border-radius: 12px; background: #fdeeea; }
.agebox p { margin: 0 0 10px; line-height: 1.4; }
.agebox .acts { display: flex; flex-wrap: wrap; gap: 8px; }
.tag.love { background: #fbe3ee; color: #a3366b; }
.hear { display: flex; gap: 10px; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--line); }
.hear .face { width: 34px; height: 34px; flex: none; }
.hear .txt { min-width: 0; line-height: 1.35; }
.rels { display: flex; flex-wrap: wrap; gap: 8px; }
.rel { display: flex; align-items: center; gap: 7px; padding: 4px 11px 4px 4px; border: 0; border-radius: 20px; font: inherit; font-size: 14px; cursor: pointer; background: #e2f1da; color: #1f5a2c; }
.rel.foe { background: #fde3de; color: #93251b; }
.rel .face { width: 28px; height: 28px; flex: none; }
.stagegrid { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; }
.convhead { margin: 18px 0 8px; padding: 9px 12px; border-radius: 10px; background: #eef1f6; line-height: 1.3; }
.convhead:first-child { margin-top: 0; }
.convhead.now { background: #fff1c9; }
.convhead b, .convhead .cap { display: block; }
.said { display: flex; gap: 9px; align-items: flex-start; padding: 5px 0; }
.said .face { width: 32px; height: 32px; flex: none; }
.said .txt { min-width: 0; line-height: 1.35; }
.said b { font-size: 13px; color: var(--muted); font-weight: 600; }
.said p { margin: 1px 0 0; }
.said p.loud { font-weight: 700; }
.said p.soft { color: var(--muted); }
.said.same { padding-top: 0; }
.said.same .face { visibility: hidden; height: 0; }
.said.same b { display: none; }
/* ---- отношения ---- */
.emote { pointer-events: none; }
.tie { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 0; border: 0; border-bottom: 1px solid var(--line); background: none; font: inherit; text-align: left; cursor: pointer; color: inherit; }
.tie:hover { background: #f5f6f9; }
.tie .face { width: 36px; height: 36px; }
.tie .faces .face { width: 30px; height: 30px; }
.tie .txt { flex: 1; min-width: 0; line-height: 1.32; }
.tie .ttl { display: block; }
.tie .ttl em { margin-left: 7px; padding: 1px 7px; border-radius: 8px; background: #fff1c9; color: #7a5a00; font-size: 12px; font-style: normal; }
.tie .cap { display: block; }
.heat { position: relative; flex: none; width: 58px; height: 8px; border-radius: 4px; background: #e6e9ef; overflow: hidden; }
.heat::after { content: ""; position: absolute; left: 50%; top: 0; width: 1px; height: 100%; background: #aeb5c2; }
.heat i { position: absolute; top: 0; height: 100%; }
.heat.pal i { background: #2f9e5b; }
.heat.foe i { background: #d23b2f; }
.back { margin: 3px 0 8px 46px; font-size: 13px; line-height: 1.35; color: var(--muted); }
.btn.peace { margin: 0 0 10px 46px; }
.ring { position: relative; width: 100%; max-width: 340px; aspect-ratio: 1; margin: 2px auto 8px; }
.ring svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.ring .node { position: absolute; width: 44px; height: 44px; padding: 2px; border: 0; border-radius: 50%; background: #fff; transform: translate(-50%, -50%); cursor: pointer; box-shadow: 0 1px 4px #0003; transition: opacity .15s; }
.ring .node .face { width: 40px; height: 40px; }
.ring .node.on { box-shadow: 0 0 0 3px var(--enamel); z-index: 1; }
.ring .node.dim { opacity: .35; }
.ring .node:focus-visible { outline: 3px solid var(--enamel); outline-offset: 2px; }
.legend { display: flex; justify-content: center; gap: 16px; margin-bottom: 10px; font-size: 13px; color: var(--muted); }
.legend span::before { content: ""; display: inline-block; width: 18px; height: 4px; margin-right: 6px; border-radius: 2px; vertical-align: middle; }
.legend .pal::before { background: #2f9e5b; }
.legend .foe::before { background: #d23b2f; }
.legend .crush::before { background: repeating-linear-gradient(90deg, #e0558f 0 3px, transparent 3px 6px); }
.tiehead { margin: 14px 0 4px; }
/* ---- настройки двора ---- */
.trashhead { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.trashhead b { font-size: 22px; }
.trashnum { font-size: 13px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.trashnote { min-height: 2.9em; margin-bottom: 12px; color: var(--ink); }
.trash { width: 100%; height: 34px; margin: 10px 0 2px; appearance: none; background: none; cursor: pointer; }
.trash::-webkit-slider-runnable-track { height: 10px; border-radius: 5px; background: linear-gradient(90deg, #7fb86a, #e0b23a 45%, #c8502e 75%, #5a2a22); }
.trash::-moz-range-track { height: 10px; border-radius: 5px; background: linear-gradient(90deg, #7fb86a, #e0b23a 45%, #c8502e 75%, #5a2a22); }
.trash::-webkit-slider-thumb { appearance: none; width: 28px; height: 28px; margin-top: -9px; border-radius: 50%; border: 3px solid var(--ink); background: #fff; }
.trash::-moz-range-thumb { width: 24px; height: 24px; border-radius: 50%; border: 3px solid var(--ink); background: #fff; }
.trash:focus-visible { outline: 3px solid var(--enamel); outline-offset: 3px; border-radius: 8px; }
.trashends { display: flex; justify-content: space-between; margin-bottom: 12px; font-size: 13px; color: var(--muted); }
.metric[data-trend=up] b::after, .metric[data-trend=down] b::after { content: "▲"; margin-left: 4px; font-size: 10px; color: var(--ok); vertical-align: 3px; }
.metric[data-trend=down] b::after { content: "▼"; color: var(--alarm); }
.why { padding: 8px 12px; border-radius: 10px; background: #f0f2f7; }
/* ---- доска объявлений и карточка квартиры ---- */
.posted { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line, #e6e3da); }
.posted .txt { flex: 1; white-space: pre-line; font-size: 14px; }
.flatno { font-weight: 700; font-size: 18px; }
.flatpeople { display: grid; gap: 6px; margin-top: 10px; }
.flatman { display: flex; align-items: center; gap: 10px; }
.flatman .txt { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.flatman .acts { display: flex; gap: 6px; }
@media (max-width: 520px) { .flatman { flex-wrap: wrap; } .flatman .acts { width: 100%; } .flatman .acts .btn { flex: 1; } }
/* ---- туман: четыре полосы, едут силами видеокарты ---- */
#fog { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
#fog[hidden] { display: none; }
#fog i { position: absolute; left: -640px; right: -640px; height: 34%; background-repeat: repeat-x; background-size: 640px 100%; will-change: transform; animation: drift 70s linear infinite; }
#fog i:nth-child(1) { top: 26%; opacity: .2; }
#fog i:nth-child(2) { top: 40%; opacity: .26; animation-duration: 52s; animation-direction: reverse; }
#fog i:nth-child(3) { top: 54%; opacity: .3; animation-duration: 84s; }
#fog i:nth-child(4) { top: 68%; height: 40%; opacity: .38; animation-duration: 60s; animation-direction: reverse; }
.night #fog { opacity: .45; }
@keyframes drift { to { transform: translate3d(640px, 0, 0); } }
@media (prefers-reduced-motion: reduce) { .switch, .switch i { transition: none; } #fog i { animation: none; } }

/* вход через Яндекс ID: чёрная кнопка со знаком, как требует Яндекс */
#auth .or { display: flex; align-items: center; gap: 10px; margin: 14px 0 10px; color: var(--muted); font-size: 13px; }
#auth .or::before, #auth .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.btn.ya { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; background: #000; color: #fff; text-decoration: none; font-weight: 600; }
.btn.ya:hover { background: #222; }
.btn.ya .ya-mark { width: 22px; height: 22px; flex: none; }
#auth .captcha { min-height: 102px; margin: 4px 0 12px; }               /* место под окошко держим заранее, чтобы кнопка не прыгала */
