/* ============ FONT STACK & FALLBACK TESTER ============ */
/* ============ RESET & VARIABLES - STUDIO DARK THEME ============ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
    width: 100%;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
    background: #0B0D10;
    color: #E9EEF5;
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    width: 100%;
}

body.high-contrast {
    background: #000000;
    color: #FFFFFF;
    --primary: #FFFF00;
    --primary-dark: #FFD700;
    --border: #FFFF00;
    --cyan-gradient: #FFFF00;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 20% 30%, rgba(64, 224, 255, 0.03) 0%, transparent 45%),
                radial-gradient(circle at 80% 70%, rgba(64, 224, 255, 0.03) 0%, transparent 45%);
    pointer-events: none;
    z-index: 0;
}

:root {
    --primary: #40E0FF;
    --primary-dark: #00B8D4;
    --primary-light: rgba(64, 224, 255, 0.15);
    --primary-glow: rgba(64, 224, 255, 0.25);
    --surface-0: #0B0D10;
    --surface-1: #151A21;
    --surface-2: #1E2630;
    --surface-3: #273140;
    --text-primary: #E9EEF5;
    --text-secondary: #C0C8D2;
    --text-tertiary: #9AA5B5;
    --text-muted: #8A99B0;
    --border: #273140;
    --danger: #FF5252;
    --success: #4CAF50;
    --warning: #FFB74D;
    --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.5);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.6);
    --shadow-lg: 0 16px 32px rgba(0, 0, 0, 0.7);
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-xl: 32px;
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --cyan-gradient: linear-gradient(135deg, #40E0FF, #00B8D4);
}

main {
    flex: 1;
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ============ HEADER ============ */
.header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: rgba(11, 13, 16, 0.98);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.header-container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 10px 24px;
    display: grid;
    grid-template-columns: minmax(120px, auto) 1fr minmax(120px, auto);
    align-items: center;
    gap: 20px;
}

.logo-link {
    grid-column: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.logo-icon {
    width: 36px;
    height: 36px;
    background: var(--cyan-gradient);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #0B0D10;
    font-size: 1.1rem;
    box-shadow: 0 0 15px rgba(64, 224, 255, 0.3);
}

.brand-name {
    font-size: 1.2rem;
    font-weight: 700;
    color: #E9EEF5;
    letter-spacing: -0.5px;
    white-space: nowrap;
}

.brand-name span {
    color: var(--primary);
    font-weight: 800;
}

.nav-desktop {
    display: flex;
    align-items: center;
    gap: 4px;
    justify-content: center;
    padding: 4px 8px;
    background: rgba(21, 26, 33, 0.6);
    border-radius: 40px;
    border: 0.5px solid var(--border);
    backdrop-filter: blur(20px);
    width: fit-content;
    max-width: 100%;
    margin: 0 auto;
}

.nav-link {
    color: #9AA5B5;
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 30px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid transparent;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.nav-link:hover {
    color: var(--primary);
    background: rgba(64, 224, 255, 0.1);
    border-color: rgba(64, 224, 255, 0.2);
}

.nav-link i {
    font-size: 0.8rem;
    color: #8A99B0;
}

.nav-dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: #151A21;
    border-radius: 12px;
    padding: 8px;
    min-width: 200px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    z-index: 1000;
    backdrop-filter: blur(12px);
}

.nav-dropdown:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.dropdown-menu a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    color: #9AA5B5;
    text-decoration: none;
    font-size: 0.8rem;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.dropdown-menu a i {
    width: 16px;
    color: var(--primary);
    font-size: 0.9rem;
}

.dropdown-menu a:hover {
    background: rgba(64, 224, 255, 0.1);
    color: var(--primary);
}

.action-buttons {
    grid-column: 3;
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: flex-end;
}

.auth-btn {
    padding: 8px 16px;
    border-radius: 40px;
    font-size: 0.8rem;
    font-weight: 600;
    background: #1E2630;
    border: 1px solid #273140;
    color: #E9EEF5;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    height: 44px;
    transition: var(--transition);
}

.auth-btn:hover {
    background: var(--cyan-gradient);
    color: #0B0D10;
    transform: translateY(-2px);
}

.contrast-toggle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #1E2630;
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    cursor: pointer;
    transition: all 0.3s ease;
}

.mobile-menu-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #1E2630;
    border: 1px solid var(--border);
    display: none;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    cursor: pointer;
}

/* ============ MOBILE MENU ============ */
.mobile-menu {
    position: fixed;
    top: 0;
    right: -100%;
    width: 280px;
    max-width: 85vw;
    height: 100vh;
    background: #151A21;
    z-index: 1001;
    transition: right 0.3s ease;
    padding: 80px 20px 20px;
    border-left: 1px solid var(--border);
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.mobile-menu.active {
    right: 0;
}

.mobile-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.mobile-menu-close {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #1E2630;
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    cursor: pointer;
}

.mobile-nav-links {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 20px;
}

.mobile-nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: #9AA5B5;
    text-decoration: none;
    font-size: 0.95rem;
    border-radius: 8px;
    transition: var(--transition);
}

.mobile-nav-link i {
    width: 20px;
    color: var(--primary);
}

.mobile-nav-link:hover {
    background: rgba(64, 224, 255, 0.1);
    color: var(--primary);
}

.mobile-nav-link.active {
    background: rgba(64, 224, 255, 0.15);
    color: var(--primary);
    font-weight: 600;
}

.mobile-divider {
    height: 1px;
    background: var(--border);
    margin: 16px 0;
}

.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.mobile-menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

.new-badge {
    margin-left: auto;
    font-size: 0.6rem;
    background: var(--cyan-gradient);
    color: #0B0D10;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 600;
}

/* ============ HERO ROW ============ */
.hero-row {
    display: flex;
    align-items: stretch;
    gap: 20px;
    width: 100%;
    margin: 30px 0 20px;
}

.hero-box {
    flex: 1 1 50%;
    min-width: 0;
    display: flex;
    align-items: center;
    background: rgba(21, 26, 33, 0.95);
    backdrop-filter: blur(20px);
    border: 0.5px solid var(--border);
    border-radius: 60px;
    padding: 0 24px;
    box-shadow: var(--shadow-lg);
    height: 56px;
    box-sizing: border-box;
}

.hero-title-box {
    justify-content: center;
    padding-left: 28px;
}

.hero-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #E9EEF5;
    margin: 0;
    line-height: 1.3;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
    text-align: center;
    width: 100%;
}

.hero-title .gradient-text {
    background: var(--cyan-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-title .version-badge {
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    padding: 2px 8px;
    border-radius: 20px;
    background: rgba(64, 224, 255, 0.15);
    border: 1px solid var(--primary);
    color: var(--primary);
    -webkit-text-fill-color: var(--primary);
}

.hero-input-box {
    position: relative;
    padding-left: 48px;
}

.hero-input-box > i {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--primary);
    font-size: 0.9rem;
    opacity: 0.85;
    pointer-events: none;
}

.hero-input-box .custom-input-field {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    background: transparent;
    border: none;
    color: #E9EEF5;
    font-size: 0.9rem;
    font-weight: 500;
    outline: none;
}

.hero-input-box .custom-input-field::placeholder {
    color: #8A99B0;
}

/* ============ GLOBAL CONTROLS ============ */
.global-controls {
    background: rgba(21, 26, 33, 0.95);
    backdrop-filter: blur(20px);
    border: 0.5px solid var(--border);
    border-radius: 60px;
    padding: 0 14px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    height: 56px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
}

.global-controls.global-preview-controls {
    height: auto;
    min-height: 56px;
    padding: 6px 14px;
    flex-wrap: wrap;
}

.controls-collapsible {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    height: 100%;
}

.controls-primary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 100%;
    width: 100%;
}

.control-item {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #1E2630;
    padding: 0 12px;
    border-radius: 30px;
    border: 1px solid var(--border);
    height: 38px;
}

.control-item label {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.numeric-input {
    width: 58px;
    padding: 3px 6px;
    background: #151A21;
    border: 1px solid var(--border);
    border-radius: 30px;
    color: #E9EEF5;
    font-size: 0.75rem;
    font-weight: 600;
    text-align: center;
    height: 26px;
    -moz-appearance: textfield;
    appearance: textfield;
}

.numeric-input::-webkit-outer-spin-button,
.numeric-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.font-select-sm {
    background: #151A21;
    border: 1px solid var(--border);
    border-radius: 30px;
    color: #E9EEF5;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 4px 24px 4px 10px;
    height: 26px;
    min-width: 100px;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8' viewBox='0 0 24 24' fill='none' stroke='%2340E0FF' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    cursor: pointer;
}

/* ============ TOOL PANELS ============ */
.tool-panel {
    background: rgba(21, 26, 33, 0.95);
    backdrop-filter: blur(20px);
    border: 0.5px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-lg);
}

/* Panels that host dropdowns must escape their own stacking context */
.tool-panel--overflow {
    position: relative;
    z-index: 20;
    overflow: visible;
}

/* Sibling panels should not paint above the previous one */
.tool-panel + .tool-panel {
    position: relative;
    z-index: 1;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

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

.panel-title i {
    color: var(--primary);
    font-size: 1.1rem;
}

.panel-title h2 {
    font-size: 1.05rem;
    font-weight: 700;
    color: #E9EEF5;
}

.panel-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.panel-btn {
    padding: 8px 14px;
    background: #1E2630;
    border: 1px solid var(--border);
    border-radius: 30px;
    color: var(--primary);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
    min-height: 36px;
}

.panel-btn:hover {
    background: var(--cyan-gradient);
    color: #0B0D10;
    border-color: var(--primary);
    transform: translateY(-1px);
}

.panel-btn.active {
    background: linear-gradient(135deg, #00F0FF, #00CCFF) !important;
    color: #000000 !important;
    border-color: #00F0FF !important;
    box-shadow: 0 0 0 3px rgba(0, 240, 255, 0.35),
                0 0 25px rgba(0, 240, 255, 0.8) !important;
    transform: scale(1.05) !important;
}

.panel-btn.active i {
    color: #000000 !important;
}

/* ============ STACK LIST ============ */
.stack-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.stack-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #1E2630;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 16px;
    transition: all 0.2s;
    cursor: grab;
}

.stack-item:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
}

.stack-item:hover {
    border-color: var(--primary);
    background: rgba(64, 224, 255, 0.05);
}

.stack-item.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.stack-item.primary-item {
    background: linear-gradient(135deg, rgba(64, 224, 255, 0.1), rgba(0, 184, 212, 0.05));
    border-color: var(--primary);
}

.stack-item.fallback-item {
    background: rgba(30, 38, 48, 0.6);
}

.stack-drag {
    color: #8A99B0;
    cursor: grab;
    font-size: 0.9rem;
}

.stack-number {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(64, 224, 255, 0.15);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    flex-shrink: 0;
}

.stack-name {
    flex: 1;
    font-size: 0.9rem;
    font-weight: 600;
    color: #E9EEF5;
}

.stack-name small {
    display: block;
    font-size: 0.65rem;
    color: #8A99B0;
    font-weight: 400;
    margin-top: 2px;
}

.stack-badge {
    padding: 3px 10px;
    border-radius: 30px;
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stack-badge.primary {
    background: var(--cyan-gradient);
    color: #0B0D10;
}

.stack-badge.system {
    background: rgba(255, 183, 77, 0.15);
    color: #FFB74D;
    border: 1px solid rgba(255, 183, 77, 0.3);
}

.stack-badge.generic {
    background: rgba(76, 175, 80, 0.15);
    color: #4CAF50;
    border: 1px solid rgba(76, 175, 80, 0.3);
}

.stack-remove {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: transparent;
    border: 1px solid transparent;
    color: #8A99B0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.stack-remove:hover {
    background: rgba(255, 82, 82, 0.1);
    border-color: rgba(255, 82, 82, 0.3);
    color: #FF5252;
}

/* ============ FALLBACK ADDER ============ */
.fallback-adder {
    position: relative;
    z-index: 30;
    width: 100%;
}

.fallback-search-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    height: 56px;
    padding: 0 8px 0 20px;
    background: #1E2630;
    border: 1.5px solid var(--border);
    border-radius: 30px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
    cursor: text;
}

.fallback-search-wrap:hover {
    border-color: rgba(64, 224, 255, 0.5);
    background: rgba(30, 38, 48, 0.9);
}

.fallback-search-wrap:focus-within {
    border-color: var(--primary);
    background: rgba(64, 224, 255, 0.04);
    box-shadow: none;
}

.fallback-search-icon {
    color: var(--primary);
    font-size: 0.95rem;
    flex-shrink: 0;
    opacity: 0.9;
}

.fallback-search {
    flex: 1;
    min-width: 0;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 500;
    height: 100%;
    font-family: inherit;
    letter-spacing: 0.01em;
}

.fallback-search::placeholder {
    color: var(--text-muted);
    font-weight: 400;
    opacity: 1;
}

.fallback-search-divider {
    width: 1px;
    height: 24px;
    background: var(--border);
    flex-shrink: 0;
    transition: background 0.2s ease;
}

.fallback-search-wrap:focus-within .fallback-search-divider {
    background: rgba(64, 224, 255, 0.35);
}

.fallback-add-upload {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 40px;
    padding: 0 16px;
    border-radius: 30px;
    background: rgba(64, 224, 255, 0.08);
    border: 1px solid rgba(64, 224, 255, 0.35);
    color: var(--primary);
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    font-family: inherit;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.fallback-add-upload i {
    font-size: 0.85rem;
}

.fallback-add-upload:hover {
    background: var(--cyan-gradient);
    color: #0B0D10;
    border-color: transparent;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(64, 224, 255, 0.25);
}

.fallback-add-upload:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
}

.fallback-add-upload.has-upload {
    background: rgba(76, 175, 80, 0.1);
    border-color: rgba(76, 175, 80, 0.5);
    color: #4CAF50;
}

.fallback-add-upload.has-upload:hover {
    background: linear-gradient(135deg, #4CAF50, #388E3C);
    color: #FFFFFF;
    border-color: transparent;
}

.fallback-hint {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 8px 4px 0;
    font-size: 0.72rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.fallback-hint i {
    color: var(--primary);
    font-size: 0.72rem;
    opacity: 0.8;
}

.fallback-results {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    max-height: 360px;
    overflow-y: auto;
    background: #151A21;
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 8px;
    margin: 0;
    list-style: none;
    z-index: 9999;
    box-shadow: var(--shadow-lg);
    animation: fadeInPanel 0.15s ease;
}

.fallback-results[hidden] {
    display: none;
}

.fallback-result {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.87rem;
    color: var(--text-secondary);
    transition: background 0.12s ease, color 0.12s ease;
}

.fallback-result:hover,
.fallback-result.active {
    background: rgba(64, 224, 255, 0.1);
    color: var(--primary);
}

.fallback-result-name {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 600;
}

.fallback-result-source {
    flex-shrink: 0;
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    border: 1px solid var(--border);
    padding: 2px 8px;
    border-radius: 20px;
    font-weight: 700;
}

.fallback-result:hover .fallback-result-source,
.fallback-result.active .fallback-result-source {
    color: var(--primary);
    border-color: rgba(64, 224, 255, 0.4);
}

.fallback-empty {
    padding: 18px 12px;
    font-size: 0.82rem;
    color: var(--text-muted);
    text-align: center;
    font-style: italic;
}

.fallback-results::-webkit-scrollbar {
    width: 8px;
}

.fallback-results::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 4px;
}

/* ============ PREVIEW GRID ============ */
.toggle-group {
    display: flex;
    gap: 4px;
    background: #1E2630;
    padding: 3px;
    border-radius: 30px;
    border: 1px solid var(--border);
}

.toggle-btn {
    padding: 6px 14px;
    background: transparent;
    border: none;
    border-radius: 30px;
    color: #9AA5B5;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.toggle-btn.active {
    background: var(--cyan-gradient);
    color: #0B0D10;
}

.preview-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.preview-card {
    background: #1E2630;
    border-radius: var(--radius-md);
    padding: 20px;
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
}

.preview-fallback {
    border-left: 4px solid var(--warning);
}

.preview-primary {
    border-left: 4px solid var(--primary);
}

.preview-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.preview-fallback .preview-label {
    color: var(--warning);
}

.preview-primary .preview-label {
    color: var(--primary);
}

.preview-text {
    font-size: 32px;
    line-height: 1.2;
    word-break: break-word;
    min-height: 60px;
    transition: all 0.3s ease;
    margin-bottom: 12px;
}

.preview-meta {
    font-size: 0.7rem;
    color: #8A99B0;
    font-family: 'JetBrains Mono', monospace;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

/* ============ SWAP ANIMATION ============ */
.swap-demo {
    background: #1E2630;
    border-radius: var(--radius-md);
    padding: 24px;
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
}

.swap-stage {
    position: relative;
    height: 200px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.swap-line {
    font-size: 40px;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: opacity 0.6s ease, transform 0.6s ease;
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    transform: translateY(-50%);
}

.swap-line-fallback {
    opacity: 1;
    transform: translateY(-50%);
}

.swap-line-primary {
    opacity: 0;
    transform: translateY(-50%) translateY(4px);
}

.swap-demo.active .swap-line-fallback {
    opacity: 0;
    transform: translateY(-50%) translateY(-4px);
}

.swap-demo.active .swap-line-primary {
    opacity: 1;
    transform: translateY(-50%);
}

.swap-indicator {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 16px;
    background: rgba(64, 224, 255, 0.15);
    border: 1px solid var(--primary);
    color: var(--primary);
    border-radius: 30px;
    font-size: 0.75rem;
    font-weight: 600;
    opacity: 0;
    transition: opacity 0.4s;
}

.swap-demo.active .swap-indicator {
    opacity: 1;
}

/* ============ METRICS ============ */
.cls-badge {
    padding: 6px 14px;
    border-radius: 30px;
    font-size: 0.75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(76, 175, 80, 0.15);
    border: 1px solid rgba(76, 175, 80, 0.3);
    color: #4CAF50;
}

.cls-badge.warn {
    background: rgba(255, 183, 77, 0.15);
    border-color: rgba(255, 183, 77, 0.3);
    color: #FFB74D;
}

.cls-badge.bad {
    background: rgba(255, 82, 82, 0.15);
    border-color: rgba(255, 82, 82, 0.3);
    color: #FF5252;
}

.cls-badge.neutral {
    background: rgba(154, 165, 181, 0.15);
    border-color: rgba(154, 165, 181, 0.3);
    color: #9AA5B5;
}

.cls-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    animation: pulseDot 2s infinite;
}

@keyframes pulseDot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.85); }
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
}

.metric-card {
    background: #1E2630;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px;
    text-align: center;
    transition: all 0.2s;
}

.metric-card:hover {
    border-color: var(--primary);
}

.metric-label {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
    font-family: 'JetBrains Mono', monospace;
}

.metric-value {
    font-size: 1.4rem;
    font-weight: 800;
    color: #E9EEF5;
    font-family: 'JetBrains Mono', monospace;
    margin-bottom: 4px;
}

.metric-hint {
    font-size: 0.7rem;
    color: #8A99B0;
}

.measure-note {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-top: 16px;
    padding: 12px 14px;
    background: rgba(64, 224, 255, 0.05);
    border: 1px solid rgba(64, 224, 255, 0.2);
    border-radius: 12px;
    font-size: 0.72rem;
    color: var(--text-tertiary);
    line-height: 1.5;
}

.measure-note i {
    color: var(--primary);
    margin-top: 2px;
    flex-shrink: 0;
}

/* ============ CSS OUTPUT ============ */
.css-output {
    background: #0B0D10;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
    font-family: 'JetBrains Mono', 'Monaco', 'Consolas', monospace;
    font-size: 0.8rem;
    line-height: 1.7;
    color: #E9EEF5;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 500px;
    overflow-y: auto;
    margin: 0;
}

.css-output::-webkit-scrollbar {
    width: 8px;
}

.css-output::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 4px;
}

/* ============ INFO SECTION ============ */
.info-section {
    max-width: 900px;
    margin: 60px auto 40px;
    padding: 32px;
    background: rgba(21, 26, 33, 0.5);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

.info-section h2 {
    font-size: 1.4rem;
    font-weight: 700;
    color: #E9EEF5;
    margin-bottom: 16px;
}

.info-section h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary);
    margin: 24px 0 12px;
}

.info-section p {
    font-size: 0.9rem;
    color: #C0C8D2;
    line-height: 1.7;
    margin-bottom: 12px;
}

.info-section ul {
    margin: 12px 0 12px 22px;
    color: #C0C8D2;
    font-size: 0.9rem;
}

.info-section li {
    margin-bottom: 8px;
    line-height: 1.6;
}

.info-section code {
    background: #0B0D10;
    padding: 2px 8px;
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85em;
    color: var(--primary);
}

.info-section strong {
    color: #E9EEF5;
}

/* ============ FAQ ============ */
.faq-section {
    max-width: 900px;
    margin: 0 auto 40px;
    padding: 32px;
    background: rgba(21, 26, 33, 0.5);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

.faq-section h2 {
    font-size: 1.4rem;
    font-weight: 700;
    color: #E9EEF5;
    margin-bottom: 20px;
}

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

.faq-item {
    background: #1E2630;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    transition: all 0.2s;
}

.faq-item[open] {
    border-color: var(--primary);
}

.faq-item summary {
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    color: #E9EEF5;
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.faq-item summary::-webkit-details-marker {
    display: none;
}

.faq-item summary::after {
    content: '+';
    color: var(--primary);
    font-size: 1.2rem;
    font-weight: 700;
    transition: transform 0.2s;
}

.faq-item[open] summary::after {
    transform: rotate(45deg);
}

.faq-item p {
    margin-top: 12px;
    font-size: 0.85rem;
    color: #C0C8D2;
    line-height: 1.7;
}

.faq-item code {
    background: #0B0D10;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85em;
    color: var(--primary);
}

/* ============ NEWSLETTER ============ */
.newsletter-section {
    max-width: 600px;
    margin: 40px auto;
    padding: 32px 24px;
    background: linear-gradient(135deg, #1E2630, #151A21);
    border: 1px solid var(--primary);
    border-radius: var(--radius-lg);
    text-align: center;
    box-shadow: 0 0 40px rgba(64, 224, 255, 0.15);
}

.newsletter-header {
    margin-bottom: 20px;
}

.pill-tag {
    display: inline-block;
    background: rgba(64, 224, 255, 0.15);
    color: var(--primary);
    padding: 5px 14px;
    border-radius: 30px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 12px;
}

.newsletter-header h2 {
    font-size: 1.3rem;
    font-weight: 800;
    color: #E9EEF5;
    margin-bottom: 8px;
}

.newsletter-header p {
    font-size: 0.85rem;
    color: #8A99B0;
}

.premium-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.premium-form input[type="email"] {
    padding: 14px 20px;
    background: #0B0D10;
    border: 1px solid var(--border);
    border-radius: 40px;
    color: #E9EEF5;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s;
}

.premium-form input[type="email"]:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(64, 224, 255, 0.15);
}

.premium-form button[type="submit"] {
    padding: 14px 24px;
    background: var(--cyan-gradient);
    color: #0B0D10;
    border: none;
    border-radius: 40px;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
}

.premium-form button[type="submit"]:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(64, 224, 255, 0.4);
}

.newsletter-status {
    font-size: 0.8rem;
    padding: 10px 16px;
    border-radius: 12px;
    margin-top: 8px;
}

.newsletter-status.error {
    background: rgba(255, 82, 82, 0.1);
    color: #FF5252;
    border: 1px solid rgba(255, 82, 82, 0.3);
}

.newsletter-status.success {
    background: rgba(76, 175, 80, 0.1);
    color: #4CAF50;
    border: 1px solid rgba(76, 175, 80, 0.3);
}

/* ============ AFFILIATE BANNER ============ */
.fp-aff-wrap {
    max-width: 1000px;
    margin: 48px auto 40px;
    padding: 0 24px;
}

.fp-aff-box {
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 24px;
    padding: 32px 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 32px;
    flex-wrap: wrap;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.2);
}

.fp-aff-box:hover {
    transform: translateY(-4px);
    border-color: rgba(64, 224, 255, 0.25);
}

.fp-aff-badge {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    color: #40E0FF;
    text-transform: uppercase;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.fp-aff-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 28px;
    background: linear-gradient(135deg, #40E0FF, #00B8D4);
    color: #0F172A;
    font-weight: 700;
    font-size: 0.9rem;
    border-radius: 100px;
    text-decoration: none;
    white-space: nowrap;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 4px 15px rgba(64, 224, 255, 0.2);
}

.fp-aff-btn:hover {
    transform: scale(1.03);
    box-shadow: 0 6px 20px rgba(64, 224, 255, 0.35);
}

/* ============ TOAST ============ */
#toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(80px);
    background: var(--cyan-gradient);
    color: #0B0D10;
    padding: 12px 20px;
    border-radius: 40px;
    font-size: 0.85rem;
    font-weight: 600;
    text-align: center;
    box-shadow: var(--shadow-lg);
    z-index: 2000;
    transition: transform 0.25s ease;
    max-width: 90vw;
    display: flex;
    align-items: center;
    gap: 8px;
    opacity: 0;
    pointer-events: none;
}

#toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

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

/* ============ RESPONSIVE ============ */
@media (max-width: 1024px) {
    .header-container {
        display: flex;
        justify-content: space-between;
    }
    .nav-desktop {
        display: none;
    }
    .mobile-menu-btn {
        display: flex;
    }
    .hero-row {
        flex-direction: column;
        gap: 10px;
    }
    .hero-box {
        width: 100%;
        flex: 1 1 100%;
        height: 52px;
    }
    .preview-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    main {
        padding: 0 16px;
    }
    .hero-row {
        margin: 16px 0 12px;
    }
    .hero-title {
        font-size: 0.82rem;
    }
    .hero-box {
        height: 48px;
        border-radius: 24px;
        padding: 0 18px;
    }
    .global-controls {
        height: auto;
        min-height: 60px;
        padding: 8px 12px;
        border-radius: 24px;
    }
    .controls-primary {
        flex-wrap: wrap;
        gap: 6px;
    }
        .control-item {
        flex: 1 1 calc(33.333% - 4px);
        justify-content: space-between;
        height: 40px;
        padding: 0 10px;
        min-width: 0;
    }
    .numeric-input {
        width: 60px;
        height: 28px;
        font-size: 0.8rem;
    }
    .font-select-sm {
        height: 28px;
        font-size: 0.75rem;
    }
    .tool-panel {
        padding: 16px;
        border-radius: 20px;
    }
    .panel-header {
        gap: 8px;
    }
    .panel-title h2 {
        font-size: 0.95rem;
    }
    .panel-actions {
        width: 100%;
    }
    .panel-btn {
        flex: 1 1 auto;
        justify-content: center;
    }
    .preview-text {
        font-size: 26px;
    }
    .swap-line {
        font-size: 28px;
    }
    .metrics-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .css-output {
        font-size: 0.72rem;
        padding: 16px;
    }
    .info-section,
    .faq-section {
        padding: 20px;
        margin-left: 0;
        margin-right: 0;
    }
    .info-section h2,
    .faq-section h2 {
        font-size: 1.15rem;
    }
    .newsletter-section {
        padding: 24px 20px;
    }
    .fp-aff-wrap {
        padding: 0 16px;
    }
    .fp-aff-box {
        padding: 24px 20px;
        flex-direction: column;
        text-align: center;
    }
    .fp-aff-btn {
        width: 100%;
        justify-content: center;
    }
    .stack-item {
        padding: 10px 12px;
        gap: 8px;
    }
    .stack-name {
        font-size: 0.85rem;
    }
    .stack-badge {
        font-size: 0.55rem;
        padding: 2px 8px;
    }
    .fallback-search-wrap {
        height: 52px;
        padding: 0 6px 0 16px;
        gap: 10px;
    }
    .fallback-search {
        font-size: 0.85rem;
    }
    .fallback-add-upload span {
        display: none;
    }
    .fallback-add-upload {
        width: 40px;
        padding: 0;
        justify-content: center;
    }
    .fallback-hint {
        font-size: 0.68rem;
    }
    .fallback-results {
        max-height: 280px;
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: 0.75rem;
    }
    .hero-box {
        height: 44px;
        padding: 0 14px;
    }
    .hero-input-box {
        padding-left: 40px;
    }
    .hero-input-box > i {
        left: 14px;
        font-size: 0.8rem;
    }
    .hero-input-box .custom-input-field {
        font-size: 0.85rem;
    }
    .control-item {
        flex: 1 1 100%;
        min-width: 0;
    }
    .panel-btn {
        font-size: 0.7rem;
        padding: 6px 10px;
    }
    .preview-text {
        font-size: 22px;
    }
    .swap-line {
        font-size: 22px;
    }
    .metric-value {
        font-size: 1.1rem;
    }
    .stack-badge {
        display: none;
    }
    .stack-name small {
        display: none;
    }
    .fallback-search::placeholder {
        font-size: 0.75rem;
    }
}

/* ============ ACCESSIBILITY ============ */
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
}

/* The fallback search input sits inside its own focus ring on .fallback-search-wrap.
   Suppress the inner outline so we don't get a double ring. */
.fallback-search:focus,
.fallback-search:focus-visible {
    outline: none !important;
    box-shadow: none !important;
}

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

/* ============ SOURCE TABS ============ */
.source-tabs {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 16px;
    padding: 6px;
    background: rgba(21, 26, 33, 0.6);
    border: 1px solid var(--border);
    border-radius: 40px;
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
}

.source-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 30px;
    color: #9AA5B5;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 44px;
    white-space: nowrap;
}

.source-tab i {
    font-size: 0.9rem;
    color: #8A99B0;
    transition: color 0.2s;
}

.source-tab:hover {
    color: var(--primary);
    background: rgba(64, 224, 255, 0.08);
}

.source-tab:hover i {
    color: var(--primary);
}

.source-tab.active {
    background: var(--cyan-gradient);
    color: #0B0D10;
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(64, 224, 255, 0.25);
}

.source-tab.active i {
    color: #0B0D10;
}

.source-panel {
    display: none;
    animation: fadeInPanel 0.25s ease;
}

.source-panel.active {
    display: block;
}

@keyframes fadeInPanel {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============ UPLOAD ZONE ============ */
.upload-zone-stack {
    background: rgba(21, 26, 33, 0.95);
    backdrop-filter: blur(20px);
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: 40px 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 20px;
    min-height: 180px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.upload-zone-stack:hover,
.upload-zone-stack.dragover {
    border-color: var(--primary);
    background: rgba(64, 224, 255, 0.05);
    transform: translateY(-2px);
}

.upload-icon-stack {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(64, 224, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    color: var(--primary);
    margin-bottom: 8px;
}

.upload-title-stack {
    font-size: 1.05rem;
    font-weight: 700;
    color: #E9EEF5;
}

.upload-hint-stack {
    font-size: 0.8rem;
    color: #8A99B0;
}

.uploaded-info-stack {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
    background: #1E2630;
    border: 1px solid var(--primary);
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    animation: fadeInPanel 0.25s ease;
}

.uploaded-info-stack i.fa-file-signature {
    font-size: 1.6rem;
    color: var(--primary);
}

.uploaded-info-stack > div {
    flex: 1;
    min-width: 0;
}

#uploadedFontNameStack {
    font-size: 0.95rem;
    font-weight: 700;
    color: #E9EEF5;
    word-break: break-word;
}

#uploadedFontMetaStack {
    font-size: 0.72rem;
    color: #8A99B0;
}

.uploaded-clear-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: transparent;
    border: 1px solid var(--border);
    color: #8A99B0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.uploaded-clear-btn:hover {
    background: rgba(255, 82, 82, 0.1);
    border-color: #FF5252;
    color: #FF5252;
}

/* ============ MOBILE ============ */
@media (max-width: 768px) {
    .source-tabs {
        width: 100%;
        border-radius: 24px;
        padding: 4px;
        gap: 4px;
    }
    .source-tab {
        flex: 1;
        padding: 8px 10px;
        font-size: 0.72rem;
        min-height: 40px;
        border-radius: 20px;
        justify-content: center;
        gap: 4px;
    }
    .source-tab span {
        display: none;
    }
    .source-tab i {
        font-size: 1rem;
    }
    .upload-zone-stack {
        padding: 28px 16px;
        min-height: 140px;
    }
    .upload-icon-stack {
        width: 52px;
        height: 52px;
        font-size: 1.4rem;
    }
    .upload-title-stack {
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .source-tab {
        padding: 6px 8px;
        min-height: 36px;
    }
}

@supports (padding: max(0px)) {
    .header-container,
    .container,
    .footer-container {
        padding-left: max(16px, env(safe-area-inset-left));
        padding-right: max(16px, env(safe-area-inset-right));
    }
}
/* ============ v4: fallback base selector, notice, overrides toggle ============ */
.base-select-row {
    margin: 0 0 16px;
    padding: 14px 16px;
    background: #1E2630;
    border: 1px solid var(--border);
    border-radius: 16px;
}
.base-select-row label {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    color: #E9EEF5;
    margin-bottom: 8px;
}
.base-select {
    width: 100%;
    min-height: 44px;
    padding: 10px 14px;
    background: #151A21;
    color: #E9EEF5;
    border: 1px solid var(--border);
    border-radius: 30px;
    font-size: 0.85rem;
    font-family: inherit;
}
.base-select:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
}
.base-help {
    margin: 10px 0 0;
    font-size: 0.75rem;
    line-height: 1.6;
    color: #9AA5B5;
}
.metrics-notice {
    margin: 0 0 16px;
    padding: 12px 16px;
    font-size: 0.8rem;
    line-height: 1.6;
    color: #FFB74D;
    background: rgba(255, 183, 77, 0.1);
    border: 1px solid rgba(255, 183, 77, 0.3);
    border-radius: 14px;
}
.metrics-notice[hidden] { display: none; }
.overrides-btn { margin-left: auto; margin-right: 10px; }
.overrides-btn[aria-pressed="true"] {
    background: var(--cyan-gradient);
    color: #0B0D10;
    border-color: var(--primary);
}
.measure-note { line-height: 1.7; }
@media (max-width: 640px) {
    .overrides-btn { margin: 8px 0 0; }
}

/* ===== Mobile header fix: keep Sign In and the menu button on screen ===== */
@media (max-width: 640px) {
    .header-container { gap: 8px; padding-left: 12px; padding-right: 12px; }
    .logo-link { min-width: 0; flex-shrink: 1; }
    .brand-name { font-size: 1.05rem; white-space: nowrap; }
    .action-buttons { gap: 6px; flex-shrink: 0; }
    .auth-btn, .global-auth-btn { white-space: nowrap; width: 40px; height: 40px; padding: 0; justify-content: center; flex-shrink: 0; }
    .auth-btn span, .global-auth-btn span { display: none; }
    .contrast-toggle, .mobile-menu-btn { width: 40px; height: 40px; flex-shrink: 0; }
}
@media (max-width: 360px) {
    .brand-name { font-size: 0.95rem; }
    .logo-icon { width: 32px; height: 32px; font-size: 0.95rem; }
    .action-buttons { gap: 4px; }
}
