/* Palette and type follow Apple's web style. System fonts only (no web fonts), so pages load everywhere, incl. mainland China. */
:root {
    --bg: #f5f5f7;
    --surface: #ffffff;
    --surface-2: #fbfbfd;
    --ink: #1d1d1f;
    --ink-2: #6e6e73;
    --ink-3: #86868b;
    --line: #d2d2d7;
    --line-2: #e8e8ed;
    --accent: #0071e3;
    --accent-2: #0066cc;
    --accent-soft: #e8f1fc;
    --accent-ink: #ffffff;
    --conf: #5e5ce6;
    --conf-soft: #efeffd;
    --ok: #248a3d;
    --ok-soft: #e7f5ea;
    --warn: #a05a00;
    --warn-soft: #fbf1df;
    --danger: #d70015;
    --danger-soft: #fdebed;
    --info: #0066cc;
    --info-soft: #e8f1fc;
    --thumb-a: #e8e8ed;
    --thumb-b: #d2d2d7;
    --art: #1d1d1f;
    --art-opacity: .09;
    --glass: rgba(251, 251, 253, .8);
    --shadow: 0 2px 12px rgba(0, 0, 0, .06);
    --shadow-lg: 0 18px 50px rgba(0, 0, 0, .16);
    --radius: 18px;
    --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei", "Noto Sans CJK SC", Arial, sans-serif;
    --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Helvetica Neue", "Segoe UI Light", "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei UI Light", "Microsoft YaHei UI", "Microsoft YaHei", Arial, sans-serif;
    --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
    color-scheme: light;
}
@media (prefers-color-scheme: dark) {
    :root {
        --bg: #000000;
        --surface: #1d1d1f;
        --surface-2: #161617;
        --ink: #f5f5f7;
        --ink-2: #a1a1a6;
        --ink-3: #86868b;
        --line: #424245;
        --line-2: #2c2c2e;
        --accent: #0071e3;
        --accent-2: #2997ff;
        --accent-soft: #0b2440;
        --accent-ink: #ffffff;
        --conf: #9d9bff;
        --conf-soft: #1e1d3d;
        --ok: #30d158;
        --ok-soft: #0f2e18;
        --warn: #ffd60a;
        --warn-soft: #332b05;
        --danger: #ff453a;
        --danger-soft: #3a1210;
        --info: #2997ff;
        --info-soft: #0b2440;
        --thumb-a: #1d1d1f;
        --thumb-b: #2c2c2e;
        --art: #f5f5f7;
        --art-opacity: .11;
        --glass: rgba(22, 22, 23, .8);
        --shadow: 0 2px 12px rgba(0, 0, 0, .5);
        --shadow-lg: 0 18px 50px rgba(0, 0, 0, .6);
        color-scheme: dark;
    }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 300 15px/1.5 var(--font); letter-spacing: -.01em; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
b, strong { font-weight: 500; }
h1, h2, h3 { font-family: var(--font-display); }
/* abstract line artwork behind every page (except the 3D viewer) */
body:not(.scene)::before { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; background: var(--art); opacity: var(--art-opacity);
    -webkit-mask: url(/assets/lines.svg) center / cover no-repeat; mask: url(/assets/lines.svg) center / cover no-repeat; }
body:not(.scene) { position: relative; z-index: 0; }
a { color: var(--accent-2); }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.wrap { max-width: 1280px; margin: 0 auto; padding: 0 28px; }
.muted { color: var(--ink-3); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- top bar */
.top { position: sticky; top: 0; z-index: 30; background: var(--glass);
    backdrop-filter: saturate(1.8) blur(20px); -webkit-backdrop-filter: saturate(1.8) blur(20px); border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent); }
.top .wrap { display: flex; align-items: center; gap: 18px; height: 52px; }
.brand { display: flex; align-items: center; text-decoration: none; color: var(--ink); flex: none; }
.logo { display: block; height: 26px; width: auto; aspect-ratio: 664 / 166; }
.top nav { display: flex; gap: 2px; margin-left: 18px; }
.top nav a { text-decoration: none; color: var(--ink-2); padding: 6px 10px; font-size: 13px; font-weight: 400; transition: color .2s; }
.top nav a:hover { color: var(--ink); }
.top nav a[aria-current="page"] { color: var(--ink); }
.top .right { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.usermenu { position: relative; }
.usermenu > button { display: flex; align-items: center; gap: 8px; border: 0; background: transparent;
    border-radius: 999px; padding: 3px 10px 3px 3px; cursor: pointer; color: var(--ink-2); }
.usermenu > button:hover { color: var(--ink); background: var(--line-2); }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--ink); color: var(--bg); display: grid; place-items: center;
    font-size: 11px; font-weight: 500; letter-spacing: .02em; flex: none; }
.usermenu .who { font-size: 13px; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 220px; background: var(--surface); border: 1px solid var(--line);
    border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; z-index: 40; }
.menu .head { padding: 8px 10px 10px; border-bottom: 1px solid var(--line-2); margin-bottom: 4px; }
.menu .head b { display: block; font-size: 13.5px; font-weight: 500; }
.menu .head span { font-size: 12px; color: var(--ink-3); }
.menu a, .menu button { display: block; width: 100%; text-align: left; padding: 8px 10px; border-radius: 8px; border: 0; background: none;
    text-decoration: none; font-size: 13.5px; cursor: pointer; }
.menu a:hover, .menu button:hover { background: var(--line-2); }

/* ---------- buttons, inputs */
.btn { height: 36px; padding: 0 16px; border-radius: 980px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; color: var(--ink);
    font-size: 13.5px; font-weight: 400; transition: background .2s, border-color .2s, opacity .2s; display: inline-flex; align-items: center; justify-content: center; gap: 7px; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--ink-3); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary, .btn.accent { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover, .btn.accent:hover { background: #0077ed; border-color: #0077ed; }
.btn.danger { color: var(--danger); }
.btn.danger:hover { border-color: var(--danger); background: var(--danger-soft); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--line-2); }
.btn.sm { height: 30px; padding: 0 12px; font-size: 12.5px; }
.btn svg, .icon { width: 16px; height: 16px; flex: none; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > label, .label { font-size: 12.5px; font-weight: 400; color: var(--ink-2); }
.field .hint { font-size: 12px; color: var(--ink-3); }
.input, select.input, textarea.input { height: 44px; padding: 0 14px; border-radius: 12px; font-weight: 300; border: 1px solid var(--line); background: var(--surface);
    width: 100%; font-size: 14px; }
textarea.input { height: auto; min-height: 88px; padding: 10px 12px; resize: vertical; line-height: 1.45; }
.input:focus { outline: 4px solid color-mix(in srgb, var(--accent) 25%, transparent); outline-offset: 0; border-color: var(--accent); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.error { background: var(--danger-soft); color: var(--danger); padding: 9px 12px; border-radius: 9px; font-size: 13px; margin-bottom: 14px; }
.okmsg { background: var(--ok-soft); color: var(--ok); padding: 9px 12px; border-radius: 9px; font-size: 13px; margin-bottom: 14px; }

/* ---------- pills / badges */
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 500; padding: 2px 8px; border-radius: 999px;
    background: var(--line-2); color: var(--ink-2); white-space: nowrap; letter-spacing: .01em; }
.pill svg { width: 12px; height: 12px; }
.pill.public { background: var(--ok-soft); color: var(--ok); }
.pill.unlisted { background: var(--info-soft); color: var(--info); }
.pill.private { background: var(--conf-soft); color: var(--conf); }
.pill.admin { background: var(--ink); color: var(--bg); }
.pill.collaborator { background: var(--accent-soft); color: var(--accent-2); }
.pill.viewer { background: var(--line-2); color: var(--ink-2); }
.pill.off { background: var(--danger-soft); color: var(--danger); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }

/* ---------- gallery */
.hero { padding: 104px 0 64px; text-align: center; }
.eyebrow { font-size: 12px; color: var(--ink-2); font-weight: 500; margin: 0 0 18px; letter-spacing: .22em; text-transform: uppercase; }
.hero h1 { font-size: clamp(38px, 6vw, 76px); line-height: 1.04; font-weight: 600; letter-spacing: -.035em; margin: 0 auto 24px; }
.hero h1 span { display: block; font-weight: 200; color: var(--ink-3); }
.hero p { color: var(--ink-2); margin: 0 auto; font-size: clamp(16px, 1.6vw, 19px); font-weight: 300; max-width: 46ch; line-height: 1.5; }
.welcome { padding: 56px 0 8px; }
.welcome h1 { font-size: clamp(30px, 4vw, 44px); letter-spacing: -.025em; margin: 0 0 6px; font-weight: 200; }
.welcome p { margin: 0; color: var(--ink-2); font-size: 17px; }

.section { padding: 36px 0 8px; }
.section-head { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 12px; margin-bottom: 18px; }
.section-head h2 { font-size: 28px; font-weight: 300; margin: 0; letter-spacing: -.02em; display: flex; align-items: center; gap: 10px; }
.section-head .sub { color: var(--ink-3); font-size: 13px; }
.section-head .tools { margin-left: auto; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.search { position: relative; }
.search input { height: 36px; width: 260px; padding: 0 14px 0 34px; border-radius: 980px; font-weight: 300; border: 1px solid var(--line); background: var(--surface); }
.search input:focus { outline: 2px solid color-mix(in srgb, var(--accent) 60%, transparent); outline-offset: -1px; }
.search svg { position: absolute; left: 11px; top: 10px; width: 16px; height: 16px; color: var(--ink-3); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { height: 30px; padding: 0 14px; font-weight: 400; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--ink-2); cursor: pointer; font-size: 12.5px; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 24px; padding-bottom: 24px; }
.card { text-decoration: none; display: block; color: var(--ink); background: var(--surface); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
    transition: transform .35s cubic-bezier(.2, .7, .2, 1), box-shadow .35s; }
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.card .txt { padding: 14px 18px 18px; }
.thumb { aspect-ratio: 16 / 10; overflow: hidden; position: relative; background: linear-gradient(135deg, var(--thumb-a), var(--thumb-b)); }
.thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .5s cubic-bezier(.2, .7, .2, 1); }
.card:hover .thumb img { transform: scale(1.04); }
.thumb .ph { position: absolute; inset: 0; display: grid; place-items: center; color: var(--ink-3); }
.thumb .ph svg { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .45; }
.thumb .ph span { font-size: 40px; font-weight: 200; position: relative; }
.thumb .over { position: absolute; left: 10px; top: 10px; display: flex; gap: 6px; }
.thumb .over .pill { background: rgba(15, 15, 18, .72); color: #fff; backdrop-filter: blur(6px); }
.thumb .play { position: absolute; right: 12px; bottom: 12px; width: 38px; height: 38px; border-radius: 50%; background: rgba(255, 255, 255, .92); color: #16161a;
    display: grid; place-items: center; opacity: 0; transform: translateY(6px); transition: .25s; box-shadow: 0 4px 14px rgba(0,0,0,.25); }
.card:hover .play { opacity: 1; transform: none; }
.card h3 { font-size: 17px; font-weight: 400; margin: 0 0 2px; letter-spacing: -.015em; }
.card .meta { font-size: 13px; color: var(--ink-3); }
.empty { padding: 48px 20px; color: var(--ink-3); text-align: center; border: 1px dashed var(--line); border-radius: var(--radius); }
.empty b { color: var(--ink); display: block; margin-bottom: 4px; font-weight: 400; font-size: 17px; }

.foot { border-top: 1px solid var(--line); color: var(--ink-3); font-size: 12px; padding: 26px 0 40px; margin-top: 48px; }
.foot .wrap { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; }

/* ---------- auth pages */
.auth { min-height: 100dvh; display: grid; grid-template-columns: 1.05fr 1fr; }
.auth .art { background: #000; color: #f5f5f7; padding: 44px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; isolation: isolate; }
.auth .art::before { content: ""; position: absolute; inset: 0; z-index: -1; background: #f5f5f7; opacity: .22;
    -webkit-mask: url(/assets/lines.svg) center / cover no-repeat; mask: url(/assets/lines.svg) center / cover no-repeat; }
.auth .art .brand { color: #f5f5f7; }
.auth .art .logo { height: 40px; }
.auth .art h2 { font-size: 40px; line-height: 1.08; letter-spacing: -.03em; max-width: 13ch; margin: 0 0 14px; font-weight: 200; }
.auth .art p { color: #a1a1a6; max-width: 40ch; margin: 0; font-size: 17px; }
.auth .panel { display: grid; place-items: center; padding: 40px 24px; background: color-mix(in srgb, var(--bg) 70%, transparent); }
.auth form { width: min(380px, 100%); }
.auth form h1 { font-size: 34px; font-weight: 200; margin: 0 0 8px; letter-spacing: -.025em; }
.auth form > p { color: var(--ink-2); margin: 0 0 28px; }
.auth .btn.primary { width: 100%; height: 44px; margin-top: 8px; font-size: 15px; }
.auth .small { font-size: 12.5px; color: var(--ink-3); margin-top: 18px; }
.auth .mobile-logo { display: none; height: 30px; color: var(--ink); margin-bottom: 36px; }

/* ---------- scene page */
body.scene { height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
.scene-bar { display: flex; align-items: center; gap: 12px; height: 56px; padding: 0 14px; border-bottom: 1px solid var(--line); background: var(--glass); backdrop-filter: saturate(1.8) blur(20px); -webkit-backdrop-filter: saturate(1.8) blur(20px); flex: none; }
.scene-bar .title { min-width: 0; }
.scene-logo { padding-right: 14px; margin-right: 2px; border-right: 1px solid var(--line); }
.scene-logo .logo { height: 20px; }
.scene-bar .title h1 { font-size: 15px; font-weight: 400; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 8px; }
.scene-bar .title div { font-size: 12px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scene-bar .actions { margin-left: auto; display: flex; gap: 6px; flex: none; align-items: center; }
.iconbtn { width: 36px; height: 36px; border-radius: 50%; color: var(--ink); border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; cursor: pointer; text-decoration: none; flex: none; }
.iconbtn:hover { border-color: var(--ink-3); }
.iconbtn svg { width: 18px; height: 18px; }
.stage { flex: 1; display: flex; min-height: 0; position: relative; }
.stage iframe { flex: 1; border: 0; width: 100%; height: 100%; background: #141416; }
.info { width: 340px; flex: none; border-left: 1px solid var(--line); background: var(--surface); padding: 22px; overflow: auto; }
.info h2 { font-size: 24px; font-weight: 300; margin: 0 0 8px; letter-spacing: -.02em; }
.info dl { display: grid; grid-template-columns: 92px 1fr; gap: 8px 10px; margin: 18px 0; font-size: 13px; }
.info dt { color: var(--ink-3); }
.info dd { margin: 0; }
.info .desc { color: var(--ink-2); white-space: pre-line; }
.info .block { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line-2); font-size: 12.5px; color: var(--ink-2); }
.info .block b { color: var(--ink); display: block; margin-bottom: 6px; font-size: 12.5px; font-weight: 500; }
.kbd { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; }
.kbd span:nth-child(odd) { color: var(--ink-3); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-size: 12px; padding: 2px 9px; border-radius: 6px; background: var(--bg); color: var(--ink-2); border: 1px solid var(--line); }
.nda { display: flex; gap: 10px; background: var(--conf-soft); color: var(--conf); border-radius: 10px; padding: 10px 12px; font-size: 12.5px; margin-top: 16px; }
.nda svg { width: 16px; height: 16px; flex: none; margin-top: 1px; }
.watermark { position: absolute; left: 14px; top: 12px; pointer-events: none; color: rgba(255,255,255,.42); font-size: 11.5px;
    text-shadow: 0 1px 2px rgba(0,0,0,.6); line-height: 1.35; }
.notice { margin: 12vh auto; max-width: 420px; text-align: center; color: var(--ink-2); padding: 0 20px; }
.notice .ic { width: 52px; height: 52px; border-radius: 14px; background: var(--line-2); display: grid; place-items: center; margin: 0 auto 16px; }
.notice h1 { font-size: 28px; font-weight: 300; color: var(--ink); margin: 0 0 8px; }

/* ---------- toast + dialogs */
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(16px); background: var(--ink); color: var(--bg); padding: 10px 16px;
    border-radius: 10px; font-size: 13px; opacity: 0; transition: .2s; pointer-events: none; z-index: 100; box-shadow: var(--shadow-lg); }
.toast.show { opacity: 1; transform: translateX(-50%); }
.toast.bad { background: var(--danger); color: #fff; }
dialog { border: 1px solid var(--line); border-radius: 20px; background: var(--surface); color: var(--ink); width: min(560px, calc(100vw - 32px)); padding: 0; box-shadow: var(--shadow-lg); }
dialog::backdrop { background: rgba(10, 10, 12, .5); }
dialog .dh { padding: 18px 22px 0; display: flex; align-items: center; }
dialog .dh h3 { margin: 0; font-size: 21px; font-weight: 300; }
dialog .dh .x { margin-left: auto; }
dialog .db { padding: 16px 22px; }
dialog .df { padding: 14px 22px 18px; display: flex; gap: 8px; justify-content: flex-end; border-top: 1px solid var(--line-2); }
dialog textarea.code { width: 100%; height: 110px; font: 12px/1.45 var(--mono); padding: 10px; border-radius: 9px; border: 1px solid var(--line); background: var(--bg); resize: vertical; }
.secret { font: 600 18px/1.3 var(--mono); background: var(--bg); border: 1px dashed var(--line); padding: 14px; border-radius: 10px; text-align: center; letter-spacing: .04em; user-select: all; }

/* ---------- responsive */
@media (max-width: 900px) {
    .auth { grid-template-columns: 1fr; }
    .auth .art { display: none; }
    .auth .mobile-logo { display: block; }
    .hero { padding: 64px 0 40px; }
}
@media (max-width: 760px) {
    .wrap { padding: 0 16px; }
    .top nav { display: none; }
    .usermenu .who { display: none; }
    .usermenu > button { padding-right: 3px; }
    .search input { width: 100%; }
    .search, .section-head .tools { width: 100%; }
    .info { position: absolute; right: 0; top: 0; bottom: 0; width: min(340px, 92vw); z-index: 20; box-shadow: var(--shadow-lg); }
    .scene-bar .hide-sm { display: none; }
    .row2 { grid-template-columns: 1fr; }
}
