:root {
  --ink: #17201d;
  --muted: #65716c;
  --faint: #8d9692;
  --paper: #f4f6f3;
  --surface: #ffffff;
  --surface-2: #edf1ed;
  --line: #dce2dd;
  --line-strong: #c9d1cb;
  --forest: #236b4e;
  --forest-strong: #19533b;
  --forest-soft: #dceae3;
  --coral: #d1663f;
  --coral-soft: #f3dfd8;
  --sidebar: #15201c;
  --sidebar-2: #1d2b26;
  --sidebar-line: #314039;
  --sidebar-text: #eff4f0;
  --sidebar-muted: #97a59e;
  --danger: #b33b3b;
  --shadow-sm: 0 2px 8px rgba(23, 32, 29, 0.06);
  --shadow-md: 0 16px 40px rgba(23, 32, 29, 0.14);
  --radius-sm: 4px;
  --radius: 6px;
  --sidebar-w: 236px;
  --detail-w: 360px;
  color-scheme: light;
}

[data-theme="dark"] {
  --ink: #edf2ee;
  --muted: #a8b2ad;
  --faint: #818c87;
  --paper: #111814;
  --surface: #19221e;
  --surface-2: #202c27;
  --line: #304039;
  --line-strong: #42534b;
  --forest: #62aa86;
  --forest-strong: #83c19f;
  --forest-soft: #213b2f;
  --coral: #e2825e;
  --coral-soft: #452d25;
  --sidebar: #0c120f;
  --sidebar-2: #15201b;
  --sidebar-line: #28372f;
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.18);
  --shadow-md: 0 18px 50px rgba(0, 0, 0, 0.34);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--paper); }
body { margin: 0; color: var(--ink); background: var(--paper); font-family: Inter, "Segoe UI", "Microsoft YaHei", sans-serif; letter-spacing: 0; }
button, input, select, textarea { font: inherit; letter-spacing: 0; }
button, a, select { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }
svg { width: 18px; height: 18px; stroke-width: 1.8; flex: none; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--forest) 42%, transparent); outline-offset: 2px; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
body.overlay-open { overflow: hidden; }
.sidebar { position: sticky; top: 0; height: 100vh; z-index: 30; display: flex; flex-direction: column; overflow-y: auto; background: var(--sidebar); color: var(--sidebar-text); border-right: 1px solid var(--sidebar-line); }
.brand-row { height: 78px; padding: 0 20px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--sidebar-line); }
.brand { min-width: 0; display: inline-flex; align-items: center; gap: 11px; }
.brand-mark { width: 34px; height: 34px; position: relative; display: inline-flex; align-items: flex-end; gap: 3px; padding: 8px; background: var(--forest); border-radius: 5px; }
.brand-mark span { width: 4px; background: #fff; border-radius: 1px; }
.brand-mark span:nth-child(1) { height: 9px; }
.brand-mark span:nth-child(2) { height: 16px; background: #e9b08f; }
.brand-mark span:nth-child(3) { height: 12px; }
.brand-copy { display: grid; gap: 2px; }
.brand-copy strong { font-family: Georgia, "Songti SC", serif; font-size: 17px; line-height: 1.2; }
.brand-copy small { color: var(--sidebar-muted); font-size: 9px; font-weight: 700; letter-spacing: 1.4px; }
.sidebar-section { padding: 24px 14px 4px; }
.sidebar-label { margin: 0 8px 10px; color: var(--sidebar-muted); font-size: 10px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; }
.category-nav { display: grid; gap: 4px; }
.nav-item { width: 100%; min-height: 43px; border: 0; border-radius: 5px; padding: 0 10px; display: flex; align-items: center; justify-content: space-between; background: transparent; color: #b8c3bd; cursor: pointer; transition: background .18s ease, color .18s ease; }
.nav-item:hover { color: #fff; background: rgba(255, 255, 255, .05); }
.nav-item.active { color: #fff; background: var(--forest); }
.nav-item-main { display: inline-flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 600; }
.nav-item svg { width: 17px; height: 17px; }
.nav-count { min-width: 24px; height: 21px; padding: 0 6px; display: inline-grid; place-items: center; border: 1px solid var(--sidebar-line); border-radius: 10px; color: var(--sidebar-muted); font-size: 10px; }
.nav-item.active .nav-count { color: #fff; border-color: rgba(255,255,255,.2); background: rgba(0,0,0,.13); }
.text-icon-btn { width: 26px; height: 26px; padding: 0; display: grid; place-items: center; border: 0; background: transparent; color: var(--sidebar-muted); cursor: pointer; }
.text-icon-btn svg { width: 14px; height: 14px; }
.sidebar-footer { padding: 14px; border-top: 1px solid var(--sidebar-line); }
.profile-card { min-height: 54px; display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 5px; }
.profile-card:hover { background: var(--sidebar-2); }
.avatar { width: 35px; height: 35px; display: grid; place-items: center; border-radius: 50%; background: var(--coral); color: #fff; font-size: 12px; font-weight: 700; }
.profile-copy { min-width: 0; flex: 1; display: grid; gap: 2px; }
.profile-copy strong { font-size: 12px; }
.profile-copy small { color: var(--sidebar-muted); font-size: 10px; }
.profile-card > svg { width: 14px; color: var(--sidebar-muted); }

.workspace { min-width: 0; padding: 0 34px 50px; background: var(--paper); }
.workspace-header { position: sticky; top: 0; z-index: 20; padding-top: 30px; background: color-mix(in srgb, var(--paper) 95%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid transparent; }
.workspace-header.scrolled { border-bottom-color: var(--line); }
.title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; }
.eyebrow { margin: 0 0 8px; color: var(--coral); font-size: 10px; font-weight: 700; letter-spacing: 1.5px; }
h1, h2, h3, p { overflow-wrap: anywhere; }
.title-row h1 { margin: 0; font-family: Georgia, "Songti SC", serif; font-size: 32px; line-height: 1.25; letter-spacing: 0; }
.page-subtitle { margin: 8px 0 0; color: var(--muted); font-size: 13px; }
.header-actions { display: flex; align-items: center; gap: 9px; }
.account-btn { max-width: 210px; }
.account-btn span { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-btn { width: 38px; height: 38px; padding: 0; display: inline-grid; place-items: center; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); color: var(--muted); cursor: pointer; transition: border-color .15s ease, color .15s ease, background .15s ease; }
.icon-btn:hover, .icon-btn.active { border-color: var(--forest); color: var(--forest); background: var(--forest-soft); }
.primary-btn, .secondary-btn { min-height: 39px; padding: 0 14px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 5px; font-size: 12px; font-weight: 700; cursor: pointer; }
.primary-btn { border: 1px solid var(--forest); background: var(--forest); color: #fff; }
.primary-btn:hover { border-color: var(--forest-strong); background: var(--forest-strong); }
.secondary-btn { border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); }
.secondary-btn:hover { border-color: var(--forest); color: var(--forest); }
.search-row { margin-top: 25px; }
.search-box { width: 100%; height: 46px; display: flex; align-items: center; gap: 10px; padding: 0 13px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--surface); color: var(--muted); box-shadow: var(--shadow-sm); }
.search-box:focus-within { border-color: var(--forest); box-shadow: 0 0 0 3px color-mix(in srgb, var(--forest) 14%, transparent); }
.search-box input { min-width: 0; flex: 1; height: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 13px; }
.search-box input::placeholder { color: var(--faint); }
.search-box kbd { padding: 3px 6px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; background: var(--surface-2); color: var(--faint); font: 10px Inter, "Segoe UI", sans-serif; }
.toolbar { min-height: 61px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.tabs { display: flex; align-items: stretch; align-self: stretch; gap: 24px; }
.tab { position: relative; padding: 0 2px; border: 0; background: transparent; color: var(--muted); font-size: 12px; font-weight: 600; cursor: pointer; }
.tab::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: transparent; }
.tab:hover, .tab.active { color: var(--ink); }
.tab.active::after { background: var(--coral); }
.toolbar-actions { display: flex; align-items: center; gap: 9px; }
.sort-control { height: 36px; padding: 0 7px 0 10px; display: flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); color: var(--muted); }
.sort-control svg { width: 15px; }
.sort-control select { height: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 11px; cursor: pointer; }
.view-switch { display: flex; gap: 3px; }
.view-switch .icon-btn { width: 36px; height: 36px; }
.results-meta { height: 45px; display: flex; align-items: center; justify-content: space-between; }
.results-meta p { margin: 0; color: var(--muted); font-size: 11px; }
.results-meta strong { color: var(--ink); }
.active-filter { height: 27px; display: inline-flex; align-items: center; gap: 5px; padding: 0 8px; border: 1px solid var(--forest); border-radius: 14px; background: var(--forest-soft); color: var(--forest); font-size: 10px; cursor: pointer; }
.active-filter svg { width: 12px; height: 12px; }

.prompt-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: start; gap: 18px; }
.prompt-card { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); box-shadow: var(--shadow-sm); cursor: pointer; transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease; }
.prompt-card:hover { transform: translateY(-2px); border-color: var(--line-strong); box-shadow: 0 12px 28px rgba(23, 32, 29, .1); }
.prompt-card.selected { border-color: var(--forest); box-shadow: 0 0 0 2px color-mix(in srgb, var(--forest) 12%, transparent); }
.card-preview { position: relative; width: 100%; aspect-ratio: 16 / 9; overflow: hidden; background: var(--surface-2); cursor: zoom-in; }
.card-preview img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s ease; }
.prompt-card:hover .card-preview img { transform: scale(1.025); }
.card-preview::after, .detail-preview::after { content: "点击查看完整图片"; position: absolute; right: 10px; top: 10px; min-height: 24px; padding: 0 8px; display: inline-flex; align-items: center; border-radius: 4px; background: rgba(18, 27, 23, .72); color: #fff; font-size: 9px; font-weight: 700; opacity: 0; transform: translateY(-4px); transition: opacity .18s ease, transform .18s ease; pointer-events: none; }
.card-preview:hover::after, .detail-preview:hover::after { opacity: 1; transform: translateY(0); }
.preview-category { position: absolute; left: 11px; bottom: 10px; min-height: 25px; padding: 0 8px; display: inline-flex; align-items: center; gap: 5px; border: 1px solid rgba(255,255,255,.18); border-radius: 4px; background: rgba(18, 27, 23, .78); backdrop-filter: blur(8px); color: #fff; font-size: 9px; font-weight: 700; }
.preview-category svg { width: 12px; height: 12px; }
.category-image { background: rgba(77, 52, 32, .78); }
.category-ui { background: rgba(24, 72, 54, .82); }
.card-body { padding: 14px 15px 13px; }
.card-meta { min-height: 27px; display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.favorite-btn { width: 29px; height: 29px; padding: 0; display: grid; place-items: center; border: 0; border-radius: 50%; background: transparent; color: var(--faint); cursor: pointer; }
.favorite-btn:hover { background: var(--coral-soft); color: var(--coral); }
.favorite-btn.active { color: var(--coral); }
.favorite-btn.active svg { fill: currentColor; }
.favorite-btn svg { width: 16px; height: 16px; }
.prompt-card h2 { min-height: 25px; margin: 2px 0 7px; font-family: Georgia, "Songti SC", serif; font-size: 17px; line-height: 1.45; }
.card-summary { min-height: 38px; margin: 0; display: -webkit-box; overflow: hidden; color: var(--muted); font-size: 11px; line-height: 1.7; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.tag-row { min-height: 25px; margin-top: 12px; display: flex; flex-wrap: wrap; gap: 5px; }
.tag { height: 23px; padding: 0 7px; display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 4px; background: var(--surface-2); color: var(--muted); font-size: 9px; }
.card-footer { min-height: 42px; margin-top: 12px; padding-top: 11px; display: flex; align-items: center; justify-content: space-between; gap: 10px; border-top: 1px solid var(--line); }
.card-stats { min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 7px 10px; }
.usage, .prompt-type { display: inline-flex; align-items: center; gap: 5px; color: var(--faint); font-size: 9px; }
.prompt-type { max-width: 145px; color: var(--forest); font-weight: 700; }
.prompt-type svg, .usage svg { width: 12px; height: 12px; }
.copy-btn { min-width: 69px; height: 30px; padding: 0 10px; display: inline-flex; align-items: center; justify-content: center; gap: 5px; border: 1px solid var(--line-strong); border-radius: 4px; background: var(--surface); color: var(--ink); font-size: 10px; font-weight: 700; cursor: pointer; }
.copy-btn:hover { border-color: var(--forest); color: var(--forest); background: var(--forest-soft); }
.copy-btn svg { width: 13px; height: 13px; }
.prompt-grid.list-view { grid-template-columns: minmax(0, 1fr); }
.prompt-grid.list-view .prompt-card { display: grid; grid-template-columns: minmax(210px, 34%) 1fr; }
.prompt-grid.list-view .card-preview { height: 100%; min-height: 210px; aspect-ratio: auto; }
.prompt-grid.list-view .card-body { align-self: stretch; display: flex; flex-direction: column; }
.prompt-grid.list-view .card-footer { margin-top: auto; }
.empty-state { min-height: 330px; display: grid; place-items: center; align-content: center; text-align: center; }
.empty-icon, .detail-empty-mark { width: 54px; height: 54px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; background: var(--surface); color: var(--muted); }
.empty-state h2, .detail-empty h2 { margin: 16px 0 5px; font-family: Georgia, "Songti SC", serif; font-size: 18px; }
.empty-state p, .detail-empty p { margin: 0 0 18px; color: var(--muted); font-size: 11px; }

.detail-panel { position: fixed; left: 50%; top: 50%; z-index: 121; width: min(920px, calc(100vw - 40px)); max-height: calc(100vh - 44px); overflow-y: auto; border: 1px solid color-mix(in srgb, var(--line) 82%, transparent); border-radius: 12px; background: var(--surface); box-shadow: 0 30px 90px rgba(0, 0, 0, .28); opacity: 0; pointer-events: none; transform: translate(-50%, -46%) scale(.96); transition: opacity .2s ease, transform .2s ease; }
.detail-panel.open { opacity: 1; pointer-events: auto; transform: translate(-50%, -50%) scale(1); }
.detail-empty { display: none; }
.detail-content { min-height: 0; padding: 28px 30px 88px; }
.detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.detail-kicker { color: var(--coral); font-size: 9px; font-weight: 700; letter-spacing: .8px; }
.detail-head h2 { margin: 7px 0 0; font-family: Georgia, "Songti SC", serif; font-size: 25px; line-height: 1.35; }
.detail-close { display: inline-grid; flex: none; }
.detail-preview { position: relative; width: 100%; aspect-ratio: 16 / 8.5; margin-top: 20px; overflow: hidden; border-radius: 8px; background: var(--surface-2); cursor: zoom-in; }
.detail-preview img { width: 100%; height: 100%; object-fit: cover; }
.detail-meta-grid { margin-top: 16px; display: grid; grid-template-columns: 1fr; border: 1px solid var(--line); border-radius: 5px; }
.detail-meta-grid.has-type { grid-template-columns: 1fr 1fr; }
.detail-meta-grid div { min-width: 0; padding: 11px 12px; display: grid; gap: 4px; }
.detail-meta-grid.has-type div + div { border-left: 1px solid var(--line); }
.detail-meta-grid span, .section-label, .section-label-row { color: var(--faint); font-size: 9px; text-transform: uppercase; font-weight: 700; letter-spacing: .5px; }
.detail-meta-grid strong { font-size: 11px; overflow-wrap: anywhere; }
.detail-section { margin-top: 22px; }
.section-label-row { display: flex; justify-content: space-between; }
.section-label-row small { font-size: 9px; font-weight: 500; text-transform: none; letter-spacing: 0; }
.detail-summary { margin: 9px 0 0; padding: 12px 13px; border: 1px solid var(--line); border-radius: 5px; background: var(--paper); color: var(--muted); font-size: 11px; line-height: 1.75; }
.paywall-box { margin-top: 9px; padding: 16px; display: grid; gap: 14px; border: 1px dashed color-mix(in srgb, var(--forest) 45%, var(--line)); border-radius: 8px; background: linear-gradient(135deg, color-mix(in srgb, var(--forest-soft) 62%, transparent), var(--paper)); }
.paywall-copy { display: grid; gap: 5px; }
.paywall-copy strong { font-size: 14px; }
.paywall-copy span, .paywall-qr p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.6; }
.paywall-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.paywall-qr { display: grid; justify-items: center; gap: 10px; padding-top: 4px; }
.paywall-qr img { width: 188px; height: 188px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.prompt-content { max-height: min(360px, 38vh); margin-top: 9px; padding: 14px; overflow-y: auto; border: 1px solid var(--line); border-radius: 5px; background: var(--paper); color: var(--ink); font-size: 11px; line-height: 1.85; white-space: pre-wrap; }
.detail-tags { margin-top: 9px; }
.detail-actions { position: sticky; left: 0; right: 0; bottom: 0; z-index: 2; margin: 24px -30px -88px; padding: 14px 30px; display: grid; grid-template-columns: 1fr 1.35fr; gap: 8px; border-top: 1px solid var(--line); background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(12px); }
.detail-actions .active { border-color: var(--coral); color: var(--coral); background: var(--coral-soft); }
.detail-scrim, .sidebar-scrim { display: none; }
.detail-scrim { position: fixed; inset: 0; z-index: 120; background: rgba(10, 16, 13, .46); backdrop-filter: blur(10px); }
.detail-scrim.open { display: block; }

.modal-backdrop { position: fixed; inset: 0; z-index: 100; padding: 28px; display: grid; place-items: center; overflow-y: auto; background: rgba(10, 16, 13, .68); backdrop-filter: blur(5px); }
.modal { width: min(680px, 100%); max-height: calc(100vh - 56px); overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: var(--shadow-md); }
.modal-header { position: sticky; top: 0; z-index: 2; padding: 20px 22px 16px; display: flex; align-items: flex-start; justify-content: space-between; border-bottom: 1px solid var(--line); background: var(--surface); }
.modal-header h2 { margin: 0; font-family: Georgia, "Songti SC", serif; font-size: 21px; }
.modal-form { padding: 20px 22px 22px; }
.form-grid { display: grid; gap: 14px; }
.form-grid.two-col { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid + .form-grid, .form-grid + .field, .field + .field { margin-top: 14px; }
.field { min-width: 0; display: grid; gap: 7px; color: var(--ink); font-size: 11px; font-weight: 700; }
.field input, .field select, .field textarea { width: 100%; border: 1px solid var(--line-strong); border-radius: 5px; outline: 0; background: var(--paper); color: var(--ink); font-size: 12px; font-weight: 400; }
.field input, .field select { height: 40px; padding: 0 10px; }
.field textarea { min-height: 140px; padding: 10px; resize: vertical; line-height: 1.7; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--forest); box-shadow: 0 0 0 3px color-mix(in srgb, var(--forest) 13%, transparent); }
.form-error { margin: 12px 0 0; padding: 9px 11px; border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent); border-radius: 4px; background: color-mix(in srgb, var(--danger) 10%, transparent); color: var(--danger); font-size: 11px; }
.modal-actions { margin-top: 18px; padding-top: 16px; display: flex; justify-content: flex-end; gap: 8px; border-top: 1px solid var(--line); }
.auth-modal { width: min(440px, 100%); }
.auth-actions { flex-wrap: wrap; }
.toast-region { position: fixed; right: 24px; bottom: 24px; z-index: 150; display: grid; gap: 8px; pointer-events: none; }
.toast { min-width: 240px; max-width: 340px; padding: 11px 13px; display: flex; align-items: center; gap: 9px; border: 1px solid var(--line); border-left: 3px solid var(--forest); border-radius: 5px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow-md); font-size: 11px; animation: toast-in .22s ease both; }
.toast.error { border-left-color: var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.image-viewer { position: fixed; inset: 0; z-index: 140; padding: 28px; display: grid; place-items: center; background: rgba(6, 10, 8, .88); backdrop-filter: blur(10px); cursor: zoom-out; }
.image-viewer-frame { max-width: min(96vw, 1600px); max-height: min(92vh, 1000px); margin: 0; display: grid; gap: 12px; justify-items: center; }
.image-viewer-frame img { max-width: 100%; max-height: calc(92vh - 44px); width: auto; height: auto; object-fit: contain; border-radius: 8px; background: rgba(255,255,255,.06); box-shadow: 0 24px 80px rgba(0,0,0,.42); cursor: default; }
.image-viewer-frame figcaption { max-width: 86vw; color: rgba(255,255,255,.84); font-size: 12px; line-height: 1.6; text-align: center; }
.image-viewer-close { position: fixed; right: 22px; top: 22px; z-index: 1; width: 42px; height: 42px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.22); border-radius: 50%; background: rgba(255,255,255,.12); color: #fff; cursor: pointer; }
.image-viewer-close:hover { background: rgba(255,255,255,.2); }
.error-page { min-height: 100vh; padding: 30px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.error-page h1 { margin: 0; font-family: Georgia, "Songti SC", serif; font-size: 30px; }
.error-page > p:not(.eyebrow) { margin: 10px 0 20px; color: var(--muted); }
.mobile-only { display: none; }

@media (max-width: 1440px) {
  .workspace { padding-inline: 25px; }
  .prompt-grid { gap: 14px; }
}

@media (max-width: 1180px) {
  .app-shell { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
  .prompt-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 820px) {
  .mobile-only { display: inline-grid; }
  .app-shell { display: block; }
  .sidebar { position: fixed; left: 0; top: 0; z-index: 90; width: min(var(--sidebar-w), calc(100vw - 50px)); transform: translateX(-102%); box-shadow: var(--shadow-md); transition: transform .24s ease; }
  .sidebar.open { transform: translateX(0); }
  .sidebar-scrim { position: fixed; inset: 0; z-index: 85; background: rgba(10,16,13,.5); }
  .sidebar-scrim.open { display: block; }
  .sidebar-close { border-color: var(--sidebar-line); background: transparent; color: var(--sidebar-muted); }
  .workspace { padding: 0 18px 40px; }
  .workspace-header { padding-top: 0; }
  .mobile-brand-row { height: 56px; margin-inline: -18px; padding: 0 18px; grid-template-columns: 38px 1fr; align-items: center; gap: 11px; border-bottom: 1px solid var(--line); }
  .mobile-brand { font-family: Georgia, "Songti SC", serif; font-size: 15px; font-weight: 700; }
  .title-row { padding-top: 20px; }
  .title-row h1 { font-size: 27px; }
  .prompt-grid { grid-template-columns: minmax(0, 1fr); }
  .prompt-grid.list-view .prompt-card { grid-template-columns: minmax(170px, 38%) 1fr; }
  .detail-panel { width: min(680px, calc(100vw - 28px)); max-height: calc(100vh - 28px); }
  .detail-content { padding: 22px 20px 82px; }
  .detail-actions { margin: 22px -20px -82px; padding-inline: 20px; }
}

@media (max-width: 560px) {
  .workspace { padding-inline: 14px; }
  .mobile-brand-row { margin-inline: -14px; padding-inline: 14px; }
  .title-row { gap: 10px; }
  .title-row h1 { font-size: 24px; }
  .page-subtitle { max-width: 230px; }
  .header-actions .primary-btn { width: 39px; padding: 0; }
  .header-actions .primary-btn span { display: none; }
  .search-row { margin-top: 19px; }
  .search-box kbd { display: none; }
  .toolbar { align-items: flex-end; }
  .tabs { height: 55px; gap: 17px; }
  .sort-control { width: 39px; padding: 0; justify-content: center; }
  .sort-control select { position: absolute; width: 39px; opacity: 0; }
  .prompt-grid.list-view .prompt-card { display: block; }
  .prompt-grid.list-view .card-preview { min-height: 0; aspect-ratio: 16 / 9; }
  .form-grid.two-col { grid-template-columns: 1fr; }
  .modal-backdrop { padding: 0; align-items: end; }
  .modal { width: 100%; max-height: 94vh; border-radius: 8px 8px 0 0; }
  .detail-panel { left: 0; right: 0; bottom: 0; top: auto; width: 100%; max-height: 92vh; border-radius: 12px 12px 0 0; transform: translateY(104%); }
  .detail-panel.open { transform: translateY(0); }
  .detail-preview { aspect-ratio: 16 / 10; }
  .detail-meta-grid.has-type { grid-template-columns: 1fr; }
  .detail-meta-grid.has-type div + div { border-left: 0; border-top: 1px solid var(--line); }
  .detail-actions { grid-template-columns: 1fr; }
  .toast-region { left: 14px; right: 14px; bottom: 14px; }
  .toast { width: 100%; max-width: none; min-width: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
