/* Prompt 工具箱 · Apple 风格基础层（加载顺序：base → components → modes）
   浅色为默认，深色由 html[data-theme="dark"] 覆盖；主题由 head 预置脚本 + pt-main 三态控制 */
:root {
    color-scheme: light;
    --bg: #f5f5f7;
    --surface: #ffffff;
    --surface-2: #eaeaea;
    --fill: #f2f2f4;
    --fg: #1d1d1f;
    --muted: #6e6e73;
    --border: rgba(0, 0, 0, 0.08);
    --accent: #0071e3;
    --accent-hover: #0077ed;
    --accent-active: #006edb;
    --success: #34c759;
    --warn: #ff9f0a;
    --danger: #ff3b30;
    --hover: rgba(0, 0, 0, 0.05);
    --hover-strong: rgba(0, 0, 0, 0.09);
    --ring: rgba(0, 113, 227, 0.25);
    --ph-bg: rgba(0, 113, 227, 0.12);
    --ph-fg: #0071e3;
    --hl-bg: rgba(255, 159, 10, 0.2);
    --header-bg: rgba(255, 255, 255, 0.72);
    --float-bg: rgba(255, 255, 255, 0.92);
    --toast-bg: rgba(28, 28, 30, 0.92);

    --font-display: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'PingFang SC', 'Helvetica Neue', 'Microsoft YaHei', sans-serif;
    --font-body: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'PingFang SC', 'Helvetica Neue', 'Microsoft YaHei', sans-serif;
    --font-mono: 'SF Mono', 'JetBrains Mono', ui-monospace, Menlo, monospace;

    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04), 0 1px 1px rgba(0, 0, 0, 0.02);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.06), 0 2px 6px rgba(0, 0, 0, 0.03);
    --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.12), 0 4px 12px rgba(0, 0, 0, 0.06);
    --header-height: 56px;
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0b0b0d;
    --surface: #1c1c1e;
    --surface-2: #2c2c2e;
    --fill: #262629;
    --fg: #f5f5f7;
    --muted: #98989d;
    --border: rgba(255, 255, 255, 0.12);
    --accent: #2997ff;
    --accent-hover: #3da5ff;
    --accent-active: #1e86e8;
    --success: #30d158;
    --warn: #ffd60a;
    --danger: #ff453a;
    --hover: rgba(255, 255, 255, 0.08);
    --hover-strong: rgba(255, 255, 255, 0.14);
    --ring: rgba(41, 151, 255, 0.35);
    --ph-bg: rgba(41, 151, 255, 0.2);
    --ph-fg: #2997ff;
    --hl-bg: rgba(255, 214, 10, 0.22);
    --header-bg: rgba(28, 28, 30, 0.72);
    --float-bg: rgba(44, 44, 46, 0.92);
    --toast-bg: rgba(44, 44, 46, 0.95);
}

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

body {
    background: var(--bg);
    color: var(--fg);
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

header {
    background: var(--header-bg);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}
.logo-icon {
    width: 30px; height: 30px;
    border-radius: 9px;
    background: var(--fg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--bg);
}
.logo-icon .lucide { width: 16px; height: 16px; }
.logo-text h1 {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 600;
    color: var(--fg);
    letter-spacing: -0.01em;
    line-height: 1.2;
}
.logo-text p {
    font-size: 12px;
    color: var(--muted);
    letter-spacing: 0.01em;
}

.controls {
    display: flex;
    gap: 8px;
    align-items: center;
    overflow: hidden;
    min-width: 0;
}

.search-box {
    position: relative;
    overflow: hidden;
    flex: 1 1 auto;
    min-width: 0;
}
.search-box > .lucide {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    width: 14px;
    height: 14px;
    pointer-events: none;
}
.search-box input {
    background: var(--fill);
    border: 1px solid transparent;
    border-radius: 10px;
    padding: 8px 36px 8px 32px;
    font-family: var(--font-body);
    font-size: 13px;
    color: var(--fg);
    width: 100%;
    max-width: 200px;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.search-box input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--ring);
    background: var(--surface);
}
.search-box input::placeholder {
    color: var(--muted);
}
.search-box .shortcut-hint {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 10px;
    font-weight: 500;
    color: var(--muted);
    letter-spacing: 0.02em;
    pointer-events: none;
    font-family: var(--font-mono);
    background: var(--surface-2);
    padding: 1px 5px;
    border-radius: 5px;
    border: 1px solid var(--border);
    line-height: 1.4;
}
.search-box input:focus ~ .shortcut-hint,
.search-box input:not(:placeholder-shown) ~ .shortcut-hint {
    display: none;
}
.search-box .clear-btn {
    position: absolute;
    right: 6px; top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    display: none;
    padding: 0;
    width: 24px; height: 24px;
    border-radius: 6px;
    z-index: 2;
    align-items: center;
    justify-content: center;
    transition: background 0.1s;
}
.search-box .clear-btn .lucide { width: 13px; height: 13px; }
.search-box .clear-btn:hover { background: var(--hover); }
.search-box .clear-btn.visible {
    display: flex;
}

.filter-bar {
    max-width: 1200px;
    margin: 14px auto 20px;
    padding: 4px;
    display: flex;
    gap: 2px;
    flex-wrap: wrap;
    background: var(--surface-2);
    border-radius: 12px;
    width: fit-content;
}

.filter-btn {
    background: transparent;
    border: none;
    color: var(--muted);
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 500;
    padding: 6px 16px;
    border-radius: 9px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s;
    letter-spacing: 0.01em;
}
.filter-btn .count {
    font-weight: 400;
    font-size: 12px;
    opacity: 0.55;
    margin-left: 2px;
}
.filter-btn:hover {
    color: var(--fg);
}
.filter-btn.active {
    background: var(--surface);
    color: var(--fg);
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 0 0 0.5px rgba(0, 0, 0, 0.03);
}
.filter-btn.active .count {
    opacity: 0.7;
}

.main {
    max-width: 1200px;
    margin: 20px auto 28px;
    padding: 0 24px;
}

.section-title {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--fg);
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}
.section-title .lucide {
    color: var(--muted);
    width: 16px;
    height: 16px;
}
.section-count {
    margin-left: auto;
    font-size: 12px;
    font-weight: 400;
    color: var(--muted);
    letter-spacing: 0.01em;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

/* ── Toolbar row (sort + tag + batch) ── */
.toolbar-row {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.toolbar-left { display: flex; align-items: center; gap: 6px; }
.toolbar-right { display: flex; align-items: center; gap: 6px; }
.sort-group { display: flex; align-items: center; gap: 4px; }
.sort-label { font-size: 12px; color: var(--muted); letter-spacing: 0.02em; margin-right: 6px; }
.sort-option {
    background: transparent; border: 1px solid var(--border); border-radius: 999px;
    padding: 4px 12px; font-size: 12px; color: var(--muted); cursor: pointer;
    font-family: var(--font-body); font-weight: 500; white-space: nowrap;
    transition: all 0.12s;
}
.sort-option:hover { border-color: var(--muted); color: var(--fg); }
.sort-option.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.tag-toggle {
    background: transparent; border: 1px solid var(--border); border-radius: 10px;
    padding: 5px 14px; font-size: 12px; font-family: var(--font-body); font-weight: 500;
    color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
    transition: all 0.12s; white-space: nowrap;
}
.tag-toggle .lucide { width: 13px; height: 13px; }
.tag-toggle:hover { border-color: var(--muted); color: var(--fg); background: var(--hover); }
.tag-toggle.active { border-color: var(--accent); color: var(--accent); }
.tag-toggle.has-tag { background: var(--ph-bg); border-color: var(--accent); color: var(--accent); }
.tag-toggle .tag-badge { display: none; background: var(--accent); color: #fff; border-radius: 10px; padding: 0 6px; font-size: 10px; line-height: 16px; margin-left: 2px; }
.tag-toggle.has-tag .tag-badge { display: inline-block; }
.batch-toggle {
    background: transparent; border: 1px solid var(--border); border-radius: 10px;
    padding: 5px 14px; font-size: 12px; font-family: var(--font-body); font-weight: 500;
    color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
    transition: all 0.12s; white-space: nowrap;
}
.batch-toggle .lucide { width: 13px; height: 13px; }
.batch-toggle:hover { border-color: var(--muted); color: var(--fg); background: var(--hover); }
.batch-toggle.active { border-color: var(--accent); color: var(--accent); }
