/* ========== Windows 11 Fluent Design Variables ========== */
:root {
    /* Light Mode Colors */
    --bg-solid: #f3f3f3;
    --bg-mica: rgba(243, 243, 243, 0.85);
    --bg-card: rgba(255, 255, 255, 0.7);
    --bg-card-hover: rgba(255, 255, 255, 0.9);
    --bg-subtle: rgba(0, 0, 0, 0.03);
    --bg-input: rgba(255, 255, 255, 0.7);
    --bg-input-focus: rgba(255, 255, 255, 1);

    --text-primary: #1a1a1a;
    --text-secondary: #616161;
    --text-tertiary: #8a8a8a;
    --text-disabled: #a0a0a0;

    --accent: #0078d4;
    --accent-light: #60cdff;
    --accent-hover: #106ebe;
    --accent-subtle: rgba(0, 120, 212, 0.08);

    --success: #107c10;
    --warning: #f7630c;
    --error: #c42b1c;

    --border-default: rgba(0, 0, 0, 0.06);
    --border-subtle: rgba(0, 0, 0, 0.04);
    --border-strong: rgba(0, 0, 0, 0.1);

    --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.04), 0 0 1px rgba(0, 0, 0, 0.08);
    --shadow-flyout: 0 8px 32px rgba(0, 0, 0, 0.12), 0 0 1px rgba(0, 0, 0, 0.1);
    --shadow-dialog: 0 16px 64px rgba(0, 0, 0, 0.18), 0 0 1px rgba(0, 0, 0, 0.12);
    --header-primary: #2563eb;
    --header-primary-hover: #1d4ed8;
    --header-text-main: #1f2937;
    --header-text-sub: #6b7280;
    --header-bg: rgba(255, 255, 255, 0.95);
    --header-border: #e5e7eb;
    --header-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);

    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;

    --backdrop-blur: blur(20px) saturate(125%);

    --transition-fast: 0.1s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Mode */
[data-theme="dark"] {
    --bg-solid: #202020;
    --bg-mica: rgba(32, 32, 32, 0.85);
    --bg-card: rgba(45, 45, 45, 0.7);
    --bg-card-hover: rgba(55, 55, 55, 0.85);
    --bg-subtle: rgba(255, 255, 255, 0.04);
    --bg-input: rgba(45, 45, 45, 0.7);
    --bg-input-focus: rgba(60, 60, 60, 1);

    --text-primary: #ffffff;
    --text-secondary: #c5c5c5;
    --text-tertiary: #9e9e9e;
    --text-disabled: #6d6d6d;

    --accent: #60cdff;
    --accent-light: #99ebff;
    --accent-hover: #4cc2ff;
    --accent-subtle: rgba(96, 205, 255, 0.1);

    --success: #6ccb5f;
    --warning: #fcb849;
    --error: #ff99a4;

    --border-default: rgba(255, 255, 255, 0.08);
    --border-subtle: rgba(255, 255, 255, 0.04);
    --border-strong: rgba(255, 255, 255, 0.12);

    --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.2), 0 0 1px rgba(0, 0, 0, 0.3);
    --shadow-flyout: 0 8px 32px rgba(0, 0, 0, 0.36), 0 0 1px rgba(0, 0, 0, 0.4);
    --shadow-dialog: 0 16px 64px rgba(0, 0, 0, 0.48), 0 0 1px rgba(0, 0, 0, 0.5);
    --header-bg: var(--bg-card);
    --header-text-main: var(--text-primary);
    --header-text-sub: var(--text-secondary);
    --header-border: var(--border-default);
}

/* System preference auto detection */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg-solid: #202020;
        --bg-mica: rgba(32, 32, 32, 0.85);
        --bg-card: rgba(45, 45, 45, 0.7);
        --bg-card-hover: rgba(55, 55, 55, 0.85);
        --bg-subtle: rgba(255, 255, 255, 0.04);
        --bg-input: rgba(45, 45, 45, 0.7);
        --bg-input-focus: rgba(60, 60, 60, 1);

        --text-primary: #ffffff;
        --text-secondary: #c5c5c5;
        --text-tertiary: #9e9e9e;
        --text-disabled: #6d6d6d;

        --accent: #60cdff;
        --accent-light: #99ebff;
        --accent-hover: #4cc2ff;
        --accent-subtle: rgba(96, 205, 255, 0.1);

        --success: #6ccb5f;
        --warning: #fcb849;
        --error: #ff99a4;

        --border-default: rgba(255, 255, 255, 0.08);
        --border-subtle: rgba(255, 255, 255, 0.04);
        --border-strong: rgba(255, 255, 255, 0.12);

        --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.2), 0 0 1px rgba(0, 0, 0, 0.3);
        --shadow-flyout: 0 8px 32px rgba(0, 0, 0, 0.36), 0 0 1px rgba(0, 0, 0, 0.4);
        --shadow-dialog: 0 16px 64px rgba(0, 0, 0, 0.48), 0 0 1px rgba(0, 0, 0, 0.5);
        --header-bg: var(--bg-card);
        --header-text-main: var(--text-primary);
        --header-text-sub: var(--text-secondary);
        --header-border: var(--border-default);
    }
}

/* ========== Base Reset ========== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI Variable', 'Segoe UI', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-solid);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ========== Login Page ========== */
.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: var(--bg-solid);
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: 
        radial-gradient(ellipse at 20% 20%, rgba(96, 205, 255, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(0, 120, 212, 0.12) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(96, 205, 255, 0.08) 0%, transparent 70%);
    animation: bgFloat 20s ease-in-out infinite;
    pointer-events: none;
}

@keyframes bgFloat {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(2%, 2%) rotate(1deg); }
    66% { transform: translate(-1%, 1%) rotate(-1deg); }
}

.login-container {
    background: var(--bg-card);
    backdrop-filter: var(--backdrop-blur);
    -webkit-backdrop-filter: var(--backdrop-blur);
    padding: 48px 44px;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-dialog);
    border: 1px solid var(--border-default);
    width: 100%;
    max-width: 420px;
    position: relative;
    z-index: 1;
    animation: slideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(24px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.login-logo {
    text-align: center;
    margin-bottom: 8px;
}

.login-logo .logo-icon {
    font-size: 3.5rem;
    display: block;
    margin-bottom: 16px;
    filter: drop-shadow(0 4px 12px rgba(0, 120, 212, 0.2));
}

.login-container h1 {
    font-size: 1.75rem;
    font-weight: 600;
    text-align: center;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.login-subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 32px;
    font-size: 0.9rem;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.login-form .form-group {
    margin-bottom: 0;
}

.login-form label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--text-primary);
}

.login-form .label-icon {
    font-size: 1rem;
    opacity: 0.7;
}

.login-form input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

.login-form input::placeholder {
    color: var(--text-tertiary);
}

.login-form input:hover {
    background: var(--bg-input-focus);
    border-color: var(--border-strong);
}

.login-form input:focus {
    outline: none;
    background: var(--bg-input-focus);
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent);
}

.login-form .btn-primary {
    margin-top: 8px;
    padding: 12px 24px;
    font-weight: 600;
    border-radius: var(--radius-md);
}

.login-error {
    color: var(--error);
    text-align: center;
    padding: 12px 16px;
    font-size: 0.875rem;
    background: rgba(196, 43, 28, 0.08);
    border: 1px solid rgba(196, 43, 28, 0.2);
    border-radius: var(--radius-md);
    animation: shake 0.4s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-6px); }
    75% { transform: translateX(6px); }
}

.login-footer {
    margin-top: 32px;
    padding-top: 20px;
    border-top: 1px solid var(--border-default);
    text-align: center;
}

.login-footer p {
    color: var(--text-tertiary);
    font-size: 0.75rem;
}

/* ========== Main App Container ========== */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
}

/* ========== Header ========== */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: var(--bg-card);
    backdrop-filter: var(--backdrop-blur);
    -webkit-backdrop-filter: var(--backdrop-blur);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    border: 1px solid var(--border-subtle);
    margin-bottom: 24px;
    gap: 16px;
    flex-wrap: wrap;
}

.header-brand {
    display: flex;
    align-items: center;
}

.header h1 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.visitor-shell {
    max-width: 1200px;
}

.visitor-header {
    align-items: center;
    padding: 16px 24px;
    background: var(--header-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    border: 1px solid var(--header-border);
    margin-bottom: 24px;
    gap: 16px;
    flex-wrap: wrap;
}

.visitor-header .header-brand h1 {
    color: var(--header-text-main);
    font-weight: 700;
    letter-spacing: -0.025em;
}

.brand-accent {
    color: var(--header-primary);
}

.visitor-tagline {
    margin-left: 12px;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.visitor-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.visitor-header .theme-toggle {
    width: 40px;
    height: 40px;
    padding: 8px;
    border-radius: 50%;
    border: 1px solid transparent;
    background: transparent;
    color: var(--header-text-sub);
    transition: var(--transition-normal);
}

.visitor-header .theme-toggle:hover {
    background: rgba(37, 99, 235, 0.08);
    color: var(--header-primary);
}

.visitor-header .theme-toggle:active {
    transform: translateY(0);
}

.visitor-header .theme-icon {
    width: 20px;
    height: 20px;
}

.login-btn {
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 38px;
    padding: 0 24px;
    border-radius: 999px;
    background-color: var(--header-primary);
    border: 1px solid var(--header-primary);
    color: #ffffff;
    font-weight: 600;
    font-size: 0.9rem;
    transition: var(--transition-normal);
    box-shadow: 0 2px 5px rgba(37, 99, 235, 0.2);
}

.login-btn:hover {
    background-color: var(--header-primary-hover);
    border-color: var(--header-primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.login-btn:active {
    transform: translateY(0);
}

.visitor-hero {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    padding: 24px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-card);
    margin-bottom: 24px;
}

.hero-content h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.hero-content p {
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.hero-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.hero-tags span {
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    background: var(--bg-subtle);
    color: var(--text-secondary);
    font-size: 0.75rem;
}

.hero-tip {
    min-width: 220px;
    font-size: 0.875rem;
    color: var(--text-secondary);
    background: var(--bg-subtle);
    border-radius: var(--radius-md);
    padding: 12px 16px;
}

.hero-tip a {
    color: var(--accent);
    font-weight: 600;
    text-decoration: none;
}

.hero-tip a:hover {
    text-decoration: underline;
}

/* Theme Toggle - Minimal Design */
.theme-toggle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-normal);
    position: relative;
}

.theme-toggle:hover {
    background: var(--bg-subtle);
    color: var(--text-primary);
}

.theme-toggle:active {
    transform: scale(0.92);
}

.theme-toggle .theme-icon {
    width: 20px;
    height: 20px;
    transition: all var(--transition-normal);
}

.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
    position: absolute;
    transition: all var(--transition-normal);
}

.theme-toggle .icon-sun {
    opacity: 0;
    transform: rotate(-90deg) scale(0.5);
}

.theme-toggle .icon-moon {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

[data-theme="dark"] .theme-toggle .icon-sun {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

[data-theme="dark"] .theme-toggle .icon-moon {
    opacity: 0;
    transform: rotate(90deg) scale(0.5);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .theme-toggle .icon-sun {
        opacity: 1;
        transform: rotate(0deg) scale(1);
    }
    :root:not([data-theme="light"]) .theme-toggle .icon-moon {
        opacity: 0;
        transform: rotate(90deg) scale(0.5);
    }
}

.logout-btn {
    padding: 8px 16px;
    font-size: 0.875rem;
}

/* ========== Navigation Tabs ========== */
.nav-tabs {
    display: flex;
    gap: 4px;
    background: var(--bg-subtle);
    padding: 4px;
    border-radius: var(--radius-md);
}

.tab-btn {
    padding: 8px 20px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 0.875rem;
    font-weight: 500;
    white-space: nowrap;
}

.tab-btn:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.tab-btn.active {
    background: var(--bg-card);
    color: var(--accent);
    box-shadow: var(--shadow-card);
}

/* ========== Tab Content ========== */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ========== Generate Layout ========== */
.generate-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

/* ========== Cards / Panels ========== */
.input-panel,
.result-panel,
.management-panel {
    width: 100%;
    margin: 0;
    background: var(--bg-card);
    backdrop-filter: var(--backdrop-blur);
    -webkit-backdrop-filter: var(--backdrop-blur);
    padding: 24px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    border: 1px solid var(--border-subtle);
    position: relative;
    z-index: 1;
}

.input-panel {
    z-index: 2;
}

/* ========== Form Styles ========== */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--text-primary);
}

.form-group .required {
    color: var(--error);
}

.form-group textarea,
.form-group input[type="text"],
.form-group input[type="number"],
.form-group select {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: inherit;
    resize: vertical;
    transition: all var(--transition-fast);
}

.form-group select {
    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 12 12'%3E%3Cpath fill='%23616161' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.form-group textarea:hover,
.form-group input:hover,
.form-group select:hover {
    background: var(--bg-input-focus);
    border-color: var(--border-strong);
}

.form-group textarea:focus,
.form-group input:focus,
.form-group select:focus {
    outline: none;
    background: var(--bg-input-focus);
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent);
}

.form-hint {
    margin-top: 6px;
    font-size: 0.75rem;
    color: var(--text-tertiary);
}

.form-row {
    display: flex;
    gap: 16px;
}

.form-group.half {
    flex: 1;
}

/* ========== Slider Input ========== */
.slider-container {
    display: flex;
    align-items: center;
    padding: 6px 0;
}

.slider-track {
    position: relative;
    flex: 1;
    height: 6px;
    background: var(--bg-subtle);
    border-radius: 3px;
    cursor: pointer;
}

.slider-fill {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background: var(--header-primary);
    border-radius: 3px;
    pointer-events: none;
}

.slider-thumb {
    position: absolute;
    top: 50%;
    width: 18px;
    height: 18px;
    background: var(--header-primary);
    border: 2px solid var(--bg-card);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    cursor: grab;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.slider-thumb:hover {
    transform: translate(-50%, -50%) scale(1.1);
    box-shadow: 0 3px 10px rgba(37, 99, 235, 0.4);
}

.slider-thumb:active {
    cursor: grabbing;
    transform: translate(-50%, -50%) scale(1.15);
}

.slider-input-hidden {
    display: none;
}

/* ========== Custom Dropdown ========== */
.custom-dropdown {
    position: relative;
    flex: 1;
    min-width: 0;
}

.dropdown-label {
    font-size: 0.875rem;
    color: var(--text-primary);
    font-weight: 500;
    margin-bottom: 6px;
    display: block;
    white-space: nowrap;
}

.dropdown-trigger {
    width: 100%;
    height: 40px;
    padding: 0 12px;
    background: var(--bg-input);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all var(--transition-fast);
    text-align: left;
    font-family: inherit;
}

.dropdown-trigger:hover {
    background: var(--bg-input-focus);
    border-color: var(--border-strong);
}

.dropdown-trigger.active {
    border-color: var(--accent);
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    background: var(--bg-input-focus);
}

.dropdown-trigger .dropdown-arrow {
    width: 10px;
    height: 10px;
    color: var(--text-tertiary);
    transition: transform var(--transition-fast);
    flex-shrink: 0;
    margin-left: 8px;
}

.dropdown-trigger.active .dropdown-arrow {
    transform: rotate(180deg);
    color: var(--accent);
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-input-focus);
    border: 1px solid var(--border-default);
    border-top: none;
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    z-index: 500;
    opacity: 0;
    visibility: hidden;
    transform: scaleY(0);
    transform-origin: top;
    transition: all 0.15s ease;
    max-height: 280px;
    overflow-y: auto;
    overflow-x: hidden;
}

.dropdown-menu::-webkit-scrollbar {
    width: 6px;
}

.dropdown-menu::-webkit-scrollbar-track {
    background: transparent;
}

.dropdown-menu::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: 3px;
}

.dropdown-menu::-webkit-scrollbar-thumb:hover {
    background: var(--text-tertiary);
}

.dropdown-menu.open {
    opacity: 1;
    visibility: visible;
    transform: scaleY(1);
}

.dropdown-item {
    padding: 10px 12px;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.875rem;
    color: var(--text-primary);
    position: relative;
    border-left: 2px solid transparent;
}

.dropdown-item:hover {
    background: var(--bg-subtle);
}

.dropdown-item.selected {
    background: var(--accent-subtle);
    border-left-color: var(--accent);
    color: var(--accent);
}

.dropdown-item .item-check {
    margin-left: auto;
    font-size: 0.75rem;
    color: var(--accent);
    opacity: 0;
    transform: scale(0.8);
    transition: all var(--transition-fast);
}

.dropdown-item.selected .item-check {
    opacity: 1;
    transform: scale(1);
}

.dropdown-item:last-child {
    border-radius: 0 0 var(--radius-md) var(--radius-md);
}

/* ========== Size Selector ========== */
.size-selector {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}



/* Hidden elements for JS compatibility */
.ratio-buttons,
.preset-sizes,
.custom-size {
    display: none !important;
}

/* ========== Buttons ========== */
.btn-primary {
    width: 100%;
    padding: 12px 24px;
    background-color: var(--header-primary);
    border: none;
    border-radius: var(--radius-md);
    color: white;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(37, 99, 235, 0.2);
}

.btn-primary:hover {
    background-color: var(--header-primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Generate Button Loading State */
.btn-primary.loading {
    position: relative;
    pointer-events: none;
    background-color: var(--header-primary);
}

@keyframes btnPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.btn-primary .btn-spinner {
    display: none;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: btnSpin 0.8s linear infinite;
}

.btn-primary.loading .btn-spinner {
    display: inline-block;
}

.btn-primary.loading .btn-text {
    display: none;
}

.btn-primary.loading .btn-loading {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

@keyframes btnSpin {
    to { transform: rotate(360deg); }
}

/* Pulse effect on hover when not loading */
.btn-primary:not(.loading):not(:disabled)::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    opacity: 0;
    box-shadow: 0 0 0 0 var(--header-primary);
    transition: opacity 0.3s, box-shadow 0.3s;
    pointer-events: none;
}

.btn-primary:not(.loading):not(:disabled):hover::after {
    opacity: 0.3;
    box-shadow: 0 0 0 4px var(--header-primary);
}

.btn-secondary {
    padding: 8px 16px;
    background: var(--bg-subtle);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-secondary:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-strong);
}

.btn-danger {
    padding: 8px 16px;
    background: transparent;
    border: 1px solid var(--error);
    border-radius: var(--radius-md);
    color: var(--error);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-danger:hover {
    background: var(--error);
    color: white;
}

.btn-text {
    display: inline;
}

.btn-loading {
    display: none;
    align-items: center;
    gap: 8px;
}

.btn-loading.show {
    display: inline-flex;
}

.hidden {
    display: none !important;
}

/* ========== Result Panel / Gallery ========== */
.result-panel {
    min-height: 400px;
    display: flex;
    flex-direction: column;
    z-index: 0;
}

.gallery-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-subtle);
}

.gallery-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.gallery-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 12px;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--accent);
    border: 1px solid var(--accent);
    border-radius: var(--radius-sm);
    background: transparent;
}

.gallery-actions {
    display: flex;
    gap: 8px;
}

.gallery-action-btn {
    padding: 6px 12px;
    background: transparent;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.gallery-action-btn:hover {
    background: var(--bg-subtle);
    border-color: var(--border-strong);
    color: var(--text-primary);
}

.gallery-action-btn.danger {
    border-color: var(--error);
    color: var(--error);
}

.gallery-action-btn.danger:hover {
    background: rgba(196, 43, 28, 0.1);
    border-color: var(--error);
    color: var(--error);
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
    flex: 1;
    align-content: start;
    overflow-y: auto;
    overflow-x: hidden;
    height: 420px;
    max-height: 420px;
    padding: 4px;
}

.gallery-grid::-webkit-scrollbar {
    width: 6px;
}

.gallery-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: var(--radius-md);
    overflow: hidden;
    cursor: pointer;
    background: var(--bg-subtle);
    border: 1px solid var(--border-subtle);
    transition: all var(--transition-fast);
}

.gallery-item:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: var(--shadow-card);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-normal);
}

.gallery-item:hover img {
    transform: scale(1.05);
}

.gallery-item-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.5) 0%, transparent 40%);
    opacity: 0;
    transition: opacity var(--transition-fast);
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    padding: 8px;
}

.gallery-item:hover .gallery-item-overlay,
.gallery-item:focus-within .gallery-item-overlay {
    opacity: 1;
}

.gallery-item-actions {
    display: flex;
    gap: 6px;
}

.gallery-item-btn {
    width: 28px;
    height: 28px;
    padding: 0;
    background: rgba(255, 255, 255, 0.85);
    border: none;
    border-radius: 6px;
    color: #555;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.gallery-item-btn svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
}

.gallery-item-btn:hover {
    background: white;
    color: #333;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.2);
    backdrop-filter: none;
}

.gallery-item-btn.delete {
    background: rgba(220, 60, 60, 0.85);
    color: white;
}

.gallery-item-btn.delete:hover {
    background: #dc3c3c;
    color: white;
    backdrop-filter: none;
}

.result-placeholder {
    text-align: center;
    color: var(--text-tertiary);
    padding: 60px 40px;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.placeholder-icon {
    width: 96px;
    height: 72px;
    margin-bottom: 16px;
    border: 2px dashed currentColor;
    border-radius: var(--radius-md);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    color: var(--text-secondary);
    opacity: 0.35;
    font-size: 0;
}

.placeholder-icon::before {
    content: '';
    position: absolute;
    inset: 18px 16px 16px;
    border-radius: calc(var(--radius-sm) * 1.2);
    background: linear-gradient(135deg, currentColor 0%, transparent 90%);
    clip-path: polygon(0% 100%, 25% 60%, 42% 78%, 60% 40%, 78% 60%, 100% 30%, 100% 100%);
    opacity: 0.65;
}

.placeholder-icon::after {
    content: '';
    position: absolute;
    top: 16px;
    right: 20px;
    width: 12px;
    height: 12px;
    border: 2px solid currentColor;
    border-radius: 50%;
    opacity: 0.8;
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.15);
}

.result-placeholder p {
    font-size: 0.875rem;
}

.result-error {
    text-align: center;
    color: var(--error);
    padding: 40px;
}

.error-icon {
    font-size: 3rem;
    margin-bottom: 12px;
}

/* Legacy support - hidden */
.result-image,
.image-actions {
    display: none;
}

/* ========== Management Panels ========== */
.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.panel-header h2 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
}

.panel-header .btn-primary {
    width: auto;
    padding: 8px 20px;
}

.panel-subtitle {
    margin-top: 4px;
    font-size: 0.8rem;
    color: var(--text-tertiary);
}

/* Info Box */
.info-box {
    background: var(--accent-subtle);
    border: 1px solid rgba(0, 120, 212, 0.15);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    margin-bottom: 20px;
}

.info-box p {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.info-box a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}

.info-box a:hover {
    text-decoration: underline;
}

/* Action Bar */
.action-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

/* Stats Bar */
.stats-bar {
    display: flex;
    gap: 24px;
    padding: 16px 20px;
    background: var(--bg-subtle);
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    flex-wrap: wrap;
    border: 1px solid var(--border-subtle);
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 70px;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    margin-bottom: 4px;
}

.stat-value {
    font-size: 1.375rem;
    font-weight: 600;
    color: var(--text-primary);
}

.stat-value.success {
    color: var(--success);
}

.stat-value.warning {
    color: var(--warning);
}

/* Item List */
.item-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.list-empty {
    text-align: center;
    padding: 48px;
    color: var(--text-tertiary);
    font-size: 0.9rem;
}

.list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: var(--bg-subtle);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    transition: all var(--transition-fast);
}

.list-item:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-default);
}

.item-info {
    flex: 1;
}

.item-name {
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.item-meta {
    font-size: 0.8rem;
    color: var(--text-tertiary);
}

.item-meta span {
    margin-right: 16px;
}

.item-quota {
    margin-top: 6px;
    font-size: 0.8rem;
}

.item-quota .quota-value {
    color: var(--success);
    font-weight: 600;
}

.item-quota .quota-value.low {
    color: var(--warning);
}

.item-quota .quota-value.empty {
    color: var(--error);
}

.item-actions {
    display: flex;
    gap: 10px;
}

.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.status-badge.active {
    background: rgba(16, 124, 16, 0.12);
    color: var(--success);
}

.status-badge.inactive {
    background: rgba(247, 99, 12, 0.12);
    color: var(--warning);
}

/* ========== Logs Panel ========== */
.logs-panel {
    padding-top: 20px;
}

.logs-header {
    align-items: flex-start;
}

.logs-header-text h2 {
    margin-bottom: 2px;
}

.logs-summary {
    font-size: 0.8rem;
    color: var(--text-secondary);
    background: var(--bg-subtle);
    padding: 8px 12px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    max-width: 260px;
    text-align: right;
}

.logs-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

#logs-clear-btn {
    padding: 6px 12px;
    font-size: 0.8rem;
}

.logs-filters {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-subtle);
}

.logs-filter {
    max-width: none;
    flex: 0 0 auto;
}

/* 日志筛选下拉：自定义下拉不换行，宽度随内容 */
.logs-filter .custom-dropdown {
    flex: 0 0 auto;
    display: inline-block;
}

.logs-filter .dropdown-trigger {
    width: auto;
    min-width: 160px;
    white-space: nowrap;
}

.logs-filter .dropdown-text {
    white-space: nowrap;
}

.logs-filter .dropdown-item span:not(.item-check) {
    white-space: nowrap;
}

.logs-filter .dropdown-menu {
    left: 0;
    right: auto;
    min-width: 100%;
    width: max-content;
}

.logs-list-wrapper {
    max-height: 420px;
    overflow-y: auto;
    padding-right: 4px;
}

#logs-list .list-item {
    padding: 14px 18px;
}

#logs-list .item-name {
    display: flex;
    align-items: center;
    gap: 10px;
}

#logs-list .item-name span:last-child {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

#logs-list .item-meta {
    margin-top: 4px;
}

/* API Info */
.api-info {
    background: var(--bg-subtle);
    padding: 20px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    border: 1px solid var(--border-subtle);
}

.api-info h3 {
    margin-bottom: 12px;
    font-size: 0.95rem;
    font-weight: 600;
}

.api-info h4 {
    margin-top: 16px;
    margin-bottom: 10px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.api-info code {
    display: inline-block;
    padding: 8px 14px;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    font-family: 'Cascadia Code', 'Consolas', 'Monaco', monospace;
    font-size: 0.85rem;
    margin: 8px 0;
    color: var(--text-primary);
}

.api-hint {
    font-size: 0.8rem;
    color: var(--text-tertiary);
}

.api-hint code {
    padding: 2px 8px;
    margin: 0;
}

.code-block {
    display: block;
    padding: 16px;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    font-family: 'Cascadia Code', 'Consolas', monospace;
    font-size: 0.8rem;
    overflow-x: auto;
    white-space: pre;
    border: 1px solid var(--border-subtle);
}

/* ========== Modal ========== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: var(--bg-solid);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-dialog);
    border: 1px solid var(--border-default);
    animation: modalSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalSlideUp {
    from { opacity: 0; transform: translateY(32px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-default);
}

.modal-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
}

.modal-close {
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 1.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: var(--bg-subtle);
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--border-default);
    background: var(--bg-subtle);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.modal-footer .btn-primary {
    width: auto;
}

/* Checkbox */
.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 0.9rem;
}

.checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--accent);
}

/* Key Display */
.key-display {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-top: 16px;
}

.key-display code {
    flex: 1;
    padding: 12px 14px;
    background: var(--bg-subtle);
    border-radius: var(--radius-md);
    font-family: 'Cascadia Code', monospace;
    font-size: 0.85rem;
    word-break: break-all;
    border: 1px solid var(--border-default);
}

.warning-text {
    color: var(--warning);
    font-size: 0.875rem;
    line-height: 1.5;
}

/* ========== Toast ========== */
.toast {
    position: fixed;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 24px;
    background: var(--bg-card);
    backdrop-filter: var(--backdrop-blur);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-flyout);
    border: 1px solid var(--border-default);
    z-index: 2000;
    transition: all var(--transition-normal);
    font-size: 0.9rem;
}

.toast.hidden {
    opacity: 0;
    transform: translateX(-50%) translateY(16px);
    pointer-events: none;
}

.toast.success {
    background: var(--success);
    border-color: var(--success);
    color: white;
}

.toast.error {
    background: var(--error);
    border-color: var(--error);
    color: white;
}

/* ========== Image Preview Modal ========== */
.image-preview-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-preview-modal.hidden {
    display: none;
}

.preview-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    cursor: zoom-out;
}

.preview-container {
    position: relative;
    max-width: 90vw;
    max-height: 80vh;
    z-index: 1;
    animation: previewFadeIn 0.3s ease;
}

@keyframes previewFadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.preview-container img {
    max-width: 90vw;
    max-height: 80vh;
    object-fit: contain;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-dialog);
}

/* Preview Toolbar - Fixed at top of viewport */
.preview-toolbar {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    padding: 8px 16px;
    border-radius: 24px;
    z-index: 20;
}

.preview-close {
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: white;
    font-size: 1.25rem;
    cursor: pointer;
    padding: 4px 8px;
    opacity: 0.8;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-close:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.15);
}

/* Preview Navigation */
.preview-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: var(--radius-md);
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 16px 12px;
    opacity: 0.6;
    transition: all var(--transition-fast);
    z-index: 10;
}

.preview-nav:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.2);
}

.preview-nav.prev {
    left: 20px;
}

.preview-nav.next {
    right: 20px;
}

.preview-nav:disabled {
    opacity: 0.2;
    cursor: not-allowed;
}

.preview-counter {
    color: white;
    font-size: 0.85rem;
    font-weight: 500;
    padding: 0 8px;
    border-left: 1px solid rgba(255, 255, 255, 0.2);
    border-right: 1px solid rgba(255, 255, 255, 0.2);
}

.preview-actions {
    display: flex;
    gap: 4px;
}

.preview-action-btn {
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: white;
    font-size: 0.8rem;
    cursor: pointer;
    padding: 6px 12px;
    opacity: 0.8;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 5px;
}

.preview-action-btn svg {
    flex-shrink: 0;
}

.preview-action-btn:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.15);
}

.preview-toolbar-divider {
    width: 1px;
    height: 20px;
    background: rgba(255, 255, 255, 0.2);
}

@media (max-width: 768px) {
    .preview-nav {
        padding: 12px 8px;
        font-size: 1.2rem;
    }
    .preview-nav.prev {
        left: 10px;
    }
    .preview-nav.next {
        right: 10px;
    }
    .preview-toolbar {
        top: 12px;
        padding: 6px 12px;
        gap: 8px;
    }
    .preview-actions {
        flex-wrap: wrap;
        gap: 6px;
    }
    .preview-action-btn {
        padding: 4px 10px;
        font-size: 0.75rem;
        min-width: 90px;
        text-align: center;
        white-space: nowrap;
    }
    .preview-counter {
        font-size: 0.75rem;
        padding: 0 6px;
    }
    .preview-container {
        max-width: 95vw;
        max-height: 75vh;
    }
    .preview-container img {
        max-width: 95vw;
        max-height: 75vh;
    }
}

/* ========== Responsive Design ========== */
@media (max-width: 1024px) {
    .generate-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 16px;
    }

    .header:not(.visitor-header) {
        display: grid;
        grid-template-columns: auto 1fr auto;
        grid-template-rows: auto auto;
        grid-template-areas: 
            "brand . right"
            "tabs tabs tabs";
        padding: 16px;
        gap: 12px;
        align-items: center;
    }

    .header:not(.visitor-header) .header-brand {
        grid-area: brand;
    }

    .header:not(.visitor-header) .header-right {
        grid-area: right;
        width: auto;
        justify-content: flex-end;
    }

    .nav-tabs {
        grid-area: tabs;
        width: 100%;
        overflow-x: auto;
        justify-content: flex-start;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .nav-tabs::-webkit-scrollbar {
        display: none;
    }

    .tab-btn {
        padding: 8px 16px;
        font-size: 0.8rem;
        flex-shrink: 0;
    }

    .input-panel,
    .result-panel,
    .management-panel {
        padding: 20px;
    }

    .form-row {
        flex-direction: column;
        gap: 0;
    }

    .form-group.half {
        width: 100%;
    }

    .stats-bar {
        gap: 16px;
        justify-content: center;
    }

    .stat-item {
        min-width: 60px;
    }

    .list-item {
        flex-direction: column;
        gap: 16px;
        align-items: flex-start;
    }

    .item-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .panel-header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }

    .panel-header .btn-primary {
        width: 100%;
    }

    .login-container {
        padding: 32px 24px;
        margin: 16px;
    }

    .modal-content {
        margin: 16px;
        max-height: calc(100vh - 32px);
    }

    .size-selector {
        flex-direction: column;
        gap: 12px;
    }

    .size-selector .custom-dropdown {
        width: 100%;
    }

    .visitor-hero {
        flex-direction: column;
        align-items: flex-start;
    }

    .hero-tip {
        width: 100%;
    }

    .visitor-actions {
        width: auto;
        justify-content: flex-end;
        align-items: center;
        gap: 0.75rem;
        flex: 0 0 auto;
    }

    .visitor-actions .theme-toggle {
        margin-right: 0;
    }

    .visitor-generate .input-panel {
        position: relative;
        z-index: 3;
    }

    .visitor-generate .dropdown-menu {
        z-index: 999;
    }

    .visitor-generate .gallery-grid {
        height: auto;
        max-height: none;
        overflow: visible;
    }

    .visitor-generate .result-panel {
        height: auto;
    }


    .dropdown-menu {
        max-height: 200px;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 1.125rem;
    }

    .image-actions {
        flex-direction: column;
    }

    .image-actions .btn-secondary {
        width: 100%;
    }

    .key-display {
        flex-direction: column;
    }

    .key-display code {
        width: 100%;
    }

    .key-display .btn-secondary {
        width: 100%;
    }
}

/* ========== 移动端访客筛选下拉框宽度限制 ========== */
@media (max-width: 768px) {
    /* 日志筛选区域堆叠布局 */
    .logs-filters {
        flex-direction: column;
        align-items: stretch;
    }

    .logs-filter {
        width: 100%;
    }

    .logs-filter .custom-dropdown {
        width: 100%;
        display: block;
    }

    /* 下拉触发按钮：限制宽度，超长文字省略 */
    .logs-filter .dropdown-trigger {
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }

    .logs-filter .dropdown-text {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        flex: 1;
        min-width: 0;
    }

    /* 下拉菜单：限制宽度，超长选项文字省略 */
    .logs-filter .dropdown-menu {
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }

    .logs-filter .dropdown-item {
        max-width: 100%;
        overflow: hidden;
    }

    .logs-filter .dropdown-item span:not(.item-check) {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        flex: 1;
        min-width: 0;
    }
}
