:root {
  --ink: #211e2e;
  --paper: #eeedf2;
  --paper-dim: #dfdce8;
  --line: rgba(33, 30, 46, .18);
  --muted: #716c80;
  --acid: #c4b7ff;
  --black: #292439;
  --red: #a34e71;
  --serif: Georgia, "Noto Serif SC", "Songti SC", SimSun, serif;
  --sans: "Microsoft YaHei UI", "Microsoft YaHei", Arial, sans-serif;
  --mono: "Cascadia Mono", Consolas, monospace;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #ece9f4;
  --paper: #17151d;
  --paper-dim: #24212d;
  --line: rgba(225, 219, 239, .2);
  --muted: #aaa4b7;
  --acid: #b8a8ef;
  --black: #292535;
  --red: #e08cac;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--paper); color: var(--ink); }
html { scrollbar-gutter: stable; }
html.modal-open { overflow: hidden; overscroll-behavior: none; }
html.modal-open body { position: fixed; top: var(--modal-scroll-y); left: var(--modal-scroll-x); right: 0; overflow: hidden; }
.dialog, .single-info, .comparison-grid { overscroll-behavior: contain; }
body { margin: 0; min-height: 100vh; font-family: var(--sans); font-size: 14px; background: var(--paper); }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
.noise { position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: .23; background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.78' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.19'/%3E%3C/svg%3E"); }
.shell { width: min(1560px, 100%); min-height: 100vh; margin: 0 auto; background: rgba(238, 237, 242, .82); border-inline: 1px solid var(--line); }
.topbar { min-height: 86px; display: flex; align-items: center; gap: 28px; padding: 0 34px; border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; white-space: nowrap; }
.brand-mark { display: grid; width: 38px; aspect-ratio: 1; place-items: center; color: var(--acid); background: var(--black); font: 700 22px var(--serif); }
.brand b { display: block; font: 700 19px var(--serif); letter-spacing: .13em; }
.brand em { display: block; margin-top: 3px; color: var(--muted); font: 9px var(--mono); font-style: normal; letter-spacing: .15em; }
.topbar-note { flex: 1; margin: 0; color: var(--muted); font-family: var(--serif); }
.topbar-actions, .form-actions { display: flex; align-items: center; gap: 16px; }
.primary-button, .text-button, .compare-button, .round-button, .close-button { border: 0; background: transparent; color: var(--ink); }
.primary-button { padding: 12px 17px; background: var(--black); color: var(--acid); font-weight: 700; letter-spacing: .04em; transition: background .15s, transform .15s; }
.primary-button:hover { background: #32352d; transform: translateY(-1px); }
.text-button { padding: 7px 0; border-bottom: 1px solid var(--ink); font-size: 12px; }
.text-button:hover { color: var(--red); border-color: var(--red); }
.app-grid { display: grid; grid-template-columns: 265px minmax(0, 1fr); min-height: calc(100vh - 86px); }
.sidebar { display: flex; flex-direction: column; border-right: 1px solid var(--line); padding: 24px 18px 18px; }
.sidebar-heading { display: flex; justify-content: space-between; align-items: center; padding: 0 8px 13px; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .15em; }
.round-button { display: grid; place-items: center; width: 25px; height: 25px; border: 1px solid var(--line); border-radius: 50%; font-size: 18px; line-height: 1; transition: .15s; }
.round-button:hover { border-color: var(--ink); background: var(--black); color: var(--acid); }
.group-list { display: grid; gap: 3px; }
.group-item { display: grid; grid-template-columns: 19px minmax(0, 1fr) auto; align-items: center; gap: 8px; width: 100%; min-height: 45px; padding: 8px; border: 1px solid transparent; color: var(--ink); background: transparent; text-align: left; }
.group-item:hover { background: rgba(22,24,21,.05); }
.group-item.is-active { border-color: var(--ink); background: var(--black); color: var(--paper); }
.group-item-mark { display: grid; width: 18px; height: 18px; place-items: center; border: 1px solid currentColor; font: 10px var(--mono); }
.group-item-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.group-item-count { color: var(--muted); font: 10px var(--mono); }
.group-item.is-active .group-item-count { color: var(--acid); }
.sidebar-foot { margin-top: auto; padding: 20px 8px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; line-height: 1.7; }
.sidebar-foot p { margin: 0; }
.workspace { min-width: 0; padding: clamp(26px, 5vw, 72px) clamp(22px, 6vw, 100px) 65px; }
.workspace-head { display: flex; justify-content: space-between; gap: 25px; align-items: end; }
.eyebrow { margin: 0 0 10px; color: var(--muted); font: 11px var(--mono); letter-spacing: .13em; text-transform: uppercase; }
h1, h2, p { overflow-wrap: anywhere; }
h1 { margin: 0; font: 700 clamp(38px, 5vw, 68px)/.95 var(--serif); letter-spacing: -.055em; }
h2 { margin: 0; font: 700 29px/1.1 var(--serif); letter-spacing: -.04em; }
.workspace-summary { display: flex; gap: 17px; padding-bottom: 6px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.workspace-summary b { color: var(--ink); font: 700 22px var(--serif); }
.prompt-panel { margin-top: 38px; padding: 18px 0 20px; border-block: 1px solid var(--ink); }
.prompt-panel-head { display: flex; justify-content: space-between; align-items: baseline; color: var(--muted); font: 11px var(--mono); letter-spacing: .12em; }
.prompt-panel p { max-width: 850px; max-height: 7.5em; margin: 14px 0 0; overflow: auto; white-space: pre-wrap; font: 18px/1.65 var(--serif); }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 28px; }
.thumbnail-toggle { min-height: 40px; padding: 10px 13px; white-space: nowrap; border: 1px solid var(--line); background: transparent; color: var(--ink); font-size: 12px; }
.thumbnail-toggle[aria-pressed="true"] { border-color: #6954a8; background: #e8e1ff; }
.thumbnail-toggle:hover { border-color: var(--ink); }
.search-field { position: relative; flex: 1; min-width: 100px; }
.search-field input, .select-field select { width: 100%; height: 42px; padding: 0 35px 0 12px; border: 1px solid var(--line); border-radius: 0; outline: none; color: var(--ink); background: rgba(255,255,255,.28); }
.search-field input:focus, .select-field select:focus, .form-sheet input:focus, .form-sheet textarea:focus, .form-sheet select:focus { border-color: var(--ink); box-shadow: inset 0 -2px var(--acid); }
.search-field span { position: absolute; right: 12px; top: 9px; color: var(--muted); font: 22px/1 var(--serif); pointer-events: none; }
.select-field { width: 130px; }
.compare-button { min-width: 119px; height: 42px; padding: 0 13px; border: 1px solid var(--ink); font-size: 12px; font-weight: 700; }
.compare-button:not(:disabled):hover { background: var(--acid); }
.compare-button:disabled { cursor: not-allowed; border-color: var(--line); color: var(--muted); }
.compare-button span { display: inline-grid; place-items: center; width: 17px; height: 17px; margin-left: 4px; background: var(--acid); color: var(--black); border-radius: 50%; font: 10px var(--mono); }
.compare-button:disabled span { background: var(--paper-dim); }
.list-label { display: flex; justify-content: space-between; margin-top: 34px; padding: 0 4px 10px; color: var(--muted); border-bottom: 1px solid var(--ink); font: 10px var(--mono); letter-spacing: .13em; text-transform: uppercase; }
.project-list { display: grid; }
.project-row { display: grid; grid-template-columns: 32px minmax(150px, 1.6fr) minmax(120px, 1fr) 100px 154px; align-items: center; gap: 14px; min-height: 83px; border-bottom: 1px solid var(--line); transition: background .16s; }
.project-row:hover { background: rgba(255,255,255,.26); }
.compare-toggle { appearance: none; display: grid; width: 18px; height: 18px; margin: 0 0 0 7px; place-content: center; border: 1px solid var(--muted); background: transparent; }
.compare-toggle::after { width: 7px; height: 7px; background: var(--acid); content: ""; transform: scale(0); }
.compare-toggle:checked { border-color: var(--ink); background: var(--black); }
.compare-toggle:checked::after { transform: scale(1); }
.project-name { display: block; width: max-content; max-width: 100%; color: var(--ink); border: 0; border-bottom: 1px solid transparent; background: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 2px 0; font: 700 21px var(--serif); text-align: left; }
.project-name:hover { border-color: var(--ink); }
.project-meta { min-width: 0; color: var(--muted); font: 12px var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rating { color: var(--ink); font: 15px/1 var(--serif); letter-spacing: 1px; }
.rating .is-empty { color: var(--muted); font: 11px var(--sans); letter-spacing: 0; }
.project-actions { display: flex; justify-content: flex-end; align-items: center; gap: 13px; }
.project-actions button, .project-actions a { color: var(--ink); font-size: 12px; text-decoration: none; border: 0; border-bottom: 1px solid transparent; background: transparent; padding: 5px 0; }
.project-actions button:hover, .project-actions a:hover { color: var(--red); border-color: var(--red); }
.empty-state { display: grid; min-height: 280px; place-items: center; border-bottom: 1px solid var(--line); color: var(--muted); text-align: center; }
.empty-state p { margin: 0 0 14px; font: 20px var(--serif); }
.empty-state small { font-size: 12px; }
.empty-state button { margin-top: 18px; }
.project-list { grid-template-columns: repeat(var(--gallery-columns, 4), minmax(0, 1fr)); gap: 14px; padding-bottom: 18px; border-bottom: 1px solid var(--line); background: transparent; }
.project-card { position: relative; display: flex; min-width: 0; flex-direction: column; min-height: 385px; padding: 10px; background: rgba(246, 245, 249, .82); animation-delay: var(--delay); transition: background .18s, transform .18s; }
.project-card:hover { z-index: 1; background: #fbfaff; transform: translateY(-3px); box-shadow: 0 7px 0 rgba(41, 36, 57, .1); }
.project-card.is-only { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(220px, 1fr); gap: 24px; min-height: 0; }
.project-card.is-only .project-card-body { padding: 16px 14px; }
.drag-handle { position: absolute; right: 18px; top: 18px; z-index: 3; display: flex; align-items: center; gap: 5px; padding: 6px 9px; color: white; background: #292439e8; border: 1px solid #ffffff60; font-size: 16px; cursor: grab; touch-action: none; user-select: none; }
.drag-handle span { font-size: 11px; }
.drag-handle:active { cursor: grabbing; }
.project-card.is-dragging { opacity: .6; }
.project-card.drop-target { outline: 3px solid #6954a8; outline-offset: -3px; background: #e5defb; }
.project-list.is-saving-order .drag-handle { pointer-events: none; opacity: .5; }
.compare-check { position: absolute; z-index: 2; top: 18px; left: 18px; display: inline-flex; align-items: center; gap: 5px; padding: 5px 7px; color: var(--paper); background: rgba(33, 30, 46, .78); font: 10px var(--mono); cursor: pointer; }
.compare-check .compare-toggle { width: 12px; height: 12px; margin: 0; border-color: currentColor; }
.compare-check .compare-toggle::after { width: 5px; height: 5px; }
.preview-frame, .comparison-preview { position: relative; overflow: hidden; background: #d5d1e3; }
.preview-frame { aspect-ratio: 16 / 10; }
.preview-frame::after { position: absolute; inset: 0; border: 1px solid rgba(33,30,46,.12); content: ""; pointer-events: none; }
.preview-frame iframe, .comparison-preview iframe { position: absolute; top: 0; left: 0; display: block; width: 1280px; height: 800px; border: 0; transform-origin: top left; background: #d5d1e3; }
.preview-frame iframe { pointer-events: none; }
.preview-open { position: absolute; right: 0; bottom: 0; z-index: 2; padding: 9px 12px; border: 0; color: var(--paper); background: var(--black); font: 12px var(--sans); text-decoration: none; }
.preview-open:hover { color: var(--acid); }
.preview-placeholder { display: grid; width: 100%; height: 100%; min-height: 120px; place-items: center; color: var(--muted); font: 11px var(--mono); }
.preview-load-status { position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; text-align: center; background: #e8e4f1; color: var(--muted); font-size: 12px; z-index: 1; pointer-events: none; }
.preview-load-status[hidden] { display: none; }
.preview-load-status { display: flex; flex-direction: column; justify-content: center; gap: 12px; }
.preview-load-status button { pointer-events: auto; padding: 7px 12px; border: 1px solid var(--line); background: var(--paper); color: var(--ink); font-size: 12px; }
.preview-load-status button[hidden] { display: none; }
.project-card-body { display: flex; min-height: 0; flex: 1; flex-direction: column; padding: 13px 5px 2px; }
.project-card-top { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.project-index { color: var(--muted); font: 10px var(--mono); }
.project-card .rating { font-size: 12px; }
.project-card .rating .is-empty { font-size: 10px; }
.project-card .project-name { margin-top: 13px; font-size: 26px; }
.project-model { margin: 5px 0 0; color: var(--muted); font: 11px var(--mono); }
.project-notes { display: -webkit-box; overflow: hidden; margin: 13px 0; color: #4f4a5d; font: 13px/1.55 var(--serif); -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.project-card .project-actions { margin-top: auto; justify-content: flex-start; padding-top: 8px; border-top: 1px solid var(--line); }
.project-card .project-actions button, .project-card .project-actions a { font: 11px var(--mono); }

.dialog { width: min(620px, calc(100vw - 28px)); max-height: min(790px, calc(100vh - 28px)); padding: 0; border: 1px solid var(--ink); background: var(--paper); color: var(--ink); box-shadow: 10px 10px 0 rgba(22, 24, 21, .22); }
.dialog::backdrop { background: rgba(16, 18, 16, .7); backdrop-filter: blur(3px); }
.wide-dialog { width: min(760px, calc(100vw - 28px)); }
.form-sheet { padding: 31px; }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; }
.dialog-heading .eyebrow { margin: 0; }
.close-button { width: 28px; height: 28px; margin: -8px -8px 0 0; font: 29px/1 var(--serif); }
.close-button:hover { color: var(--red); }
.form-sheet h2 { margin: 14px 0 28px; }
.form-sheet label { display: grid; align-content: start; gap: 8px; margin-top: 18px; color: var(--muted); font-size: 12px; }
.form-sheet input, .form-sheet textarea, .form-sheet select { width: 100%; min-width: 0; padding: 10px 11px; border: 1px solid var(--line); border-radius: 0; outline: none; color: var(--ink); background: rgba(255,255,255,.35); }
.form-sheet textarea { resize: vertical; font: 13px/1.6 var(--sans); }
.form-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; gap: 0 17px; }
.form-grid > label { min-width: 0; }
.form-grid input, .form-grid select { box-sizing: border-box; height: 42px; }
.form-grid .field-hint { margin-top: 0; }
.field-hint { margin: 8px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.form-actions { justify-content: flex-end; margin-top: 28px; }
.compare-dialog { width: min(1260px, calc(100vw - 28px)); }
.comparison-sheet { padding: 31px; }
.compare-title { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin: 10px 0 25px; }
.compare-title p { margin: 0; color: var(--muted); font: 11px var(--mono); }
.comparison-grid { display: grid; grid-template-columns: repeat(var(--columns, 2), minmax(0, 1fr)); border-top: 1px solid var(--ink); }
.comparison-column { min-width: 0; padding: 20px; border-right: 1px solid var(--line); }
.comparison-column:first-child { padding-left: 0; }
.comparison-column:last-child { padding-right: 0; border-right: 0; }
.comparison-column h3 { margin: 0; font: 700 23px var(--serif); }
.comparison-model { margin: 8px 0 17px; color: var(--muted); font: 11px var(--mono); }
.comparison-notes { min-height: 90px; margin: 17px 0; padding: 14px 0; border-block: 1px solid var(--line); white-space: pre-wrap; font: 14px/1.65 var(--serif); }
.comparison-preview { aspect-ratio: 16 / 10; margin: 15px 0 0; border: 1px solid var(--line); }
.comparison-open { display: inline-flex; padding-bottom: 3px; border-bottom: 1px solid var(--ink); color: var(--ink); font-size: 12px; text-decoration: none; }
.comparison-open:hover { color: var(--red); border-color: var(--red); }
.split-toolbar { display: flex; align-items: center; gap: 22px; padding: 12px 0 18px; flex-wrap: wrap; }
.split-toolbar[hidden] { display: none; }
.split-toolbar label { display: flex; align-items: center; gap: 8px; margin: 0; white-space: nowrap; }
.split-toolbar input { width: 16px; height: 16px; accent-color: var(--black); }
.split-toolbar .sync-switch { position: relative; gap: 10px; padding: 10px 14px; border: 1px solid var(--line); background: #fff; cursor: pointer; }
.split-toolbar .sync-switch input { position: absolute; width: 1px; height: 1px; padding: 0; opacity: 0; }
.switch-track { width: 38px; height: 22px; border-radius: 20px; background: #a7a3b2; padding: 3px; transition: background .15s; }
.switch-track::after { content: ''; display: block; width: 16px; height: 16px; border-radius: 50%; background: white; transition: transform .15s; }
.sync-switch input:checked + .switch-track { background: #6954a8; }
.sync-switch input:checked + .switch-track::after { transform: translateX(16px); }
.sync-switch input:focus-visible + .switch-track { outline: 2px solid var(--ink); outline-offset: 3px; }
.sync-switch strong { color: var(--muted); font-size: 12px; font-weight: 400; margin-left: 6px; }
@media (prefers-reduced-motion: reduce) { .switch-track, .switch-track::after { transition: none; } }
.split-toolbar small { margin-left: auto; color: var(--muted); }
#sync-status { font-size: 12px; color: var(--muted); }
.compare-dialog.is-split { width: calc(100vw - 24px); max-width: none; height: calc(100dvh - 24px); max-height: none; }
.is-split .comparison-sheet { padding: 20px 24px; }
.is-split .compare-title { margin: 4px 0 8px; }
.is-split .comparison-grid { grid-template-columns: repeat(var(--columns, 2), minmax(340px, 1fr)); overflow-x: auto; }
.is-split .comparison-column { padding: 14px 12px; }
.is-split .comparison-column h3 { font-size: 20px; }
.is-split .comparison-model { margin: 7px 0; }
.is-split .comparison-preview { height: max(560px, calc(100dvh - 290px)); aspect-ratio: auto; margin-top: 12px; }
.is-split .comparison-notes { min-height: 0; margin: 8px 0; padding: 8px 0; font-size: 12px; }
.toast { position: fixed; left: 50%; bottom: 28px; z-index: 10; max-width: calc(100vw - 32px); padding: 11px 16px; color: var(--paper); background: var(--black); box-shadow: 4px 4px 0 var(--acid); font-size: 13px; transform: translate(-50%, 130px); opacity: 0; transition: .2s; }
.toast.is-visible { transform: translate(-50%, 0); opacity: 1; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }

html:not(.is-admin) [data-admin-only] { display: none !important; }
html.is-admin #login-button { display: none; }
.auth-dialog { width: min(460px, calc(100vw - 28px)); }
.auth-copy { margin: -10px 0 6px; color: var(--muted); font: 14px/1.6 var(--serif); }
.form-error { margin: 12px 0 0; padding: 10px 12px; color: #8d2530; border-left: 3px solid var(--red); background: rgba(164, 39, 52, .08); font-size: 12px; }
.form-error[hidden] { display: none; }

@media (max-width: 800px) {
  .project-card.is-only { display: flex; gap: 0; }
  .topbar { min-height: 72px; padding: 0 18px; gap: 12px; }
  .topbar-note, #export-library { display: none; }
  .topbar-actions { margin-left: auto; }
  .app-grid { grid-template-columns: 1fr; }
  .sidebar { padding: 14px 18px; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar-foot { display: none; }
  .sidebar-heading { padding: 0 0 9px; }
  .group-list { grid-auto-flow: column; grid-auto-columns: max-content; grid-template-columns: none; overflow-x: auto; padding-bottom: 2px; }
  .group-item { width: max-content; max-width: 210px; min-height: 35px; grid-template-columns: 18px minmax(0,1fr) auto; }
  .workspace { padding: 35px 18px 50px; }
  .workspace-head { align-items: start; }
  h1 { font-size: 45px; }
  .workspace-summary { display: grid; gap: 4px; text-align: right; }
  .workspace-summary b { font-size: 18px; }
  .toolbar { flex-wrap: wrap; }
  .search-field { flex-basis: calc(100% - 140px); }
  .project-row { grid-template-columns: 28px minmax(0,1fr) auto; min-height: 84px; gap: 8px; }
  .project-meta { grid-column: 2; grid-row: 2; margin-top: -18px; }
  .rating { grid-column: 3; grid-row: 1; font-size: 13px; }
  .project-actions { grid-column: 3; grid-row: 2; margin-top: -20px; gap: 9px; }
  .list-label span:last-child { display: none; }
  .form-sheet, .comparison-sheet { padding: 23px; }
  .form-grid { grid-template-columns: 1fr; }
  .comparison-grid { grid-template-columns: 1fr; }
  .comparison-column, .comparison-column:first-child, .comparison-column:last-child { padding: 18px 0; border-right: 0; border-bottom: 1px solid var(--line); }
  .comparison-column:last-child { border-bottom: 0; }
}

@media (max-width: 450px) {
  .brand b { font-size: 17px; }
  .primary-button { padding: 11px 12px; }
  .workspace-summary { display: none; }
  .select-field { width: 118px; }
  .compare-button { flex: 1; }
}

@media (prefers-reduced-motion: no-preference) {
  .project-row { animation: row-in .35s both; }
  @keyframes row-in { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: translateY(0); } }
}

.project-card[hidden] { display: none !important; }
.project-list > .empty-state { grid-column: 1 / -1; }
.single-toolbar, .single-info { display: none; }
.compare-dialog.is-single { width: calc(100vw - 32px); height: calc(100dvh - 32px); max-width: none; max-height: none; overflow: hidden; padding: 0; }
.is-single .comparison-sheet { height: 100%; padding: 0; display: flex; flex-direction: column; position: relative; min-height: 0; }
.is-single .comparison-sheet::after { content: ''; display: block; flex: 0 0 20px; background: var(--paper); border-top: 1px solid var(--line); }
.is-single .single-toolbar { display: flex; align-items: center; gap: 18px; padding: 12px 20px; min-height: 64px; border-bottom: 1px solid var(--line); flex-shrink: 0; }
.single-heading { display: flex; align-items: baseline; gap: 15px; min-width: 0; flex: 1; }
.single-heading strong { font: 700 20px var(--serif); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.single-heading span { color: var(--muted); font-size: 11px; white-space: nowrap; }
.single-toolbar select { width: auto; padding: 7px 10px; font-size: 12px; }
.single-toolbar a { white-space: nowrap; color: var(--ink); font-size: 12px; text-decoration: none; }
.single-toolbar button { white-space: nowrap; }
.single-toolbar .close-button { margin: 0; flex-shrink: 0; }
.is-single .dialog-heading, .is-single .compare-title { display: none; }
.is-single .comparison-grid { display: block; flex: 1; min-height: 0; overflow: hidden; border: 0; }
.is-single .comparison-column { display: flex; width: 100%; height: 100%; min-height: 0; padding: 0; border: 0; }
.is-single .comparison-column > :not(.comparison-preview) { display: none; }
.is-single .comparison-preview { flex: 1; width: 100%; height: 100%; min-height: 0; aspect-ratio: auto; margin: 0; border: 0; background: #dfdce8; }
.is-single .single-info:not([hidden]) { display: block; position: absolute; z-index: 5; top: 70px; right: 22px; width: min(360px, calc(100% - 44px)); max-height: calc(100% - 90px); overflow: auto; background: var(--paper); border: 1px solid var(--line); padding: 16px 20px; box-shadow: 0 8px 32px #211e2e25; }
.single-info p { margin: 7px 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 12px; line-height: 1.7; }
@media (max-width: 700px) {
  .compare-dialog.is-single { width: 100vw; height: 100dvh; margin: 0; }
  .is-single .single-toolbar { gap: 10px; padding: 10px; flex-wrap: wrap; }
  .single-heading { flex-basis: calc(100% - 44px); }
  .single-heading span { overflow: hidden; text-overflow: ellipsis; }
  .single-toolbar .close-button { position: absolute; top: 10px; right: 10px; }
}

.shell { width: min(1920px, 100%); }

/* The gallery chrome follows the selected theme; embedded作品 keep their own palette. */
:root[data-theme="dark"] .shell { background: rgba(23, 21, 29, .9); }
:root[data-theme="dark"] .primary-button:hover { background: #373242; }
:root[data-theme="dark"] .group-item:hover,
:root[data-theme="dark"] .project-row:hover { background: rgba(225, 219, 239, .07); }
:root[data-theme="dark"] .thumbnail-toggle[aria-pressed="true"] { border-color: #8f7dc9; background: #342d4b; }
:root[data-theme="dark"] .thumbnail-toggle[aria-pressed="false"] { background: #201d28; color: var(--muted); }
:root[data-theme="dark"] .search-field input,
:root[data-theme="dark"] .select-field select,
:root[data-theme="dark"] .form-sheet input,
:root[data-theme="dark"] .form-sheet textarea,
:root[data-theme="dark"] .form-sheet select,
:root[data-theme="dark"] .single-toolbar select { background: rgba(255, 255, 255, .055); color: var(--ink); }
:root[data-theme="dark"] input::placeholder,
:root[data-theme="dark"] textarea::placeholder { color: #858092; opacity: 1; }
:root[data-theme="dark"] select option { background: #201d28; color: var(--ink); }
:root[data-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator { opacity: .85; }
:root[data-theme="dark"] .project-card { background: rgba(37, 33, 46, .9); }
:root[data-theme="dark"] .project-card:hover { background: #2d2937; box-shadow: 0 7px 0 rgba(0, 0, 0, .25); }
:root[data-theme="dark"] .project-card.drop-target { background: #3b3453; }
:root[data-theme="dark"] .project-notes { color: #c8c2d1; }
:root[data-theme="dark"] .preview-frame,
:root[data-theme="dark"] .comparison-preview,
:root[data-theme="dark"] .is-single .comparison-preview { background: #24212d; }
:root[data-theme="dark"] .preview-frame::after { border-color: rgba(236, 233, 244, .12); }
:root[data-theme="dark"] .preview-load-status { background: #292531; }
:root[data-theme="dark"] .preview-load-status button { background: #1d1a23; }
:root[data-theme="dark"] .dialog { box-shadow: 10px 10px 0 rgba(0, 0, 0, .4); }
:root[data-theme="dark"] .dialog::backdrop { background: rgba(5, 4, 7, .78); }
:root[data-theme="dark"] .split-toolbar .sync-switch { background: #211e29; }
:root[data-theme="dark"] .switch-track { background: #625d6d; }
:root[data-theme="dark"] .switch-track::after { background: #eeeaf5; }
:root[data-theme="dark"] .form-error { color: #f0a5bd; background: rgba(224, 140, 172, .1); }
:root[data-theme="dark"] .is-single .single-info:not([hidden]) { box-shadow: 0 8px 32px rgba(0, 0, 0, .48); }
:root[data-theme="dark"] .toast { color: #17151d; background: #ece9f4; }
@media (max-width: 1100px) { .project-list { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 650px) { .project-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 450px) { .project-list { grid-template-columns: minmax(0, 1fr); } }
