/* Editorial / archive design system.
   Display: PT Serif. Body: Inter. Palette: paper + ink + terracotta accent. */
@import url('https://fonts.googleapis.com/css2?family=PT+Serif:ital,wght@0,400;0,700;1,400&family=Inter:wght@400;500;600;700&display=swap');

html {
    color-scheme: light;
}

html[data-theme="dark"] {
    color-scheme: dark;
}

:root {
    /* Logo filter — flip dark PNGs to light in dark mode */
    --logo-filter: none;

    /* Brand — SVHU cyan, used sparingly */
    --color-primary: #1c9fc7;
    --color-primary-hover: #1681a3;
    --color-primary-soft: rgba(28, 159, 199, 0.1);
    --color-primary-soft-hover: rgba(28, 159, 199, 0.18);
    --color-primary-text-on-soft: #1681a3;
    --color-secondary: #1681a3;

    /* Paper & ink */
    --color-bg: #fbfaf7;
    --color-surface: #ffffff;
    --color-surface-alt: #f4f2ec;
    --color-surface-inset: #ece9e1;
    --color-text: #1a1a1a;
    --color-text-muted: #3d3d3d;
    --color-text-soft: #6b6b6b;
    --color-text-faint: #9a9892;
    --color-border: #e8e6e0;
    --color-border-soft: #efede7;
    --color-border-faint: #f4f2ec;

    /* Status */
    --color-error: #b3382c;
    --color-success: #2d7a4f;
    --color-warning: #b06a1a;

    /* Favorite button */
    --color-favorite: #1c9fc7;
    --color-favorite-idle: #ffffff;
    --favorite-btn-bg: rgba(0, 0, 0, 0.45);
    --favorite-btn-bg-active: #1c9fc7;
    --favorite-btn-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);

    /* Typography */
    --font-display: 'PT Serif', Georgia, 'Times New Roman', serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 40px;
    --space-2xl: 64px;

    /* Border radius — minimal; editorial favors square corners */
    --radius-sm: 2px;
    --radius-md: 4px;
    --radius-lg: 6px;
    --radius-xl: 8px;

    /* Shadows — kept understated */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 2px 6px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 6px 20px rgba(0, 0, 0, 0.12);
    --shadow-xl: 0 12px 40px rgba(0, 0, 0, 0.2);
    --shadow-card-hover: 0 2px 8px rgba(0, 0, 0, 0.08);

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
    --transition-slow: 0.35s ease;
}

/* Dark mode: deep ink paper, warm-cool grey for text. Same accent. */
html[data-theme="dark"] {
    --color-bg: #16161a;
    --color-surface: #1c1c20;
    --color-surface-alt: #212126;
    --color-surface-inset: #0e0e10;
    --color-text: #ededeb;
    --color-text-muted: #cbc9c4;
    --color-text-soft: #9a9892;
    --color-text-faint: #6b6b66;
    --color-border: #2a2a2e;
    --color-border-soft: #252528;
    --color-border-faint: #1f1f22;
    --color-primary: #2eb4d6;
    --color-primary-hover: #5cc4e0;
    --color-primary-soft: rgba(46, 180, 214, 0.16);
    --color-primary-soft-hover: rgba(46, 180, 214, 0.26);
    --color-primary-text-on-soft: #7ad2e8;
    --shadow-card-hover: 0 2px 8px rgba(0, 0, 0, 0.5);
    --logo-filter: invert(1);
}

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

body {
    font-family: var(--font-body);
    background: var(--color-bg);
    min-height: 100vh;
    color: var(--color-text);
    font-size: 15px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* Editorial typography defaults. Display headings use PT Serif. */
h1, h2, h3, h4, h5 {
    font-family: var(--font-display);
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.005em;
    color: var(--color-text);
}

a {
    color: var(--color-primary);
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
}

a:hover {
    color: var(--color-primary-hover);
}

.screen {
    display: block;
}

.hidden {
    display: none !important;
}

.screen.hidden {
    display: none !important;
}

/* Accessibility */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--color-primary);
    color: white;
    padding: 8px 16px;
    text-decoration: none;
    z-index: 10000;
    border-radius: 0 0 var(--radius-sm) 0;
    font-weight: 600;
}

.skip-link:focus {
    top: 0;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Focus styles for keyboard navigation */
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible,
.breadcrumb-item:focus-visible,
.image-card:focus-visible,
.folder-card:focus-visible {
    outline: 3px solid var(--color-primary);
    outline-offset: 2px;
}

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

    .unicycle-bg {
        animation: none;
    }
}

/* Login Screen — centered single column, no card chrome */
#login-screen {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 24px;
    position: relative;
}

.unicycle-bg {
    display: none;
}

.login-container {
    background: transparent;
    padding: 0;
    width: 100%;
    max-width: 380px;
    position: relative;
    z-index: 1;
}

.login-container h1 {
    font-family: var(--font-display);
    text-align: center;
    margin-bottom: 6px;
    color: var(--color-text);
    font-size: 34px;
    font-weight: 700;
    letter-spacing: -0.015em;
    line-height: 1.1;
}

.login-container > p {
    text-align: center;
    color: var(--color-text-soft);
    font-size: 14px;
    margin-bottom: 36px;
    line-height: 1.5;
}

.unicycle-logo {
    width: 360px;
    max-width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    object-fit: contain;
    display: block;
    margin: 0 auto 32px;
    opacity: 0.92;
    filter: var(--logo-filter);
}

#login-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-top: 12px;
}

#login-form input[type="text"],
#login-form input[type="password"] {
    padding: 13px 16px;
    font-size: 15px;
}

#login-form button {
    margin-top: 6px;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="search"] {
    padding: 11px 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    line-height: 1.4;
    font-family: inherit;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    background: var(--color-surface);
    color: var(--color-text);
    box-sizing: border-box;
}

#login-form input[type="text"],
#login-form input[type="password"] {
    width: 100%;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
input[type="number"]:focus,
input[type="search"]:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-soft);
}

input::placeholder {
    color: var(--color-text-faint);
}

button {
    padding: 10px 18px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    cursor: pointer;
    transition: background-color var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
    font-weight: 500;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

#login-form button {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: white;
    font-weight: 600;
    font-size: 15px;
    padding: 12px 18px;
}

#login-form button:hover {
    background: var(--color-primary-hover);
    border-color: var(--color-primary-hover);
}

.error-message {
    color: var(--color-error);
    text-align: center;
    margin-top: 8px;
    min-height: 20px;
    font-size: 13px;
    font-weight: 500;
}

/* Gallery Screen */
#gallery-screen {
    padding: 0;
    min-height: 100vh;
}

header,
.admin-header {
    background: var(--color-bg);
    padding: 20px 48px 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    border-bottom: 1px solid var(--color-border);
    box-shadow: none;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

header h1 {
    font-family: var(--font-display);
    color: var(--color-text);
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.01em;
    line-height: 1.15;
}

.header-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-logo {
    width: 32px;
    height: 32px;
    object-fit: contain;
    opacity: 0.85;
    filter: var(--logo-filter);
}

.header-controls {
    display: flex;
    gap: 4px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
    flex: 1;
}

.header-controls > * {
    flex-shrink: 0;
}

/* Navigation: text links, no button chrome */
.btn-nav {
    background: transparent;
    border: none;
    padding: 6px 10px;
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text-soft);
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: color var(--transition-fast), border-color var(--transition-fast);
}

.btn-nav:hover {
    color: var(--color-text);
    background: transparent;
}

.btn-nav.active {
    color: var(--color-text);
    border-bottom-color: var(--color-primary);
}

/* Gallery toolbar */
.gallery-toolbar {
    background: var(--color-bg);
    padding: 12px 48px;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.toolbar-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

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

.selected-count {
    font-size: 14px;
    color: var(--color-text-muted);
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

.item-count {
    font-size: 13px;
    color: var(--color-text-muted);
    font-variant-numeric: tabular-nums;
}

/* User Menu Dropdown */
.user-menu {
    position: relative;
}

.user-menu-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: border-color var(--transition-fast), color var(--transition-fast);
    font-size: 14px;
    font-family: inherit;
    color: var(--color-text-soft);
}

.user-menu-btn:hover {
    color: var(--color-text);
    border-color: var(--color-border);
}

.user-menu-btn #user-info {
    color: var(--color-text-soft);
    font-weight: 500;
}

.dropdown-arrow {
    font-size: 10px;
    transition: transform var(--transition-fast);
    color: var(--color-text-faint);
}

.user-menu-btn.active .dropdown-arrow {
    transform: rotate(180deg);
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    min-width: 200px;
    z-index: 1000;
    overflow: hidden;
}

.user-dropdown.hidden {
    display: none;
}

.dropdown-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border: none;
    background: var(--color-surface);
    color: var(--color-text);
    font-size: 14px;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    transition: background var(--transition-fast);
    border-bottom: 1px solid var(--color-border-faint);
}

.dropdown-item:last-child {
    border-bottom: none;
}

.dropdown-item:hover {
    background: var(--color-surface-alt);
}

.dropdown-icon {
    display: inline-block;
    width: 16px;
    height: 16px;
    background-color: currentColor;
    opacity: 0.7;
    -webkit-mask-position: center;
    mask-position: center;
    -webkit-mask-size: contain;
    mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    flex-shrink: 0;
}

.dropdown-icon--key {
    -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='8' cy='15' r='6'/><path d='m13 11 8-8'/><path d='m17 7 3 3'/></svg>");
    mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='8' cy='15' r='6'/><path d='m13 11 8-8'/><path d='m17 7 3 3'/></svg>");
}

.dropdown-icon--logout {
    -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4'/><polyline points='16 17 21 12 16 7'/><line x1='21' y1='12' x2='9' y2='12'/></svg>");
    mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4'/><polyline points='16 17 21 12 16 7'/><line x1='21' y1='12' x2='9' y2='12'/></svg>");
}

.user-info {
    font-size: 13px;
    color: var(--color-text-soft);
    padding: 4px 0;
    font-weight: 500;
}

#selected-count {
    font-weight: 600;
    color: var(--color-text);
    margin-right: 8px;
    padding: 0;
    font-size: 13px;
    font-variant-numeric: tabular-nums;
}

.btn-primary {
    background: var(--color-primary);
    color: white;
    font-weight: 500;
    border: 1px solid var(--color-primary);
    font-size: 14px;
    padding: 8px 16px;
}

.btn-primary:hover:not(:disabled) {
    background: var(--color-primary-hover);
    border-color: var(--color-primary-hover);
}

.btn-primary:disabled {
    background: var(--color-border);
    border-color: var(--color-border);
    color: var(--color-text-faint);
    cursor: not-allowed;
}

.btn-secondary {
    background: transparent;
    color: var(--color-text);
    border: 1px solid var(--color-border);
    font-weight: 500;
    font-size: 14px;
    padding: 8px 16px;
}

.btn-secondary:hover {
    background: var(--color-surface-alt);
    border-color: var(--color-text-soft);
}

.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 40px;
    color: var(--color-text-soft);
    font-size: 15px;
    font-weight: 500;
    font-style: italic;
}

.loading::after {
    content: '';
    width: 90px;
    height: 90px;
    background: url('onewheel-header-logo.png') center/contain no-repeat;
    animation: loadingPulse 1.4s ease-in-out infinite;
    flex-shrink: 0;
    filter: var(--logo-filter);
}

@keyframes loadingPulse {
    0%, 100% { transform: scale(1);    opacity: 0.65; }
    50%      { transform: scale(0.94); opacity: 1; }
}

.loading.hidden {
    display: none;
}

/* Breadcrumb Navigation */
.breadcrumb {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px;
    padding: 10px 0;
    font-size: 14px;
}

.breadcrumb-item {
    color: var(--color-text-muted);
    transition: color var(--transition-normal);
}

.breadcrumb-item:not(.active):hover {
    color: var(--color-primary);
    text-decoration: underline;
}

.breadcrumb-item.active {
    color: var(--color-primary);
    font-weight: 600;
}

.breadcrumb-separator {
    color: var(--color-text-faint);
}

/* Loading states */
.image-wrapper.loading {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.image-wrapper img[data-src],
.image-wrapper video[data-src] {
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.image-wrapper img.loaded,
.image-wrapper video.loaded {
    opacity: 1;
}

/* Error states */
.media-error {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.95);
    gap: 10px;
    font-size: 14px;
    color: var(--color-error);
    z-index: 10;
}

.media-error-icon {
    font-size: 32px;
}

.retry-btn {
    padding: 8px 16px;
    background: var(--color-primary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition: background-color var(--transition-fast), transform var(--transition-fast);
}

.retry-btn:hover {
    background: var(--color-primary-hover);
}

/* Gallery Grid — uniform aspect, generous gaps. Caption beneath each image. */
.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 44px 20px;
    padding: 40px 48px 80px;
    max-width: 1600px;
    margin: 0 auto;
}

.image-card {
    background: transparent;
    border: none;
    border-radius: 0;
    overflow: visible;
    box-shadow: none;
    transition: opacity var(--transition-fast);
    cursor: pointer;
    position: relative;
    content-visibility: auto;
    contain-intrinsic-size: 320px 280px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    display: flex;
    flex-direction: column;
}

.image-card:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 4px;
}

.image-card.selected .image-wrapper {
    outline: 2px solid var(--color-primary);
    outline-offset: -2px;
}

.image-wrapper {
    position: relative;
    width: 100%;
    /* aspect-ratio is the modern, safe way; padding-top: 75% kept as a
       fallback for older engines. With both, the wrapper can't extend
       past 4:3 even if a <video> element with no metadata insists on
       its 300×150 default intrinsic size before load. */
    aspect-ratio: 4 / 3;
    padding-top: 0;
    overflow: hidden;
    background: var(--color-surface-inset);
    border-radius: var(--radius-sm);
}

@supports not (aspect-ratio: 4 / 3) {
    .image-wrapper {
        padding-top: 75%;
    }
}

.image-wrapper img,
.image-wrapper video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity var(--transition-fast);
}

.image-card:hover .image-wrapper img,
.image-card:hover .image-wrapper video {
    opacity: 0.92;
}

.play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 48px;
    height: 48px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
    z-index: 5;
    pointer-events: none;
    opacity: 0;
    transition: background var(--transition-fast), opacity var(--transition-normal);
}

.image-wrapper:has(video.loaded) .play-icon {
    opacity: 1;
}

.image-card:hover .play-icon {
    background: rgba(0, 0, 0, 0.75);
}

.checkbox-overlay {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 24px;
    height: 24px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 3px;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
    transition: background var(--transition-fast), border-color var(--transition-fast), opacity var(--transition-fast);
    opacity: 0;
}

.image-card:hover .checkbox-overlay,
.image-card.selected .checkbox-overlay,
.image-card:focus-within .checkbox-overlay {
    opacity: 1;
}

.image-card.selected .checkbox-overlay {
    background: var(--color-primary);
    border-color: var(--color-primary);
}

.checkbox-overlay::after {
    content: '✓';
    color: white;
    font-size: 14px;
    font-weight: bold;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.image-card.selected .checkbox-overlay::after {
    opacity: 1;
}

/* Favorite (star) button — top-left of image-card */
.favorite-btn {
    position: absolute;
    top: 12px;
    left: 12px;
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
    padding: 0;
    border: 2px solid rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    background: var(--favorite-btn-bg);
    color: var(--color-favorite-idle);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 11;
    box-shadow: var(--favorite-btn-shadow);
    transition:
        background var(--transition-fast),
        color var(--transition-fast),
        transform var(--transition-fast),
        border-color var(--transition-fast);
    font-size: 20px;
    line-height: 1;
}

.favorite-btn .favorite-icon {
    display: block;
    font-size: 20px;
    line-height: 1;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

.favorite-btn:hover {
    transform: scale(1.08);
    background: rgba(0, 0, 0, 0.6);
}

.favorite-btn.is-favorite {
    background: var(--favorite-btn-bg-active);
    color: #fff;
    border-color: #fff;
}

.favorite-btn.is-favorite .favorite-icon {
    color: #fff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

.favorite-btn:focus-visible {
    outline: 3px solid var(--color-primary);
    outline-offset: 2px;
}

/* Pulse animation on click */
@keyframes favorite-pulse {
    0%   { transform: scale(1); }
    40%  { transform: scale(1.25); }
    100% { transform: scale(1); }
}

.favorite-btn.pulse {
    animation: favorite-pulse 0.35s ease;
}

@media (prefers-reduced-motion: reduce) {
    .favorite-btn.pulse {
        animation: none;
    }
    .favorite-btn:hover {
        transform: none;
    }
}

/* Type filter (Alle / Ordner / Bilder / Videos / Favoriten) */
.type-filter {
    display: inline-flex;
    gap: 4px;
    padding: 4px;
    background: rgba(28, 159, 199, 0.08);
    border: 1px solid rgba(28, 159, 199, 0.2);
    border-radius: 999px;
    flex-wrap: wrap;
}

.type-filter-btn {
    background: transparent;
    border: none;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-muted);
    border-radius: 999px;
    cursor: pointer;
    transition: background var(--transition-fast), color var(--transition-fast), transform var(--transition-fast);
}

.type-filter-btn:hover {
    color: var(--color-primary);
    background: rgba(28, 159, 199, 0.1);
}

.type-filter-btn.active {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
    color: #fff;
    box-shadow: 0 2px 8px rgba(28, 159, 199, 0.35);
}

.type-filter-btn.favorites-filter-btn .star-icon {
    margin-right: 2px;
    color: var(--color-primary);
}

.type-filter-btn.favorites-filter-btn.active .star-icon {
    color: #fff;
}

/* Empty state (filters-aware) */
.gallery p.empty-state {
    padding: 40px 20px;
    font-size: 16px;
}

.gallery p.empty-state::before {
    display: none;
}

/* Caption sits beneath the image, like a photo credit. */
.image-name {
    margin-top: 8px;
    padding: 0 2px;
    font-size: 12px;
    font-weight: 400;
    font-style: italic;
    color: var(--color-text-soft);
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    pointer-events: none;
    font-variant-numeric: tabular-nums;
}

/* Form Modals — paper card on a subtle backdrop */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(20, 20, 24, 0.45);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    overscroll-behavior: contain;
    padding: 24px;
}

.modal.hidden {
    display: none;
}

.modal-content {
    position: relative;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 32px 32px 24px;
    max-width: 480px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
}

.modal-content h2 {
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 700;
    color: var(--color-text);
    letter-spacing: -0.005em;
    margin: 0 0 var(--space-md);
}

.close-modal {
    position: absolute;
    top: 12px;
    right: 12px;
    color: var(--color-text-faint);
    font-size: 22px;
    cursor: pointer;
    z-index: 1001;
    transition: color var(--transition-fast);
    width: 28px;
    height: 28px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border-radius: var(--radius-sm);
    border: none;
    padding: 0;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.close-modal:hover {
    color: var(--color-text);
    background: var(--color-surface-alt);
}

/* Preview Modal — full-bleed dark overlay, image centered */
.preview-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 15, 17, 0.95);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1100;
    overscroll-behavior: contain;
    padding: 24px;
}

.preview-modal.hidden {
    display: none;
}

.preview-close,
.preview-nav-btn,
.slideshow-btn {
    position: absolute;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.85);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: color var(--transition-fast), border-color var(--transition-fast);
    font-family: inherit;
    z-index: 1101;
}

.preview-close {
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-close:hover {
    color: white;
    border-color: rgba(255, 255, 255, 0.45);
}

.preview-counter {
    position: absolute;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 13px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.75);
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.04em;
    z-index: 1101;
}

.preview-nav-btn {
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.preview-nav-prev {
    left: 16px;
}

.preview-nav-next {
    right: 16px;
}

.preview-nav-btn:hover:not(:disabled) {
    color: white;
    border-color: rgba(255, 255, 255, 0.5);
}

.preview-nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.slideshow-btn {
    top: 16px;
    left: 16px;
    height: 36px;
    padding: 0 12px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.slideshow-icon {
    font-size: 11px;
}

.slideshow-btn:hover {
    color: white;
    border-color: rgba(255, 255, 255, 0.45);
}

.slideshow-btn.playing {
    color: var(--color-primary);
    border-color: var(--color-primary);
}

.slideshow-btn.playing:hover {
    color: white;
    border-color: var(--color-primary-hover);
    background: var(--color-primary);
}

.preview-container {
    max-width: 90vw;
    max-height: 78vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

#preview-image,
#preview-video {
    /* The <img> tag has width="1" height="1" attributes (CLS placeholder).
       Without explicit width/height auto, max-width:100% just caps a 1×1
       image and the preview renders as a single pixel — that was the
       "image preview shows path but no picture" bug. */
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 78vh;
    object-fit: contain;
    border-radius: 0;
    box-shadow: none;
    border: none;
    /* View-Transitions anchor: when a gallery thumb is morphed into the
       preview (and back on close), both share this name so the browser
       captures and animates the geometry change. */
    view-transition-name: preview-anchor;
}

/* Slow the morph slightly so the eye can follow it. */
::view-transition-group(preview-anchor) {
    animation-duration: 380ms;
    animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

::view-transition-image-pair(preview-anchor) {
    animation-duration: 380ms;
    animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

/* Page-level crossfade (rest of the chrome fading while modal shows/hides). */
::view-transition-group(root) {
    animation-duration: 220ms;
}

#preview-video {
    background: #000;
}

.preview-filename {
    margin-top: 16px;
    font-size: 13px;
    font-style: italic;
    color: rgba(255, 255, 255, 0.7);
    max-width: 80vw;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
}

.preview-hints {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 11px;
    color: rgba(255, 255, 255, 0.45);
    letter-spacing: 0.04em;
    text-align: center;
}

#preview-container {
    max-width: 100%;
    max-height: 80vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-nav {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.nav-btn {
    background: transparent;
    color: rgba(255, 255, 255, 0.85);
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.25);
}

.nav-btn:hover:not(:disabled) {
    color: white;
    border-color: rgba(255, 255, 255, 0.5);
}

.nav-btn:disabled {
    cursor: not-allowed;
    opacity: 0.4;
    border-color: rgba(255, 255, 255, 0.15);
}

/* Responsive */
@media (max-width: 768px) {
    .header-top {
        flex-direction: column;
        align-items: flex-start;
        padding: 15px;
        gap: 15px;
    }

    .header-title {
        width: 100%;
    }

    .header-title h1 {
        font-size: 20px;
    }

    .header-logo {
        width: 30px;
        height: 30px;
    }

    .header-controls {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .user-menu {
        width: 100%;
    }

    .user-menu-btn {
        width: 100%;
        justify-content: space-between;
    }

    .user-dropdown {
        right: auto;
        left: 0;
        width: 100%;
    }

    .user-info {
        width: 100%;
        text-align: center;
        font-size: 12px;
        padding: 6px 10px;
    }

    .btn-nav,
    .btn-secondary,
    .btn-primary {
        width: 100%;
        padding: 10px 16px;
        font-size: 14px;
        justify-content: center;
    }

    .btn-nav {
        border-bottom: none;
        border-left: 3px solid transparent;
    }

    .btn-nav.active {
        border-left-color: var(--color-primary);
        background: rgba(28, 159, 199, 0.1);
    }

    .gallery-toolbar {
        flex-direction: column;
        align-items: flex-start;
        padding: 15px;
        gap: 10px;
    }

    .toolbar-left,
    .toolbar-right {
        width: 100%;
    }

    .toolbar-right {
        flex-direction: column;
        gap: 8px;
    }

    .breadcrumb {
        padding: 10px 15px;
        font-size: 13px;
        flex-wrap: wrap;
    }

    .breadcrumb-item {
        font-size: 13px;
    }

    .gallery {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 15px;
        padding: 15px;
    }

    .media-card,
    .folder-card {
        min-height: 160px;
    }

    .media-card img,
    .media-card video {
        height: 120px;
    }

    .card-name {
        font-size: 12px;
        padding: 6px;
    }

    .checkbox {
        width: 20px;
        height: 20px;
        top: 6px;
        right: 6px;
    }

    /* Keep favorite button tap-friendly on mobile */
    .favorite-btn {
        top: 8px;
        left: 8px;
        width: 34px;
        height: 34px;
        min-width: 32px;
        min-height: 32px;
    }

    .favorite-btn .favorite-icon {
        font-size: 18px;
    }

    .type-filter {
        width: 100%;
        justify-content: flex-start;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap;
    }

    .type-filter-btn {
        white-space: nowrap;
    }

    .login-container {
        padding: 30px 20px;
        margin: 15px;
    }

    /* Admin page mobile */
    .admin-tabs {
        padding: 0 15px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .tab-btn {
        white-space: nowrap;
        padding: 12px 20px;
        font-size: 14px;
    }

    .admin-content {
        padding: 15px;
    }

    .users-table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .users-table {
        font-size: 12px;
    }

    .users-table th,
    .users-table td {
        padding: 8px;
    }

    /* FAQ mobile */
    .faq-content {
        padding: 0 15px;
    }

    .faq-toolbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .faq-toolbar h2 {
        font-size: 1.4em;
    }

    .faq-item {
        padding: 15px;
    }

    .faq-item-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .faq-actions {
        margin-left: 0;
        margin-top: 10px;
    }

    .faq-question {
        font-size: 1em;
    }

    /* Modal improvements */
    .modal-content {
        width: 95%;
        max-width: 95%;
        margin: 10px;
        padding: 20px;
    }

    #preview-image,
    #preview-video {
        max-height: 60vh;
    }

    .modal-nav {
        flex-direction: column;
        gap: 10px;
    }

    .nav-btn {
        width: 100%;
        padding: 12px;
    }
}

/* Empty state */
.gallery p {
    color: var(--color-text-soft);
    text-align: center;
    width: 100%;
    padding: 60px 20px;
    font-size: 16px;
    font-style: italic;
    font-weight: 400;
    background: transparent;
    border-radius: 0;
    box-shadow: none;
}

.gallery p::before {
    content: '';
    display: block;
    width: 56px;
    height: 56px;
    margin: 0 auto 16px;
    background: url('onewheel-header-logo.png') center/contain no-repeat;
    opacity: 0.4;
    filter: var(--logo-filter);
}

/* Folder Cards — same uniform aspect grid as image cards, with a folder icon. */
.folder-card {
    background: transparent;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
    transition: opacity var(--transition-fast);
    cursor: pointer;
    position: relative;
    border: none;
    display: flex;
    flex-direction: column;
    text-align: left;
    gap: 8px;
    content-visibility: auto;
    contain-intrinsic-size: 200px 240px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.folder-card::before {
    content: '';
    display: block;
    width: 100%;
    padding-top: 75%;
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    position: relative;
    /* Pseudo-elements don't always inherit the universal `* { box-sizing }`
       reset, so the right/bottom borders get pushed outside the 100% width
       and clipped. Pin it explicitly. */
    box-sizing: border-box;
    transition: border-color var(--transition-fast), background var(--transition-fast);
}

.folder-card:hover::before,
.folder-card:focus-visible::before {
    border-color: var(--color-primary);
    background: var(--color-primary-soft);
}

.folder-card .folder-icon {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    padding-top: 75%;
    pointer-events: none;
    display: block;
    /* Hide the emoji/text fallback inside .folder-icon — the real icon
       is rendered by ::after via an SVG mask. Without this, the emoji
       glyph overflows past padding-top and bleeds into .folder-name. */
    font-size: 0;
    line-height: 0;
    color: transparent;
}

.folder-card .folder-icon::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 56px;
    height: 44px;
    background: var(--color-text-faint);
    -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='currentColor'><path d='M3 6a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6z'/></svg>") center / contain no-repeat;
            mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='currentColor'><path d='M3 6a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6z'/></svg>") center / contain no-repeat;
    transition: background var(--transition-fast);
}

.folder-card:hover .folder-icon::after {
    background: var(--color-primary);
}

.folder-card.back-button .folder-icon::after {
    -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M14 7l-5 5 5 5' fill='none' stroke='currentColor' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/></svg>") center / 60% 60% no-repeat;
            mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M14 7l-5 5 5 5' fill='none' stroke='currentColor' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/></svg>") center / 60% 60% no-repeat;
}

/* The `←` text fallback inside .back-icon is hidden by the font-size:0 rule
   on .folder-icon above. Keep the element visible so its ::after (the SVG
   arrow mask) actually renders — display:none here used to hide it. */

.folder-card .folder-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text);
    word-break: break-word;
    overflow-wrap: anywhere;
    min-width: 0;
    line-height: 1.3;
    padding: 0 2px;
}

.folder-card.back-button .folder-name {
    font-style: italic;
    color: var(--color-text-soft);
}

/* Upload card — same grid footprint as a folder card, rendered last.
   Dashed border tile with a '+' centered and "Hochladen" label below. */
.upload-card {
    background: transparent;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
    cursor: pointer;
    position: relative;
    border: none;
    display: flex;
    flex-direction: column;
    text-align: left;
    gap: 8px;
    content-visibility: auto;
    contain-intrinsic-size: 200px 240px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transition: opacity var(--transition-fast);
}

.upload-card::before {
    content: '';
    display: block;
    width: 100%;
    padding-top: 75%;
    background: transparent;
    border: 1.5px dashed var(--color-border);
    border-radius: var(--radius-sm);
    box-sizing: border-box;
    transition: border-color var(--transition-fast), background var(--transition-fast);
}

.upload-card::after {
    content: '';
    position: absolute;
    top: 37.5%;
    left: 50%;
    width: 36px;
    height: 36px;
    transform: translate(-50%, -50%);
    background: var(--color-text-faint);
    -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M12 5v14M5 12h14' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round'/></svg>") center / contain no-repeat;
            mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M12 5v14M5 12h14' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round'/></svg>") center / contain no-repeat;
    transition: background var(--transition-fast);
    pointer-events: none;
}

.upload-card:hover::before,
.upload-card:focus-visible::before {
    border-color: var(--color-primary);
    background: var(--color-primary-soft);
}

.upload-card:hover::after,
.upload-card:focus-visible::after {
    background: var(--color-primary);
}

.upload-card:focus-visible {
    outline: none;
}

.upload-card-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text-soft);
    min-width: 0;
    line-height: 1.3;
    padding: 0 2px;
    transition: color var(--transition-fast);
}

.upload-card:hover .upload-card-label,
.upload-card:focus-visible .upload-card-label {
    color: var(--color-primary);
}

/* Form styles — editorial */
.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--color-text);
    font-size: 13px;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    line-height: 1.4;
    font-family: inherit;
    background: var(--color-surface);
    color: var(--color-text);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    box-sizing: border-box;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-soft);
}

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

.form-group small {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    color: var(--color-text-soft);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 30px;
}

/* ============================================
   Gallery Filter Bar (Search + Type filter)
   ============================================ */
.gallery-filterbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 48px;
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
    flex-wrap: wrap;
}

.search-wrapper {
    position: relative;
    flex: 1 1 280px;
    min-width: 200px;
    max-width: 420px;
    display: flex;
    align-items: center;
}

.search-input {
    width: 100%;
    padding: 10px 38px 10px 14px;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: 14px;
    background: var(--color-bg);
    color: var(--color-text);
    caret-color: var(--color-text);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    box-sizing: border-box;
}

.search-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(28, 159, 199, 0.15);
    background: var(--color-surface);
}

.search-input::-webkit-search-cancel-button,
.search-input::-webkit-search-decoration {
    -webkit-appearance: none;
    appearance: none;
}

.search-clear {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 26px;
    height: 26px;
    padding: 0;
    border: none;
    background: rgba(0, 0, 0, 0.08);
    color: var(--color-text-muted);
    border-radius: 50%;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition-fast), color var(--transition-fast);
}

.search-clear:hover {
    background: var(--color-primary);
    color: white;
}

.type-filter {
    display: inline-flex;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 3px;
    gap: 2px;
}

.type-filter-btn {
    background: transparent;
    border: none;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-muted);
    cursor: pointer;
    border-radius: calc(var(--radius-md) - 4px);
    transition: background var(--transition-fast), color var(--transition-fast);
}

.type-filter-btn:hover:not(.active) {
    background: rgba(28, 159, 199, 0.1);
    color: var(--color-primary);
}

.type-filter-btn.active {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-hover) 100%);
    color: white;
    box-shadow: 0 2px 6px rgba(28, 159, 199, 0.3);
}

/* Help button */
#shortcuts-help-btn {
    width: 38px;
    height: 38px;
    padding: 0;
    font-weight: 700;
    font-size: 18px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Empty filter result state */
.gallery-empty-filter {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    font-size: 16px;
    font-style: italic;
    color: var(--color-text-soft);
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    font-weight: 600;
}

/* ============================================
   Slideshow controls in preview
   ============================================ */
.preview-toolbar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 15px;
    background: rgba(0, 0, 0, 0.4);
    padding: 8px 16px;
    border-radius: 999px;
    backdrop-filter: blur(6px);
    color: white;
}

.preview-counter {
    font-size: 14px;
    font-weight: 600;
    min-width: 60px;
    text-align: center;
    color: white;
    font-variant-numeric: tabular-nums;
}

.slideshow-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: rgba(28, 159, 199, 0.85);
    color: white;
    border: none;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: background var(--transition-fast), transform var(--transition-fast);
}

.slideshow-btn:hover {
    background: var(--color-primary);
    transform: scale(1.05);
}

.slideshow-btn.playing {
    background: #27ae60;
}

.slideshow-btn.playing:hover {
    background: #2ecc71;
}

.slideshow-icon {
    font-size: 14px;
    line-height: 1;
}

/* ============================================
   Shortcuts help modal
   ============================================ */
.shortcuts-modal-content {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: 36px 40px;
    max-width: 500px;
    width: 92%;
    box-shadow: var(--shadow-xl);
    color: var(--color-text);
}

.shortcuts-modal-content .close-modal {
    top: 12px;
    right: 12px;
    color: var(--color-text-muted);
    background: transparent;
    font-size: 28px;
    width: 36px;
    height: 36px;
}

.shortcuts-modal-content .close-modal:hover {
    background: var(--color-primary);
    color: white;
    transform: rotate(90deg);
}

.shortcuts-modal-content h2 {
    margin-bottom: 24px;
    color: var(--color-text);
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.shortcuts-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.shortcut-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    background: var(--color-bg);
}

.shortcut-row dt {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.shortcut-row dd {
    text-align: right;
    font-size: 14px;
    color: var(--color-text-muted);
}

kbd {
    display: inline-block;
    padding: 3px 8px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-bottom-width: 2px;
    border-radius: 4px;
    font-family: 'SFMono-Regular', Menlo, Monaco, Consolas, 'Courier New', monospace;
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text);
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.05);
    min-width: 22px;
    text-align: center;
}

/* ============================================
   Rubber-band (drag-to-select) overlay
   ============================================ */
.rubber-band {
    position: fixed;
    pointer-events: none;
    background: rgba(28, 159, 199, 0.15);
    border: 1.5px solid var(--color-primary);
    border-radius: 2px;
    z-index: 500;
}

.rubber-band.hidden {
    display: none;
}

/* Disable text selection while rubber-banding */
body.rubber-banding {
    user-select: none;
    -webkit-user-select: none;
}

body.rubber-banding .image-card,
body.rubber-banding .folder-card {
    cursor: crosshair;
}

/* ============================================
   Breadcrumb dropdown
   ============================================ */
.breadcrumb-item-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.breadcrumb-dropdown-toggle {
    background: transparent;
    border: none;
    padding: 2px 6px;
    margin-left: 2px;
    font-size: 11px;
    color: var(--color-text-muted);
    cursor: pointer;
    border-radius: 4px;
    line-height: 1;
    transition: background var(--transition-fast), color var(--transition-fast);
}

.breadcrumb-dropdown-toggle:hover,
.breadcrumb-dropdown-toggle[aria-expanded="true"] {
    background: rgba(28, 159, 199, 0.15);
    color: var(--color-primary);
}

.breadcrumb-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    min-width: 180px;
    max-width: 280px;
    max-height: 320px;
    overflow-y: auto;
    z-index: 900;
    padding: 4px 0;
}

.breadcrumb-dropdown.hidden {
    display: none;
}

.breadcrumb-dropdown-item {
    display: block;
    width: 100%;
    padding: 8px 14px;
    background: transparent;
    border: none;
    text-align: left;
    font-size: 13px;
    color: var(--color-text);
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: background var(--transition-fast);
}

.breadcrumb-dropdown-item:hover,
.breadcrumb-dropdown-item:focus-visible {
    background: var(--color-primary-soft);
    color: var(--color-primary);
    outline: none;
}

.breadcrumb-dropdown-item.current {
    font-weight: 700;
    color: var(--color-primary);
    background: var(--color-primary-soft);
}

.breadcrumb-dropdown-empty {
    padding: 10px 14px;
    font-size: 13px;
    color: var(--color-text-muted);
    font-style: italic;
}

/* ============================================
   Filter bar mobile
   ============================================ */
@media (max-width: 768px) {
    .gallery-filterbar {
        padding: 10px 15px;
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .search-wrapper {
        max-width: 100%;
    }

    .type-filter {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        justify-content: flex-start;
    }

    .type-filter-btn {
        flex-shrink: 0;
    }

    .preview-toolbar {
        margin-bottom: 10px;
        padding: 6px 12px;
        gap: 10px;
    }

    .slideshow-btn .slideshow-label {
        display: none;
    }

    .shortcuts-modal-content {
        padding: 24px 20px;
    }

    .shortcut-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .shortcut-row dd {
        text-align: left;
    }

    .breadcrumb-dropdown {
        max-width: 90vw;
    }
}

/* ============================================
   Reduced motion support for new features
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    .slideshow-btn,
    .type-filter-btn,
    .search-input,
    .search-clear,
    .breadcrumb-dropdown-toggle,
    .breadcrumb-dropdown-item {
        transition: none !important;
    }

    .slideshow-btn:hover {
        transform: none;
    }
}

/* ============================================
   Dark theme variants for new features
   ============================================ */
/* Filterbar / search / shortcuts / breadcrumb-dropdown / kbd:
   base rules in this file are already token-driven, so dark mode just
   adapts. No overrides needed. */
/* ============================================
   Dark Mode Toggle Button
   ============================================ */
.btn-dark-mode {
    background: transparent;
    border: 1px solid var(--color-border);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast);
    padding: 0;
    font-size: 20px;
    flex-shrink: 0;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.btn-dark-mode:hover {
    background: var(--color-primary-soft);
    border-color: var(--color-primary);
    transform: scale(1.1);
}

.dark-mode-icon::after {
    content: '\263D';
}

[data-theme="dark"] .dark-mode-icon::after {
    content: '\2600';
}

/* ============================================
   Password Visibility Toggle
   ============================================ */
.password-input-wrapper {
    position: relative;
    width: 100%;
}

.password-input-wrapper input[type="password"],
.password-input-wrapper input[type="text"] {
    width: 100%;
    padding-right: 50px;
}

.toggle-password-btn {
    position: absolute;
    right: 6px;
    top: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    font-size: 18px;
    color: var(--color-text-muted);
    transition: color var(--transition-fast);
    line-height: 1;
    border-radius: 4px;
}

.toggle-password-btn:hover {
    color: var(--color-primary);
}

.eye-icon::after {
    content: '\1F441';
}

.eye-icon.visible::after {
    content: '\1F440';
}

/* Login screen sits on plain paper — no decorative blobs.
   The OneWheel logo + form do all the talking. */
#login-screen {
    background: var(--color-bg);
}

/* ============================================
   Dark Mode Color Scheme — DELETED
   The authoritative dark tokens live at the top of this file
   (html[data-theme="dark"] block, ~line 79). The previous override
   block here silently re-defined them with a navy/purple palette that
   collided with the editorial paper-and-ink design and caused every
   downstream dark-mode bug. Body inherits --color-bg / --color-text.
   ============================================ */

/* Dark-mode login: same blob structure, just with the dark bg base.
   Pseudo-blob colors are overridden directly above near the blob rules. */
[data-theme="dark"] #login-screen {
    background: var(--color-bg);
}

/* .login-container is designed transparent in light mode; keep it transparent
   in dark mode too — adding a solid background here paints the gaps between
   form fields as harsh horizontal bands. */

/* Inputs inherit --color-surface / --color-border / --color-text from the
   dark theme token block at the top of this file — no extra rules needed.
   Placeholder color is unified via the base input::placeholder rule. */

/* ============================================
   Dark-mode targeted overrides
   Everything else inherits via tokens defined at the top of this file.
   Only the rules where a base hardcoded color would look broken in dark
   mode (or where a semantic animation needs a different palette) live here.
   ============================================ */

/* Shimmer animation uses surface tones explicitly because the gradient
   stops are mid-animation values, not steady-state palette. */
[data-theme="dark"] .image-wrapper.loading {
    background: linear-gradient(90deg,
        var(--color-surface-inset) 25%,
        var(--color-surface-alt) 50%,
        var(--color-surface-inset) 75%);
    background-size: 200% 100%;
}

/* Checkbox/media-error overlays use a translucent surface in dark mode so
   they stay readable over the underlying image. */
[data-theme="dark"] .checkbox-overlay {
    background: rgba(28, 28, 32, 0.95);
    border-color: var(--color-primary-hover);
}

[data-theme="dark"] .media-error {
    background: rgba(28, 28, 32, 0.95);
}

/* OS-auto dark-mode fallback: re-use the editorial dark tokens when the
   user has not explicitly chosen a theme via data-theme. */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]):not([data-theme="dark"]) {
        --color-bg: #16161a;
        --color-surface: #1c1c20;
        --color-surface-alt: #212126;
        --color-surface-inset: #0e0e10;
        --color-text: #ededeb;
        --color-text-muted: #cbc9c4;
        --color-text-soft: #9a9892;
        --color-text-faint: #6b6b66;
        --color-border: #2a2a2e;
        --color-border-soft: #252528;
        --color-border-faint: #1f1f22;
        --color-primary: #2eb4d6;
        --color-primary-hover: #5cc4e0;
        --color-primary-soft: rgba(46, 180, 214, 0.16);
        --color-primary-soft-hover: rgba(46, 180, 214, 0.26);
        --color-primary-text-on-soft: #7ad2e8;
        --logo-filter: invert(1);
        --shadow-card-hover: 0 2px 8px rgba(0, 0, 0, 0.5);
        color-scheme: dark;
    }
}

/* ========== Card Entrance Animations ========== */
.card-enter {
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.card-enter.card-visible {
    opacity: 1;
    transform: none;
}

@media (prefers-reduced-motion: reduce) {
    .card-enter,
    .card-enter.card-visible {
        opacity: 1;
        transform: none;
        transition: none;
    }
}

/* ========== Drag & Drop Upload ========== */
.upload-drop-overlay {
    position: fixed;
    inset: 0;
    background: rgba(28, 159, 199, 0.35);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    animation: upload-overlay-fade-in 0.15s ease;
}

.upload-drop-overlay.hidden {
    display: none !important;
}

.upload-drop-message {
    background: var(--color-surface);
    color: var(--color-text);
    border: 3px dashed var(--color-primary);
    border-radius: var(--radius-lg);
    padding: 40px 60px;
    text-align: center;
    box-shadow: var(--shadow-md);
    max-width: 90vw;
}

.upload-drop-icon {
    font-size: 56px;
    color: var(--color-primary);
    margin-bottom: 12px;
    line-height: 1;
    animation: upload-drop-bounce 1s ease-in-out infinite;
}

.upload-drop-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 6px;
}

.upload-drop-target {
    font-size: 16px;
    font-weight: 700;
    color: var(--color-primary);
    word-break: break-all;
}

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

@keyframes upload-drop-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

/* upload-drop overlay/message inherit --color-surface / --color-text /
   --color-primary tokens — no dark override needed. */

/* Upload queue card */
.upload-queue-card {
    position: fixed;
    bottom: 100px;
    right: 20px;
    width: 360px;
    max-width: 360px;
    max-height: 70vh;
    background: var(--color-surface);
    color: var(--color-text);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: upload-queue-slide-in 0.25s ease;
}

.upload-queue-card.hidden {
    display: none !important;
}

@keyframes upload-queue-slide-in {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.upload-queue-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-hover) 100%);
    color: #fff;
    font-weight: 700;
    font-size: 14px;
}

.upload-queue-title {
    flex: 1;
}

.upload-queue-close {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 22px;
    line-height: 1;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition-fast);
}

.upload-queue-close:hover,
.upload-queue-close:focus-visible {
    background: rgba(255, 255, 255, 0.2);
    outline: none;
}

.upload-queue-list {
    list-style: none;
    margin: 0;
    padding: 0;
    overflow-y: auto;
    max-height: calc(70vh - 44px);
}

.upload-queue-item {
    padding: 10px 12px;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.upload-queue-item:last-child {
    border-bottom: none;
}

.upload-queue-item-top {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.upload-queue-item-name {
    flex: 1;
    min-width: 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.upload-queue-item-size {
    font-size: 11px;
    color: var(--color-text-muted);
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}

.upload-queue-progress {
    width: 100%;
    height: 6px;
    background: var(--color-surface-alt);
    border-radius: 3px;
    overflow: hidden;
}

.upload-queue-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-hover) 100%);
    transition: width 0.15s ease;
}

.upload-queue-item.success .upload-queue-progress-fill {
    width: 100% !important;
    background: var(--color-success);
}

.upload-queue-item.error .upload-queue-progress-fill {
    background: var(--color-error);
}

.upload-queue-item-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 12px;
}

.upload-queue-item-status {
    color: var(--color-text-muted);
    font-variant-numeric: tabular-nums;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.upload-queue-item.success .upload-queue-item-status {
    color: var(--color-success);
    font-weight: 600;
}

.upload-queue-item.error .upload-queue-item-status {
    color: var(--color-error);
    font-weight: 600;
}

.upload-queue-item-retry {
    background: transparent;
    border: 1px solid var(--color-primary);
    color: var(--color-primary);
    border-radius: 12px;
    padding: 2px 10px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--transition-fast), color var(--transition-fast);
    flex-shrink: 0;
}

.upload-queue-item-retry:hover,
.upload-queue-item-retry:focus-visible {
    background: var(--color-primary);
    color: #fff;
    outline: none;
}

.upload-queue-item-target {
    font-size: 11px;
    color: var(--color-text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* upload-queue inherits --color-surface / --color-text / --color-border /
   --color-text-muted / --color-surface-alt tokens — no overrides needed. */

@media (max-width: 768px) {
    .upload-queue-card {
        left: 12px;
        right: 12px;
        bottom: 80px;
        width: auto;
        max-width: none;
    }

    .upload-drop-message {
        padding: 24px 32px;
    }

    .upload-drop-icon {
        font-size: 44px;
    }

    .upload-drop-title {
        font-size: 15px;
    }

    .upload-drop-target {
        font-size: 14px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .upload-drop-overlay,
    .upload-queue-card {
        animation: none;
    }

    .upload-drop-icon {
        animation: none;
    }

    .upload-queue-progress-fill {
        transition: none;
    }
}

/* ============================================
   Global search button (header)
   ============================================ */
.btn-global-search {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: transparent;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    color: var(--color-text-muted);
    font-size: 14px;
    cursor: pointer;
    transition: background-color var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
    flex-shrink: 0;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.btn-global-search:hover,
.btn-global-search:focus-visible {
    background: rgba(28, 159, 199, 0.1);
    border-color: var(--color-primary);
    color: var(--color-primary);
    outline: none;
}

.btn-global-search:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

.global-search-icon {
    display: inline-block;
    width: 14px;
    height: 14px;
    background-color: currentColor;
    -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='8'/><line x1='21' y1='21' x2='16.65' y2='16.65'/></svg>") center/contain no-repeat;
    mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='8'/><line x1='21' y1='21' x2='16.65' y2='16.65'/></svg>") center/contain no-repeat;
    flex-shrink: 0;
}

.global-search-label {
    font-weight: 600;
}

.global-search-kbd {
    display: inline-flex;
    align-items: center;
}

.btn-global-search .global-search-kbd kbd {
    font-size: 11px;
    padding: 2px 6px;
    min-width: 20px;
}

/* btn-global-search inherits tokens — no override needed. */

@media (max-width: 600px) {
    .btn-global-search {
        padding: 8px 10px;
    }

    .global-search-label,
    .global-search-kbd {
        display: none;
    }
}

/* ============================================
   Global search palette (command-palette modal)
   ============================================ */
.search-palette {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(5px);
    z-index: 1100;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 10vh 16px 16px;
    overscroll-behavior: contain;
    animation: searchPaletteFadeIn 0.18s ease-out;
}

.search-palette.hidden {
    display: none;
}

@keyframes searchPaletteFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes searchPaletteSlideIn {
    from { opacity: 0; transform: translateY(-8px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.search-palette-card {
    width: 100%;
    max-width: 560px;
    background: var(--color-surface);
    color: var(--color-text);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35), 0 2px 8px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: min(80vh, 640px);
    animation: searchPaletteSlideIn 0.2s ease-out;
}

.search-palette-input-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--color-border);
}

.search-palette-icon {
    display: inline-block;
    width: 18px;
    height: 18px;
    background-color: var(--color-text-muted);
    -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='8'/><line x1='21' y1='21' x2='16.65' y2='16.65'/></svg>") center/contain no-repeat;
    mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='8'/><line x1='21' y1='21' x2='16.65' y2='16.65'/></svg>") center/contain no-repeat;
    flex-shrink: 0;
}

.search-palette-input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-size: 16px;
    color: var(--color-text);
    padding: 4px 0;
    min-width: 0;
}

.search-palette-input::placeholder {
    color: var(--color-text-muted);
    opacity: 0.8;
}

.search-palette-input:focus {
    outline: none;
}

.search-palette-card:focus-within .search-palette-input-row {
    box-shadow: inset 0 -2px 0 var(--color-primary);
}

.search-palette-status {
    font-size: 12px;
    color: var(--color-text-muted);
    flex-shrink: 0;
    min-width: 20px;
    text-align: right;
}

.search-palette-close {
    background: transparent;
    border: none;
    color: var(--color-text-muted);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color var(--transition-fast), color var(--transition-fast);
    padding: 0;
    flex-shrink: 0;
}

.search-palette-close:hover,
.search-palette-close:focus-visible {
    background: var(--color-primary);
    color: white;
    outline: none;
}

.search-palette-results {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
    -webkit-overflow-scrolling: touch;
}

.search-palette-results:focus {
    outline: none;
}

.search-palette-hint,
.search-palette-empty,
.search-palette-loading,
.search-palette-error {
    padding: 20px 18px;
    color: var(--color-text-muted);
    font-size: 14px;
    text-align: center;
}

.search-palette-error {
    color: var(--color-error);
}

.search-palette-section {
    padding: 6px 0 10px;
}

.search-palette-section-title {
    padding: 8px 18px 6px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-text-muted);
}

.search-palette-result {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 18px;
    cursor: pointer;
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
    color: var(--color-text);
    font-size: 14px;
    line-height: 1.3;
    transition: background-color var(--transition-fast);
}

.search-palette-result:hover {
    background: var(--color-primary-soft);
}

.search-palette-result.is-active {
    background: var(--color-primary-soft-hover);
}

.search-palette-result:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: -2px;
}

.search-palette-result-icon {
    font-size: 18px;
    flex-shrink: 0;
    width: 22px;
    text-align: center;
}

.search-palette-result-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.search-palette-result-name {
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-palette-result-context {
    font-size: 12px;
    color: var(--color-text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-palette-footer {
    display: flex;
    gap: 16px;
    padding: 10px 16px;
    border-top: 1px solid var(--color-border);
    background: var(--color-bg);
    font-size: 12px;
    color: var(--color-text-muted);
    flex-wrap: wrap;
}

.search-palette-footer kbd {
    font-size: 10px;
    padding: 1px 5px;
    min-width: 18px;
}

/* search-palette family fully token-driven; no dark overrides needed. */

/* Mobile: full-screen card */
@media (max-width: 600px) {
    .search-palette {
        padding: 0;
        align-items: stretch;
    }

    .search-palette-card {
        max-width: none;
        border-radius: 0;
        max-height: none;
        height: 100%;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .search-palette,
    .search-palette-card {
        animation: none;
    }

    .search-palette-result {
        transition: none;
    }
}
