:root {
    color-scheme: dark;
    --bg: #0b0e12;
    --bg-soft: #0f1319;
    --surface: #141922;
    --surface-raised: #1a202b;
    --surface-hover: #202837;
    --line: rgba(226, 232, 240, 0.09);
    --line-strong: rgba(226, 232, 240, 0.15);
    --text: #f4f1e9;
    --text-soft: #c8c8c4;
    --muted: #89919f;
    --muted-dim: #626b79;
    --accent: #e9a15d;
    --accent-bright: #f4b778;
    --accent-soft: rgba(233, 161, 93, 0.14);
    --scrollbar-track: rgba(255, 255, 255, 0.08);
    --scrollbar-thumb: rgba(157, 166, 180, 0.52);
    --scrollbar-thumb-hover: rgba(233, 161, 93, 0.82);
    --teal: #72c9bb;
    --danger: #e97978;
    --shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
    --radius-lg: 22px;
    --radius-md: 14px;
    --radius-sm: 10px;
}

:root[data-theme="light"] {
    color-scheme: light;
    --bg: #f5f1e8;
    --bg-soft: #eee8de;
    --surface: #fffdf8;
    --surface-raised: #ffffff;
    --surface-hover: #f0e8dc;
    --line: rgba(54, 53, 50, 0.12);
    --line-strong: rgba(54, 53, 50, 0.19);
    --text: #25272b;
    --text-soft: #4d5158;
    --muted: #747b84;
    --muted-dim: #969ba2;
    --accent: #b8662e;
    --accent-bright: #a85825;
    --accent-soft: rgba(184, 102, 46, 0.12);
    --scrollbar-track: rgba(83, 70, 54, 0.12);
    --scrollbar-thumb: rgba(122, 97, 72, 0.48);
    --scrollbar-thumb-hover: rgba(184, 102, 46, 0.78);
    --teal: #358e83;
    --danger: #c65e62;
    --shadow: 0 24px 70px rgba(53, 44, 33, 0.16);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

* [hidden] {
    display: none !important;
}

html,
body {
    min-height: 100%;
}

body {
    background:
        radial-gradient(circle at 82% -12%, rgba(106, 88, 151, 0.18), transparent 34rem),
        radial-gradient(circle at 18% 110%, rgba(57, 127, 126, 0.08), transparent 30rem),
        var(--bg);
    color: var(--text);
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    font-size: 14px;
    line-height: 1.5;
    overflow: hidden;
}

:root[data-theme="light"] body {
    background:
        radial-gradient(circle at 82% -12%, rgba(196, 143, 82, 0.14), transparent 34rem),
        radial-gradient(circle at 18% 110%, rgba(57, 127, 126, 0.09), transparent 30rem),
        var(--bg);
}

button,
input,
textarea,
select {
    color: inherit;
    font: inherit;
}

button {
    border: 0;
}

button,
[role="button"] {
    -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[tabindex="0"]:focus-visible {
    outline: 2px solid var(--accent-bright);
    outline-offset: 3px;
}

svg {
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.7;
}

.inline-icon {
    width: 15px;
    height: 15px;
    flex: 0 0 auto;
}

.app-shell {
    display: grid;
    grid-template-columns: 278px minmax(0, 1fr);
    height: 100dvh;
    min-height: 560px;
    overflow: hidden;
}

.sidebar {
    position: relative;
    z-index: 10;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
    background: rgba(13, 17, 23, 0.88);
    border-right: 1px solid var(--line);
    backdrop-filter: blur(18px);
}

.sidebar::before {
    position: absolute;
    top: -100px;
    left: -120px;
    width: 270px;
    height: 270px;
    border-radius: 50%;
    background: rgba(233, 161, 93, 0.08);
    content: "";
    filter: blur(40px);
    pointer-events: none;
}

.sidebar-brand {
    position: relative;
    display: flex;
    align-items: center;
    gap: 11px;
    min-height: 84px;
    padding: 21px 20px 15px;
}

.brand-mark {
    display: grid;
    width: 43px;
    height: 43px;
    flex: 0 0 auto;
    place-items: center;
    overflow: hidden;
    border: 1px solid rgba(244, 183, 120, 0.55);
    border-radius: 14px;
    background: #f8cc36;
    box-shadow: 0 8px 24px rgba(233, 161, 93, 0.2);
}

.brand-mark img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.brand-mark.small {
    width: 32px;
    height: 32px;
    border-radius: 10px;
}

.brand-copy {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.brand-copy strong,
.mobile-brand strong {
    color: var(--text);
    font-size: 16px;
    font-weight: 760;
    letter-spacing: 0.055em;
    line-height: 1.1;
    white-space: nowrap;
}

.brand-copy strong span,
.mobile-brand strong span {
    color: var(--muted);
    font-weight: 500;
}

.brand-copy small {
    margin-top: 2px;
    color: var(--muted-dim);
    font-size: 9px;
    font-weight: 650;
    letter-spacing: 0.16em;
}

.icon-button {
    display: inline-grid;
    width: 34px;
    height: 34px;
    flex: 0 0 auto;
    place-items: center;
    border: 1px solid transparent;
    border-radius: 10px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    transition: 160ms ease;
}

.icon-button svg {
    width: 17px;
    height: 17px;
}

.icon-button:hover {
    border-color: var(--line-strong);
    background: var(--surface-hover);
    color: var(--text);
}

.sidebar-close {
    display: none;
    margin-left: auto;
}

.privacy-note {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 18px 18px;
    padding: 9px 11px;
    border: 1px solid rgba(114, 201, 187, 0.12);
    border-radius: 10px;
    background: rgba(114, 201, 187, 0.06);
    color: #9dbeb8;
    font-size: 11px;
}

.status-dot {
    width: 7px;
    height: 7px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: var(--teal);
    box-shadow: 0 0 0 4px rgba(114, 201, 187, 0.1);
}

.privacy-lock {
    margin-left: auto;
    color: var(--muted-dim);
    font-size: 16px;
    transform: rotate(-35deg);
}

.search-box {
    display: flex;
    align-items: center;
    gap: 9px;
    height: 42px;
    margin: 0 18px 22px;
    padding: 0 11px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: rgba(255, 255, 255, 0.035);
    color: var(--muted);
    transition: 160ms ease;
}

.search-box:focus-within {
    border-color: rgba(233, 161, 93, 0.55);
    background: rgba(233, 161, 93, 0.055);
    box-shadow: 0 0 0 4px rgba(233, 161, 93, 0.07);
}

.search-box > svg {
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
}

.search-box input {
    width: 100%;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--text);
    font-size: 12px;
}

.search-box input::placeholder {
    color: var(--muted-dim);
}

kbd {
    flex: 0 0 auto;
    padding: 2px 6px;
    border: 1px solid var(--line);
    border-radius: 5px;
    color: var(--muted-dim);
    font-size: 10px;
    line-height: 1.4;
}

.primary-nav,
.category-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.primary-nav {
    padding: 0 12px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 40px;
    padding: 0 11px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    text-align: left;
    transition: 160ms ease;
}

.nav-item svg {
    width: 16px;
    height: 16px;
}

.nav-item span {
    flex: 1;
    font-size: 13px;
}

.nav-item b {
    color: var(--muted-dim);
    font-size: 11px;
    font-weight: 500;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-soft);
}

.nav-item.active {
    border-color: rgba(233, 161, 93, 0.17);
    background: linear-gradient(90deg, rgba(233, 161, 93, 0.15), rgba(233, 161, 93, 0.035));
    color: var(--accent-bright);
}

.nav-item.active b {
    color: var(--accent);
}

.sidebar-section {
    display: flex;
    flex-direction: column;
    min-height: 0;
    margin-top: 27px;
}

.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px 10px;
    color: var(--muted-dim);
    font-size: 10px;
    font-weight: 650;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.mini-action {
    width: 22px;
    height: 22px;
    border-radius: 7px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font-size: 17px;
    line-height: 1;
}

.mini-action:hover {
    background: var(--surface-hover);
    color: var(--accent-bright);
}

.category-list {
    flex: 0 1 auto;
    min-height: 0;
    padding: 0 12px;
    overflow-y: auto;
}

.category-item {
    display: flex;
    align-items: center;
    min-height: 38px;
    padding: 2px 4px 2px 2px;
    border: 1px solid transparent;
    border-radius: 10px;
    transition: 160ms ease;
}

.category-item:hover,
.category-item.drag-target {
    border-color: var(--line);
    background: rgba(255, 255, 255, 0.035);
}

.category-item.active {
    border-color: rgba(255, 255, 255, 0.07);
    background: rgba(255, 255, 255, 0.055);
}

.category-item.dragging {
    opacity: 0.45;
}

.drag-handle {
    width: 20px;
    color: var(--muted-dim);
    cursor: grab;
    font-size: 15px;
    text-align: center;
    user-select: none;
}

.category-main {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
    flex: 1;
    height: 32px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    text-align: left;
}

.category-item.active .category-main {
    color: var(--text-soft);
}

.category-color,
.category-pill i,
.detail-tag i {
    display: inline-block;
    width: 7px;
    height: 7px;
    flex: 0 0 auto;
    border-radius: 50%;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--category-color, #9aa4b4) 12%, transparent);
}

.category-name {
    min-width: 0;
    overflow: hidden;
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.category-count {
    display: inline-block;
    width: 28px;
    flex: 0 0 28px;
    margin-left: 8px;
    color: var(--muted-dim);
    font-size: 11px;
    text-align: right;
}

.category-actions {
    display: flex;
    width: 52px;
    flex: 0 0 52px;
    gap: 1px;
    justify-content: flex-end;
    opacity: 0;
    transition: 160ms ease;
}

.category-item:hover .category-actions,
.category-item:focus-within .category-actions {
    opacity: 1;
}

.icon-button.tiny {
    width: 25px;
    height: 25px;
    border-radius: 7px;
    font-size: 15px;
}

.sidebar-spacer {
    flex: 1;
    min-height: 20px;
}

.sidebar-bottom {
    padding: 15px 16px 17px;
    border-top: 1px solid var(--line);
}

.storage-card {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 11px;
    padding: 10px 11px;
    border: 1px solid rgba(114, 201, 187, 0.12);
    border-radius: 12px;
    background: rgba(114, 201, 187, 0.045);
}

.storage-card.error {
    border-color: rgba(233, 121, 120, 0.25);
    background: rgba(233, 121, 120, 0.06);
}

.storage-card-icon {
    display: grid;
    width: 27px;
    height: 27px;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 8px;
    background: rgba(114, 201, 187, 0.12);
    color: var(--teal);
}

.storage-card-icon svg {
    width: 15px;
    height: 15px;
}

.storage-card strong,
.storage-card span {
    display: block;
}

.storage-card strong {
    color: var(--text-soft);
    font-size: 11px;
    font-weight: 600;
}

.storage-card span {
    margin-top: 1px;
    color: var(--muted-dim);
    font-size: 10px;
}

.sidebar-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 7px;
    margin-bottom: 10px;
}

.add-category-form {
    display: flex;
    gap: 7px;
}

.add-category-form input {
    width: 100%;
    min-width: 0;
    height: 34px;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: 9px;
    outline: 0;
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-soft);
    font-size: 11px;
}

.add-category-form input:focus {
    border-color: rgba(233, 161, 93, 0.45);
}

.accent-icon {
    width: 34px;
    height: 34px;
    border-color: rgba(233, 161, 93, 0.25);
    background: var(--accent-soft);
    color: var(--accent-bright);
}

.accent-icon:hover {
    border-color: var(--accent);
    background: rgba(233, 161, 93, 0.22);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 36px;
    padding: 0 13px;
    border: 1px solid transparent;
    border-radius: 10px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    transition: 160ms ease;
}

.btn svg {
    width: 15px;
    height: 15px;
}

.btn-primary {
    background: var(--accent);
    box-shadow: 0 7px 20px rgba(233, 161, 93, 0.12);
    color: #24170f;
}

.btn-primary:hover {
    background: var(--accent-bright);
    box-shadow: 0 10px 25px rgba(233, 161, 93, 0.2);
    transform: translateY(-1px);
}

.btn-subtle {
    border-color: var(--line);
    background: rgba(255, 255, 255, 0.035);
    color: var(--text-soft);
}

.btn-subtle:hover {
    border-color: var(--line-strong);
    background: var(--surface-hover);
    color: var(--text);
}

.main-content {
    position: relative;
    display: flex;
    min-width: 0;
    flex-direction: column;
    overflow: hidden;
    background: rgba(11, 14, 18, 0.48);
}

.topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "hero actions";
    align-items: center;
    gap: 24px;
    min-height: 96px;
    padding: 0 38px;
    border-bottom: 1px solid var(--line);
}

.topbar-left {
    display: none;
    align-items: center;
}

.topbar-actions,
.mobile-brand {
    display: flex;
    align-items: center;
}

.topbar-hero {
    grid-area: hero;
    min-width: 0;
}

.topbar-hero h1 {
    margin-top: 6px;
    overflow: hidden;
    color: var(--text);
    font-family: Georgia, "Songti SC", "STSong", serif;
    font-size: clamp(21px, 2.1vw, 30px);
    font-weight: 400;
    letter-spacing: -0.045em;
    line-height: 1.1;
    text-overflow: ellipsis;
}

.topbar-hero h1 em {
    color: var(--accent-bright);
    font-style: normal;
}

.topbar-hero-note {
    overflow: hidden;
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.topbar-hero .eyebrow {
    font-size: 8px;
    letter-spacing: 0.16em;
}

.topbar-hero .eyebrow span {
    width: 18px;
}

.topbar-actions {
    grid-area: actions;
}

.topbar-actions {
    gap: 10px;
}

.theme-toggle {
    border-color: var(--line);
    background: rgba(255, 255, 255, 0.035);
    color: var(--accent-bright);
}

.theme-toggle:hover {
    border-color: var(--line-strong);
    background: var(--surface-hover);
    color: var(--text);
}

.theme-icon {
    grid-area: 1 / 1;
    width: 17px;
    height: 17px;
}

.theme-icon-moon {
    display: none;
}

:root[data-theme="light"] .theme-icon-sun {
    display: none;
}

:root[data-theme="light"] .theme-icon-moon {
    display: block;
}

.mobile-menu,
.mobile-brand {
    display: none;
}

.topbar-stat {
    display: flex;
    align-items: baseline;
    gap: 6px;
    min-width: 68px;
    padding-right: 14px;
    border-right: 1px solid var(--line);
}

.topbar-stat strong {
    color: var(--text);
    font-family: Georgia, "Songti SC", serif;
    font-size: 18px;
    font-weight: 500;
}

.topbar-stat span {
    color: var(--muted-dim);
    font-size: 10px;
}

.eyebrow,
.modal-eyebrow,
.empty-kicker {
    color: var(--accent);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.18em;
}

.eyebrow {
    display: flex;
    align-items: center;
    gap: 9px;
}

.eyebrow span {
    width: 23px;
    height: 1px;
    background: var(--accent);
}

.content-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 25px 6.3% 20px;
}

.toolbar-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.toolbar-context h2 {
    color: var(--text);
    font-size: 19px;
    font-weight: 650;
    letter-spacing: -0.03em;
}

.toolbar-context p {
    margin-top: 4px;
    color: var(--muted-dim);
    font-size: 11px;
}

.count-pill {
    padding: 3px 8px;
    border: 1px solid rgba(233, 161, 93, 0.19);
    border-radius: 99px;
    background: var(--accent-soft);
    color: var(--accent-bright);
    font-size: 10px;
}

.toolbar-controls {
    display: flex;
    align-items: center;
    gap: 9px;
}

.sort-control {
    display: flex;
    align-items: center;
    gap: 7px;
    height: 36px;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.025);
}

.sort-control span {
    color: var(--muted-dim);
    font-size: 10px;
}

.sort-control select {
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--text-soft);
    cursor: pointer;
    font-size: 11px;
    color-scheme: dark;
}

.sort-control option {
    background: #171d27;
    color: #f4f1e9;
}

.view-toggle {
    display: flex;
    gap: 2px;
    height: 36px;
    padding: 3px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.025);
}

.view-button {
    display: grid;
    width: 29px;
    height: 28px;
    place-items: center;
    border-radius: 7px;
    background: transparent;
    color: var(--muted-dim);
    cursor: pointer;
}

.view-button svg {
    width: 15px;
    height: 15px;
}

.view-button.active,
.view-button:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.view-button.active {
    color: var(--accent-bright);
}

.prompts-container {
    flex: 1;
    min-height: 0;
    padding: 0 6.3% 28px;
    overflow: auto;
    scrollbar-gutter: stable;
}

.prompts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(272px, 1fr));
    align-items: start;
    gap: 17px;
}

.prompt-card {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: linear-gradient(145deg, rgba(26, 32, 43, 0.93), rgba(18, 23, 31, 0.96));
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12);
    cursor: pointer;
    transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.prompt-card:hover {
    border-color: rgba(233, 161, 93, 0.34);
    box-shadow: 0 20px 42px rgba(0, 0, 0, 0.28);
    transform: translateY(-3px);
}

.card-media {
    position: relative;
    aspect-ratio: 3 / 4;
    overflow: hidden;
    background:
        linear-gradient(135deg, rgba(233, 161, 93, 0.18), transparent 56%),
        linear-gradient(135deg, #252d3b, #151a24);
}

.card-media::after {
    position: absolute;
    inset: 0;
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: inherit;
    content: "";
    pointer-events: none;
}

.card-media img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transform: scale(1.02);
    transition: opacity 300ms ease, transform 600ms ease;
}

.card-media.loaded img {
    opacity: 1;
}

.prompt-card:hover .card-media.loaded img {
    transform: scale(1.05);
}

.card-media.broken::before {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: var(--muted);
    content: "图片无法读取";
    font-size: 11px;
}

.card-media-empty {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 19px;
    background:
        radial-gradient(circle at 75% 20%, rgba(114, 201, 187, 0.2), transparent 40%),
        linear-gradient(135deg, #222b35, #151a24);
}

.card-media-empty span {
    display: grid;
    width: 43px;
    height: 43px;
    place-items: center;
    border: 1px solid rgba(233, 161, 93, 0.28);
    border-radius: 50%;
    color: var(--accent-bright);
}

.card-media-empty span svg {
    width: 19px;
    height: 19px;
}

.card-media-empty small {
    align-self: flex-end;
    color: var(--muted-dim);
    font-size: 10px;
}

.media-badge {
    position: absolute;
    right: 11px;
    bottom: 10px;
    padding: 4px 7px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    background: rgba(7, 9, 12, 0.57);
    color: #e7e2d8;
    font-size: 10px;
    backdrop-filter: blur(8px);
}

.card-body {
    padding: 16px 17px 15px;
}

.card-topline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.category-pill,
.detail-tag {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    max-width: 100%;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 10px;
    line-height: 1.2;
    white-space: nowrap;
}

.category-pill {
    overflow: hidden;
    text-overflow: ellipsis;
}

.favorite-button {
    display: grid;
    width: 28px;
    height: 28px;
    place-items: center;
    border-radius: 8px;
    background: transparent;
    color: var(--muted-dim);
    cursor: pointer;
    font-family: Arial, sans-serif;
    font-size: 19px;
    line-height: 1;
    transition: 160ms ease;
}

.favorite-button:hover,
.favorite-button.active {
    background: rgba(233, 121, 120, 0.1);
    color: var(--danger);
}

.card-title {
    display: -webkit-box;
    min-height: 46px;
    margin-top: 13px;
    overflow: hidden;
    color: var(--text);
    font-size: 15px;
    font-weight: 650;
    letter-spacing: -0.02em;
    line-height: 1.45;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.card-desc {
    display: -webkit-box;
    min-height: 59px;
    margin-top: 9px;
    overflow: hidden;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.65;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
}

.card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
}

.card-date {
    color: var(--muted-dim);
    font-size: 10px;
}

.card-copy {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 7px;
    border-radius: 6px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font-size: 10px;
}

.card-copy svg {
    width: 13px;
    height: 13px;
}

.card-copy:hover {
    background: var(--accent-soft);
    color: var(--accent-bright);
}

.prompts-grid.list-view {
    grid-template-columns: 1fr;
}

.prompts-grid.list-view .prompt-card {
    display: grid;
    grid-template-columns: 185px minmax(0, 1fr);
}

.prompts-grid.list-view .card-media {
    height: 100%;
    min-height: 185px;
    aspect-ratio: auto;
}

.prompts-grid.list-view .card-body {
    min-width: 0;
}

.prompts-grid.list-view .card-desc {
    min-height: 41px;
    -webkit-line-clamp: 2;
}

.empty-state {
    display: flex;
    min-height: 330px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 50px 20px;
    text-align: center;
}

.empty-art {
    position: relative;
    width: 90px;
    height: 74px;
    margin-bottom: 24px;
}

.empty-square {
    position: absolute;
    display: block;
    width: 47px;
    height: 47px;
    border: 1px solid rgba(233, 161, 93, 0.3);
    border-radius: 12px;
    background: rgba(233, 161, 93, 0.08);
    transform: rotate(16deg);
}

.square-one {
    top: 5px;
    left: 5px;
}

.square-two {
    top: 17px;
    left: 28px;
    border-color: rgba(114, 201, 187, 0.28);
    background: rgba(114, 201, 187, 0.07);
    transform: rotate(-12deg);
}

.square-three {
    top: 2px;
    left: 47px;
    border-color: rgba(255, 255, 255, 0.13);
    background: rgba(255, 255, 255, 0.04);
    transform: rotate(34deg);
}

.empty-spark {
    position: absolute;
    top: -9px;
    right: 8px;
    color: var(--accent-bright);
    font-size: 17px;
}

.empty-state h3 {
    margin-top: 9px;
    color: var(--text);
    font-family: Georgia, "Songti SC", serif;
    font-size: 23px;
    font-weight: 400;
}

.empty-state > p:not(.empty-kicker) {
    max-width: 330px;
    margin: 8px auto 20px;
    color: var(--muted);
    font-size: 12px;
}

.main-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 43px;
    padding: 0 6.3%;
    border-top: 1px solid var(--line);
    color: var(--muted-dim);
    font-size: 10px;
}

.main-footer #saveStatus.error {
    color: var(--danger);
}

.mobile-scrim {
    display: none;
}

.modal-overlay {
    position: fixed;
    z-index: 200;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(3, 5, 8, 0.74);
    backdrop-filter: blur(10px);
}

.modal-overlay.active {
    display: flex;
    animation: fade-in 180ms ease both;
}

.modal {
    display: flex;
    width: min(690px, 100%);
    max-height: min(850px, 92dvh);
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--line-strong);
    border-radius: 20px;
    background: linear-gradient(150deg, #1b222d, #11161e);
    box-shadow: var(--shadow);
    animation: modal-in 220ms ease both;
}

.modal-large {
    height: min(850px, 92dvh);
}

.modal-large form {
    display: flex;
    min-height: 0;
    flex: 1;
    flex-direction: column;
}

.modal-small {
    width: min(440px, 100%);
}

.modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    padding: 23px 25px 19px;
    border-bottom: 1px solid var(--line);
}

.modal-eyebrow {
    margin-bottom: 6px;
    color: var(--muted-dim);
    font-size: 9px;
}

.modal-header h2 {
    color: var(--text);
    font-family: Georgia, "Songti SC", serif;
    font-size: 23px;
    font-weight: 400;
}

.modal-body {
    min-height: 0;
    padding: 22px 25px;
    overflow: auto;
}

.modal-large .modal-body {
    flex: 1;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 14px;
}

.form-group {
    min-width: 0;
    margin-bottom: 17px;
}

.form-group.span-two {
    grid-column: 1 / -1;
}

.form-group label,
.form-hint-label {
    display: block;
    margin-bottom: 7px;
    color: var(--text-soft);
    font-size: 11px;
    font-weight: 600;
}

.form-group label span {
    color: var(--accent);
}

.label-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}

.field-counter,
.form-hint {
    color: var(--muted-dim);
    font-size: 10px;
    font-weight: 400;
}

.form-hint-group {
    align-self: end;
    padding: 0 4px 10px;
}

.form-hint-label {
    margin-bottom: 2px;
    color: var(--muted-dim);
    font-size: 10px;
}

.form-group input,
.form-group textarea,
.form-group select {
    display: block;
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 10px;
    outline: 0;
    background: rgba(8, 11, 15, 0.44);
    color: var(--text);
    font-size: 12px;
    color-scheme: dark;
    transition: 160ms ease;
}

.form-group input,
.form-group select {
    height: 42px;
    padding: 0 12px;
}

.form-group textarea {
    min-height: 156px;
    padding: 11px 12px;
    resize: vertical;
    line-height: 1.65;
}

.form-group textarea.small-textarea {
    min-height: 92px;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    border-color: rgba(233, 161, 93, 0.55);
    background: rgba(233, 161, 93, 0.045);
    box-shadow: 0 0 0 4px rgba(233, 161, 93, 0.06);
}

.form-group select option {
    background: #171d27 !important;
    color: #f4f1e9 !important;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--muted-dim);
}

.image-upload-area {
    display: flex;
    min-height: 112px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 19px;
    border: 1px dashed rgba(233, 161, 93, 0.28);
    border-radius: 12px;
    background: rgba(233, 161, 93, 0.035);
    color: var(--muted);
    cursor: pointer;
    transition: 160ms ease;
}

.image-upload-area:hover,
.image-upload-area.dragover {
    border-color: var(--accent);
    background: rgba(233, 161, 93, 0.09);
    color: var(--text-soft);
}

.upload-icon {
    display: grid;
    width: 30px;
    height: 30px;
    margin-bottom: 2px;
    place-items: center;
    border-radius: 9px;
    background: var(--accent-soft);
    color: var(--accent-bright);
}

.upload-icon svg {
    width: 16px;
    height: 16px;
}

.image-upload-area strong {
    color: var(--text-soft);
    font-size: 11px;
}

.image-upload-area > span {
    color: var(--muted-dim);
    font-size: 10px;
}

.image-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.image-preview-item {
    position: relative;
    width: 70px;
    height: 70px;
    overflow: hidden;
    border: 1px solid var(--line-strong);
    border-radius: 9px;
    background: var(--surface);
}

.image-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.remove-image {
    position: absolute;
    top: 4px;
    right: 4px;
    display: grid;
    width: 19px;
    height: 19px;
    place-items: center;
    border-radius: 50%;
    background: rgba(12, 14, 18, 0.8);
    color: #fff;
    cursor: pointer;
    font-size: 13px;
    line-height: 1;
}

.remove-image:hover {
    background: var(--danger);
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 15px 25px;
    border-top: 1px solid var(--line);
}

.modal-footnote {
    min-width: 0;
    color: var(--muted-dim);
    font-size: 10px;
}

.modal-footer-actions {
    display: flex;
    flex: 0 0 auto;
    gap: 8px;
}

.color-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding-top: 3px;
}

.color-option {
    width: 31px;
    height: 31px;
    border: 3px solid transparent;
    border-radius: 50%;
    cursor: pointer;
    transition: 160ms ease;
}

.color-option:hover {
    transform: scale(1.1);
}

.color-option.selected {
    border-color: var(--text);
    box-shadow: 0 0 0 2px var(--accent);
}

.detail-scrim {
    position: fixed;
    z-index: 90;
    inset: 0;
    display: none;
    background: rgba(3, 5, 8, 0.55);
    backdrop-filter: blur(3px);
}

.detail-scrim.active {
    display: block;
    animation: fade-in 180ms ease both;
}

.detail-panel {
    position: fixed;
    z-index: 100;
    top: 0;
    right: 0;
    display: flex;
    width: min(505px, 100%);
    height: 100dvh;
    flex-direction: column;
    border-left: 1px solid var(--line-strong);
    background: linear-gradient(160deg, #1a212c, #10151d 80%);
    box-shadow: -24px 0 70px rgba(0, 0, 0, 0.35);
    transform: translateX(105%);
    transition: transform 260ms cubic-bezier(0.22, 1, 0.36, 1);
}

.detail-panel.active {
    transform: translateX(0);
}

.detail-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    padding: 27px 27px 22px;
    border-bottom: 1px solid var(--line);
}

.detail-header-copy {
    min-width: 0;
}

.detail-header h2 {
    max-width: 390px;
    color: var(--text);
    font-family: Georgia, "Songti SC", serif;
    font-size: 25px;
    font-weight: 400;
    letter-spacing: -0.04em;
    line-height: 1.25;
}

.detail-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 13px;
}

.detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 28px;
    color: var(--muted-dim);
    font-size: 10px;
}

.detail-meta span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.detail-meta .inline-icon {
    width: 13px;
    height: 13px;
}

.detail-meta .detail-favorite {
    color: var(--danger);
}

.detail-content {
    min-height: 0;
    padding: 26px 27px;
    overflow: auto;
}

.detail-section {
    margin-bottom: 27px;
}

.detail-section-heading {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 11px;
    color: var(--muted-dim);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.13em;
    text-transform: uppercase;
}

.detail-rule {
    height: 1px;
    flex: 1;
    background: var(--line);
}

.detail-text {
    color: var(--text-soft);
    font-size: 13px;
    line-height: 1.75;
    white-space: pre-wrap;
    word-break: break-word;
}

.detail-text.muted {
    color: var(--muted);
}

.detail-images {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
}

.detail-image {
    position: relative;
    display: block;
    min-width: 0;
    overflow: hidden;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: var(--surface);
    cursor: pointer;
}

.detail-image img {
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    transition: 180ms ease;
}

.detail-image:hover img {
    opacity: 0.78;
    transform: scale(1.03);
}

.detail-image span {
    position: absolute;
    right: 7px;
    bottom: 7px;
    padding: 3px 5px;
    border-radius: 5px;
    background: rgba(7, 9, 12, 0.65);
    color: var(--text-soft);
    font-size: 9px;
}

.detail-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 17px 27px 22px;
    border-top: 1px solid var(--line);
}

.detail-actions .btn-primary {
    flex: 1;
}

.danger-icon {
    color: var(--danger);
}

.danger-icon:hover {
    border-color: rgba(233, 121, 120, 0.25);
    background: rgba(233, 121, 120, 0.1);
    color: #ff9a99;
}

.toast {
    position: fixed;
    z-index: 400;
    bottom: 27px;
    left: 50%;
    max-width: min(420px, calc(100vw - 32px));
    padding: 11px 17px;
    border: 1px solid rgba(233, 161, 93, 0.28);
    border-radius: 10px;
    background: #202832;
    box-shadow: 0 13px 35px rgba(0, 0, 0, 0.32);
    color: var(--text);
    font-size: 12px;
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, 18px);
    transition: 220ms ease;
}

.toast.show {
    opacity: 1;
    transform: translate(-50%, 0);
}

.toast.error {
    border-color: rgba(233, 121, 120, 0.35);
    background: #352124;
}

html {
    scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
    scrollbar-width: auto;
}

::-webkit-scrollbar {
    width: 14px;
    height: 14px;
}

::-webkit-scrollbar-button {
    display: none;
    width: 0;
    height: 0;
}

::-webkit-scrollbar-track {
    border-radius: 99px;
    background: var(--scrollbar-track);
}

::-webkit-scrollbar-thumb {
    min-height: 288px;
    border: 2px solid transparent;
    border-radius: 9px;
    background: var(--scrollbar-thumb);
    background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-thumb-hover);
    background-clip: padding-box;
}

:root[data-theme="light"] .sidebar {
    background: rgba(255, 253, 248, 0.86);
}

:root[data-theme="light"] .main-content {
    background: rgba(245, 241, 232, 0.76);
}

:root[data-theme="light"] .search-box,
:root[data-theme="light"] .sort-control,
:root[data-theme="light"] .view-toggle,
:root[data-theme="light"] .btn-subtle,
:root[data-theme="light"] .add-category-form input {
    background: rgba(255, 255, 255, 0.72);
}

:root[data-theme="light"] .btn-primary {
    border-color: rgba(127, 82, 45, 0.18);
    background: #e7d3bb;
    box-shadow: 0 7px 20px rgba(127, 82, 45, 0.12);
    color: #3d2d21;
}

:root[data-theme="light"] .btn-primary:hover {
    border-color: rgba(127, 82, 45, 0.25);
    background: #ddc0a0;
    box-shadow: 0 10px 25px rgba(127, 82, 45, 0.17);
    color: #2f231a;
}

:root[data-theme="light"] .prompt-card {
    background: linear-gradient(145deg, #fffdf8, #f3eee5);
    box-shadow: 0 12px 30px rgba(67, 55, 40, 0.08);
}

:root[data-theme="light"] .prompt-card:hover {
    box-shadow: 0 20px 42px rgba(67, 55, 40, 0.16);
}

:root[data-theme="light"] .card-media {
    background:
        linear-gradient(135deg, rgba(184, 102, 46, 0.15), transparent 56%),
        linear-gradient(135deg, #eee5d7, #dcd6cc);
}

:root[data-theme="light"] .card-media::after {
    border-color: rgba(54, 53, 50, 0.08);
}

:root[data-theme="light"] .card-media-empty {
    background:
        radial-gradient(circle at 75% 20%, rgba(53, 142, 131, 0.16), transparent 40%),
        linear-gradient(135deg, #e9e2d7, #d9d4ca);
}

:root[data-theme="light"] .modal {
    background: linear-gradient(150deg, #fffdf8, #f0ebe2);
}

:root[data-theme="light"] .detail-panel {
    background: linear-gradient(160deg, #fffdf8, #f0ebe2 80%);
    box-shadow: -24px 0 70px rgba(67, 55, 40, 0.17);
}

:root[data-theme="light"] .form-group input,
:root[data-theme="light"] .form-group textarea,
:root[data-theme="light"] .form-group select {
    background: rgba(255, 255, 255, 0.82);
    color-scheme: light;
}

:root[data-theme="light"] .sort-control select {
    color-scheme: light;
}

:root[data-theme="light"] .sort-control option,
:root[data-theme="light"] .form-group select option {
    background: #fffdf8 !important;
    color: #25272b !important;
}

:root[data-theme="light"] .toast {
    background: #fff8ef;
    box-shadow: 0 13px 35px rgba(67, 55, 40, 0.18);
}

:root[data-theme="light"] .square-three {
    border-color: rgba(54, 53, 50, 0.13);
    background: rgba(54, 53, 50, 0.035);
}

@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes modal-in {
    from { opacity: 0; transform: translateY(10px) scale(0.985); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 1120px) {
    .topbar {
        padding: 0 28px;
    }

    .content-toolbar,
    .prompts-container,
    .main-footer {
        padding-right: 5%;
        padding-left: 5%;
    }
}

@media (max-width: 900px) {
    .app-shell {
        display: block;
    }

    .sidebar {
        position: fixed;
        z-index: 120;
        top: 0;
        bottom: 0;
        left: 0;
        width: min(310px, 88vw);
        box-shadow: 18px 0 60px rgba(0, 0, 0, 0.35);
        transform: translateX(-105%);
        transition: transform 260ms cubic-bezier(0.22, 1, 0.36, 1);
    }

    body.sidebar-open .sidebar {
        transform: translateX(0);
    }

    .sidebar-close,
    .mobile-menu {
        display: inline-grid;
    }

    .mobile-brand {
        display: flex;
        gap: 8px;
    }

    .mobile-scrim {
        position: fixed;
        z-index: 110;
        inset: 0;
        display: block;
        background: rgba(3, 5, 8, 0.58);
        opacity: 0;
        pointer-events: none;
        transition: 180ms ease;
    }

    body.sidebar-open .mobile-scrim {
        opacity: 1;
        pointer-events: auto;
    }

    .topbar {
        grid-template-rows: auto auto;
        grid-template-areas: "left actions" "hero hero";
        gap: 0 16px;
        min-height: 0;
        padding: 12px 20px 14px;
    }

    .topbar-left {
        display: flex;
        gap: 9px;
    }

    .topbar-hero {
        padding-top: 11px;
    }

    .content-toolbar,
    .prompts-container,
    .main-footer {
        padding-right: 7%;
        padding-left: 7%;
    }

    .prompts-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }
}

@media (max-width: 650px) {
    .topbar {
        padding: 11px 15px 13px;
    }

    .topbar-actions {
        gap: 6px;
    }

    .topbar-stat,
    .topbar-import {
        display: none;
    }

    .topbar-actions > .btn-primary {
        min-height: 34px;
        padding: 0 10px;
        font-size: 11px;
    }

    .topbar-hero h1 {
        font-size: 28px;
        line-height: 1.12;
    }

    .topbar-hero-note {
        font-size: 10px;
    }

    .content-toolbar {
        align-items: stretch;
        flex-direction: column;
        gap: 16px;
        padding: 20px 20px 15px;
    }

    .toolbar-controls {
        justify-content: space-between;
        gap: 6px;
    }

    .sort-control {
        flex: 1;
    }

    .sort-control select {
        max-width: 100%;
    }

    .toolbar-add {
        display: none;
    }

    .prompts-container {
        padding: 0 20px 22px;
    }

    .prompts-grid {
        grid-template-columns: 1fr;
        gap: 13px;
    }

    .prompts-grid.list-view .prompt-card {
        display: block;
    }

    .prompts-grid.list-view .card-media {
        min-height: 0;
        aspect-ratio: 3 / 4;
    }

    .main-footer {
        min-height: 38px;
        padding: 0 20px;
        font-size: 9px;
    }

    .main-footer span:last-child {
        display: none;
    }

    .modal-overlay {
        align-items: flex-end;
        padding: 0;
    }

    .modal {
        width: 100%;
        max-height: 94dvh;
        border-right: 0;
        border-bottom: 0;
        border-radius: 19px 19px 0 0;
    }

    .modal-large {
        height: 94dvh;
    }

    .modal-header,
    .modal-body,
    .modal-footer {
        padding-right: 20px;
        padding-left: 20px;
    }

    .form-grid {
        display: block;
    }

    .form-hint-group {
        display: none;
    }

    .modal-footer {
        align-items: flex-end;
        flex-direction: column;
    }

    .modal-footnote {
        align-self: flex-start;
    }

    .modal-footer-actions {
        width: 100%;
    }

    .modal-footer-actions .btn {
        flex: 1;
    }

    .detail-panel {
        width: 100%;
    }

    .detail-header,
    .detail-content,
    .detail-actions {
        padding-right: 20px;
        padding-left: 20px;
    }

    .detail-header h2 {
        font-size: 23px;
    }
}

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