/* ============================================================================
   Cambridge Studio — the students' writing app
   Chrome: dark aurora. Writing surface: warm light paper.
   ============================================================================ */
body.st { min-height: 100vh; background: #070d1f; color: #eef2ff; overflow-x: hidden; }
html:has(body.st) { overflow-x: hidden; }
.st-app, .st-modal .box { overflow-wrap: anywhere; }
body.st::before { content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background: radial-gradient(55% 45% at 10% 0%, rgba(139,123,255,.38), transparent 70%), radial-gradient(45% 40% at 95% 5%, rgba(45,226,198,.25), transparent 70%), radial-gradient(60% 50% at 50% 110%, rgba(214,162,58,.22), transparent 70%); }
.st-app { position: relative; z-index: 1; }
.st-bar { position: sticky; top: 0; z-index: 60; display: flex; align-items: center; gap: 12px; padding: 10px clamp(14px, 3vw, 32px); background: rgba(7,13,31,.72); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-bottom: 1px solid rgba(255,255,255,.08); }
.st-logo { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-weight: 800; letter-spacing: -.01em; white-space: nowrap; min-width: 0; }
.st-logo img { width: 34px; height: 34px; border-radius: 9px; background: #fff; padding: 3px; }
.st-logo small { display: block; font-size: .66rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: #a5b0d6; }
.st-bar .sp { flex: 1; }
.st-me { display: flex; align-items: center; gap: 8px; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.12); color: #fff; border-radius: 999px; padding: 4px 12px 4px 4px; cursor: pointer; font-weight: 600; font-size: .9rem; white-space: nowrap; max-width: 46vw; }
.st-me #stMeName { overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 520px) { .st-bar .st-explore { display: none; } .st-logo small { display: none; } .st-logo { font-size: .95rem; } }
.st-me .av { width: 30px; height: 30px; border-radius: 50%; overflow: hidden; background: linear-gradient(135deg, #8b7bff, #2de2c6); display: grid; place-items: center; font-weight: 800; font-size: .8rem; color: #0a0f22; }
.st-me .av img { width: 100%; height: 100%; object-fit: cover; }
.st-menu { position: absolute; right: clamp(14px, 3vw, 32px); top: 58px; min-width: 220px; background: #111a33; border: 1px solid rgba(255,255,255,.12); border-radius: 16px; padding: 6px; box-shadow: 0 30px 60px -20px rgba(0,0,0,.6); display: none; }
.st-menu.open { display: block; }
.st-menu button, .st-menu a { display: flex; width: 100%; align-items: center; gap: 10px; padding: 11px 12px; border: 0; background: none; color: #eef2ff; border-radius: 10px; cursor: pointer; text-decoration: none; font-size: .95rem; text-align: left; }
.st-menu button:hover, .st-menu a:hover { background: rgba(255,255,255,.07); }
.st-view { max-width: 1120px; margin: 0 auto; padding: clamp(18px, 4vw, 40px) clamp(14px, 3vw, 32px) 80px; }
.st-view[hidden] { display: none; }
.st-h1 { font-size: clamp(1.9rem, 4.6vw, 3rem); line-height: 1.05; letter-spacing: -.03em; margin: 0; font-weight: 800; }
.st-sub { color: #a5b0d6; margin: 8px 0 0; font-size: 1.05rem; }
.st-card { background: rgba(255,255,255,.055); border: 1px solid rgba(255,255,255,.1); border-radius: 22px; padding: clamp(18px, 3vw, 26px); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.st-card h2 { margin: 0 0 12px; font-size: 1.1rem; }
.st-grid { display: grid; gap: 16px; }
.st-label { display: block; font-size: .78rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: #a5b0d6; margin: 0 0 8px; }
.st-input, .st-select, .st-textarea { width: 100%; min-height: 50px; padding: 12px 16px; border-radius: 14px; border: 1px solid rgba(255,255,255,.16); background: rgba(5,10,26,.6); color: #fff; font-size: 1.05rem; outline: none; transition: border-color .2s, box-shadow .2s; }
.st-textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
.st-input:focus, .st-select:focus, .st-textarea:focus { border-color: #8b7bff; box-shadow: 0 0 0 4px rgba(139,123,255,.25); }
.st-input::placeholder, .st-textarea::placeholder { color: #6f7aa3; }
.st-hint { font-size: .85rem; color: #8f9ac2; margin-top: 6px; }
.st-err { color: #ff8a8a; font-weight: 600; font-size: .92rem; margin-top: 10px; min-height: 1.2em; }
.st-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.st-pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; font-size: .78rem; font-weight: 700; white-space: nowrap; }
.st-pill.draft { background: rgba(255,255,255,.1); color: #d6dbf2; }
.st-pill.submitted { background: rgba(250,204,21,.16); color: #fde68a; }
.st-pill.changes_requested { background: rgba(251,113,133,.18); color: #fecdd3; }
.st-pill.live { background: rgba(52,211,153,.18); color: #a7f3d0; }
.st-pill.unpublished { background: rgba(148,163,184,.2); color: #e2e8f0; }
.st-pill.pending { background: rgba(250,204,21,.16); color: #fde68a; }
.st-pill.new { background: #f43f5e; color: #fff; }
.st-banner { display: flex; gap: 12px; align-items: flex-start; padding: 14px 18px; border-radius: 16px; margin-bottom: 16px; font-size: .98rem; line-height: 1.45; }
.st-banner .ic { font-size: 1.3rem; line-height: 1.2; }
.st-banner.info { background: rgba(56,189,248,.12); border: 1px solid rgba(56,189,248,.3); }
.st-banner.warn { background: rgba(250,204,21,.12); border: 1px solid rgba(250,204,21,.3); }
.st-banner.bad { background: rgba(251,113,133,.13); border: 1px solid rgba(251,113,133,.35); }
.st-banner.good { background: rgba(52,211,153,.12); border: 1px solid rgba(52,211,153,.3); }
.st-banner .acts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }

/* ── login ── */
.st-login { min-height: calc(100vh - 60px); display: grid; grid-template-columns: 1.1fr 1fr; gap: clamp(20px, 5vw, 70px); align-items: center; max-width: 1120px; margin: 0 auto; padding: 30px clamp(14px, 3vw, 32px); }
.st-login .hello { font-size: clamp(2.4rem, 6vw, 4.4rem); line-height: .98; letter-spacing: -.04em; font-weight: 800; margin: 0; }
.st-login .hello em { font-style: normal; background: linear-gradient(90deg, #8b7bff, #2de2c6, #f3cf72); -webkit-background-clip: text; background-clip: text; color: transparent; }
.st-login .lead { color: #a5b0d6; font-size: 1.15rem; margin: 18px 0 0; max-width: 32ch; }
.st-login .safe { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }
.st-login .safe span { font-size: .82rem; padding: 7px 12px; border-radius: 999px; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.1); }
.st-seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; padding: 5px; border-radius: 16px; background: rgba(5,10,26,.6); border: 1px solid rgba(255,255,255,.12); }
.st-seg button { min-height: 44px; border: 0; border-radius: 12px; background: transparent; color: #c9d0ec; font-weight: 700; cursor: pointer; }
.st-seg button.on { background: #8b7bff; color: #0a0f22; }
@media (max-width: 860px) { .st-login { grid-template-columns: 1fr; padding-top: 18px; } .st-login .lead { max-width: none; } }

/* PIN boxes */
.st-pin { position: relative; display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; max-width: 420px; }
.st-pin input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; font-size: 16px; letter-spacing: 3em; cursor: text; z-index: 2; caret-color: transparent; }
.st-pin span { height: 58px; border-radius: 14px; border: 1px solid rgba(255,255,255,.18); background: rgba(5,10,26,.6); display: grid; place-items: center; font-size: 1.5rem; font-weight: 800; transition: border-color .15s, transform .15s; }
.st-pin span.f { border-color: #8b7bff; }
.st-pin span.cur { border-color: #2de2c6; box-shadow: 0 0 0 4px rgba(45,226,198,.2); }
.st-pin.shake { animation: stShake .4s; }
@keyframes stShake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
@media (max-width: 400px) { .st-pin { gap: 5px; } .st-pin span { height: 50px; font-size: 1.25rem; } }
.st-check { display: flex; gap: 10px; align-items: flex-start; font-size: .92rem; color: #c9d0ec; cursor: pointer; margin-top: 14px; }
.st-check input { width: 20px; height: 20px; accent-color: #8b7bff; margin-top: 1px; flex: none; }

/* ── dashboard ── */
.st-hero { display: flex; justify-content: space-between; gap: 18px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 24px; }
.st-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 18px 0; }
.st-stat { padding: 16px; border-radius: 18px; background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.09); }
.st-stat b { font-size: 1.8rem; display: block; line-height: 1.1; }
.st-stat small { color: #a5b0d6; font-size: .78rem; letter-spacing: .1em; text-transform: uppercase; }
@media (max-width: 640px) { .st-stats { grid-template-columns: repeat(2, 1fr); } }
.st-steps { display: grid; gap: 10px; counter-reset: s; }
.st-step { display: flex; gap: 14px; align-items: center; padding: 12px 14px; border-radius: 14px; background: rgba(5,10,26,.45); }
.st-step .n { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; background: rgba(255,255,255,.1); flex: none; }
.st-step.done .n { background: #34d399; color: #052e1c; }
.st-step.wait .n { background: #facc15; color: #3a2a00; }
.st-step .t { flex: 1; }
.st-step .t small { display: block; color: #a5b0d6; }
.st-two { display: grid; grid-template-columns: 1.25fr 1fr; gap: 16px; }
@media (max-width: 900px) { .st-two { grid-template-columns: 1fr; } }
.st-badges { display: flex; flex-wrap: wrap; gap: 8px; }
.st-badge { padding: 7px 12px; border-radius: 12px; background: rgba(255,255,255,.07); font-weight: 600; font-size: .86rem; }
.st-filter { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0 14px; }
.st-filter button { border: 1px solid rgba(255,255,255,.14); background: transparent; color: #c9d0ec; border-radius: 999px; padding: 8px 14px; font-weight: 600; cursor: pointer; }
.st-filter button.on { background: #eef2ff; color: #0a0f22; border-color: #eef2ff; }
.st-posts { display: grid; gap: 10px; }
.st-post { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; padding: 16px 18px; border-radius: 18px; background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.09); cursor: pointer; transition: background .2s, transform .2s; }
.st-post:hover { background: rgba(255,255,255,.08); transform: translateY(-1px); }
.st-post h3 { margin: 0 0 6px; font-size: 1.1rem; }
.st-post .m { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; color: #a5b0d6; font-size: .84rem; }
.st-track { display: flex; align-items: center; gap: 4px; margin-top: 10px; }
.st-track i { font-style: normal; font-size: .72rem; color: #8f9ac2; white-space: nowrap; }
.st-track .dot { width: 12px; height: 12px; border-radius: 50%; background: rgba(255,255,255,.15); flex: none; }
.st-track .bar { height: 3px; flex: 1; min-width: 14px; border-radius: 3px; background: rgba(255,255,255,.15); }
.st-track .on { background: #2de2c6; }
.st-track .now { background: #facc15; box-shadow: 0 0 0 4px rgba(250,204,21,.2); }
.st-track .bad { background: #fb7185; box-shadow: 0 0 0 4px rgba(251,113,133,.2); }
.st-empty { text-align: center; padding: 40px 20px; color: #a5b0d6; }
.st-empty .big { font-size: 3rem; }

/* ── profile designer ── */
.st-pro { display: grid; grid-template-columns: 1fr 440px; gap: 22px; align-items: start; }
@media (max-width: 1000px) { .st-pro { grid-template-columns: 1fr; } }
.st-preview { position: sticky; top: 80px; }
.st-preview .frame { border-radius: 26px; overflow: hidden; border: 1px solid rgba(255,255,255,.14); background: #000; box-shadow: 0 40px 80px -40px rgba(0,0,0,.8); height: 620px; position: relative; }
.st-preview iframe { width: 390px; height: 820px; border: 0; transform-origin: 0 0; position: absolute; left: 0; top: 0; }
.st-preview .cap { text-align: center; color: #a5b0d6; font-size: .84rem; margin-top: 10px; }
@media (max-width: 1000px) { .st-preview { position: static; } .st-preview .frame { height: 520px; max-width: 420px; margin: 0 auto; } }
.st-photo { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.st-photo .av { width: 112px; height: 112px; border-radius: 50%; overflow: hidden; background: linear-gradient(135deg, #8b7bff, #2de2c6); display: grid; place-items: center; font-size: 2.4rem; font-weight: 800; color: #0a0f22; flex: none; position: relative; }
.st-photo .av img { width: 100%; height: 100%; object-fit: cover; }
.st-cover { height: 120px; border-radius: 16px; overflow: hidden; background: linear-gradient(120deg, rgba(139,123,255,.6), rgba(45,226,198,.5)); display: grid; place-items: center; color: #fff; font-weight: 700; position: relative; }
.st-cover img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.st-cover .btns { position: relative; z-index: 2; display: flex; gap: 8px; }
.st-themes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
@media (max-width: 520px) { .st-themes { grid-template-columns: repeat(2, 1fr); } }
.st-theme { border: 2px solid transparent; border-radius: 16px; padding: 0; overflow: hidden; cursor: pointer; background: none; color: inherit; text-align: left; }
.st-theme.on { border-color: #2de2c6; box-shadow: 0 0 0 4px rgba(45,226,198,.2); }
.st-theme .sw { height: 64px; background: var(--bg); position: relative; }
.st-theme .sw::before { content: ""; position: absolute; inset: 0; background: var(--aurora); }
.st-theme .sw i { position: absolute; left: 10px; bottom: 10px; width: 26px; height: 26px; border-radius: 50%; background: var(--accent); box-shadow: 18px 0 0 var(--accent2); }
.st-theme b { display: block; padding: 8px 10px; font-size: .86rem; background: rgba(255,255,255,.06); }
.st-swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.st-swatch { width: 38px; height: 38px; border-radius: 50%; border: 3px solid transparent; cursor: pointer; display: grid; place-items: center; font-size: .7rem; color: #fff; font-weight: 800; }
.st-swatch.on { border-color: #fff; box-shadow: 0 0 0 3px rgba(255,255,255,.25); }
.st-opts { display: flex; gap: 8px; flex-wrap: wrap; }
.st-opt { border: 1px solid rgba(255,255,255,.16); background: rgba(5,10,26,.5); color: #dfe4fa; border-radius: 14px; padding: 10px 14px; cursor: pointer; font-weight: 600; display: flex; gap: 8px; align-items: center; }
.st-opt.on { border-color: #2de2c6; background: rgba(45,226,198,.12); color: #fff; }
.st-chipin { display: flex; flex-wrap: wrap; gap: 8px; }
.st-chipin .c { display: inline-flex; gap: 6px; align-items: center; padding: 7px 10px 7px 12px; border-radius: 999px; background: rgba(139,123,255,.2); font-weight: 600; font-size: .88rem; }
.st-chipin .c button { border: 0; background: rgba(255,255,255,.15); color: #fff; width: 22px; height: 22px; border-radius: 50%; cursor: pointer; line-height: 1; }
.st-sugg { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.st-sugg button { border: 1px dashed rgba(255,255,255,.25); background: none; color: #c9d0ec; border-radius: 999px; padding: 6px 11px; cursor: pointer; font-size: .82rem; }
.st-url { display: flex; align-items: stretch; border-radius: 14px; overflow: hidden; border: 1px solid rgba(255,255,255,.16); background: rgba(5,10,26,.6); }
.st-url span { display: flex; align-items: center; padding: 0 4px 0 14px; color: #8f9ac2; font-size: .95rem; white-space: nowrap; }
.st-url input { border: 0; background: transparent; color: #fff; font-size: 1.05rem; font-weight: 700; padding: 12px 14px 12px 2px; min-width: 0; flex: 1; outline: none; }
.st-avail { margin-top: 8px; font-weight: 600; font-size: .92rem; }
.st-avail.ok { color: #6ee7b7; } .st-avail.no { color: #fda4af; }
@media (max-width: 520px) { .st-url span { font-size: .78rem; padding-left: 10px; } }

/* ── editor ── */
.st-edbar { position: sticky; top: 55px; z-index: 50; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 10px 0 12px; background: linear-gradient(180deg, rgba(7,13,31,.95) 70%, rgba(7,13,31,0)); }
.st-edbar .sp { flex: 1; }
.st-saved { color: #a5b0d6; font-size: .85rem; white-space: nowrap; }
.st-paper { background: #fffdf8; color: #1d1a16; border-radius: 26px; padding: clamp(18px, 5vw, 56px) clamp(16px, 6vw, 72px) clamp(24px, 5vw, 48px); box-shadow: 0 40px 90px -40px rgba(0,0,0,.7); max-width: 860px; margin: 0 auto; }
.st-paper ::selection { background: #c7d2fe; }
.st-cats { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
@media (max-width: 640px) { .st-cats { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 6px; margin-left: -16px; margin-right: -16px; padding-left: 16px; padding-right: 16px; scrollbar-width: none; } .st-cats::-webkit-scrollbar { display: none; } .st-cats button { flex: none; } }
.st-cats button { border: 1px solid #e3ddcf; background: #fff; color: #4a443b; border-radius: 999px; padding: 7px 13px; font-weight: 600; font-size: .86rem; cursor: pointer; }
.st-cats button.on { background: #1d1a16; color: #fff; border-color: #1d1a16; }
.st-title { width: 100%; border: 0; outline: none; resize: none; font-family: var(--font-read); font-size: clamp(2rem, 5vw, 3rem); line-height: 1.1; font-weight: 700; background: transparent; color: #1d1a16; padding: 0; overflow: hidden; }
.st-title::placeholder { color: #c4bcae; }
.st-covered { margin: 6px 0 18px; }
.st-coverbox { border: 2px dashed #e3ddcf; border-radius: 18px; padding: 16px; text-align: center; color: #8a8174; cursor: pointer; font-weight: 600; }
.st-coverbox:hover { border-color: #b4462b; color: #b4462b; }
.st-coverimg { position: relative; border-radius: 18px; overflow: hidden; }
.st-coverimg img { width: 100%; max-height: 340px; object-fit: cover; }
.st-coverimg .x { position: absolute; top: 10px; right: 10px; }
.st-blocks { font-family: var(--font-read); font-size: 1.15rem; line-height: 1.75; color: #1d1a16; }
.blk { position: relative; margin: 4px 0; border-radius: 12px; padding: 4px 8px; margin-left: -8px; margin-right: -8px; transition: background .15s; }
.blk:hover, .blk.focus { background: #f6f1e6; }
.blk-tools { position: absolute; right: 6px; top: -16px; display: none; gap: 4px; z-index: 5; background: #1d1a16; border-radius: 12px; padding: 4px; box-shadow: 0 10px 24px -10px rgba(0,0,0,.5); }
.blk:hover .blk-tools, .blk.focus .blk-tools { display: flex; }
.blk-tools button { border: 0; background: transparent; color: #fff; min-width: 32px; height: 32px; border-radius: 8px; cursor: pointer; font-size: .85rem; font-weight: 700; padding: 0 8px; }
.blk-tools button:hover { background: rgba(255,255,255,.14); }
.blk-tools .lbl { color: #a29a8c; font-size: .7rem; text-transform: uppercase; letter-spacing: .1em; align-self: center; padding: 0 6px; }
[contenteditable] { outline: none; }
[contenteditable]:empty::before { content: attr(data-ph); color: #c4bcae; pointer-events: none; }
.ed-p { min-height: 1.75em; white-space: pre-wrap; }
.ed-p.center { text-align: center; }
.ed-h { width: 100%; border: 0; outline: none; background: transparent; font-family: var(--font-ui); font-weight: 800; color: #1d1a16; padding: 6px 0; line-height: 1.2; white-space: pre-wrap; overflow-wrap: anywhere; }
.ed-h.h2 { font-size: 1.7rem; } .ed-h.h3 { font-size: 1.3rem; }
.ed-h:empty::before { content: attr(data-ph); color: #c4bcae; }
.ed-code-head { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; font-family: var(--font-ui); padding-right: 150px; }
.ed-list { margin: 0; padding-left: 1.4em; min-height: 1.75em; }
.ed-quote { border-left: 4px solid #b4462b; padding-left: 16px; font-style: italic; font-size: 1.25rem; }
.ed-cap { width: 100%; border: 0; border-bottom: 1px dashed #e3ddcf; outline: none; background: transparent; font-family: var(--font-ui); font-size: .9rem; color: #6d655a; padding: 6px 0; margin-top: 6px; text-align: center; }
.ed-callout { display: flex; gap: 12px; padding: 14px 16px; border-radius: 14px; background: #fdecd8; border: 1px solid #f6d5ad; font-family: var(--font-ui); font-size: 1.02rem; }
.ed-callout .emo { font-size: 1.5rem; cursor: pointer; border: 0; background: none; padding: 0; line-height: 1; }
.ed-callout [contenteditable] { flex: 1; }
.ed-emojis { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 8px; }
.ed-emojis button { border: 1px solid #e3ddcf; background: #fff; border-radius: 10px; font-size: 1.2rem; width: 40px; height: 40px; cursor: pointer; }
.ed-drop { border: 2px dashed #d9d1c1; border-radius: 18px; padding: 26px 16px; text-align: center; color: #8a8174; font-family: var(--font-ui); cursor: pointer; transition: border-color .2s, background .2s; }
.ed-drop:hover, .ed-drop.over { border-color: #b4462b; background: #fbf3ea; color: #b4462b; }
.ed-drop .big { font-size: 2rem; display: block; }
.ed-img { position: relative; }
.ed-img img { border-radius: 14px; width: 100%; height: auto; }
.ed-img.left, .ed-img.right { width: 50%; }
.ed-img.right { margin-left: auto; }
.ed-img.center { width: 66%; margin: 0 auto; }
.ed-layouts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; margin-top: 8px; }
.ed-layouts button { border: 1px solid #e3ddcf; background: #fff; color: #4a443b; border-radius: 10px; padding: 6px 10px; font-family: var(--font-ui); font-size: .8rem; font-weight: 700; cursor: pointer; }
.ed-layouts button.on { background: #1d1a16; color: #fff; border-color: #1d1a16; }
.ed-gal { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.ed-gal.c2 { grid-template-columns: repeat(2, 1fr); }
.ed-gal .g { position: relative; }
.ed-gal .g img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 12px; }
.ed-gal .g .x { position: absolute; top: 6px; right: 6px; width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(0,0,0,.65); color: #fff; cursor: pointer; }
.ed-gal .add { aspect-ratio: 1; border: 2px dashed #d9d1c1; border-radius: 12px; display: grid; place-items: center; color: #8a8174; cursor: pointer; font-family: var(--font-ui); font-weight: 700; background: none; }
.ed-busy { display: grid; place-items: center; padding: 30px; color: #8a8174; font-family: var(--font-ui); gap: 10px; }
.ed-busy .spin { width: 34px; height: 34px; border-radius: 50%; border: 3px solid #e3ddcf; border-top-color: #b4462b; animation: sbpSpin 1s linear infinite; }
@keyframes sbpSpin { to { transform: rotate(360deg); } }
.ed-embed { display: grid; gap: 8px; font-family: var(--font-ui); }
.ed-embed input { width: 100%; border: 1px solid #e3ddcf; border-radius: 12px; padding: 12px 14px; font-size: 1rem; outline: none; }
.ed-embed .thumb { position: relative; border-radius: 14px; overflow: hidden; background: #000; }
.ed-embed .thumb img { width: 100%; opacity: .85; }
.ed-embed .thumb span { position: absolute; inset: 0; display: grid; place-items: center; font-size: 3rem; }
.ed-code { width: 100%; min-height: 140px; border: 0; border-radius: 14px; background: #0b1020; color: #e6edf7; font-family: var(--font-mono); font-size: .92rem; line-height: 1.6; padding: 14px 16px; resize: vertical; outline: none; tab-size: 4; }
.ed-hr { text-align: center; color: #a29a8c; letter-spacing: 1em; padding: 10px 0; font-family: var(--font-ui); }
.ed-add { margin-top: 18px; padding: 14px; border-radius: 18px; background: #f6f1e6; font-family: var(--font-ui); }
.ed-add p { margin: 0 0 10px; font-size: .85rem; font-weight: 700; color: #6d655a; text-transform: uppercase; letter-spacing: .1em; }
.ed-addgrid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
@media (max-width: 640px) { .ed-addgrid { grid-template-columns: repeat(3, 1fr); } }
.ed-addgrid button { border: 1px solid #e3ddcf; background: #fff; border-radius: 14px; padding: 12px 6px; cursor: pointer; display: grid; gap: 4px; justify-items: center; font-weight: 700; font-size: .8rem; color: #3a352d; transition: transform .15s, border-color .15s; }
.ed-addgrid button:hover { transform: translateY(-2px); border-color: #b4462b; }
.ed-addgrid button span { font-size: 1.4rem; }
.ed-fmt { position: fixed; z-index: 120; display: none; gap: 2px; background: #1d1a16; padding: 5px; border-radius: 12px; box-shadow: 0 14px 30px -10px rgba(0,0,0,.5); }
.ed-fmt.show { display: flex; }
.ed-fmt button { border: 0; background: transparent; color: #fff; min-width: 36px; height: 36px; border-radius: 8px; cursor: pointer; font-size: .95rem; }
.ed-fmt button:hover { background: rgba(255,255,255,.15); }
.ed-sec { margin-top: 34px; padding-top: 22px; border-top: 1px solid #ebe4d6; font-family: var(--font-ui); }
.ed-sec h3 { margin: 0 0 4px; font-size: 1.15rem; }
.ed-sec .why { margin: 0 0 14px; color: #6d655a; font-size: .92rem; }
.ed-refs { display: grid; gap: 10px; counter-reset: r; margin: 0; padding: 0; list-style: none; }
.ed-ref { display: grid; grid-template-columns: 38px 1fr auto; gap: 8px; align-items: start; }
.ed-ref .n { width: 38px; height: 38px; border-radius: 10px; background: #1d1a16; color: #fff; display: grid; place-items: center; font-weight: 800; }
.ed-ref .f { display: grid; gap: 6px; }
.ed-ref input { width: 100%; border: 1px solid #e3ddcf; border-radius: 10px; padding: 9px 12px; font-size: .95rem; outline: none; background: #fff; color: #1d1a16; }
.ed-ref input:focus, .ed-embed input:focus { border-color: #b4462b; }
.ed-ref .b { display: flex; flex-direction: column; gap: 6px; }
.ed-btn { border: 1px solid #e3ddcf; background: #fff; color: #3a352d; border-radius: 10px; padding: 8px 12px; font-weight: 700; cursor: pointer; font-size: .85rem; white-space: nowrap; }
.ed-btn:hover { border-color: #1d1a16; }
.ed-btn.dark { background: #1d1a16; color: #fff; border-color: #1d1a16; }
.ed-capsule { display: grid; gap: 10px; }
.ed-switch { display: flex; gap: 12px; align-items: center; cursor: pointer; font-weight: 700; }
.ed-switch input { width: 22px; height: 22px; accent-color: #b4462b; }
.ed-thread { display: grid; gap: 10px; margin-bottom: 12px; max-height: 420px; overflow-y: auto; padding: 4px; }
.ed-msg { max-width: 82%; padding: 10px 14px; border-radius: 16px; font-size: .95rem; line-height: 1.45; white-space: pre-wrap; }
.ed-msg small { display: block; font-size: .72rem; opacity: .7; margin-top: 4px; }
.ed-msg.student { justify-self: end; background: #1d1a16; color: #fff; border-bottom-right-radius: 4px; }
.ed-msg.admin { justify-self: start; background: #e9f2ff; color: #0b2a55; border-bottom-left-radius: 4px; }
.ed-msg.admin b { display: block; font-size: .78rem; margin-bottom: 2px; }
.ed-msg.system { justify-self: center; background: transparent; color: #8a8174; font-size: .82rem; text-align: center; padding: 2px 8px; }
.ed-say { display: flex; gap: 8px; align-items: flex-end; }
.ed-say textarea { flex: 1; min-height: 52px; max-height: 160px; border: 1px solid #e3ddcf; border-radius: 14px; padding: 12px 14px; font: inherit; resize: vertical; outline: none; background: #fff; color: #1d1a16; }
.ed-say textarea:focus { border-color: #b4462b; }

/* ── modal ── */
.st-modal { position: fixed; inset: 0; z-index: 300; display: none; align-items: center; justify-content: center; padding: 16px; background: rgba(3,6,18,.7); backdrop-filter: blur(6px); }
.st-modal.open { display: flex; }
.st-modal .box { width: min(520px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: #101a35; border: 1px solid rgba(255,255,255,.12); border-radius: 24px; padding: 24px; color: #eef2ff; animation: stIn .3s var(--ease); }
.st-modal .box.wide { width: min(980px, 100%); padding: 0; background: #000; overflow: hidden; }
.st-modal .box h3 { margin: 0 0 8px; font-size: 1.3rem; }
.st-modal .acts { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }
.st-modal iframe { width: 100%; height: min(80vh, 900px); border: 0; display: block; background: #fff; }
.st-modal .pvbar { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; background: #101a35; }
@keyframes stIn { from { transform: translateY(16px) scale(.98); opacity: 0; } }
.st-qr { background: #fff; border-radius: 16px; padding: 12px; width: 200px; margin: 12px auto; }
.st-qr svg { width: 176px; height: 176px; display: block; }
