/* CSS-Ателье: бархатная ночь, слоновая кость, золото. Действует на страницах квеста, проектора и управления. */
:root {
  --bg: #110d15; --bg2: #16111b; --panel: #1a1420; --panel2: #211a28; --panel3: #2a2132;
  --line: rgba(214, 183, 120, .15); --line2: rgba(214, 183, 120, .32);
  --text: #eee5d6; --muted: #a69a8b; --gold: #d6b778; --gold2: #b8964f; --gold3: #efd79f;
  --rose: #e08aa0; --ok: #9fd8b0; --bad: #ee8f86; --warn: #f0cf85;
  --display: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --text-font: "Jost", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  --script: "Marck Script", "Segoe Script", cursive;
  --radius: 4px;
  --shadow: 0 30px 60px -28px rgba(0, 0, 0, .75);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100vh; color: var(--text); font: 15px/1.6 var(--text-font);
  background:
    radial-gradient(900px 500px at 8% -10%, rgba(224, 138, 160, .10), transparent 60%),
    radial-gradient(800px 600px at 105% 15%, rgba(110, 160, 220, .08), transparent 60%),
    radial-gradient(700px 500px at 50% 120%, rgba(214, 183, 120, .07), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--gold); }
h2, h3 { margin: 0; font-family: var(--display); font-weight: 600; letter-spacing: .01em; }
h3 { font-size: 1.35rem; margin-bottom: 12px; color: var(--text); }
code { font-family: var(--mono); font-size: .88em; color: var(--gold3); background: rgba(214, 183, 120, .09); padding: 1px 6px; border-radius: 3px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .85em; margin: -6px 0 12px; }
::selection { background: rgba(214, 183, 120, .35); color: #fff; }

.btn {
  font: 500 12.5px/1 var(--text-font); letter-spacing: .2em; text-transform: uppercase;
  padding: 14px 24px; border-radius: 999px; cursor: pointer;
  color: var(--gold); background: transparent; border: 1px solid var(--line2);
  transition: background .3s, color .3s, box-shadow .3s, transform .2s, border-color .3s;
}
.btn:hover { border-color: var(--gold); box-shadow: 0 0 24px -8px rgba(214, 183, 120, .6); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.btn.primary { color: #1a130c; border-color: transparent; background: linear-gradient(135deg, var(--gold3), var(--gold) 45%, var(--gold2)); box-shadow: 0 12px 26px -12px rgba(214, 183, 120, .75); }
.btn.primary:hover { filter: brightness(1.06); box-shadow: 0 16px 30px -12px rgba(214, 183, 120, .9); }
.btn.primary.busy { animation: breathe 1.2s ease-in-out infinite; }
.btn.ghost { color: var(--ok); border-color: rgba(159, 216, 176, .45); }
.btn.danger { color: var(--bad); border-color: rgba(238, 143, 134, .45); }
.btn.sm { padding: 8px 14px; font-size: 11px; }
.icon { background: none; border: 1px solid transparent; color: var(--muted); font-size: 16px; line-height: 1; padding: 7px 9px; border-radius: 999px; cursor: pointer; text-decoration: none; transition: color .2s, border-color .2s; }
.icon:hover { color: var(--gold); border-color: var(--line2); }
@keyframes breathe { 50% { opacity: .7; } }

.loading { min-height: 100vh; display: grid; place-items: center; font: italic 500 1.6rem var(--display); color: var(--muted); letter-spacing: .02em; }
.loading-mark { color: var(--gold); display: inline-block; animation: spin 4s linear infinite; margin-right: 8px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Шапка ---------- */
.top { display: flex; align-items: center; gap: 16px; padding: 14px 24px; border-bottom: 1px solid var(--line); flex-wrap: wrap; background: linear-gradient(180deg, rgba(17, 13, 21, .9), rgba(17, 13, 21, .6)); }
.brand { font: 600 1.7rem/1 var(--display); color: var(--text); text-decoration: none; letter-spacing: .02em; white-space: nowrap; }
.brand em { font-style: italic; color: var(--gold); font-weight: 500; }
.progress { flex: 1; min-width: 180px; display: flex; align-items: center; gap: 12px; }
.progress .bar { flex: 1; height: 3px; background: rgba(214, 183, 120, .14); border-radius: 3px; overflow: visible; position: relative; }
.progress .bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--gold2), var(--gold3)); border-radius: 3px; position: relative; transition: width 1s cubic-bezier(.2, .8, .2, 1); box-shadow: 0 0 12px rgba(239, 215, 159, .55); }
.progress .bar i::after { content: ""; position: absolute; right: -4px; top: 50%; width: 8px; height: 8px; margin-top: -4px; border-radius: 50%; background: var(--gold3); box-shadow: 0 0 10px var(--gold3); }
.progress.big .bar { height: 4px; }
.ptext { font: 500 12px var(--text-font); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.top .online { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.top .online b { color: var(--text); font-weight: 500; }
.top .online .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.top .me { display: flex; align-items: center; gap: 8px; padding: 6px 14px 6px 8px; border: 1px solid var(--line2); border-radius: 999px; font-weight: 500; white-space: nowrap; }
.top .me.done { border-color: var(--gold); box-shadow: 0 0 18px -4px rgba(214, 183, 120, .6); }
.my-progress { color: var(--gold); font-size: 12px; letter-spacing: .08em; }
.conn { width: 7px; height: 7px; border-radius: 50%; background: var(--bad); box-shadow: 0 0 8px var(--bad); }
.conn.on { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.pw-banner { padding: 10px 24px; font-size: 14px; background: rgba(240, 207, 133, .08); border-bottom: 1px solid rgba(240, 207, 133, .25); color: var(--warn); }
.pw-banner a { font-weight: 600; }

/* ---------- Раскладка ---------- */
.layout { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(380px, 1fr); gap: 24px; padding: 24px; align-items: start; max-width: 1680px; margin: 0 auto; }
.work { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.side { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.box, .mission { background: linear-gradient(180deg, rgba(33, 26, 40, .92), rgba(26, 20, 32, .92)); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; box-shadow: var(--shadow); position: relative; }
.box::before, .mission::before { content: ""; position: absolute; inset: 5px; border: 1px solid rgba(214, 183, 120, .07); border-radius: 2px; pointer-events: none; }
@media (max-width: 1150px) { .layout { grid-template-columns: 1fr; } }

/* ---------- Этюды ---------- */
.steps { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 6px; }
@media (max-width: 760px) { .steps { grid-template-columns: repeat(6, 1fr); } }
.step { height: 54px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; cursor: pointer; font: inherit; color: var(--muted); background: rgba(26, 20, 32, .8); border: 1px solid var(--line); border-radius: var(--radius); transition: border-color .25s, color .25s, transform .2s, background .25s; }
.step:hover { border-color: var(--line2); color: var(--text); transform: translateY(-2px); }
.step-n { font: italic 600 1.15rem/1 var(--display); letter-spacing: .02em; }
.step-i { font-size: 12px; line-height: 1; }
.step.done { color: var(--gold); border-color: rgba(214, 183, 120, .35); background: rgba(214, 183, 120, .06); }
.step.locked { opacity: .45; }
.step.next { border-color: var(--gold2); }
.step.active { color: #1a130c; border-color: transparent; background: linear-gradient(135deg, var(--gold3), var(--gold) 55%, var(--gold2)); transform: translateY(-2px); box-shadow: 0 10px 20px -12px rgba(214, 183, 120, .8); }

/* ---------- Этюд ---------- */
.m-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.m-icon { font-size: 26px; line-height: 1; }
.m-title { flex: 1; min-width: 220px; font-size: 2rem; line-height: 1.1; font-weight: 600; }
.m-badge { font-size: 11px; letter-spacing: .16em; text-transform: uppercase; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line2); color: var(--muted); white-space: nowrap; }
.m-badge.done { color: var(--ok); border-color: rgba(159, 216, 176, .4); }
.m-badge.open { color: var(--gold); }
.m-brief { margin: 12px 0 6px; font-size: 1.05em; color: #e3d9c8; }
.m-who { min-height: 26px; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.who-l { margin-right: 6px; }
.who-av { position: relative; font-size: 18px; }
.who-av i { position: absolute; right: -6px; top: -6px; font-size: 10px; font-style: normal; }
.who-first { color: var(--gold); font-style: italic; font-family: var(--display); font-size: 1.1rem; }
.m-details { margin: 10px 0; border-top: 1px solid var(--line); padding-top: 10px; }
.m-details summary { cursor: pointer; font: italic 600 1.2rem var(--display); color: var(--gold); list-style: none; display: flex; align-items: center; gap: 10px; }
.m-details summary::-webkit-details-marker { display: none; }
.m-details summary::before { content: "❧"; font-style: normal; transition: transform .3s; display: inline-block; }
.m-details[open] summary::before { transform: rotate(90deg); }
.m-details.intro summary { color: var(--rose); }
.theory { margin-top: 10px; color: #ddd3c3; max-width: 78ch; }
.theory p { margin: 10px 0; }
.theory h4 { margin: 22px 0 6px; font: 600 1.35rem var(--display); color: var(--text); }
.theory h4:first-child { margin-top: 8px; }
.theory ul { margin: 8px 0; padding-left: 22px; }
.theory li { margin: 5px 0; }
.theory li::marker { color: var(--gold); }
.theory code { white-space: normal; overflow-wrap: anywhere; }
.theory pre.mini { margin: 12px 0; padding: 14px 16px; background: #0e0a12; border: 1px solid var(--line); border-left: 2px solid var(--gold2); border-radius: var(--radius); font: 13px/1.6 var(--mono); overflow: auto; white-space: pre; }
.theory pre.mini code { background: none; padding: 0; color: #ddd3c3; font-size: inherit; white-space: inherit; }

.checks { list-style: none; padding: 0; margin: 12px 0 0; display: flex; flex-direction: column; gap: 6px; }
.chk { display: grid; grid-template-columns: 22px 1fr; column-gap: 10px; padding: 9px 12px; border-radius: var(--radius); background: rgba(14, 10, 18, .55); border: 1px solid transparent; transition: background .3s, border-color .3s; }
.chk-i { color: var(--muted); text-align: center; font-weight: 600; }
.chk.ok { border-color: rgba(159, 216, 176, .25); background: rgba(159, 216, 176, .06); }
.chk.ok .chk-i { color: var(--ok); }
.chk.bad { border-color: rgba(238, 143, 134, .28); background: rgba(238, 143, 134, .06); }
.chk.bad .chk-i { color: var(--bad); }
.chk-d { grid-column: 2; font-size: .9em; color: #f2b3ad; overflow-wrap: anywhere; }
.chk.ok .chk-d { color: var(--warn); }
.chk-d:empty { display: none; }
.broken { margin-top: 12px; padding: 12px 14px; border: 1px solid rgba(240, 207, 133, .3); background: rgba(240, 207, 133, .06); border-radius: var(--radius); font-size: .93em; }
.broken ul { margin: 6px 0 0; padding-left: 18px; }

/* ---------- Редактор и предпросмотр ---------- */
.editor-wrap { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 800px) { .editor-wrap { grid-template-columns: 1fr; } }
.pane { display: flex; flex-direction: column; min-width: 0; min-height: 480px; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: #0e0a12; box-shadow: var(--shadow); }
.pane-title { display: flex; justify-content: space-between; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--line); font: italic 600 1.05rem var(--display); color: var(--text); background: rgba(33, 26, 40, .8); }
.pane-title .hint { font: 12px var(--text-font); color: var(--muted); letter-spacing: .04em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pane-tools { display: flex; align-items: center; gap: 12px; min-width: 0; }
.reload-btn { flex: none; padding: 3px 12px; border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--muted); font: 12px var(--text-font); letter-spacing: .04em; cursor: pointer; transition: color .2s, border-color .2s; }
.reload-btn:hover, .reload-btn:focus-visible { color: var(--text); border-color: var(--muted); }
.editor { position: relative; flex: 1; min-height: 440px; font: 13.5px/1.6 var(--mono); tab-size: 2; }
.editor pre, .editor textarea { position: absolute; inset: 0; margin: 0; padding: 14px 16px; border: 0; font: inherit; line-height: inherit; tab-size: inherit; white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-all; overflow: auto; }
.editor pre { pointer-events: none; color: #ddd3c3; }
.editor pre code { background: none; padding: 0; color: inherit; font-size: inherit; white-space: inherit; }
.editor textarea { background: transparent; color: transparent; caret-color: var(--gold3); outline: 0; resize: none; z-index: 1; }
.editor textarea::placeholder { color: #5b5162; }
.editor textarea::selection { background: rgba(214, 183, 120, .28); }
#preview { flex: 1; width: 100%; min-height: 440px; border: 0; background: #fff; }
/* подсветка HTML */
.tk-t { color: #e8a37c; } .tk-p { color: #7f7487; } .tk-a { color: #b9c7ee; } .tk-v { color: #c9dfa4; } .tk-c { color: #726779; font-style: italic; } .tk-d { color: #c7a6f0; } .tk-e { color: #f0cf85; }
/* подсветка CSS */
.tk-sel { color: #eab6c6; } .tk-prop { color: #a9c9f1; } .tk-val { color: #eee5d6; } .tk-num { color: #f0cf85; } .tk-col { color: #9fd8b0; } .tk-fn { color: #c7a6f0; } .tk-at { color: var(--gold); font-style: italic; } .tk-str { color: #c9dfa4; } .tk-imp { color: #ee8f86; }

.actions { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.verdict { flex: 1; min-width: 220px; font: italic 600 1.2rem/1.3 var(--display); }
.verdict.ok { color: var(--ok); }
.verdict.bad { color: #f2b3ad; }

/* ---------- Звёздная ночь ---------- */
.art-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.art-title { margin: 0; font: 400 2rem/1 var(--script); color: var(--gold3); letter-spacing: .01em; }
.art-pct { font: 600 2.2rem/1 var(--display); color: var(--gold); text-shadow: 0 0 20px rgba(214, 183, 120, .35); }
.sn-wrap { padding: 10px; border-radius: 2px; background: linear-gradient(135deg, #7a5c2e, #d6b778 30%, #8a6a35 55%, #e8cf93 75%, #6d5128); box-shadow: 0 20px 40px -18px rgba(0, 0, 0, .8), inset 0 0 0 1px rgba(0, 0, 0, .4); }
.sn { position: relative; aspect-ratio: 1000 / 640; overflow: hidden; background: #07112b; box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .6), inset 0 0 40px rgba(0, 0, 0, .6); }
.sn-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.sn-lights { position: absolute; inset: 0; pointer-events: none; }
.sn-star, .sn-moon, .sn-win { position: absolute; transform: translate(-50%, -50%); display: block; }
.sn-star { width: var(--r); aspect-ratio: 1; border-radius: 50%; opacity: 0; transform: translate(-50%, -50%) scale(.3); transition: opacity 1.2s, transform 1.6s cubic-bezier(.2, 1.4, .3, 1); background: radial-gradient(circle, #fffdf0 0 12%, #fbe68e 22%, rgba(246, 214, 91, .55) 40%, rgba(246, 214, 91, .12) 60%, transparent 70%); }
.sn-star::before, .sn-star::after { content: ""; position: absolute; inset: -30%; border-radius: 50%; border: 2px solid rgba(251, 230, 142, .35); border-left-color: transparent; border-bottom-color: transparent; animation: halo 9s linear infinite; }
.sn-star::after { inset: -60%; border-width: 1.5px; border-color: rgba(156, 192, 234, .25); border-right-color: transparent; animation-duration: 14s; animation-direction: reverse; }
.sn-star.on { opacity: 1; transform: translate(-50%, -50%) scale(1); animation: twinkle 3.4s ease-in-out var(--d, 0s) infinite; }
@keyframes twinkle { 0%, 100% { filter: brightness(1); } 50% { filter: brightness(1.45) drop-shadow(0 0 6px #fbe68e); } }
@keyframes halo { to { transform: rotate(360deg); } }
.sn-moon { width: var(--r); aspect-ratio: 1; border-radius: 50%; opacity: calc(.12 + var(--moon, 0) * .88);
  background: radial-gradient(circle at 62% 42%, transparent 0 34%, #fff3b8 35%, #f6d65b 52%, rgba(246, 214, 91, .0) 70%);
  box-shadow: 0 0 calc(10px + var(--moon, 0) * 50px) calc(var(--moon, 0) * 14px) rgba(246, 214, 91, .45); transition: opacity 1.5s, box-shadow 1.5s; }
.sn-win { width: .7%; aspect-ratio: 1; border-radius: 1px; background: #2a2633; transition: background 1s, box-shadow 1s; }
.sn-win.on { background: #ffd66b; box-shadow: 0 0 6px 2px rgba(255, 214, 107, .6); }
.sn-shoot { position: absolute; top: 12%; left: -20%; width: 14%; height: 2px; opacity: 0; pointer-events: none; background: linear-gradient(90deg, transparent, #fff7d6); border-radius: 2px; transform: rotate(-14deg); filter: drop-shadow(0 0 4px #fff7d6); }
.sn.complete .sn-shoot { animation: shoot 7s ease-in 2s infinite; }
@keyframes shoot { 0% { left: -20%; top: 10%; opacity: 0; } 4% { opacity: 1; } 14% { left: 70%; top: 30%; opacity: 0; } 100% { left: 70%; top: 30%; opacity: 0; } }
.sn.complete { animation: glowframe 4s ease-in-out infinite; }
@keyframes glowframe { 50% { box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .6), inset 0 0 60px rgba(246, 214, 91, .18); } }
.sn-credits { position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 16px 10px; font: 400 clamp(14px, 1.6vw, 22px)/1.3 var(--script); color: #fff1c9; text-align: right; text-shadow: 0 1px 2px #000, 0 0 12px rgba(0, 0, 0, .8); background: linear-gradient(0deg, rgba(5, 8, 20, .7), transparent); }
.sn-credits:empty { display: none; }
.sn-credits span { color: var(--gold3); margin-right: 6px; }
.wall-tip { display: none; }
.wall-stats { margin-top: 12px; text-align: center; color: var(--muted); font-size: 13px; letter-spacing: .04em; }
.wall-stats b { color: var(--text); font-weight: 500; }

/* ---------- Хроника ---------- */
.feed { display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.ev { display: flex; gap: 10px; align-items: baseline; padding: 7px 4px; border-bottom: 1px solid rgba(214, 183, 120, .07); }
.ev.new { animation: fadein .6s ease-out; }
@keyframes fadein { from { opacity: 0; transform: translateY(-6px); } }
.ev-t { font: 12px var(--mono); color: var(--muted); white-space: nowrap; }
.ev-solved .ev-x::before { content: "✦ "; color: var(--gold); }
.ev-join .ev-x { color: #cfc4b3; }
.ev-house, .ev-milestone, .ev-done { color: var(--gold3); font-family: var(--display); font-size: 1.1rem; font-style: italic; }
.ev-admin .ev-x { color: var(--rose); }
.ev-empty { color: var(--muted); font-style: italic; }

/* ---------- Галерея ---------- */
.city { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; --s: .2; }
.city.empty::after { content: 'Галерея пока пуста'; color: var(--muted); font-style: italic; }
.house { cursor: pointer; background: #0e0a12; border: 1px solid var(--line); border-radius: 2px; padding: 6px 6px 0; transition: transform .3s, border-color .3s, box-shadow .3s; }
.house:hover { transform: translateY(-3px); border-color: var(--line2); box-shadow: 0 16px 30px -18px rgba(0, 0, 0, .9); }
.house.me { border-color: var(--gold2); }
.house.done { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold2), 0 0 24px -8px rgba(214, 183, 120, .6); }
.house:not(.online) { opacity: .6; }
.house .screen { position: relative; aspect-ratio: 4 / 3; overflow: hidden; background: #fff; }
.house .screen iframe { width: 800px; height: 600px; border: 0; transform-origin: 0 0; transform: scale(var(--s)); pointer-events: none; background: #fff; display: block; }
.house .typing { position: absolute; top: 4px; right: 4px; opacity: 0; font-size: 13px; background: rgba(17, 13, 21, .75); border-radius: 999px; padding: 2px 6px; transition: opacity .2s; }
.house.typing-on .typing { opacity: 1; }
.house .empty-note { display: none; position: absolute; inset: 0; align-items: center; justify-content: center; background: #efe9df; color: #9a8f80; font: italic 1rem var(--display); }
.house.blank .empty-note { display: flex; }
.meta { display: flex; align-items: center; gap: 6px; padding: 8px 2px 2px; font-size: 13px; }
.meta .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.dots { display: flex; gap: 2px; flex-wrap: wrap; max-width: 46px; justify-content: flex-end; }
.dots i { width: 5px; height: 5px; border-radius: 50%; background: #3a2f41; display: block; }
.dots i.on { background: var(--gold); }
.house .st { padding: 0 2px 8px; font-size: 12px; color: var(--muted); font-style: italic; }

/* ---------- Модалки, уведомления ---------- */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; background: rgba(8, 5, 10, .78); backdrop-filter: blur(3px); }
.modal-card { width: min(1150px, 100%); max-height: 92vh; display: flex; flex-direction: column; overflow: hidden; background: var(--panel); border: 1px solid var(--line2); border-radius: var(--radius); box-shadow: 0 40px 80px -30px #000; }
.modal-card.small { width: min(520px, 100%); }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--line); font: 600 1.3rem var(--display); }
.modal-body { display: grid; grid-template-columns: 1.2fr 1fr; min-height: 0; flex: 1; }
.modal-body.col { display: flex; flex-direction: column; gap: 14px; padding: 20px; }
@media (max-width: 820px) { .modal-body { grid-template-columns: 1fr; overflow: auto; } }
.modal-preview { background: #fff; min-height: 320px; }
.modal-preview iframe { width: 100%; height: 100%; min-height: 440px; border: 0; display: block; }
.modal-code { margin: 0; padding: 16px; overflow: auto; max-height: 72vh; background: #0e0a12; border-left: 1px solid var(--line); font: 12.5px/1.6 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; }
.modal-code code { background: none; padding: 0; color: #ddd3c3; white-space: inherit; }
.key-value { display: block; padding: 12px; word-break: break-all; white-space: normal; user-select: all; font-size: 13px; }
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 60; display: flex; flex-direction: column; gap: 8px; max-width: min(380px, calc(100vw - 36px)); }
.toast { padding: 12px 16px; background: var(--panel2); border: 1px solid var(--line2); border-left: 2px solid var(--gold); border-radius: var(--radius); box-shadow: var(--shadow); font-size: 14px; animation: fadein .4s ease-out; }
.toast.out { opacity: 0; transition: opacity .4s; }
.toast.bad { border-left-color: var(--bad); }
.toast.gold { border-left-color: var(--gold3); }
.toast.join { border-left-color: #9cc0ea; }
.toast.admin { border-left-color: var(--rose); }
.banner { position: fixed; left: 50%; top: 18%; transform: translateX(-50%); z-index: 70; max-width: 90vw; padding: 26px 40px; text-align: center; font: italic 600 clamp(20px, 3vw, 34px)/1.25 var(--display); color: #1a130c; background: linear-gradient(135deg, var(--gold3), var(--gold) 50%, var(--gold2)); border-radius: 2px; box-shadow: 0 30px 70px -20px #000; animation: bannerIn .7s cubic-bezier(.2, 1.3, .3, 1); }
@keyframes bannerIn { from { opacity: 0; transform: translateX(-50%) scale(.85); } }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 80; }

/* ---------- Экран проектора ---------- */
body.board .top { padding: 16px 32px; }
.stats { display: flex; gap: 22px; color: var(--muted); font-size: 13px; letter-spacing: .06em; white-space: nowrap; }
.stats b { font: 600 1.6rem/1 var(--display); color: var(--gold); margin-right: 4px; }
.board-layout { display: grid; grid-template-columns: minmax(0, 2fr) minmax(320px, 1fr); gap: 24px; padding: 24px 32px; max-width: 1900px; margin: 0 auto; align-items: start; }
.ticker { grid-column: 1 / -1; display: flex; gap: 14px; align-items: baseline; padding: 14px 20px; font: italic 600 1.35rem var(--display); border-bottom: 1px solid var(--line); }
.ticker .ev-t { font-style: normal; }
.art-stage .art-title { font-size: 2.6rem; }
.art-stage .art-pct { font-size: 3rem; }
.side-col { display: flex; flex-direction: column; gap: 24px; }
.leaders { margin: 0; padding-left: 26px; display: flex; flex-direction: column; gap: 6px; }
.leaders li { padding: 6px 4px; border-bottom: 1px solid rgba(214, 183, 120, .07); }
.leaders li::marker { color: var(--gold); font-family: var(--display); font-weight: 600; }
.leaders .lb-n { float: right; color: var(--gold); font-variant-numeric: tabular-nums; }
.city-box.wide { grid-column: 1 / -1; }
.city-box.wide .city { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
@media (max-width: 1000px) { .board-layout { grid-template-columns: 1fr; } }

/* ---------- Управление квестом (общая страница /<квест>/admin) ---------- */
.admin { max-width: 980px; margin: 0 auto; padding: 32px 20px; display: flex; flex-direction: column; gap: 18px; }
.admin h2 { font-size: 2.2rem; }
.admin .row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.admin input, .admin textarea { flex: 1; min-width: 160px; padding: 12px 14px; font: inherit; color: var(--text); background: #0e0a12; border: 1px solid var(--line2); border-radius: var(--radius); outline: 0; }
.admin input:focus { border-color: var(--gold); }
.admin table { width: 100%; border-collapse: collapse; font-size: 14px; }
.admin th, .admin td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); }
.admin th { color: var(--muted); font-weight: 500; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; }
.admin .ok { color: var(--ok); }
.form-error { color: var(--bad); min-height: 22px; margin-top: 8px; }
.fine { color: var(--muted); font-size: 13px; }

/* ---------- Окно подтверждения (KGU.confirm) ---------- */
.kgu-confirm { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 16px; background: rgba(8, 5, 10, .8); backdrop-filter: blur(3px); }
.kgu-confirm-box { width: min(460px, 100%); padding: 24px 26px; background: var(--panel); border: 1px solid var(--line2); border-radius: var(--radius); box-shadow: 0 40px 80px -30px #000; }
.kgu-confirm-title { margin: 0 0 8px; font: 600 1.6rem/1.2 var(--display); }
.kgu-confirm-text { margin: 0 0 6px; color: #ddd3c3; }
.kgu-confirm-label { display: block; margin: 14px 0 6px; color: var(--muted); font-size: 14px; }
.kgu-confirm-label b { color: var(--warn); }
.kgu-confirm-input { width: 100%; padding: 11px 13px; font: inherit; color: var(--text); background: #0e0a12; border: 1px solid var(--line2); border-radius: var(--radius); outline: 0; }
.kgu-confirm-input:focus { border-color: var(--gold); }
.kgu-confirm-actions { display: flex; gap: 12px; margin-top: 20px; flex-wrap: wrap; }
.kgu-confirm-actions button { font: 500 12px/1 var(--text-font); letter-spacing: .18em; text-transform: uppercase; padding: 13px 20px; border-radius: 999px; cursor: pointer; color: var(--gold); background: transparent; border: 1px solid var(--line2); }
.kgu-confirm-ok { color: #1a130c !important; border-color: transparent !important; background: linear-gradient(135deg, var(--gold3), var(--gold) 45%, var(--gold2)) !important; }
.kgu-confirm-ok.danger { color: #fff !important; background: #b8574f !important; }
.kgu-confirm-ok:disabled { opacity: .45; cursor: not-allowed; }

/* ---------- Подписи соавторов на холсте ---------- */
.sn { container-type: inline-size; }
.sn-signs { position: absolute; inset: 0; pointer-events: none; }
.sn-sign { position: absolute; transform: translate(-50%, -50%) rotate(var(--rot, -4deg)); white-space: nowrap;
  font: 400 clamp(11px, 2.7cqw, 30px)/1 var(--script); color: color-mix(in srgb, var(--ink, #fff1c9) 55%, #fff6dc);
  text-shadow: 0 1px 1px rgba(0, 0, 0, .9), 0 0 8px rgba(0, 0, 0, .75), 0 0 16px rgba(5, 10, 30, .6);
  pointer-events: auto; cursor: default; }
.sn-sign::after { content: ""; position: absolute; left: 4%; right: 8%; bottom: -3px; height: 1.5px; border-radius: 2px; background: var(--ink, #fff1c9); opacity: .55; transform: skewX(-20deg); }
.sn-sign.writing { animation: signWrite 2.2s cubic-bezier(.45, .05, .35, 1) both; }
@keyframes signWrite {
  0% { clip-path: inset(-20% 100% -20% 0); filter: drop-shadow(0 0 0 transparent); }
  80% { clip-path: inset(-20% 0 -20% 0); filter: drop-shadow(0 0 10px rgba(255, 241, 201, .8)); }
  100% { clip-path: inset(-20% 0 -20% 0); filter: none; }
}

/* ---------- Проектор: картина на всю ширину ---------- */
body.board .board-layout { grid-template-columns: 1fr; }
body.board .art-stage .sn-wrap { max-width: min(100%, calc(72vh * 1.5625)); margin: 0 auto; }
body.board .side-col { flex-direction: row; align-items: flex-start; }
body.board .side-col > * { flex: 1; min-width: 0; }
@media (max-width: 900px) { body.board .side-col { flex-direction: column; } }
.sn-sign { font-size: clamp(12px, 3.4cqw, 40px); }

/* ---------- Кнопка возврата в хаб ---------- */
.back-btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px; border-radius: 999px; border: 1px solid var(--line2); color: var(--gold); text-decoration: none; font: 500 11.5px/1 var(--text-font); letter-spacing: .16em; text-transform: uppercase; white-space: nowrap; transition: border-color .25s, box-shadow .25s; }
.back-btn:hover { border-color: var(--gold); box-shadow: 0 0 18px -6px rgba(214, 183, 120, .6); }
span.brand { cursor: default; }

/* ---------- Вопрос преподавателю ---------- */
.help-btn { color: #b9d4f2; border-color: rgba(156, 192, 234, .45); }
.help-btn:hover { border-color: #b9d4f2; box-shadow: 0 0 24px -8px rgba(156, 192, 234, .6); }
.help-btn.waiting { color: var(--warn); border-color: rgba(240, 207, 133, .6); animation: breathe 2.4s ease-in-out infinite; }
.help-text { width: 100%; padding: 12px 14px; font: inherit; color: var(--text); background: #0e0a12; border: 1px solid var(--line2); border-radius: var(--radius); resize: vertical; outline: 0; }
.help-text:focus { border-color: var(--gold); }
.help-status { padding: 10px 14px; border-left: 2px solid var(--warn); background: rgba(240, 207, 133, .07); color: var(--warn); font-size: 14px; }
.help-actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* ---------- Просмотр глазами студента (преподаватель) ---------- */
.preview-bar { padding: 10px 20px; font-size: 14px; color: #fff; background: repeating-linear-gradient(135deg, #3b2a6b 0 14px, #33245e 14px 28px); border-bottom: 1px solid rgba(255, 255, 255, .15); }
.preview-bar a { color: #fff; font-weight: 600; margin-left: 8px; }
body.preview-mode #help, body.preview-mode #keybtn, body.preview-mode #leave, body.preview-mode #pw-banner { display: none !important; }
