* { box-sizing: border-box; }
:root {
  --bg: #0b1020;
  --panel: #141b2e;
  --panel2: #1b2440;
  --line: rgba(160, 180, 220, .16);
  --text: #e8edf8;
  --muted: #93a0bd;
  --gold: #e8c37a;
  --teal: #6fd3c7;
  --red: #ff8f8f;
}
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.6 -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
}
#app { max-width: 1500px; margin: 0 auto; padding: 0 26px 40px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 26px 0 22px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 14px; }
.mark { width: 42px; height: 42px; border: 1px solid var(--gold); border-radius: 12px; object-fit: cover; box-shadow: 0 0 0 5px rgba(232, 195, 122, .07); flex: none; }
h1 { margin: 0; font-size: 20px; font-weight: 600; letter-spacing: .3px; }
.topbar p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.status { display: flex; gap: 8px; flex-wrap: wrap; }
.pill { padding: 5px 12px; border-radius: 999px; font-size: 12px; border: 1px solid var(--line); }
.pill.ok { color: var(--teal); border-color: rgba(111, 211, 199, .4); background: rgba(111, 211, 199, .08); }
.pill.warn { color: var(--gold); border-color: rgba(232, 195, 122, .4); background: rgba(232, 195, 122, .08); }
.pill.ghost { color: var(--muted); }

.layout { display: grid; grid-template-columns: 390px minmax(0, 1fr); gap: 20px; margin-top: 22px; align-items: start; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 22px; }
.panel-title { display: flex; align-items: center; gap: 9px; font-size: 13px; font-weight: 600; letter-spacing: .5px; margin: 0 0 14px; }
.panel-title:not(:first-child) { margin-top: 26px; }
.panel-title span { color: var(--gold); font-size: 11px; font-family: ui-monospace, Consolas, monospace; border: 1px solid rgba(232, 195, 122, .35); border-radius: 5px; padding: 1px 5px; }

.drop { position: relative; border: 1.5px dashed rgba(160, 180, 220, .3); border-radius: 12px; min-height: 168px; display: grid; place-items: center; cursor: pointer; overflow: hidden; background: rgba(10, 15, 30, .5); transition: border-color .15s, background .15s; }
.drop.over { border-color: var(--gold); background: rgba(232, 195, 122, .07); }
.drop.filled { background: #f3f1ea; }
.drop-img { max-width: 100%; max-height: 230px; display: block; object-fit: contain; }
.drop-hint { text-align: center; padding: 20px; }
.drop-hint strong { display: block; margin-top: 10px; font-weight: 500; }
.drop-hint small { color: var(--muted); font-size: 12px; }
.drop-icon { width: 34px; height: 34px; margin: 0 auto; border: 2px solid var(--muted); border-radius: 8px; position: relative; }
.drop-icon::after { content: ''; position: absolute; inset: 9px; border: 2px solid var(--gold); border-radius: 3px; }
.drop-change { position: absolute; right: 10px; bottom: 10px; background: rgba(11, 16, 32, .85); color: #fff; font-size: 12px; padding: 4px 10px; border-radius: 6px; }
.file-name { margin: 8px 0 0; color: var(--muted); font-size: 12px; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field.wide { grid-column: 1 / -1; }
.field > span { color: var(--muted); font-size: 12px; display: flex; justify-content: space-between; }
.field > span b { color: var(--gold); font-weight: 500; font-family: ui-monospace, Consolas, monospace; }
.field input:not([type=range]), .field select { width: 100%; background: var(--panel2); border: 1px solid var(--line); color: var(--text); border-radius: 8px; padding: 9px 10px; font: inherit; font-size: 13px; outline: none; }
.field input:focus, .field select:focus { border-color: var(--gold); }
.field select { appearance: none; }
.field small { color: var(--muted); font-size: 11px; line-height: 1.4; }
.field.slider { margin-top: 12px; }
input[type=range] { width: 100%; accent-color: var(--gold); }
.checks { display: flex; flex-direction: column; gap: 7px; margin-top: 16px; color: var(--muted); font-size: 12px; }
.checks label { display: flex; align-items: center; gap: 7px; cursor: pointer; }
.checks input { accent-color: var(--gold); }
.notice { margin: 12px 0 0; color: var(--gold); background: rgba(232, 195, 122, .08); border: 1px solid rgba(232, 195, 122, .25); border-radius: 8px; padding: 9px 11px; font-size: 12px; }
.primary { width: 100%; margin-top: 20px; padding: 12px; border: 0; border-radius: 9px; background: var(--gold); color: #1a1409; font: inherit; font-weight: 600; cursor: pointer; }
.primary:disabled { opacity: .45; cursor: not-allowed; }
.error { color: var(--red); font-size: 12px; margin: 10px 0 0; word-break: break-all; }

.stage-panel { min-height: 640px; }
.stage-head { display: flex; align-items: center; justify-content: space-between; }
.stage-head .panel-title { margin-bottom: 14px; }
.link { background: none; border: 0; color: var(--gold); cursor: pointer; font: inherit; font-size: 12px; }
.progress-box { background: var(--panel2); border: 1px solid var(--line); border-radius: 11px; padding: 16px; }
.progress-top { display: flex; justify-content: space-between; font-size: 13px; }
.progress-top span { color: var(--gold); font-family: ui-monospace, Consolas, monospace; }
.bar { height: 6px; background: rgba(160, 180, 220, .15); border-radius: 99px; margin: 12px 0 16px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--gold); border-radius: 99px; transition: width .4s; }
.log-head { cursor: pointer; color: var(--muted); font-size: 12px; display: flex; justify-content: space-between; border-top: 1px solid var(--line); padding-top: 10px; }
.logs { max-height: 190px; overflow: auto; background: #090e1c; border-radius: 8px; padding: 11px; font: 11px/1.6 ui-monospace, Consolas, monospace; color: #a9b8d6; white-space: pre-wrap; word-break: break-all; }

.author-edit-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin: 0 0 12px; padding: 11px 13px; border: 1px solid rgba(232, 195, 122, .35); background: rgba(232, 195, 122, .07); border-radius: 10px; }
.author-edit-bar .aeb-title { color: var(--gold); font-size: 13px; white-space: nowrap; }
.author-edit-bar .aeb-field { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.author-edit-bar .aeb-field b { color: var(--gold); font-variant-numeric: tabular-nums; }
.author-edit-bar select { min-width: 116px; }
.author-edit-bar .aeb-slider input[type="range"] { width: 130px; }
.result iframe { width: 100%; height: 860px; border: 1px solid var(--line); border-radius: 11px; background: #fafafa; display: block; }
.result-hint { margin: 12px 0 0; color: var(--gold); background: rgba(232, 195, 122, .08); border: 1px solid rgba(232, 195, 122, .25); border-radius: 8px; padding: 9px 11px; font-size: 12px; }
.result-meta { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
.result-meta strong { display: block; font-size: 15px; }
.result-meta span { color: var(--muted); font-size: 12px; }
.result-actions { display: flex; gap: 8px; }
.btn { border: 1px solid var(--line); color: var(--text); background: var(--panel2); padding: 7px 13px; border-radius: 8px; text-decoration: none; font-size: 12px; }
.btn:hover { border-color: var(--gold); }
.files { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 14px; font-size: 11px; }
.files span { color: var(--muted); }
.files a { color: var(--teal); text-decoration: none; border: 1px solid rgba(111, 211, 199, .25); padding: 3px 8px; border-radius: 6px; font-family: ui-monospace, Consolas, monospace; }

.empty { text-align: center; padding: 78px 20px; color: var(--muted); }
.empty strong { display: block; color: var(--text); font-size: 15px; font-weight: 500; margin-top: 22px; }
.empty p { font-size: 13px; line-height: 1.8; }
.empty-card { width: 118px; height: 168px; margin: 0 auto; border: 2px solid rgba(232, 195, 122, .5); border-radius: 12px; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 9px; transform: rotate(-7deg); }
.empty-card span { display: block; width: 60%; height: 7px; border-radius: 4px; background: rgba(232, 195, 122, .28); }
.empty-card span:nth-child(2) { width: 42%; }
.empty-card span:nth-child(3) { width: 70%; }

.library { margin-top: 26px; border-top: 1px solid var(--line); padding-top: 18px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 12px; }
.card-item { position: relative; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; cursor: pointer; background: var(--panel2); }
.card-item.active { border-color: var(--gold); }
.card-item img { width: 100%; height: 150px; object-fit: cover; display: block; }
.card-placeholder { height: 150px; display: grid; place-items: center; color: var(--muted); font-size: 13px; }
.card-info { padding: 7px 9px; }
.card-info strong { display: block; font-size: 12px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-info small { color: var(--muted); font-size: 10px; }
.del { position: absolute; top: 5px; right: 5px; width: 20px; height: 20px; border: 0; border-radius: 5px; background: rgba(10, 15, 30, .8); color: #fff; cursor: pointer; line-height: 1; }

/* ---- B-tier additions ---- */
h1 small { color: var(--gold); font-size: 11px; border: 1px solid rgba(232,195,122,.45); border-radius: 4px; padding: 1px 5px; margin-left: 6px; vertical-align: 2px; }
.pill.accent { color: var(--gold); border-color: rgba(232,195,122,.4); background: rgba(232,195,122,.08); }
.subbar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 14px; padding: 9px 14px; border: 1px solid rgba(232,195,122,.25); background: rgba(232,195,122,.06); border-radius: 9px; font-size: 12px; }
.subbar label { display: flex; align-items: center; gap: 8px; color: var(--gold); }
.subbar input { background: var(--panel2); border: 1px solid var(--line); color: var(--text); border-radius: 7px; padding: 6px 9px; font: inherit; font-size: 12px; width: 210px; }
.subbar span { color: var(--muted); }
.head-actions { display: flex; gap: 14px; align-items: center; }
.link:disabled { opacity: .5; cursor: wait; }
.share-box { display: flex; gap: 8px; margin: 0 0 14px; }
.share-box input { flex: 1; min-width: 0; background: var(--panel2); border: 1px solid var(--line); color: var(--teal); border-radius: 8px; padding: 8px 10px; font: 12px ui-monospace, Consolas, monospace; }
.share-box .btn { cursor: pointer; white-space: nowrap; }
.bar.fail i { background: var(--red); }
.queue-note { color: var(--muted); background: rgba(160,180,220,.06); border-color: var(--line); }
.library-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.library-head .panel-title { margin-bottom: 14px; }
.panel-title em { font-style: normal; font-weight: 400; color: var(--muted); font-size: 11px; letter-spacing: 0; }
.pager { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); margin-bottom: 12px; }
.pager button { width: 26px; height: 26px; border: 1px solid var(--line); background: var(--panel2); color: var(--text); border-radius: 6px; cursor: pointer; }
.pager button:disabled { opacity: .35; cursor: not-allowed; }

/* ---- C-tier: navigation & accounts ---- */
.nav { display: flex; gap: 4px; background: rgba(160,180,220,.06); border: 1px solid var(--line); border-radius: 10px; padding: 4px; }
.nav a { color: var(--muted); text-decoration: none; font-size: 13px; padding: 7px 15px; border-radius: 7px; white-space: nowrap; }
.nav a:hover { color: var(--text); }
.nav a.on { color: #1a1409; background: var(--gold); font-weight: 600; }
.userbox { display: flex; align-items: center; gap: 9px; }
.me { display: flex; align-items: center; gap: 8px; color: var(--text); text-decoration: none; font-size: 13px; }
.me em { color: var(--gold); font-style: normal; font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
.me-name { max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { border-radius: 50%; object-fit: cover; display: inline-grid; place-items: center; vertical-align: middle; border: 1px solid var(--line); background: var(--panel2); color: var(--gold); font-weight: 600; flex: none; }
.avatar.xs { width: 18px; height: 18px; font-size: 10px; }
.avatar.sm { width: 28px; height: 28px; font-size: 13px; }
.avatar.lg { width: 96px; height: 96px; font-size: 38px; border: 2px solid rgba(232,195,122,.45); }
.avatar.fallback { display: inline-grid; }
.ghost-btn, .gold-btn { border-radius: 8px; padding: 8px 15px; font: inherit; font-size: 12px; cursor: pointer; white-space: nowrap; }
.ghost-btn { border: 1px solid var(--line); background: var(--panel2); color: var(--text); }
.ghost-btn:hover { border-color: var(--gold); }
.gold-btn { border: 1px solid var(--gold); background: var(--gold); color: #1a1409; font-weight: 600; }
.gold-btn:disabled { opacity: .45; cursor: not-allowed; }
.inline-btn { background: none; border: 0; color: var(--gold); cursor: pointer; font: inherit; font-size: inherit; text-decoration: underline; padding: 0 2px; }
.toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); background: #202b48; border: 1px solid rgba(232,195,122,.5); color: var(--text); padding: 11px 20px; border-radius: 10px; font-size: 13px; z-index: 90; box-shadow: 0 10px 30px rgba(0,0,0,.45); }

/* ---- C-tier: wide views ---- */
.wide-view { margin-top: 22px; }
.view-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.view-head h2 { margin: 0; font-size: 22px; font-weight: 600; }
.view-head p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.gallery-count { color: var(--gold); font-size: 12px; }
.gallery-controls { margin: 20px 0 22px; display: flex; flex-direction: column; gap: 12px; }
.search-row { display: flex; gap: 9px; }
.search-input { flex: 1; min-width: 0; background: var(--panel2); border: 1px solid var(--line); color: var(--text); border-radius: 9px; padding: 11px 14px; font: inherit; font-size: 13px; outline: none; }
.search-input:focus { border-color: var(--gold); }
.filter-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.filter-row label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.filter-row select { background: var(--panel2); border: 1px solid var(--line); color: var(--text); border-radius: 8px; padding: 8px 10px; font: inherit; font-size: 12px; }
.filter-hint { color: var(--teal); font-size: 12px; }

.work-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; }
.work-card { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--panel2); display: flex; flex-direction: column; }
.work-cover { position: relative; cursor: pointer; background: #f4f1ea; aspect-ratio: 2 / 3; overflow: hidden; }
.work-cover img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .25s; }
.work-cover:hover img { transform: scale(1.04); }
.cover-placeholder { width: 100%; height: 100%; display: grid; place-items: center; color: #7b8296; font-size: 13px; }
.cover-open { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(11,16,32,.82); color: var(--gold); text-align: center; font-size: 12px; padding: 7px; opacity: 0; transition: opacity .2s; }
.work-cover:hover .cover-open { opacity: 1; }
.work-body { padding: 11px 12px 12px; display: flex; flex-direction: column; gap: 7px; flex: 1; }
.work-title { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.work-author { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; text-decoration: none; }
.work-author:hover { color: var(--gold); }
.work-author em { font-style: normal; color: var(--gold); font-family: ui-monospace, Consolas, monospace; }
.work-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; }
.work-time { color: var(--muted); font-size: 11px; }
.like-btn { border: 1px solid var(--line); background: rgba(160,180,220,.06); color: var(--muted); border-radius: 7px; padding: 5px 9px; font: inherit; font-size: 12px; cursor: pointer; white-space: nowrap; }
.like-btn b { color: var(--gold); font-family: ui-monospace, Consolas, monospace; }
.like-btn.liked { color: #ff8f8f; border-color: rgba(255,143,143,.45); background: rgba(255,143,143,.08); }
.like-btn:disabled { opacity: .5; cursor: not-allowed; }
.pager.big { justify-content: center; margin: 24px 0 4px; }
.pager.big button { width: auto; padding: 0 14px; }
.empty.small { padding: 54px 16px; }

/* ---- C-tier: personal space ---- */
.space-head { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.space-avatar-wrap { position: relative; flex: none; }
.avatar-edit { position: absolute; left: 50%; bottom: -8px; transform: translateX(-50%); border: 1px solid var(--line); background: #202b48; color: var(--gold); font-size: 11px; border-radius: 6px; padding: 3px 9px; cursor: pointer; white-space: nowrap; }
.space-meta { flex: 1; min-width: 220px; }
.space-meta h2 { margin: 0; font-size: 23px; font-weight: 600; }
.account-id { font-style: normal; font-size: 13px; color: var(--gold); font-family: ui-monospace, Consolas, monospace; border: 1px solid rgba(232,195,122,.35); border-radius: 5px; padding: 2px 7px; vertical-align: 3px; margin-left: 6px; }
.space-bio { margin: 8px 0 4px; color: var(--muted); font-size: 13px; }
.space-stats { margin: 0; color: var(--muted); font-size: 12px; }
.space-actions { display: flex; gap: 8px; }
.profile-edit { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; margin: 18px 0 0; padding: 14px; background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; }
.profile-edit label { display: flex; flex-direction: column; gap: 5px; color: var(--muted); font-size: 12px; flex: 1; min-width: 160px; }
.profile-edit input { background: var(--panel); border: 1px solid var(--line); color: var(--text); border-radius: 8px; padding: 9px 10px; font: inherit; font-size: 13px; }
.space-tabs { display: flex; align-items: center; gap: 8px; margin: 24px 0 16px; border-bottom: 1px solid var(--line); padding-bottom: 12px; }
.space-tabs button { border: 1px solid var(--line); background: transparent; color: var(--muted); border-radius: 8px; padding: 8px 15px; font: inherit; font-size: 13px; cursor: pointer; }
.space-tabs button.on { color: #1a1409; background: var(--gold); border-color: var(--gold); font-weight: 600; }
.space-tabs button em { font-style: normal; opacity: .7; }
.tab-note { margin-left: auto; color: var(--muted); font-size: 12px; }
.private-note { color: var(--gold); background: rgba(232,195,122,.07); border: 1px solid rgba(232,195,122,.22); border-radius: 8px; padding: 9px 12px; font-size: 12px; }
.cat-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.cat-chip { border: 1px solid var(--line); background: var(--panel2); color: var(--muted); border-radius: 999px; padding: 6px 13px; font: inherit; font-size: 12px; cursor: pointer; }
.cat-chip.on { color: #1a1409; background: var(--gold); border-color: var(--gold); font-weight: 600; }
.cat-chip.priv { border-style: dashed; }
.cat-chip em { font-style: normal; opacity: .7; margin-left: 3px; }
.priv-tag { color: var(--red); font-size: 10px; border: 1px solid rgba(255,143,143,.35); border-radius: 4px; padding: 1px 5px; margin-left: 5px; }
.muted-note { color: var(--muted); font-size: 12px; }
.manage-bar { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin: 16px 0 12px; padding: 13px; border: 1px dashed rgba(232,195,122,.35); border-radius: 10px; background: rgba(232,195,122,.04); }
.manage-bar input, .cat-manage-row input, .work-manage input { background: var(--panel); border: 1px solid var(--line); color: var(--text); border-radius: 7px; padding: 7px 9px; font: inherit; font-size: 12px; min-width: 0; }
.manage-bar input { flex: 1; max-width: 240px; }
.mini-check { display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: 12px; }
.mini-check input { accent-color: var(--gold); }
.manage-hint { color: var(--muted); font-size: 11px; }
.cat-manage { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.cat-manage-row { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.cat-manage-row input { flex: 1; max-width: 220px; }
.mini-btn { border: 1px solid var(--line); background: var(--panel2); color: var(--text); border-radius: 6px; padding: 6px 10px; font: inherit; font-size: 11px; cursor: pointer; white-space: nowrap; }
.mini-btn:hover { border-color: var(--gold); }
.mini-btn.danger { color: var(--red); border-color: rgba(255,143,143,.3); }
.work-badges { display: flex; gap: 5px; flex-wrap: wrap; }
.badge { font-size: 10px; border-radius: 5px; padding: 2px 7px; border: 1px solid var(--line); }
.badge.pub { color: var(--teal); border-color: rgba(111,211,199,.35); }
.badge.priv { color: var(--red); border-color: rgba(255,143,143,.35); }
.badge.ghost { color: var(--muted); }
.work-manage { display: flex; flex-direction: column; gap: 6px; border-top: 1px solid var(--line); padding-top: 9px; }
.work-manage input, .work-manage select { width: 100%; }
.work-manage select { background: var(--panel); border: 1px solid var(--line); color: var(--text); border-radius: 7px; padding: 6px 8px; font: inherit; font-size: 12px; }
.work-manage-row { display: flex; gap: 5px; flex-wrap: wrap; }

/* ---- C-tier: modals ---- */
.modal { position: fixed; inset: 0; background: rgba(4,7,16,.78); z-index: 80; display: grid; place-items: center; padding: 20px; }
.modal-card { position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: 15px; box-shadow: 0 24px 70px rgba(0,0,0,.55); }
.modal-close { position: absolute; top: 10px; right: 12px; width: 28px; height: 28px; border: 0; border-radius: 7px; background: var(--panel2); color: var(--text); cursor: pointer; font-size: 18px; line-height: 1; }
.auth-card { width: min(100%, 400px); padding: 30px 28px 26px; }
.auth-card h2 { margin: 0; font-size: 21px; font-weight: 600; }
.modal-sub { margin: 6px 0 22px; color: var(--muted); font-size: 12px; }
.auth-form { display: flex; flex-direction: column; gap: 13px; }
.auth-form label { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 12px; }
.auth-form input { width: 100%; background: var(--panel2); border: 1px solid var(--line); color: var(--text); border-radius: 8px; padding: 10px 11px; font: inherit; font-size: 13px; outline: none; }
.auth-form input:focus { border-color: var(--gold); }
.auth-form .primary { margin-top: 6px; }
.auth-switch { margin: 4px 0 0; text-align: center; color: var(--muted); font-size: 12px; }
.viewer-modal { padding: 16px; }
.viewer-card { width: min(100%, 1080px); padding: 14px; }
.viewer-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 2px 46px 12px 6px; }
.viewer-head strong { font-size: 15px; }
.viewer-head span { color: var(--muted); font-size: 12px; }
.viewer-head .btn { margin-left: auto; }
.viewer-card iframe { width: 100%; height: min(76vh, 760px); border: 1px solid var(--line); border-radius: 10px; background: #fafafa; display: block; }

@media (max-width: 1100px) {
  .topbar { gap: 14px; }
  .nav { order: 3; width: 100%; justify-content: center; }
}
@media (max-width: 960px) {
  .layout { grid-template-columns: 1fr; }
  .result iframe { height: 620px; }
  #app { padding: 0 14px 30px; }
  .subbar { flex-direction: column; align-items: flex-start; }
  .work-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
  .viewer-card iframe { height: 60vh; }
  .space-head { gap: 14px; }
  .tab-note { width: 100%; margin-left: 0; }
}

/* ---- viewer chrome text: workbench form + edit dialog ---- */
.text-options { margin: 14px 0 4px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel2); padding: 0 12px; }
.text-options summary { cursor: pointer; padding: 11px 2px; font-size: 12px; color: var(--text); font-weight: 600; list-style: none; }
.text-options summary::-webkit-details-marker { display: none; }
.text-options summary::before { content: '▸'; color: var(--gold); margin-right: 8px; }
.text-options[open] summary::before { content: '▾'; }
.text-options[open] { padding-bottom: 14px; }
.text-options .grid2 { margin-top: 6px; }
.field-note { color: var(--muted); font-size: 11px; line-height: 1.6; margin: 6px 0 10px; }
.text-edit-card { width: min(100%, 720px); max-height: 88vh; overflow: auto; padding: 28px; }
.text-edit-card h2 { margin: 0; font-size: 20px; }
.text-edit-card .grid2 { margin-top: 8px; }
.text-edit-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

/* ---- appearance: finishes, themes, palette ---- */
.appearance-card { width: min(100%, 760px); }
.appearance-card .text-options { margin-top: 14px; }
.color-field input[type="color"] {
  width: 100%; height: 34px; padding: 2px;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--panel2); cursor: pointer;
}
.field input[type="file"] { font-size: 11px; color: var(--muted); }
.field small { display: block; margin-top: 5px; color: var(--muted); font-size: 11px; line-height: 1.5; }

/* ---- site announcements banner (admin-published, allows HTML/CSS) ---- */
.ann-bar { display: flex; flex-direction: column; gap: 0; }
.ann-item { display: flex; align-items: stretch; border-bottom: 1px solid var(--line); }
.ann-body { flex: 1; padding: 10px 20px; background: rgba(232, 195, 122, .08); font-size: 13px; }
.ann-body :first-child { margin-top: 0; }
.ann-body :last-child { margin-bottom: 0; }
.ann-x { flex: none; width: 44px; border: none; background: transparent; color: var(--muted); font-size: 18px; cursor: pointer; }
.ann-x:hover { color: var(--text); }

/* ---- work moderation state in user's space ---- */
.mod-actions { margin-top: 8px; padding: 8px 10px; border: 1px solid rgba(255,107,107,.35); border-radius: 8px; background: rgba(255,107,107,.07); }
.mod-actions .mod-reason { margin: 0 0 8px; font-size: 12px; color: var(--danger); }
.mod-actions .mod-note { margin: 0; font-size: 12px; color: var(--info); }
.mod-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.badge.danger { background: rgba(255,107,107,.16); color: var(--danger); border: 1px solid rgba(255,107,107,.4); }
.badge.info { background: rgba(108,182,255,.16); color: var(--info); border: 1px solid rgba(108,182,255,.4); }

/* ---- my info modal ---- */
.myinfo-card { width: min(460px, 100%); }
.mi-status { display: inline-block; padding: 4px 12px; border-radius: 999px; font-size: 13px; margin-bottom: 12px; }
.mi-status.ok { background: rgba(76,212,160,.14); color: var(--ok); }
.mi-status.bad { background: rgba(255,107,107,.16); color: var(--danger); }
.mi-ban { border: 1px solid rgba(255,107,107,.4); border-radius: 10px; padding: 12px 14px; margin-bottom: 14px; }
.mi-ban h3 { margin: 0 0 6px; font-size: 14px; color: var(--danger); }
.mi-ban-title { font-weight: 600; margin: 0 0 4px; }
.mi-ban-body { margin: 0 0 8px; white-space: pre-wrap; line-height: 1.5; }
.mi-ban-hint { margin: 0; font-size: 12px; color: var(--muted); }
.mi-notices h3 { margin: 6px 0; font-size: 14px; }
.mi-notices ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.mi-notices li { border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; }
.mi-notices li.unread { border-color: var(--gold); }
.mi-n-title { font-weight: 600; }
.mi-n-body { margin-top: 3px; font-size: 13px; color: var(--muted); white-space: pre-wrap; }
.mi-n-time { margin-top: 4px; font-size: 11px; color: var(--muted); }

/* ---- live background preview ---- */
.bg-preview {
  margin: 14px 0 4px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel2);
  padding: 10px 12px 12px;
}
.bg-preview-head {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 600; color: var(--text); margin-bottom: 8px;
}
.bg-preview-status { color: var(--gold); font-weight: 500; font-family: ui-monospace, Consolas, monospace; }
.bg-preview-hint { color: var(--muted); font-weight: 400; font-size: 11px; }
.bg-preview-canvas {
  position: relative;
  aspect-ratio: 2 / 3;
  width: 100%;
  max-width: 300px;
  margin: 0 auto;
  border-radius: 8px;
  overflow: hidden;
  background:
    repeating-conic-gradient(#1b2030 0% 25%, #161a27 0% 50%) 50% / 22px 22px;
  border: 1px solid var(--line);
}
.bg-preview-canvas img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.bg-preview-empty {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 16px; text-align: center;
  color: var(--muted); font-size: 11px; line-height: 1.5;
}

