/* 이 파일은 `scripts/split-css.mjs` 가 `css/toolbox.css` 에서 뽑아 만든다 — 손으로 고치지 마라.
   고칠 곳은 `css/toolbox.css` 다 (TASK-KL-128). 이 벌: 첫 그림에 필요한 것 — 화면 그리기를 막고 기다린다 */
:root {

    color-scheme: dark;

    --bg-void: #0f1016;
    --bg-primary: #171821;
    --bg-secondary: #1d1e28;
    --bg-tertiary: #292a36;
    --bg-hover: #343542;
    --bg-active: #424352;

    --glass: rgba(23, 24, 33, 0.97);
    --glass-hover: rgba(29, 30, 40, 0.98);
    --glass-strong: rgba(15, 16, 22, 0.99);

    --glass-blur: blur(16px) saturate(115%);

    --text-primary: #f2f2ee;
    --text-secondary: #9a9a94;

    --text-tertiary: #94948f;

    --font-size-2xs: 12px;
    --font-size-xs: 14px;
    --font-size-sm: 16px;
    --font-size-md: 18px;
    --font-size-lg: 22px;

    --accent: #a79bef;

    --accent-fg: #0f1016;
    --accent-hover: #bdb4f4;
    --accent-dim: rgba(167, 155, 239, 0.10);
    --accent-subtle: rgba(167, 155, 239, 0.07);
    --accent-glow: rgba(167, 155, 239, 0.20);

    --secondary: #8292ad;
    --secondary-hover: #9aa8be;
    --secondary-subtle: rgba(130, 146, 173, 0.08);
    --secondary-glow: rgba(130, 146, 173, 0.16);

    --success: #22C55E;
    --success-subtle: rgba(34, 197, 94, 0.08);
    --error: #ED4245;
    --error-subtle: rgba(237, 66, 69, 0.08);
    --warning: #F59E0B;
    --warning-subtle: rgba(245, 158, 11, 0.08);

    --border: rgba(242, 242, 238, 0.06);
    --border-hover: rgba(242, 242, 238, 0.12);
    --border-strong: rgba(169, 155, 245, 0.4);

    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
    --radius-xl: 10px;

    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;

    --sidebar-width: 224px;
    --sidebar-collapsed-width: 56px;
    --transition: 180ms ease;
    --transition-fast: 100ms ease;
    --transition-slow: 350ms ease;

    --font-sans: 'KarmoSans', system-ui, 'Malgun Gothic', sans-serif;
    --font-serif: 'KarmoSerif', Georgia, serif;
    --font-mono: 'KarmoMono', ui-monospace, Consolas, monospace;

    --grid-color: rgba(191, 187, 220, 0.045);
    --grid-color-fine: rgba(191, 187, 220, 0.018);
    --vignette: rgba(0, 0, 0, 0.38);

    --holo-sweep: linear-gradient(112deg,
        rgba(126, 113, 190, 0.16) 0%,
        rgba(155, 111, 153, 0.09) 18%,
        rgba(15, 16, 22, 0) 34%,
        rgba(15, 16, 22, 0) 58%,
        rgba(99, 143, 157, 0.08) 74%,
        rgba(126, 113, 190, 0.13) 100%);
    --holo-bloom: radial-gradient(ellipse 120% 60% at 50% -20%, rgba(126, 113, 190, 0.16), transparent 70%);
    --chrome-grad: linear-gradient(135deg, #c9bdff 0%, #a99bf5 32%, #ffffff 54%, #a99bf5 78%, #8b7ce8 100%);
    --chrome-grad-hover: linear-gradient(135deg, #ddd5ff 0%, #c0b5f8 32%, #ffffff 54%, #c0b5f8 78%, #a99bf5 100%);
    --brand-edge: rgba(242, 242, 238, 0.34);
    --brand-shadow: rgba(0, 0, 0, 0.48);

    --decor-a: #a97999;
    --decor-b: #9188c4;
    --decor-c: #6d9da7;
    --decor-d: #aa8ca8;
    --decor-e: #756ca8;

    --fill-strong: var(--accent);
    --fill-strong-hover: var(--accent-hover);
    --fill-strong-ink: var(--bg-void);
    --glow-text: none;
    --glow-box: none;
    --shadow-float: 0 1px 0 rgba(0, 0, 0, 0.25);

    --header-shell-glass: color-mix(in srgb, var(--glass) 35%, transparent);

    --header-mega-max-h: min(44vh, 320px);
}

[data-theme="light"] {
    color-scheme: light;

    --bg-void: #ffffff;
    --bg-primary: #ffffff;
    --bg-secondary: #ffffff;
    --bg-tertiary: #e9e7f2;
    --bg-hover: #e2dff0;
    --bg-active: #d4cfe8;

    --glass: rgba(255, 255, 255, 0.85);
    --glass-hover: rgba(255, 255, 255, 0.92);
    --glass-strong: rgba(255, 255, 255, 0.96);

    --text-primary: #1a1a1f;
    --text-secondary: #64626f;
    --text-tertiary: #656374;

    --accent: #5f4dc2;
    --accent-fg: #ffffff;
    --accent-hover: #4f3eb0;
    --accent-dim: rgba(95, 77, 194, 0.10);
    --accent-subtle: rgba(95, 77, 194, 0.07);
    --accent-glow: rgba(95, 77, 194, 0.22);

    --secondary: #3f6285;
    --secondary-hover: #4f779f;
    --secondary-subtle: rgba(63, 98, 133, 0.08);
    --secondary-glow: rgba(63, 98, 133, 0.22);

    --success: #2f7d4f;
    --success-subtle: rgba(47, 125, 79, 0.08);
    --error: #b3261e;
    --error-subtle: rgba(179, 38, 30, 0.08);

    --warning: #8a5c12;
    --warning-subtle: rgba(138, 92, 18, 0.08);

    --border: rgba(26, 26, 31, 0.10);
    --border-hover: rgba(26, 26, 31, 0.18);
    --border-strong: rgba(95, 77, 194, 0.4);

    --grid-color: rgba(95, 77, 194, 0.105);
    --grid-color-fine: rgba(95, 77, 194, 0.045);

    --vignette: rgba(95, 77, 194, 0.06);

    --holo-sweep: linear-gradient(112deg,
        rgba(150, 132, 246, 0.30) 0%,
        rgba(215, 168, 240, 0.22) 18%,
        rgba(255, 255, 255, 0) 34%,
        rgba(255, 255, 255, 0) 58%,
        rgba(160, 215, 240, 0.20) 74%,
        rgba(140, 120, 245, 0.26) 100%);
    --holo-bloom: radial-gradient(ellipse 120% 60% at 50% -20%, rgba(160, 142, 248, 0.28), transparent 70%);

    --decor-a: #c2185b;
    --decor-b: #6d3fd4;
    --decor-c: #0e8fa8;
    --decor-d: #b247c9;
    --decor-e: #4a35a8;

    --chrome-grad: linear-gradient(135deg, #8a7ae8 0%, #5f4dc2 30%, #b9a8f0 52%, #5f4dc2 76%, #5847bb 100%);
    --chrome-grad-hover: linear-gradient(135deg, #9b8cf0 0%, #7b69dc 30%, #cdc0f7 52%, #7b69dc 76%, #5f4dc2 100%);
    --brand-edge: rgba(26, 26, 31, 0.30);
    --brand-shadow: rgba(255, 255, 255, 0.72);

    --fill-strong: #2a2735;
    --fill-strong-hover: #3d3950;
    --fill-strong-ink: #ffffff;
    --glow-text: none;
    --glow-box: none;

    --shadow-float: 0 1px 2px rgba(26, 26, 31, 0.06), 0 6px 16px -6px rgba(45, 35, 90, 0.16);

    --header-shell-glass: color-mix(in srgb, var(--glass) 52%, transparent);
}
[data-theme="light"] .spinner { border-color: rgba(0,0,0,0.08); border-top-color: var(--accent); }
[data-theme="light"] select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236d5bd0' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    color-scheme: light;
}
[data-theme="light"] ::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.1); }
[data-theme="light"] ::-webkit-scrollbar-thumb:hover { background: rgba(0, 0, 0, 0.18); }

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:focus-visible { outline: 1px solid var(--accent); outline-offset: 2px; }

html { background-color: var(--bg-void); }

body {
    font-family: var(--font-sans);
    font-size: var(--font-size-md);

    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    margin: 0;
    min-height: 100vh;
}

body:has(> .app-layout) {
    overflow: hidden;
}

.app-bg,
.bg-swatch {

    position: fixed;
    inset: 0;

    z-index: -1;
    pointer-events: none;

    background-image:
        linear-gradient(to right, var(--grid-color) 1px, transparent 1px),
        linear-gradient(to bottom, var(--grid-color) 1px, transparent 1px),
        linear-gradient(to right, var(--grid-color-fine) 1px, transparent 1px),
        linear-gradient(to bottom, var(--grid-color-fine) 1px, transparent 1px),
        radial-gradient(ellipse at 50% 50%, transparent 20%, var(--vignette) 100%);

    background-size: 48px 48px, 48px 48px, 12px 12px, 12px 12px, auto;
    background-repeat: repeat, repeat, repeat, repeat, no-repeat;
    background-position: 0 0, 0 0, 0 0, 0 0, center;
}

.app-bg::before,
.bg-swatch::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: var(--holo-sweep), var(--holo-bloom);
    background-size: 100% 100%;
    background-repeat: no-repeat;
    background-position: center;
}

html[data-bg="blue-magenta"] .app-bg::before,
.bg-swatch[data-bg="blue-magenta"]::before {
    background-image:
        radial-gradient(at 20% 30%, rgba(59, 130, 246, 0.20) 0px, transparent 50%),
        radial-gradient(at 80% 20%, rgba(217, 70, 239, 0.16) 0px, transparent 45%),
        radial-gradient(at 0% 80%, rgba(99, 102, 241, 0.12) 0px, transparent 40%),
        radial-gradient(at 70% 70%, rgba(192, 38, 211, 0.10) 0px, transparent 55%);
    background-size: 100% 100%;
}

html[data-bg="mesh-dots"] .app-bg::before,
.bg-swatch[data-bg="mesh-dots"]::before {
    background-image:
        radial-gradient(circle at 30% 40%, rgba(99, 102, 241, 0.30) 0px, transparent 2px),
        radial-gradient(circle at 70% 60%, rgba(217, 70, 239, 0.26) 0px, transparent 2px),
        radial-gradient(circle at 50% 50%, rgba(99, 102, 241, 0.18) 0px, transparent 2px);
    background-size: 48px 48px, 64px 64px, 80px 80px;
    background-repeat: repeat;
    background-position: 0 0;
}

html[data-bg="aurora"] .app-bg::before,
.bg-swatch[data-bg="aurora"]::before {
    background-image:
        radial-gradient(ellipse 80% 50% at 10% 20%, rgba(34, 197, 94, 0.18) 0px, transparent 50%),
        radial-gradient(ellipse 60% 40% at 90% 80%, rgba(59, 130, 246, 0.20) 0px, transparent 45%),
        radial-gradient(ellipse 70% 50% at 50% 50%, rgba(99, 102, 241, 0.14) 0px, transparent 55%);
    background-size: 100% 100%;
}

html[data-bg="subtle"] .app-bg::before,
.bg-swatch[data-bg="subtle"]::before {
    background-image:
        radial-gradient(at 50% 50%, rgba(99, 102, 241, 0.12) 0px, transparent 70%);
    background-size: 100% 100%;
}

html[data-bg="minimal"] .app-bg::before,
.bg-swatch[data-bg="minimal"]::before { background-image: none; }
html[data-bg="minimal"] .app-bg,
.bg-swatch[data-bg="minimal"] {
    background-image: radial-gradient(ellipse at 50% 50%, transparent 20%, var(--vignette) 100%);
    background-size: auto;
    background-repeat: no-repeat;
    background-position: center;
}

.bg-swatch {
    position: relative;
    inset: auto;
    z-index: 0;
    pointer-events: auto;
    width: 100%;
    aspect-ratio: 16 / 10;
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    padding: 0;
    cursor: pointer;
    background-color: var(--bg-void);
    transition: border-color .18s ease, transform .18s ease;
}
.bg-swatch:hover { transform: translateY(-2px); }
.bg-swatch[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent) inset; }
.bg-swatch-name {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    padding: 4px 6px;
    font-size: var(--font-size-2xs, 12px);
    color: var(--text-primary);
    background: linear-gradient(to top, var(--bg-void), transparent);
    text-align: center;
}
.settings-bg-picker {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(104px, 1fr));
    gap: 10px;
    width: 100%;
}

.app-layout {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 1;
}
.app-body { flex: 1; display: flex; min-height: 0; overflow: hidden; }
.main-content { margin-left: 0; }

.intro-overlay {

    position: fixed;
    inset: 0;

    height: 100svh;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;

    background: var(--holo-sweep), var(--holo-bloom), var(--bg-void);

    clip-path: inset(0 0 0 0);
    transition: clip-path 0.55s cubic-bezier(0.65, 0, 0.35, 1), opacity 0.55s ease;
    pointer-events: none;
}
.intro-overlay.done {
    clip-path: inset(0 0 100% 0);
    opacity: 0;
    pointer-events: none;
}
.intro-overlay.hidden,

html[data-intro="off"] .intro-overlay {
    display: none;
}
.intro-title {
    font-size: clamp(36px, 8vw, 64px);
    color: var(--text-primary);
    white-space: pre;
}

.intro-letter {
    display: inline-block;
    opacity: 0;
    animation: intro-letter-in 0.62s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    animation-delay: calc(var(--i) * 55ms);
}
@keyframes intro-letter-in {
    0%   { opacity: 0; filter: blur(14px); transform: translateY(22px) scale(0.94); }
    60%  { opacity: 1; filter: blur(0);    transform: translateY(0)    scale(1.02); }
    100% { opacity: 1; filter: blur(0);    transform: translateY(0)    scale(1); }
}

@media (prefers-reduced-motion: reduce) {
    .intro-overlay { transition: opacity 0.3s ease; clip-path: none; }
    .intro-overlay.done { clip-path: none; }
    .intro-letter { animation: none; opacity: 1; }
}

.header-bar-left {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    justify-self: start;
    min-width: 0;
}

.header-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    justify-self: center;
    min-width: 0;
    max-width: 100%;
    overflow: visible;
    position: relative;
    z-index: 120;
}

.header-nav-scroll {
    display: flex;
    align-items: center;

    flex-wrap: nowrap;
    justify-content: center;
    gap: 2px;
    min-width: 0;
    max-width: min(100vw - 240px, 720px);
    overflow: visible;
}

.header-nav-group {
    position: relative;
    flex-shrink: 0;
}

.header-nav-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    height: 100%;
    min-height: 32px;
    padding: 4px 10px;
    font-size: var(--font-size-xs);
    font-weight: 500;
    color: var(--text-secondary);
    letter-spacing: -0.02em;
    background: none;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-family: var(--font-sans);
    transition: color var(--transition), background var(--transition);
    white-space: nowrap;
}
.header-nav-trigger:hover,
.header-nav-group.is-open .header-nav-trigger {
    color: var(--text-primary);
    background: var(--bg-hover);
}
.header-nav-trigger-label { pointer-events: none; }

.header-nav-trigger--action { flex-shrink: 0; }

.header-search {
    position: relative;
    display: flex;
    align-items: center;
    flex: 0 1 clamp(180px, 26vw, 340px);
    min-width: 150px;
    height: 30px;
    padding: 0 6px 0 28px;
    border-radius: 999px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    transition: border-color var(--transition), background var(--transition);
}
.header-search:hover { border-color: var(--border-hover); }
.header-search:focus-within { border-color: var(--border-strong); background: var(--bg-tertiary); }
.header-search-icon {
    position: absolute;
    left: 9px;
    width: 14px;
    height: 14px;
    color: var(--text-tertiary);
    pointer-events: none;
}

input.header-search-input,
input.header-search-input:focus {
    width: 100%;
    min-width: 0;
    height: 100%;
    margin: 0;
    padding: 0;
    background: none;
    border: none;
    border-left: none;
    outline: none;
    box-shadow: none;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: var(--font-size-xs);
    line-height: 1;
}
input.header-search-input::placeholder { color: var(--text-tertiary); }

.header-search-kbd {
    flex-shrink: 0;
    margin-left: 6px;
    padding: 2px 5px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 10px;
    line-height: 1;
    letter-spacing: .04em;
    color: var(--text-tertiary);
}
@media (max-width: 720px) {
    .header-search-kbd { display: none; }
}

.header-nav-trigger--list { gap: 5px; padding-left: 8px; padding-right: 7px; }
.header-nav-trigger--list .header-nav-trigger-icon { width: 14px; height: 14px; flex-shrink: 0; }
.header-nav-trigger--list .header-nav-trigger-caret {
    width: 9px; height: 9px; flex-shrink: 0; opacity: .55;
    transition: transform var(--transition);
}
.header-nav-group.is-open .header-nav-trigger--list .header-nav-trigger-caret { transform: rotate(180deg); }

.header-nav-panel--list {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    width: min(620px, calc(100vw - 32px));
    max-height: var(--header-mega-max-h);

    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: var(--space-sm);

    background: var(--glass);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-float), 0 12px 32px -12px rgba(0, 0, 0, .55);
}
.header-nav-panel--list .header-nav-panel-inner {
    min-height: 0;
    overflow: hidden auto;
    max-width: none;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 2px 8px;
}
@media (max-width: 640px) {
    .header-nav-panel--list { left: auto; right: 0; }
    .header-nav-panel--list .header-nav-panel-inner { grid-template-columns: 1fr; }
}
.header-nav-section { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.header-nav-section-label {
    padding: 4px 8px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .02em;
    color: var(--text-tertiary);
}
.header-nav-section-empty {
    margin: 0;
    padding: 2px 8px 8px;
    font-size: 11px;
    line-height: 1.5;
    color: var(--text-tertiary);
}

.sidebar-group-label--flat {
    padding: 8px 10px 2px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .02em;
    color: var(--text-tertiary);
}
.sidebar-foot {
    margin-top: 6px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
    color: var(--text-secondary);
}

.header-nav-panel-foot {
    flex-shrink: 0;
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid var(--border);
}
.header-nav-panel-foot .nav-item-find { color: var(--text-secondary); }

.header-nav-panel {
    z-index: 200;
}
.header-nav-panel[hidden] {
    display: none !important;
}
.header-nav-panel:not([hidden]) {
    display: block;
}

.header-nav-panel--mega {
    position: fixed;
    top: 52px;
    left: 0;
    right: 0;
    width: 100%;
    max-width: none;
    min-height: 0;
    max-height: var(--header-mega-max-h);
    overflow: hidden auto;
    padding: var(--space-sm) var(--space-lg) var(--space-md);
    margin: 0;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: none;
    border-radius: 0;
    box-shadow: none;
}

.header-nav-panel-inner {
    max-width: 880px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
    gap: 4px 10px;
    align-content: start;
}

.header-nav-panel--mega .nav-item {
    padding: 7px 8px 7px 28px;
    border-left: none;
    border-radius: var(--radius-sm);
    margin: 0;
    font-size: var(--font-size-xs);
    font-weight: 500;
    color: var(--text-primary);
    background: transparent;
    border: none;
    box-shadow: none;
    transition: background var(--transition), color var(--transition);
}
.header-nav-panel--mega .nav-item:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
    box-shadow: none;
}
.header-nav-panel--mega .nav-item.active {
    color: var(--accent);
    background: var(--accent-dim);
    box-shadow: none;
}
.header-nav-panel--mega .nav-item-find {
    grid-column: 1 / -1;
    justify-content: center;
    padding-left: 8px;
    color: var(--accent);
    background: var(--accent-subtle);
    font-weight: 600;
}
.header-nav-panel--mega .nav-item-find:hover {
    background: var(--accent-dim);
}
.header-nav-panel--mega .nav-icon {
    left: 8px;
    width: 15px;
    height: 15px;
    opacity: 0.78;
}

.header-tools-link {
    display: none;
    align-items: center;
    min-height: 40px;
    padding: 0 12px;
    font-size: var(--font-size-xs);
    font-weight: 600;
    color: var(--text-secondary);
    text-decoration: none;
    white-space: nowrap;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: color var(--transition), border-color var(--transition), background var(--transition);
}

.header-tools-link[href="/karmolab/t/"] { display: inline-flex; }

.header-tools-link:hover,
.header-tools-link:active {
    color: var(--accent);
    border-color: var(--accent-dim);
    background: var(--accent-subtle);
}

.header-dev-link {
    font-size: var(--font-size-2xs);
    color: var(--text-tertiary);
    text-decoration: none;
    white-space: nowrap;
    padding: 4px 6px;
    border-radius: var(--radius-sm);
    transition: color var(--transition), background var(--transition);
}
.header-dev-link:hover {
    color: var(--accent);
    background: var(--accent-subtle);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px 7px 34px;
    color: var(--text-secondary);
    font-size: var(--font-size-xs);
    font-weight: 500;
    cursor: pointer;
    transition: color var(--transition), background var(--transition);
    text-decoration: none;
    user-select: none;
    border-left: 2px solid transparent;
    border-radius: 4px;
    margin: 1px 0;
    position: relative;
}
.nav-item:hover {
    color: var(--text-primary);
    background: var(--accent-subtle);
}
.nav-item.active {
    color: var(--accent);
    border-left-color: var(--accent);
    background: var(--accent-subtle);
    font-weight: 600;
}
.nav-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    opacity: 0.6;
}
.nav-item:hover .nav-icon,
.nav-item.active .nav-icon { opacity: 1; }
.nav-item-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    flex-shrink: 0;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: var(--space-md);
    padding: 0 var(--space-lg);
    height: 52px;
    overflow: visible;
    isolation: isolate;
    background: transparent;
    border-bottom: none;
}

.header-bar::after {
    content: '';
    position: fixed;
    left: 0;
    right: 0;
    top: 0;
    height: 52px;
    z-index: 0;
    background: var(--header-shell-glass);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: blur(22px) saturate(160%);

    border-bottom: 1px solid transparent;
    border-image: linear-gradient(90deg,
        transparent 0%, var(--accent-dim) 22%, var(--accent-glow) 50%, var(--accent-dim) 78%, transparent 100%) 1;
    pointer-events: none;
}

.header-bar > * {
    position: relative;
    z-index: 1;
}

.karmolab-version-badge {
    font-family: var(--font-mono);
    font-size: var(--font-size-2xs);
    font-weight: 500;
    letter-spacing: 0.01em;
    padding: 2px 6px;
    margin-left: 2px;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;

    color: var(--text-tertiary);
    cursor: pointer;
    transition: color 0.15s ease, background 0.15s ease;
    user-select: none;
}

.karmolab-version-badge:hover,
.karmolab-version-badge:focus-visible {
    color: var(--text-secondary);
    background: var(--bg-hover);
}

.karmolab-version-badge.is-stale {
    opacity: 1;
    color: var(--warning);
    background: color-mix(in srgb, var(--warning) 14%, transparent);
}

.header-logo {

    font-size: var(--font-size-sm);
    color: var(--text-primary);
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    transition: color var(--transition);
    flex-shrink: 0;
}
.header-logo:hover {
    color: var(--accent);
}
.header-logo.active {
    color: var(--accent);
}

.header-bar-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    justify-self: end;
    gap: 4px;
    flex-shrink: 0;
}

.content-header {
    padding: 0;
    min-height: 0;
    display: none;
    flex-shrink: 0;
}

.content-header > div:first-child {
    display: none;
}

.content-title {
    display: none;
}

.header-account { display: flex; align-items: center; position: relative; }
.header-account-btn {
    display: flex; align-items: center; gap: 7px;
    padding: 4px 10px 4px 4px;
    border: 1px solid var(--border); border-radius: 999px;
    background: transparent; cursor: pointer;
    color: var(--text-secondary); font-size: var(--font-size-xs);
    max-width: 170px;
}
.header-account-btn:hover { color: var(--text-primary); border-color: var(--accent); }
.header-account-btn.active { background: var(--accent-dim); color: var(--accent); border-color: var(--accent); }
.header-account-btn img,
.header-account-blank { width: 22px; height: 22px; border-radius: 50%; flex: 0 0 auto; }
.header-account-blank { display: grid; place-items: center; background: var(--bg-tertiary); }
.header-account-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.header-account-menu {
    position: absolute; top: 40px; right: 0; min-width: 190px; z-index: 60;
    background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .35); overflow: hidden;
}
.header-account-menu button,
.header-account-menu a {
    display: block; width: 100%; padding: 9px 13px;
    background: none; border: 0; border-top: 1px solid var(--border);
    text-align: left; font: inherit; font-size: var(--font-size-xs);
    color: var(--text-primary); cursor: pointer; text-decoration: none;
}
.header-account-menu > :first-child { border-top: 0; }
.header-account-menu button:hover,
.header-account-menu a:hover { background: var(--bg-tertiary); }
.header-account-menu button[data-signin] { color: var(--accent); font-weight: 600; }
.header-account-menu .header-account-menu-out { color: #dc2626; }
html[data-theme="dark"] .header-account-menu .header-account-menu-out { color: #fca5a5; }

.landing-suggest { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 18px; }
.landing-suggest:empty { display: none; }
.landing-suggest-label { font-size: 12px; color: var(--text-tertiary); }
.landing-suggest-item {
    padding: 6px 13px; border-radius: 999px; cursor: pointer; font: inherit; font-size: 13px;
    border: 1px solid var(--border); background: var(--bg-secondary); color: var(--text-primary);
}
.landing-suggest-item:hover { border-color: var(--accent); color: var(--accent); }

.header-btn.user-btn,
.header-btn.settings-btn,
.header-btn.lang-btn,
.theme-toggle {
    width: 36px; height: 36px; padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background var(--transition), color var(--transition);
    flex-shrink: 0;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
}
.header-btn.user-btn:hover,
.header-btn.settings-btn:hover,
.header-btn.lang-btn:hover,
.theme-toggle:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}
.header-btn.user-btn.active,
.header-btn.settings-btn.active {
    background: var(--accent-dim);
    color: var(--accent);
}
.header-btn.user-btn svg,
.header-btn.settings-btn svg,
.header-btn.lang-btn svg,
.theme-toggle .theme-icon {
    width: 18px; height: 18px;
}

.header-btn.lang-btn {
    width: auto; min-width: 36px; gap: 5px; padding: 0 8px;
}
.header-btn.lang-btn svg { opacity: .85; }
.lang-btn-code {

    font-size: 12px; font-weight: 700; letter-spacing: .06em; line-height: 1;
    color: var(--text-primary);
}
.theme-toggle .theme-icon { color: inherit; }

[data-theme="dark"] .theme-toggle .sun, [data-theme="light"] .theme-toggle .moon { display: none; }
[data-theme="light"] .theme-toggle .sun, [data-theme="dark"] .theme-toggle .moon { display: block; }

.window-controls {
    display: none;
    align-items: stretch;
    margin-left: 4px;
    align-self: stretch;
}
.wc-btn {
    width: 46px;
    min-height: 36px;
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background var(--transition), color var(--transition);
    color: var(--text-secondary);
    flex-shrink: 0;
}
.wc-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.wc-close:hover { background: #e81123; color: #fff; }
.wc-btn:active { filter: brightness(0.9); }
.wc-btn svg { width: 12px; height: 12px; display: block; }
.wc-icon-restore { display: none; }
.window-controls[data-maximized="true"] .wc-icon-max { display: none; }
.window-controls[data-maximized="true"] .wc-icon-restore { display: block; }

.prism-theme-select {
    min-width: 0; width: 130px; padding: 5px 24px 5px 8px;
    font-size: var(--font-size-xs);
    background: var(--glass);
    border: 1px solid var(--border);
    color: var(--text-tertiary); cursor: pointer;
    font-family: var(--font-mono); appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%235865F2' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 6px center;
    transition: all var(--transition);
}
.prism-theme-select:hover, .prism-theme-select:focus {
    color: var(--text-primary); border-color: var(--accent); outline: none;
    box-shadow: 0 0 8px var(--accent-dim);
}

.breadcrumb {
    display: flex; align-items: center; gap: 6px;
    font-size: var(--font-size-xs); color: var(--text-tertiary);
    font-family: var(--font-sans); font-weight: 500;
}
.breadcrumb-sep {
    opacity: 0.4; color: var(--text-tertiary);
}
.breadcrumb-link {
    color: var(--text-tertiary); text-decoration: none; cursor: pointer;
    transition: color var(--transition); background: none; border: none;
    font: inherit; font-size: inherit; padding: 0; font-family: inherit;
}
.breadcrumb-link:hover { color: var(--accent); }
.breadcrumb-current { color: var(--text-secondary); font-weight: 600; }

.tool-privacy-chip {
    margin-left: 10px;
    padding: 2px 8px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: var(--font-size-xs);
    font-weight: 600;
    white-space: nowrap;
    cursor: help;
}
.tool-privacy-chip[data-where="local"],
.tool-privacy-chip[data-where="assets"] { border-color: var(--success, #3fa66a); }
.tool-privacy-chip[data-where="ours"] { border-color: var(--accent); }
.tool-privacy-chip[data-where="third-party"],
.tool-privacy-chip[data-where="yours"],
.tool-privacy-chip[data-where="ai"] { border-color: var(--warning, #d99a2b); color: var(--text-primary); }

.main-content { flex: 1; overflow-y: auto; display: flex; flex-direction: column; position: relative; min-height: 0; }
.content-body {
    padding: var(--space-lg) var(--space-xl) var(--space-2xl);
    flex: 0 0 auto;
    min-height: 100%;
    display: flex; flex-direction: column;
    padding-top: calc(52px + var(--space-lg));
}

.main-content:has(.tool-page.layout-full.active) {
    overflow: hidden;
}
.content-body:has(.tool-page.layout-full.active) {
    flex: 1;
    min-height: 0;
    padding: 0;
    padding-top: 52px;
}

.landing-page {
    display: none; flex-direction: column;
    padding: var(--space-xl) var(--space-2xl) var(--space-2xl);
    flex: 1 1 auto;

    min-height: 100%;
    max-width: 960px; margin: 0 auto; width: 100%;

    justify-content: center;
    justify-content: safe center;
}
.content-body:has(.landing-page.active) {
    flex: 1;
    min-height: 0;

    overflow-y: auto;
}
.landing-page.active { display: flex; }
[data-block][hidden] { display: none !important; }

.landing-hero {
    padding: var(--space-2xl) 0 var(--space-md);
    margin-bottom: var(--space-md);
    position: relative;
    text-align: center;
}

.landing-title {
    font-size: clamp(64px, 9vw, 96px);
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
}
.landing-title .accent { color: var(--accent); }

.header-logo-text,
.landing-title,
.intro-title {
    font-family: var(--font-serif);
    font-weight: 900;
    letter-spacing: -0.02em;
    line-height: 1;
}

.home-decor { position: fixed; top: 0; left: 0; width: 100%; height: 100vh; height: 100lvh; pointer-events: none; z-index: 0; overflow: hidden; }

html[data-view="tool"] .home-decor { opacity: 0.35; transition: opacity .45s ease; }
html[data-view="home"] .home-decor { opacity: 0.72; transition: opacity .45s ease; }
.home-decor-stage {
    position: absolute;
    inset: 0;
    transform-origin: 50% 50%;
    will-change: transform;
    transition: transform .55s cubic-bezier(.22, .61, .36, 1);
}
html[data-view="tool"] .home-decor-stage { transform: scale(0.84); }
html[data-view="home"] .home-decor-stage { transform: scale(1); }

@media (prefers-reduced-motion: reduce) { .home-decor-stage { transition: none; } }

.home-decor-item {
    position: absolute;
    will-change: transform;

    transform: translate3d(0, 0, 0);

}
.home-decor-float { will-change: transform; }
.landing-hero, .landing-cta { position: relative; z-index: 1; }

@media (prefers-reduced-motion: reduce) {
    .home-decor-item, .home-decor-float { animation: none !important; }
}
@media (max-width: 768px) {

}

@supports (background-clip: text) or (-webkit-background-clip: text) {
    .header-logo-text {
        background: var(--chrome-grad);
        -webkit-background-clip: text;
        background-clip: text;
        color: transparent;
    }
    .landing-title {
        background: var(--chrome-grad);
        -webkit-background-clip: text;
        background-clip: text;
        color: transparent;
    }

    .landing-title .accent {
        -webkit-background-clip: initial;
        background-clip: initial;
        color: var(--accent);
    }
}

.landing-tagline {
    font-size: var(--font-size-sm);
    color: var(--text-tertiary);
    font-weight: 400;
    letter-spacing: 0.04em;
    text-shadow: 0 1px 7px var(--brand-shadow);
}

.landing-palette {
    display: flex; justify-content: center;
    width: 100%;

    position: relative; z-index: 4;

    min-height: 65px;
}

.landing-cta {
    display: flex; flex-direction: column; align-items: center; gap: var(--space-md);
    padding: var(--space-lg) 0 0; text-align: center;
}

.landing-pulse { max-width: 620px; margin: var(--space-lg) auto 0;
    position: relative; z-index: 1; }
.landing-pulse:empty { display: none; }

.landing-pulse[data-reserving] { display: block; min-height: 23px; }
.landing-pulse-line { margin: 0; display: flex; flex-wrap: wrap; align-items: center;
    justify-content: center; gap: var(--space-md);
    font-size: var(--font-size-xs); color: var(--text-tertiary); }
.landing-pulse-stat { display: inline-flex; align-items: baseline; gap: 6px; }
.landing-pulse-k { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.08em;
    text-transform: uppercase; color: var(--text-tertiary); }
.landing-pulse-line b { color: var(--accent); font-weight: 700; font-variant-numeric: tabular-nums; }

.landing-pulse-all { background:none; border:0; padding:5px 6px; margin:-5px -6px; font:inherit;
    min-height:32px; display:inline-flex; align-items:center;
    font-size:var(--font-size-xs); color:var(--accent); cursor:pointer; }

.landing-hi { margin-top: 6px; font-size: var(--font-size-sm); color: var(--accent); }

.landing-cta-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--space-sm);
}
.landing-cta-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    padding: 9px 14px;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    transition: border-color var(--transition), background var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    position: relative;

    border-radius: var(--radius-sm);
    font-family: inherit;
    appearance: none;
    -webkit-appearance: none;
}
.landing-cta-card:hover {
    background: var(--bg-tertiary);
    border-color: var(--text-tertiary);
}
.landing-cta-card:hover .landing-cta-card-icon { color: var(--accent); }
.landing-cta-card:hover .landing-cta-card-title { color: var(--accent); }
a.landing-cta-card:hover { color: inherit; }
.landing-cta-card-icon {
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
    color: var(--text-tertiary);
    transition: color var(--transition);
}
.landing-cta-card-icon svg { width: 100%; height: 100%; display: block; }
.landing-cta-card-title {
    font-size: var(--font-size-xs);
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 0.01em;
}

.kp-inline.kp-collapsed .kp-list,
.kp-inline.kp-collapsed .kp-live { display: none; }

.kp-inline { position: relative; }

.kp-inline .kp-box { display: flex; flex-direction: column; overflow: visible; }
.kp-inline .kp-list {
    position: absolute; top: calc(100% + 8px); left: 0; right: 0;
    z-index: 30;
}
.kp-inline .kp-input-wrap { display: flex; align-items: center; }

.kp-inline .kp-input-icon { width: 18px; height: 18px; flex: 0 0 auto; }
.kp-inline .kp-kbd { flex: 0 0 auto; }
.kp-inline input.kp-input { flex: 1 1 auto; min-width: 0; padding: 12px 0; font-size: var(--font-size-md); }

.kp-inline input.kp-input,
.kp-inline input.kp-input:focus {
    background: none; border: none; outline: none; box-shadow: none;
}

.status-toast {
    position: fixed;
    left: 50%;
    bottom: 24px;
    transform: translateX(-50%);
    z-index: 10000;
    font-size: var(--font-size-xs); font-weight: 600; padding: 5px 12px;
    opacity: 0; transition: opacity var(--transition-slow);
    pointer-events: none; font-family: var(--font-mono);
    letter-spacing: 0.02em;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-float);
}
.status-toast.visible { opacity: 1; }
.status-toast.success {
    background: var(--success-subtle); color: var(--success);
    border-color: rgba(34, 197, 94, 0.2);
}
.status-toast.error {
    background: var(--error-subtle); color: var(--error);
    border-color: rgba(239, 68, 68, 0.2);
}
.status-toast.has-detail { cursor: default; pointer-events: auto; padding: 8px 12px; max-width: 90vw; display: flex; align-items: center; gap: 8px; }
.status-toast-copy {

    flex-shrink: 0; padding: 4px 8px; font-size: 12px; background: color-mix(in srgb, currentColor 12%, transparent);
    border: 1px solid color-mix(in srgb, currentColor 28%, transparent); border-radius: 4px; cursor: pointer;
    color: inherit; font-family: inherit; white-space: nowrap;
}
.status-toast-copy:hover { background: color-mix(in srgb, currentColor 22%, transparent); }
.status-toast-detail {
    display: none; margin-top: 6px; font-size: var(--font-size-2xs); font-weight: 400;
    opacity: 0.9; white-space: pre-wrap; word-break: break-word;
    max-height: 100px; overflow-y: auto;
}
.status-toast-detail.open { display: block; }

.tool-page-hero {
    text-align: center;
    padding: var(--space-md) 0 var(--space-sm);
    margin-bottom: var(--space-md);
    border-bottom: 1px solid var(--border);
}
.tool-page-hero-title {
    font-family: var(--font-serif);
    font-size: 26px; font-weight: 900; letter-spacing: -0.02em;
    line-height: 1.1; color: var(--text-primary); margin-bottom: 6px;
}
.tool-page-hero-desc {
    font-size: var(--font-size-sm); color: var(--text-tertiary); letter-spacing: 0.01em;
}

.tool-desktop-only-note {
    margin: var(--space-md) 0;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    line-height: 1.6;
}

.tool-page-next { margin: var(--space-xl) 0 var(--space-md); padding-top: var(--space-md);
    border-top: 1px solid var(--border); }
.tool-page-next-head { font-size: 11px; font-weight: 700; color: var(--text-tertiary); margin-bottom: 10px; }
.tool-page-next-links { display: flex; flex-wrap: wrap; gap: 10px; }
.tool-page-next-link { flex: 1 1 200px; display: flex; flex-direction: column; gap: 3px;
    padding: 12px 14px; text-align: left; border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: var(--bg-secondary); color: inherit; text-decoration: none; cursor: pointer; font: inherit;
    transition: border-color var(--transition), background var(--transition); }
.tool-page-next-link:hover { border-color: var(--accent); background: var(--bg-tertiary); }
.tool-page-next-link b { font-size: var(--font-size-sm); color: var(--text-primary); }
.tool-page-next-link span { font-size: 11px; color: var(--text-tertiary); }

.tool-page.layout-full > .tool-page-next {
    flex: 0 0 auto;
    margin: 0;
    padding: var(--space-md) var(--space-xl) var(--space-lg);
}

.tool-page-hero-count { margin: 6px 0 0; font-size: 11px; color: var(--text-tertiary); }
.tool-page-hero-count:empty { display: none; }
.tool-page-hero-count b { color: var(--text-secondary); font-weight: 700; font-variant-numeric: tabular-nums; }

.layout-full .tool-page-hero {
    padding: var(--space-md) 0 var(--space-sm);
    margin-bottom: var(--space-sm);
}
.layout-full .tool-page-hero-title { font-size: 28px; }

.tool-page {
    display: none;
    position: relative;
}
.tool-page.active {
    display: block;
    flex: 0 0 auto;
    animation: fadeIn 200ms ease;
}
.tool-page.layout-full { display: none; }
.tool-page.layout-full.active { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.tool-page.layout-full > .tab-row { flex-shrink: 0; }
.tool-page.layout-full > .tab-panel { display: none; }
.tool-page.layout-full > .tab-panel.active { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.tool-page.layout-form {
    max-width: 900px; margin: 0 auto var(--space-2xl);
    width: 100%;
    padding: var(--space-md);
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    position: relative;
}
.tool-page.layout-wide { max-width: 1200px; margin: 0 auto var(--space-2xl); width: 100%; }
.tool-page.layout-wide .tool-page-hero { margin-bottom: var(--space-xl); }

.tab-row {
    display: flex; gap: 2px;
    border-bottom: 1px solid var(--border);
    margin-bottom: var(--space-lg);
    padding: 0 var(--space-xs);
    position: relative;

    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}
.tab-row::-webkit-scrollbar { display: none; }
.tab-row--sidebar { overflow-x: visible; }
.tab-row::after { display: none; }
.tab-btn {
    flex: none;
    white-space: nowrap;
    padding: 10px 18px; font-size: var(--font-size-xs); font-weight: 700;
    color: var(--text-tertiary); background: transparent; border: none;
    border-bottom: 2px solid transparent; cursor: pointer;
    transition: all var(--transition); font-family: var(--font-mono);
    margin-bottom: -1px; letter-spacing: 0.08em;
    text-transform: uppercase;
    position: relative;
}
.tab-btn:hover {
    color: var(--text-primary);
    background: var(--accent-subtle);
}
.tab-btn.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
    background: var(--accent-subtle);
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

.tool-tab-sidebar-layout {
    display: flex;
    gap: var(--space-lg);
    align-items: flex-start;
    width: 100%;
}
.tool-page.layout-wide .tool-tab-sidebar-layout {
    max-width: 100%;
}
.tool-page.layout-wide .tab-row.tab-row--sidebar {
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    border-bottom: none;
    border-right: 1px solid var(--border);
    padding: 0 var(--space-md) 0 0;
    margin-bottom: 0;
    min-width: min(200px, 30vw);
    max-width: 260px;
    flex-shrink: 0;
    max-height: min(72vh, 640px);
    overflow-x: hidden;
    overflow-y: auto;
    gap: 4px;
    align-items: stretch;
}
.tool-page.layout-wide .tab-row--sidebar .tab-btn {
    text-align: left;
    justify-content: flex-start;
    border-bottom: none;
    border-left: 3px solid transparent;
    margin-bottom: 0;
    text-transform: none;
    letter-spacing: 0.03em;
    font-weight: 600;
    font-size: var(--font-size-2xs);
    width: 100%;
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    white-space: normal;
    word-break: break-word;
}
.tool-page.layout-wide .tab-row--sidebar .tab-btn.active {
    border-left-color: var(--accent);
    border-bottom-color: transparent;
}
.tool-tab-sidebar-layout .tab-panels-column {
    flex: 1;
    min-width: 0;
}
.tool-page.layout-wide .tool-tab-sidebar-layout .tab-panel.active {
    overflow-x: auto;
}

@media (max-width: 720px) {
    .tool-tab-sidebar-layout {
        flex-direction: column;
        gap: var(--space-md);
    }
    .tool-page.layout-wide .tab-row.tab-row--sidebar {
        flex-direction: row;
        flex-wrap: nowrap;
        max-width: none;
        max-height: none;
        border-right: none;
        border-bottom: 1px solid var(--border);
        padding: 0 0 var(--space-sm) 0;
        width: 100%;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
    }
    .tool-page.layout-wide .tab-row--sidebar .tab-btn {
        flex: 0 0 auto;
        width: auto;
        max-width: 11rem;
        border-left: none;
        border-bottom: 2px solid transparent;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .tool-page.layout-wide .tab-row--sidebar .tab-btn.active {
        border-left-color: transparent;
        border-bottom-color: var(--accent);
    }
}

.field-group {
    margin-bottom: var(--space-sm);
    padding: 12px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-left: 2px solid var(--accent);
    position: relative;
    border-radius: var(--radius-sm);
}
.field-label {
    display: flex; align-items: center; gap: 6px;
    font-size: var(--font-size-xs);
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
    letter-spacing: 0.02em;
}
.field-row { display: flex; align-items: center; justify-content: space-between; }

textarea,
input[type="text"], input[type="password"], input[type="number"], input[type="search"],
input[type="url"], input[type="email"], input[type="tel"],
input[type="date"], input[type="time"], input[type="datetime-local"], input[type="month"] {
    width: 100%;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-left: 2px solid transparent;
    padding: 10px 14px;
    font-size: var(--font-size-sm);
    font-family: inherit;
    color: var(--text-primary);
    outline: none;
    transition: all var(--transition);
    resize: vertical;
}
textarea:focus,
input[type="text"]:focus, input[type="password"]:focus, input[type="number"]:focus, input[type="search"]:focus,
input[type="url"]:focus, input[type="email"]:focus, input[type="tel"]:focus,
input[type="date"]:focus, input[type="time"]:focus, input[type="datetime-local"]:focus, input[type="month"]:focus {
    border-color: var(--accent);
    border-left-color: var(--accent);
    background: var(--bg-tertiary);
    box-shadow: 0 0 0 1px var(--accent-dim);
}
textarea::placeholder, input::placeholder { color: var(--text-tertiary); }
textarea { min-height: 120px; line-height: 1.6; }

select {
    width: 100%;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-left: 2px solid transparent;
    padding: 10px 14px;
    font-size: var(--font-size-sm);
    font-family: inherit;
    color: var(--text-primary);
    outline: none;
    transition: all var(--transition);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235865F2' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 10px center;
}
select:focus {
    border-color: var(--accent);
    border-left-color: var(--accent);
    background: var(--bg-tertiary);
    box-shadow: 0 0 0 1px var(--accent-dim);
}
select option { background: var(--bg-secondary); color: var(--text-primary); }

input[type="range"] { width: 100%; accent-color: var(--accent); cursor: pointer; }

.fav-top-row .landing-search-wrap {
    flex: none !important;
    width: 220px !important;
    max-width: 220px !important;
}
.range-value {
    font-size: var(--font-size-xs); font-weight: 700; color: var(--accent);
    font-variant-numeric: tabular-nums; font-family: var(--font-mono);
}

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 8px 16px; font-size: var(--font-size-xs); font-weight: 600; font-family: inherit;
    border: 1px solid transparent;
    cursor: pointer; transition: all var(--transition); user-select: none;
    letter-spacing: 0.02em;
}
.btn:active { transform: scale(0.97); }

.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.4; cursor: not-allowed; }
.btn:disabled:active { transform: none; }

.btn-primary {

    width: 100%;

    background: var(--chrome-grad);
    color: var(--fill-strong-ink);
    padding: 12px 18px; margin-top: var(--space-md);
    border-color: transparent; font-weight: 800;
    border-radius: var(--radius-sm);
    text-shadow: none;
    font-family: var(--font-mono);
    letter-spacing: 0.1em; text-transform: uppercase;
}
.btn-primary:hover {
    background: var(--chrome-grad-hover);
    border-color: transparent;
}
.btn-primary:disabled { opacity: 0.35; cursor: not-allowed; }

.btn-ghost {
    background: none; color: var(--text-secondary);
    padding: 4px 10px; font-size: var(--font-size-xs); border-color: transparent;
}
.btn-ghost:hover { color: var(--accent); background: var(--accent-subtle); }
.random-count-preset.active { color: var(--accent); background: var(--accent-subtle); }

.btn-accent {
    background: var(--fill-strong); color: var(--fill-strong-ink);
    border-color: var(--fill-strong); font-weight: 700;
    border-radius: var(--radius-sm);
}
.btn-accent:hover { background: var(--fill-strong-hover); border-color: var(--fill-strong-hover); }

.btn-danger {
    background: none; color: var(--error); border-color: var(--border);
    border-radius: var(--radius-sm);
}
.btn-danger:hover { background: var(--error-subtle); border-color: var(--error); }

.btn-secondary {
    background: var(--secondary); color: var(--bg-void);
    border-color: var(--secondary); font-weight: 700;
    border-radius: var(--radius-sm);
}
.btn-secondary:hover { background: var(--secondary-hover); }

.collapsible-trigger {
    display: flex; align-items: center; gap: 6px;
    font-size: var(--font-size-2xs); font-weight: 700; color: var(--text-tertiary);
    cursor: pointer; padding: 6px 10px; margin-bottom: 6px;
    background: var(--bg-tertiary); border: 1px solid var(--border);
    border-left: 2px solid var(--accent-dim);
    font-family: var(--font-mono); letter-spacing: 0.06em;
    text-transform: uppercase;
    transition: all var(--transition);
}
.collapsible-trigger:hover {
    color: var(--accent);
    border-left-color: var(--accent);
    background: var(--accent-subtle);
}
.collapsible-trigger .chevron { width: 12px; height: 12px; transition: transform var(--transition); }
.collapsible-trigger.open .chevron { transform: rotate(90deg); }
.collapsible-trigger.open {
    color: var(--accent);
    border-left-color: var(--accent);
}
.collapsible-body {
    display: none; padding: 8px 0 12px;
    border-left: 1px solid var(--border);
    margin-left: 8px; padding-left: 12px;
}
.collapsible-body.open { display: block; }

.result-box {
    margin-top: var(--space-lg);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-left: 2px solid var(--accent);
    overflow: hidden; display: none;
    position: relative;
}
.result-box::before, .result-box::after { display: none; }
.result-box.visible {
    display: block;
    animation: fadeInUp 250ms ease;
    box-shadow: var(--shadow-float);
}

.result-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-tertiary);
    position: relative;
}
.result-header::after { display: none; }
.result-label {
    font-size: var(--font-size-2xs); font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.12em; color: var(--text-tertiary);
    font-family: var(--font-mono);
    display: flex; align-items: center; gap: 6px;
}
.result-label.success { color: var(--success); }
.result-label.error { color: var(--error); }
.result-content {
    padding: 14px; font-size: var(--font-size-xs); line-height: 1.7;
    color: var(--text-primary); white-space: pre-wrap; word-break: break-all;
    font-family: var(--font-mono); max-height: 320px; overflow-y: auto;
}
.mono-input { font-family: var(--font-mono); font-size: var(--font-size-xs); }

@view-transition { navigation: auto; }
.header-bar { view-transition-name: karmolab-header; }

@media (prefers-reduced-motion: reduce) {
    ::view-transition-group(*),
    ::view-transition-old(*),
    ::view-transition-new(*) { animation: none !important; }
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse-dot { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }

.spinner {
    width: 14px; height: 14px;
    border: 2px solid rgba(124, 58, 237, 0.1);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

.sidebar { display: none; }

html[data-nav="sidebar"] .header-nav { display: none !important; }
html[data-nav="sidebar"] .header-bar-right { grid-column: 3; }

html[data-nav="sidebar"] .sidebar {
    display: flex;
    position: fixed;
    top: 52px;
    left: 0;
    bottom: 0;
    width: var(--sidebar-collapsed-width);
    background: var(--glass-strong);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: blur(14px);
    border-right: 1px solid var(--border);
    flex-direction: column;
    flex-shrink: 0;
    overflow: hidden;
    transition: width var(--transition-slow);
    z-index: 50;
}

html[data-nav="sidebar"] .sidebar:hover {
    width: var(--sidebar-width);
}

html[data-nav="sidebar"] .main-content {
    margin-left: var(--sidebar-collapsed-width);
    transition: margin-left var(--transition-slow);
}

html[data-nav="sidebar"]:has(.sidebar:hover) .main-content {
    margin-left: var(--sidebar-width);
}

html[data-nav="sidebar"] .main-content:has(.tool-page.layout-full.active),
html[data-nav="sidebar"]:has(.sidebar:hover) .main-content:has(.tool-page.layout-full.active) {
    margin-left: 0;
}

.sidebar-nav {
    padding: var(--space-md) var(--space-sm);
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-footer {
    flex-shrink: 0;
    padding: var(--space-sm);
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
}

.sidebar-search-btn {
    width: 100%;
    background: none;
    border: none;
    cursor: pointer;
    font-family: var(--font-sans);
    text-align: left;
}
.sidebar-search-kbd {
    margin-left: auto;
    padding: 1px 5px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 10px;
    line-height: 1.4;
    color: var(--text-tertiary);
    white-space: nowrap;
}

.sidebar-dev-links {
    font-size: var(--font-size-2xs);
    color: var(--text-tertiary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;

    padding: 3px 4px 3px 9px;
    border-radius: 4px;
    overflow: hidden;
}

.sidebar-dev-links:hover { color: var(--accent); background: var(--accent-subtle); }

.sidebar-dev-links-icon {
    display: none;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--bg-tertiary);
    font-size: 11px;
    font-weight: 700;
    font-style: italic;
    color: var(--text-tertiary);
}

.sidebar-group { margin-top: var(--space-sm); }

.sidebar-group-trigger {
    display: flex;
    gap: 6px;
    width: 100%;
    padding: 6px 10px 6px 30px;
    font-size: var(--font-size-2xs);
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    transition: color var(--transition);
    text-align: left;
    position: relative;
    cursor: pointer;
    background: none;
    border: none;
}

.sidebar-group-trigger:hover { color: var(--text-secondary); }

.sidebar-group-trigger .chevron {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    display: inline-block;
    width: 8px;
    height: 8px;
    transition: transform var(--transition);
}

.sidebar-group-trigger .chevron::before {
    content: '';
    position: absolute;
    left: 1px;
    top: 2px;
    width: 4px;
    height: 4px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: rotate(-45deg);
}

.sidebar-group-trigger.open .chevron { transform: translateY(-50%) rotate(90deg); }

.sidebar-group-body { display: none; overflow: hidden; }
.sidebar-group-body.open { display: block; }

html[data-nav="sidebar"] .sidebar .nav-item-text,
html[data-nav="sidebar"] .sidebar .sidebar-group-label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: clip;
    flex-shrink: 0;
    transition: opacity var(--transition-slow);
}

html[data-nav="sidebar"] .sidebar:not(:hover) .sidebar-group-label,
html[data-nav="sidebar"] .sidebar:not(:hover) .nav-item-text {
    opacity: 0;
    pointer-events: none;
}

html[data-nav="sidebar"] .sidebar:hover .sidebar-group-label,
html[data-nav="sidebar"] .sidebar:hover .nav-item-text {
    opacity: 1;
}

html[data-nav="sidebar"] .sidebar:not(:hover) .sidebar-dev-links-icon { display: flex; }
html[data-nav="sidebar"] .sidebar:not(:hover) .sidebar-dev-links-text { display: none; }
html[data-nav="sidebar"] .sidebar:hover .sidebar-dev-links-icon { display: flex; }
html[data-nav="sidebar"] .sidebar:hover .sidebar-dev-links-text { display: inline; }

@media (max-width: 768px) {
    html[data-nav="sidebar"] .sidebar { display: none; }
    html[data-nav="sidebar"] .main-content { margin-left: 0; }
}

::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(124, 58, 237, 0.08); }
::-webkit-scrollbar-thumb:hover { background: rgba(124, 58, 237, 0.18); }

@media (max-width: 768px) {

    .app-layout {
        position: static;
        height: auto;
        min-height: 100vh;
        overflow: visible;
        width: 100%;
        max-width: 100%;
    }
    .app-body {
        min-height: 0;
        overflow: visible;
        min-width: 0;
        max-width: 100%;
    }
    .main-content {
        overflow: visible;
        min-width: 0;
        max-width: 100%;
    }
    .content-body {
        min-height: 0;
        min-width: 0;
        max-width: 100%;
    }
    .mobile-nav,
    .tool-page {
        max-width: 100%;
        min-width: 0;
    }

    .main-content:has(.tool-page.layout-full.active) { overflow: visible; padding-top: 0; }
    .content-body:has(.tool-page.layout-full.active) {
        padding: var(--space-md);
        padding-top: calc(52px + var(--space-md));
        min-height: 0;
    }
    .tool-page.layout-full.active { display: block; }
    .tool-page.layout-full.active > .tab-panel.active { display: block; min-height: 55vh; }

    .header-tools-link { display: none !important; }
    .header-dev-link { display: none !important; }

    .header-bar { padding: 0 var(--space-sm); }
    .header-bar-left { min-width: 0; }
    .header-bar-right { gap: 2px; }
    .header-logo-text { white-space: nowrap; }

    .content-body { padding-bottom: 120px; }

    html, body { overflow: visible; overflow-x: hidden; height: auto; }

    body:has(> .app-layout) { overflow: visible; overflow-x: hidden; }

    :root { --font-size-2xs: 13px; }

    .header-btn, .theme-toggle, .header-logo { min-width: 40px; min-height: 40px; }

    .mobile-nav .nav-item {
        flex: 0 0 auto;
        min-width: 40px; min-height: 40px;
        display: inline-flex; align-items: center; justify-content: center;
        padding: 5px 12px;
    }

    .header-account-signin, .kp-browse-chip { min-height: 40px; }

    .btn { min-height: 40px; padding: 9px 14px; }
    .tool-chip { min-height: 38px; padding: 9px 14px; }
    .header-logo { min-height: 40px; }
    input[type="text"], input[type="password"], input[type="date"], select, textarea { min-height: 42px; }

    .header-nav { display: none !important; }
    .main-content { margin-left: 0; }
    .header-bar {
        left: 0;
        padding: 0 var(--space-md);
        grid-template-columns: auto 1fr;
        gap: var(--space-sm);
    }

    .mobile-nav { display: flex !important; margin-top: 52px; min-height: 55px; }
    .content-body { padding: var(--space-md); }
    .landing-page { padding: var(--space-md); }
    .landing-title { font-size: 52px; }
    .landing-hero { padding: var(--space-lg) 0 var(--space-md); }
    .prism-theme-select { width: 100px; font-size: var(--font-size-2xs); }
    .tool-page-hero { padding: var(--space-md) 0 var(--space-sm); }
    .tool-page-hero-title { font-size: 28px; }
    .field-group { padding: var(--space-sm); }
    .tool-page.layout-form { padding: var(--space-sm); }
}

.mobile-nav {
    display: none; overflow-x: auto; gap: 2px;
    padding: 6px var(--space-md);
    border-bottom: 1px solid var(--border);
    background: var(--glass-strong);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: blur(14px);
    flex-shrink: 0;
}
.mobile-nav .nav-item {
    white-space: nowrap; font-size: var(--font-size-xs); padding: 5px 10px;
    border-left: none;
}

.mobile-nav .nav-item-find {
    position: sticky; left: 0; z-index: 1;
    background: var(--accent-dim);
    color: var(--accent);
    border-radius: var(--radius-sm);
    font-weight: 700;

    box-shadow: 6px 0 6px -4px var(--bg-primary);
}

.randomgen-wide {
    display: flex;
    flex-direction: column;
    min-height: 400px;
    min-width: 0;
    padding: var(--space-md);
}

.randomgen-display {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 280px;
}

.randomgen-footer {
    flex-shrink: 0;
    padding-top: var(--space-xl);
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.randomgen-bottom-bar {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.randomgen-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-sm);
}

.randomgen-row-main {
    justify-content: center;
}

.randomgen-row-options {
    justify-content: center;
}

.randomgen-icon-btn {
    min-width: 36px;
    height: 36px;
    padding: 0 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
}

.randomgen-icon-btn:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: var(--accent-subtle);
}

.randomgen-icon-btn.active {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-subtle);
}

.randomgen-icon-btn svg {
    width: 18px;
    height: 18px;
}

.randomgen-icon-btn#randomTopicBtn {
    padding: 0 10px 0 8px;
}

.randomgen-icon-btn:not(#randomTopicBtn) {
    padding: 0;
    width: 36px;
}

.randomgen-icon-btn .randomgen-topic-label {
    font-size: 11px;
    margin-left: 4px;
    max-width: 72px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.randomgen-count-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
}

.randomgen-count-wrap input[type="number"] {
    width: 44px;
    height: 36px;
    padding: 0 8px;
    font-size: var(--font-size-xs);
    font-weight: 600;
    text-align: center;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    outline: none;
    transition: all var(--transition);
    -moz-appearance: textfield;
}
.randomgen-count-wrap input[type="number"]::-webkit-outer-spin-button,
.randomgen-count-wrap input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.randomgen-count-wrap input[type="number"]:focus {
    border-color: var(--accent);
    background: var(--bg-secondary);
    box-shadow: 0 0 0 1px var(--accent-dim);
}

.randomgen-presets {
    display: flex;
    gap: 4px;
}

.randomgen-presets .random-count-preset {
    min-width: 32px;
    height: 36px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-xs);
    font-weight: 600;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--text-tertiary);
    transition: all var(--transition);
}
.randomgen-presets .random-count-preset:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-subtle);
}
.randomgen-presets .random-count-preset.active {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-subtle);
}

.randomgen-footer-links {
    font-size: 11px;
    color: var(--text-tertiary);
}

.randomgen-popup.randomgen-topic-popup-large {
    position: relative;
    max-width: 920px;
    width: 90vw;
    max-height: 85vh;
    padding: var(--space-md);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.randomgen-topic-popup-large .randomgen-topic-popup-tabs {
    flex-shrink: 0;
}

.randomgen-topic-popup-large .randomgen-topic-tab-panel {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.randomgen-topic-close-fab {
    position: absolute;
    bottom: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    padding: 0;
    font-size: 20px;
    line-height: 1;
    font-weight: 400;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 50%;
    cursor: pointer;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: all var(--transition);
}
.randomgen-topic-close-fab:hover {
    color: var(--accent);
    background: var(--accent-subtle);
    border-color: var(--accent);
}

.randomgen-topic-popup-tabs {
    display: flex;
    gap: 0;
    margin-bottom: var(--space-sm);
    border-bottom: 1px solid var(--border);
}

.randomgen-topic-tab {
    padding: 10px 16px;
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--text-tertiary);
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    cursor: pointer;
    transition: all var(--transition);
}
.randomgen-topic-tab:hover {
    color: var(--text-secondary);
}
.randomgen-topic-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.randomgen-topic-tab-panel {
    display: none;
}
.randomgen-topic-tab-panel.active {
    display: block;
}

.randomgen-topic-popup-footer {
    display: flex;
    justify-content: flex-end;
    margin-top: var(--space-md);
    padding-top: var(--space-md);
    border-top: 1px solid var(--border);
}

.randomgen-topic-grid {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    max-height: 50vh;
    overflow-y: auto;
}

.randomgen-topic-actions {
    display: flex;
    gap: var(--space-sm);
    margin-bottom: var(--space-xs);
}

.randomgen-topic-special {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: var(--space-sm);
}

.randomgen-topic-group-title {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 4px;
}

.randomgen-topic-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 6px;
}

.randomgen-topic-card {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
    padding: 8px 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition);
    overflow: visible;
}

.randomgen-topic-card:hover {
    border-color: var(--accent);
    background: var(--accent-subtle);
}

.randomgen-topic-card.active,
.randomgen-topic-mode.active {
    border-color: var(--accent);
    background: var(--accent-subtle);
    color: var(--accent);
}

.randomgen-topic-card.randomgen-topic-custom.selected {
    border-color: var(--secondary);
    background: var(--secondary-subtle);
    color: var(--secondary);
}

.randomgen-topic-card.randomgen-topic-custom.pinned {
    border-color: var(--secondary);
    background: var(--secondary-subtle);
    color: var(--secondary);
}

.randomgen-topic-card.randomgen-topic-custom.pinned::before {
    content: '';
    position: absolute;
    top: -1px;
    right: -1px;
    width: 24px;
    height: 24px;
    background: linear-gradient(225deg, var(--secondary) 50%, transparent 50%);
    border-radius: 0 var(--radius-md) 0 0;
    box-shadow: -1px 1px 2px rgba(0, 0, 0, 0.15);
    pointer-events: none;
}

.randomgen-topic-custom {
    cursor: pointer;
    display: flex;
}

.randomgen-topic-options-wrap {
    margin-top: var(--space-sm);
}

.randomgen-topic-selected-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
    min-height: 32px;
}

.randomgen-topic-selected-chip {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 8px 10px;
    font-size: var(--font-size-sm);
    font-weight: 500;
    background: var(--secondary-subtle);
    color: var(--secondary);
    border: 1px solid var(--secondary);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition);
    overflow: visible;
}
.randomgen-topic-selected-chip:hover {
    opacity: 0.9;
}

.randomgen-topic-selected-chip.pinned {
    border-color: var(--secondary);
    background: var(--secondary-subtle);
    color: var(--secondary);
}

.randomgen-topic-selected-chip.pinned::before {
    content: '';
    position: absolute;
    top: -1px;
    right: -1px;
    width: 20px;
    height: 20px;
    background: linear-gradient(225deg, var(--secondary) 50%, transparent 50%);
    border-radius: 0 var(--radius-md) 0 0;
    box-shadow: -1px 1px 2px rgba(0, 0, 0, 0.15);
    pointer-events: none;
}

.randomgen-topic-pin {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    color: var(--text-tertiary);
    transition: all var(--transition);
}

.randomgen-topic-pin:hover {
    color: var(--accent);
    background: var(--accent-subtle);
}

.randomgen-topic-selected-chip.pinned .randomgen-topic-pin {
    color: var(--accent);
}

.randomgen-topic-pin svg {
    width: 14px;
    height: 14px;
}

.randomgen-topic-hint {
    font-size: 11px;
    font-weight: 400;
    color: var(--text-tertiary);
}

.randomgen-topic-selected-empty {
    font-size: 12px;
    color: var(--text-tertiary);
}

.randomgen-topic-card-label {
    font-size: var(--font-size-sm);
    font-weight: 500;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.randomgen-topic-info {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    font-style: italic;
    color: var(--text-tertiary);
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 50%;
    cursor: pointer;
    transition: all var(--transition);
}

.randomgen-topic-info:hover {
    color: var(--accent);
    border-color: var(--accent);
}

.randomgen-topic-tab-panel[data-tab="add"] {
    max-width: 520px;
    padding-top: var(--space-xs);
}

.randomgen-add-section {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.randomgen-add-header {
    margin-bottom: 2px;
}

.randomgen-add-title {
    font-size: var(--font-size-sm);
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 4px 0;
}

.randomgen-add-desc {
    font-size: var(--font-size-2xs);
    color: var(--text-tertiary);
    margin: 0;
}

.randomgen-add-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    padding: var(--space-md);
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

.randomgen-add-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-sm);
}

.randomgen-add-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.randomgen-add-field-id {
    margin-top: 2px;
}

.randomgen-add-label {
    font-size: var(--font-size-2xs);
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.02em;
}

.randomgen-add-hint {
    font-weight: 400;
    color: var(--text-tertiary);
}

.randomgen-add-form .field-input {
    padding: 8px 12px;
    font-size: var(--font-size-xs);
    min-height: 0;
}

.randomgen-add-form textarea.field-input {
    min-height: 88px;
    resize: vertical;
}

.randomgen-add-actions {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-top: 4px;
}

.randomgen-add-actions .btn-primary {
    width: auto;
    margin-top: 0;
    padding: 8px 18px;
}

.randomgen-add-msg {
    font-size: 11px;
    color: var(--text-tertiary);
}

@media (max-width: 480px) {
    .randomgen-add-row {
        grid-template-columns: 1fr;
    }
}

.randomgen-table-popup {
    max-width: 480px;
}

.randomgen-table-content {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.randomgen-table-tag {
    display: inline-block;
    padding: 6px 10px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-sm);
}

.randomgen-gen-btn {
    width: auto !important;
    padding: 8px 20px !important;
    font-size: 13px !important;
    margin-top: 0 !important;
}

.randomgen-popup-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition);
}

.randomgen-popup-backdrop.open {
    opacity: 1;
    pointer-events: auto;
}

.randomgen-popup {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    max-width: 420px;
    max-height: 80vh;
    width: 100%;
    box-shadow: var(--shadow-float);
    display: flex;
    flex-direction: column;
}

.randomgen-popup-title {
    font-size: var(--font-size-sm);
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--space-md);
}

.randomgen-info-content {
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
    line-height: 1.6;
}
.randomgen-info-content p {
    margin: 0 0 var(--space-sm);
}
.randomgen-info-content p:last-child {
    margin-bottom: 0;
}

.randomgen-empty {
    color: var(--text-tertiary);
    font-size: var(--font-size-sm);
}

.randomgen-exclude-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 6px 12px;
    max-height: 320px;
    overflow-y: auto;
    padding: 0;
}

@media (max-width: 900px) {
    .randomgen-display {
        min-height: 220px;
    }

    .randomgen-row-options {
        justify-content: center;
    }

    .randomgen-count-wrap {
        justify-content: center;
    }
}

.tb-lightbox-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.94);
    backdrop-filter: blur(8px);
    z-index: 9999;
    display: flex; align-items: center; justify-content: center;
    cursor: zoom-out;
}
.tb-lightbox-overlay img { max-width: 90vw; max-height: 90vh; object-fit: contain; }

.karmolab-update-banner {
    position: fixed; top: 16px; right: 16px;
    z-index: 9998;
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--accent, var(--border));
    border-radius: var(--radius-md);
    box-shadow: 0 8px 24px rgba(0,0,0,0.25);
    font-size: var(--font-size-sm);
    max-width: 420px;
}
.karmolab-update-banner-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; }
.karmolab-update-banner-msg { line-height: 1.4; }
.karmolab-update-banner-msg code {
    font-family: ui-monospace, monospace;
    background: var(--bg-tertiary); padding: 1px 5px; border-radius: 4px;
    font-size: 0.95em;
}
.karmolab-update-banner-notes {
    font-size: var(--font-size-xs);
    color: var(--text-tertiary);
    text-decoration: none;
    align-self: flex-start;
}
.karmolab-update-banner-notes:hover { color: var(--accent); text-decoration: underline; }
.karmolab-update-banner-progress {
    width: 100%; height: 6px;
    -webkit-appearance: none; appearance: none;
    border: none; border-radius: 3px;
    background: var(--bg-tertiary);
    overflow: hidden;
}
.karmolab-update-banner-progress::-webkit-progress-bar { background: var(--bg-tertiary); border-radius: 3px; }
.karmolab-update-banner-progress::-webkit-progress-value { background: var(--accent); border-radius: 3px; transition: width 120ms linear; }
.karmolab-update-banner-progress::-moz-progress-bar { background: var(--accent); border-radius: 3px; }
.karmolab-update-banner-install {
    flex-shrink: 0;
    padding: 6px 12px;
    background: var(--accent); color: var(--accent-fg);
    border: none; border-radius: var(--radius-sm);
    font-weight: 600; font-size: var(--font-size-xs);
    cursor: pointer;
    min-width: 88px;

    min-height: 32px;
}
.karmolab-update-banner-install:hover { filter: brightness(1.1); }
.karmolab-update-banner-install:disabled { opacity: 0.7; cursor: progress; }
.karmolab-update-banner-restart {
    background: var(--success, #22c55e);
}

.karmolab-update-banner-close {
    flex-shrink: 0; align-self: flex-start;
    width: 32px; height: 32px;
    background: transparent; color: var(--text-tertiary);
    border: none; border-radius: var(--radius-sm);
    font-size: 16px; line-height: 1; cursor: pointer;
    padding: 0;
}
.karmolab-update-banner-close:hover { background: var(--bg-tertiary); color: var(--text-primary); }

.karmolab-update-completed-toast {
    position: fixed; top: 16px; right: 16px;
    z-index: 9998;
    display: flex; align-items: center; gap: 8px;
    padding: 8px 10px 8px 12px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--success, #22c55e);
    border-left: 3px solid var(--success, #22c55e);
    border-radius: var(--radius-md);
    box-shadow: 0 8px 24px rgba(0,0,0,0.25);
    font-size: var(--font-size-sm);
    max-width: 380px;
    opacity: 1;
    transform: translateX(0);
    transition: opacity 200ms ease, transform 200ms ease;
}
.karmolab-update-completed-toast-leaving {
    opacity: 0;
    transform: translateX(20px);
}
.karmolab-update-completed-toast-msg { line-height: 1.4; flex: 1; min-width: 0; }
.karmolab-update-completed-toast-msg code {
    font-family: ui-monospace, monospace;
    background: var(--bg-tertiary); padding: 1px 5px; border-radius: 4px;
    font-size: 0.95em;
}
.karmolab-update-completed-toast-close {
    flex-shrink: 0;
    width: 22px; height: 22px;
    background: transparent; color: var(--text-tertiary);
    border: none; border-radius: var(--radius-sm);
    font-size: 15px; line-height: 1; cursor: pointer;
    padding: 0;
}
.karmolab-update-completed-toast-close:hover { background: var(--bg-tertiary); color: var(--text-primary); }

.kl-dropzone {
    position: fixed; inset: 0; z-index: 9000; pointer-events: none;
    display: flex; align-items: center; justify-content: center;
    background: color-mix(in srgb, var(--bg-primary) 72%, transparent);
    backdrop-filter: blur(2px);
}
.kl-dropzone-box {
    padding: 22px 30px; border: 2px dashed var(--accent); border-radius: var(--radius-lg);
    background: var(--bg-secondary); color: var(--text-primary);
    font-size: var(--font-size-sm); font-weight: 600;
}

html.is-layout-full .main-content {
    overflow: hidden;
}
html.is-layout-full .content-body {
    flex: 1;
    min-height: 0;
    padding: 0;
    padding-top: 52px;
}
html.is-layout-full .tool-page.layout-full.active {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    height: 100%;
    width: 100%;
    max-width: none;
    margin: 0;
}
html.is-layout-full .tool-page.layout-full.active > .tab-panel.active {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    width: 100%;
}
html[data-nav="sidebar"].is-layout-full .main-content,
html[data-nav="sidebar"].is-layout-full .main-content:has(.tool-page.layout-full.active),
html[data-nav="sidebar"].is-layout-full:has(.sidebar:hover) .main-content,
html[data-nav="sidebar"].is-layout-full:has(.sidebar:hover) .main-content:has(.tool-page.layout-full.active) {
    margin-left: 0;
}

.landing-madewith {
    margin: 28px auto 0;
    max-width: 640px;
    text-align: center;
    font-size: var(--font-size-2xs, 11px);
    line-height: 1.7;
    color: var(--text-tertiary);
}
.landing-madewith a { color: var(--text-secondary); }
