/* ============ RESET & VARIABLES - STUDIO DARK THEME ============ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
    width: 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%;
    transition: background-color 0.3s ease, color 0.3s ease;
}

body.high-contrast {
    background: #000000;
    color: #FFFFFF;
    --primary: #FFFF00;
    --primary-dark: #FFD700;
    --primary-light: rgba(255, 255, 0, 0.2);
    --primary-glow: rgba(255, 255, 0, 0.4);
    --surface-0: #000000;
    --surface-1: #1A1A1A;
    --surface-2: #2A2A2A;
    --surface-3: #3A3A3A;
    --border: #FFFF00;
    --border-strong: #FFFF00;
    --cyan-gradient: #FFFF00;
    --apca-gold: #FFFF00;
    --apca-silver: #FFFFFF;
    --apca-bronze: #FFA500;
}

body.high-contrast .kofi-link .cup-body,
body.high-contrast .kofi-link .cup-body::before,
body.high-contrast .coffee-liquid {
    background: #FFFF00 !important;
}

body.high-contrast .cup-handle {
    border-color: #FFFF00 !important;
}

body.high-contrast .coffee-steam span {
    background: linear-gradient(to top, rgba(255, 255, 0, 0.8), transparent) !important;
}

body.high-contrast i,
body.high-contrast .fa-solid,
body.high-contrast .fa-regular,
body.high-contrast .fa-brands,
body.high-contrast .fas {
    color: #FFFF00 !important;
}

body.high-contrast .modal-header-btn i,
body.high-contrast .modal-close i,
body.high-contrast .stage-btn i,
body.high-contrast .grid-toggle i,
body.high-contrast .feature-btn i {
    color: #000000 !important;
}

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;
    transition: opacity 0.3s ease;
}

body.high-contrast::before {
    opacity: 0;
}

main {
    flex: 1;
    position: relative;
    z-index: 1;
    width: 100%;
}

:root {
    --primary: #40E0FF;
    --primary-dark: #00B8D4;
    --primary-light: rgba(64, 224, 255, 0.15);
    --primary-glow: rgba(64, 224, 255, 0.25);
    --secondary: #40E0FF;
    --accent: #00B8D4;
    --warning: #FFB74D;
    --danger: #FF5252;
    --success: #4CAF50;
    --info: #40E0FF;
    --surface-0: #0B0D10;
    --surface-1: #151A21;
    --surface-2: #1E2630;
    --surface-3: #273140;
    --text-primary: #E9EEF5;
    --text-secondary: #C0C8D2;
    --text-tertiary: #9AA5B5;
    --text-muted: #6B7A8F;
    --border: #273140;
    --border-strong: #3A4A60;
    --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);
    --shadow-glow: 0 0 30px rgba(64, 224, 255, 0.25);
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-xl: 32px;
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    --cyan-gradient: linear-gradient(135deg, #40E0FF, #00B8D4);
    --wcag-pass: #4CAF50;
    --wcag-fail: #FF5252;
    --wcag-aa-large: #FFB74D;
    --wcag-aaa: #40E0FF;
    --apca-bronze: #cd7f32;
    --apca-silver: #C0C0C0;
    --apca-gold: #FFD700;
    --grid-bg: repeating-linear-gradient(45deg, #1E2630 0px, #1E2630 10px, #151A21 10px, #151A21 20px);
}

/* ============ SKELETON LOADERS ============ */
.skeleton-loader {
    background: linear-gradient(90deg, #1E2630 25%, #2a3340 50%, #1E2630 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
    pointer-events: none;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-text {
    height: 1.2em;
    margin: 0.5em 0;
    width: 80%;
}

.skeleton-block {
    height: 150px;
    width: 100%;
    border-radius: var(--radius-md);
}

.font-card.skeleton {
    background: #1E2630;
    pointer-events: none;
    border: 1px solid var(--border);
}

/* ============ DOWNLOAD PROGRESS INDICATOR ============ */
.download-progress {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #151A21;
    padding: 24px;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    z-index: 20000;
    text-align: left;
    display: none;
    border: 1px solid var(--primary);
    min-width: 320px;
}

.download-progress.active {
    display: block;
    animation: scaleIn 0.3s ease;
}

@keyframes scaleIn {
    from { transform: translate(-50%, -50%) scale(0.9); opacity: 0; }
    to { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

.progress-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid #273140;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin { to { transform: rotate(360deg); } }

.file-list {
    margin-top: 16px;
    background: #1E2630;
    border-radius: 8px;
    padding: 12px;
    max-height: 200px;
    overflow-y: auto;
}

.file-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    font-size: 0.8rem;
    color: #9AA5B5;
    border-bottom: 1px solid #273140;
    animation: slideIn 0.2s ease;
}

@keyframes slideIn {
    from { transform: translateX(-10px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.file-item:last-child {
    border-bottom: none;
}

.file-item i {
    color: var(--primary);
    font-size: 0.9rem;
}

.file-item .file-size {
    margin-left: auto;
    color: var(--primary);
    font-size: 0.7rem;
}

/* ============ FULL SCREEN MODAL ============ */
.fullscreen-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(12px);
}

.fullscreen-modal.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: #151A21;
    border-radius: 32px;
    width: 100%;
    max-width: 1100px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    overflow: hidden;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--cyan-gradient);
    flex-shrink: 0;
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
    color: #0B0D10;
}

.modal-title i {
    color: #0B0D10;
    font-size: 2rem;
}

.modal-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-header-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(0, 0, 0, 0.2);
    color: #0B0D10;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.modal-header-btn:hover {
    background: #0B0D10;
    color: var(--primary);
    border-color: #0B0D10;
    transform: scale(1.1);
}

.modal-close {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(0, 0, 0, 0.2);
    color: #0B0D10;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.modal-close:hover {
    background: #FF5252;
    color: white;
    border-color: #FF5252;
    transform: rotate(90deg);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.fullscreen-preview {
    background: #1E2630;
    border-radius: 20px;
    padding: 40px 20px;
    margin-bottom: 20px;
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 200px;
    position: relative;
    box-sizing: border-box;
}

.fullscreen-text {
    font-size: 80px;
    line-height: 1.2;
    text-align: center;
    font-family: inherit;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    max-width: 100%;
    padding: 0 10px;
    word-break: break-word;
    overflow-wrap: break-word;
    color: #E9EEF5;
}

.modal-wcag-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 6px 12px;
    border-radius: 30px;
    font-size: 0.8rem;
    font-weight: 700;
    background: rgba(76, 175, 80, 0.2);
    color: #4CAF50;
    border: 1px solid #4CAF50;
    box-shadow: var(--shadow);
    z-index: 10;
}

.modal-wcag-badge.aaa { background: rgba(64, 224, 255, 0.2); color: #40E0FF; border-color: #40E0FF; }
.modal-wcag-badge.aa-large { background: rgba(255, 183, 77, 0.2); color: #FFB74D; border-color: #FFB74D; }
.modal-wcag-badge.fail { background: rgba(255, 82, 82, 0.2); color: #FF5252; border-color: #FF5252; }
.modal-wcag-badge.bronze { background: rgba(205, 127, 50, 0.2); color: #cd7f32; border-color: #cd7f32; }
.modal-wcag-badge.silver { background: rgba(192, 192, 192, 0.2); color: #C0C0C0; border-color: #C0C0C0; }
.modal-wcag-badge.gold { background: rgba(255, 215, 0, 0.2); color: #FFD700; border-color: #FFD700; }

@media (max-width: 768px) {
    .fullscreen-text {
        font-size: 48px;
        word-break: break-word;
        overflow-wrap: break-word;
    }
    .fullscreen-preview {
        min-height: 150px;
        padding: 20px 15px;
    }
}

.fullscreen-modal.fullscreen {
    padding: 0;
}

.fullscreen-modal.fullscreen .modal-content {
    max-width: 100%;
    max-height: 100%;
    width: 100%;
    height: 100%;
    border-radius: 0;
}

.fullscreen-modal.fullscreen .fullscreen-text {
    font-size: 120px;
    word-break: break-word;
    overflow-wrap: break-word;
}

@media (max-width: 768px) {
    .fullscreen-modal.fullscreen .fullscreen-text {
        font-size: 72px;
    }
}

.modal-toolbar {
    background: #1E2630;
    border-radius: 60px;
    padding: 12px 20px;
    margin-bottom: 20px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: center;
    justify-content: center;
}

.modal-toolbar-item {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #151A21;
    padding: 6px 14px;
    border-radius: 40px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    height: 42px;
}

.modal-toolbar-item label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary);
    text-transform: uppercase;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 4px;
}

.modal-toolbar-item label i {
    font-size: 0.8rem;
    color: var(--primary);
}

.modal-toolbar-item .numeric-input {
    width: 60px;
    padding: 4px 6px;
    border: 1px solid var(--border);
    border-radius: 30px;
    font-size: 0.8rem;
    text-align: center;
    background: #151A21;
    color: #E9EEF5;
}

.modal-toolbar-item .weight-select {
    width: 85px;
    padding: 4px 20px 4px 8px;
    border: 1px solid var(--border);
    border-radius: 30px;
    font-size: 0.8rem;
    font-weight: 500;
    appearance: none;
    background: #151A21 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%2340E0FF' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") no-repeat right 6px center;
    color: #E9EEF5;
    cursor: pointer;
}

.modal-toolbar-item .style-pill {
    height: 36px;
    padding: 4px 16px;
    border: 1px solid var(--border);
    background: #151A21;
    border-radius: 30px;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    color: #9AA5B5;
}

.modal-toolbar-item .style-pill.active {
    background: var(--cyan-gradient);
    color: #0B0D10;
    border-color: var(--primary);
}

.color-duo {
    display: flex;
    gap: 4px;
}

.color-chip {
    width: 24px;
    height: 24px;
    border-radius: 24px;
    border: 2px solid #151A21;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: transform 0.2s;
}

.color-chip:hover {
    transform: scale(1.1);
}

.modal-variable-section {
    margin-top: 16px;
    padding: 16px;
    background: #1E2630;
    border-radius: 12px;
    border: 1px solid var(--border);
    display: none;
}

.modal-variable-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.variable-font-badge {
    background: var(--cyan-gradient);
    color: #0B0D10;
    padding: 2px 8px;
    border-radius: 30px;
    font-size: 0.7rem;
    font-weight: 600;
}

.reset-axes-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: #151A21;
    color: var(--primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
}

.reset-axes-btn:hover {
    background: var(--cyan-gradient);
    color: #0B0D10;
    transform: rotate(-180deg);
}

.variable-axes-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

.axis-control {
    background: #151A21;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px;
}

.axis-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.axis-name {
    font-weight: 600;
    font-size: 0.7rem;
    color: #E9EEF5;
}

.axis-tag {
    background: rgba(64, 224, 255, 0.1);
    padding: 2px 5px;
    border-radius: 30px;
    font-size: 0.55rem;
    font-weight: 600;
    color: var(--primary);
    font-family: monospace;
}

.axis-slider-container {
    display: flex;
    align-items: center;
    gap: 6px;
}

.axis-slider {
    flex: 1;
    height: 4px;
    -webkit-appearance: none;
    background: linear-gradient(to right, #273140, var(--primary));
    border-radius: 2px;
    outline: none;
    appearance: none;
}

.axis-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    background: #E9EEF5;
    border: 2px solid var(--primary);
    border-radius: 50%;
    cursor: pointer;
    transition: 0.1s;
    box-shadow: var(--shadow);
}

.axis-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    background: var(--primary);
}

.axis-input {
    width: 45px;
    padding: 2px 3px;
    border: 1px solid var(--border);
    border-radius: 30px;
    text-align: center;
    font-size: 0.65rem;
    background: #151A21;
    color: #E9EEF5;
}

.axis-value-display {
    font-size: 0.6rem;
    color: var(--primary);
    text-align: right;
    margin-top: 4px;
}

.modal-action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    margin-top: 24px;
}

.modal-action-btn {
    padding: 14px 28px;
    border-radius: 60px;
    border: none;
    font-weight: 600;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    letter-spacing: 0.3px;
    min-width: 180px;
    position: relative;
    overflow: hidden;
}

.modal-action-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.5s, height 0.5s;
    z-index: 0;
}

.modal-action-btn:hover::before {
    width: 300px;
    height: 300px;
}

.modal-action-btn i, .modal-action-btn span {
    position: relative;
    z-index: 1;
}

.modal-action-btn.primary {
    background: var(--cyan-gradient);
    color: #0B0D10;
    border: none;
}

.modal-action-btn.primary:hover {
    background: var(--primary-dark);
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(64, 224, 255, 0.4);
}

.modal-action-btn.secondary {
    background: var(--primary);
    color: #0B0D10;
    border: none;
}

.modal-action-btn.secondary:hover {
    background: var(--primary-dark);
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(64, 224, 255, 0.4);
}

.modal-action-btn.tertiary {
    background: #151A21;
    color: var(--primary);
    border: 2px solid var(--primary);
    box-shadow: none;
}

.modal-action-btn.tertiary i {
    color: var(--primary);
}

.modal-action-btn.tertiary:hover {
    background: var(--cyan-gradient);
    color: #0B0D10;
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(64, 224, 255, 0.25);
    border-color: var(--primary);
}

.modal-action-btn.tertiary:hover i {
    color: #0B0D10;
}

@media (max-width: 768px) {
    .modal-action-btn {
        width: 100%;
        min-width: auto;
        padding: 12px 20px;
        font-size: 0.9rem;
    }
    .modal-action-btn i {
        font-size: 1rem;
    }
}

/* ============ HEADER - FIXED ============ */
.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);
    transition: transform 0.3s ease, background-color 0.3s ease;
}

.header.hidden {
    transform: translateY(-100%);
}

body.high-contrast .header {
    background: #000000;
    border-bottom: 2px solid #FFFF00;
}

.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;
    padding: 4px 0;
    transition: var(--transition);
}

.action-buttons {
    grid-column: 3;
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: flex-end;
}

@media (max-width: 1024px) {
    .header-container {
        display: flex;
        justify-content: space-between;
        grid-template-columns: none;
    }
    .logo-link {
        grid-column: auto;
    }
    .action-buttons {
        grid-column: auto;
    }
    .nav-desktop {
        display: none;
    }
}

@media (max-width: 768px) {
    .header-container {
        padding: 8px 16px;
    }
}

.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);
    transition: var(--transition);
}

.logo-link:hover .logo-icon {
    transform: rotate(5deg) scale(1.05);
    box-shadow: 0 0 25px rgba(64, 224, 255, 0.5);
}

.brand-name {
    font-size: 1.2rem;
    font-weight: 700;
    font-family: 'Plus Jakarta Sans', sans-serif;
    color: #E9EEF5;
    letter-spacing: -0.5px;
    white-space: nowrap;
}

body.high-contrast .brand-name {
    color: #FFFFFF;
}

.brand-name span {
    color: var(--primary);
    font-weight: 800;
    position: relative;
}

.brand-name span::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--cyan-gradient);
    border-radius: 2px;
    transform: scaleX(0);
    transition: transform 0.3s ease;
    transform-origin: right;
}

.logo-link:hover .brand-name span::after {
    transform: scaleX(1);
    transform-origin: left;
}

@media (max-width: 480px) {
    .brand-name {
        font-size: 1rem;
    }
    .logo-icon {
        width: 32px;
        height: 32px;
        font-size: 1rem;
    }
}

.nav-desktop {
    display: flex;
    align-items: center;
    gap: 4px;
    justify-content: center;
    margin: 0 auto;
    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%;
}

@media (max-width: 1024px) {
    .nav-desktop {
        display: none;
    }
}

.nav-link {
    color: #9AA5B5;
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 500;
    transition: all 0.2s ease;
    white-space: nowrap;
    padding: 6px 12px;
    border-radius: 30px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    position: relative;
    border: 1px solid transparent;
}

body.high-contrast .nav-link {
    color: #FFFFFF;
}

.nav-link i {
    font-size: 0.8rem;
    color: #6B7A8F;
    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);
    transform: translateY(-1px);
}

.nav-link:hover i {
    color: var(--primary);
    transform: scale(1.1);
}

.nav-link.active {
    background: var(--cyan-gradient);
    color: #0B0D10;
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(64, 224, 255, 0.3);
}

.nav-link.active i {
    color: #0B0D10;
}

.nav-dropdown {
    position: relative;
}

.dropdown-toggle {
    cursor: pointer;
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: #151A21;
    border-radius: 12px;
    padding: 8px;
    min-width: 180px;
    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,
.dropdown-menu:hover {
    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);
    transform: translateX(4px);
}

.dropdown-menu a.active {
    background: rgba(64, 224, 255, 0.15);
    color: var(--primary);
    font-weight: 600;
}

.new-badge {
    margin-left: auto;
    font-size: 0.6rem;
    background: var(--cyan-gradient);
    color: #0B0D10;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 600;
}

.action-buttons {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* Auth Button Styles */
.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;
    white-space: nowrap;
    transition: var(--transition);
    height: 44px;
}

.auth-btn i {
    font-size: 0.8rem;
    color: #40E0FF;
}

.auth-btn:hover {
    background: var(--cyan-gradient);
    border-color: transparent;
    color: #0B0D10;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(64, 224, 255, 0.3);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 4px;
    background: #1E2630;
    border: 1px solid #273140;
    border-radius: 60px;
    padding: 3px 3px 3px 10px;
    transition: var(--transition);
    height: 44px;
}

.user-profile:hover {
    border-color: #40E0FF;
    background: rgba(64, 224, 255, 0.1);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--cyan-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #0B0D10;
    font-weight: 600;
    font-size: 0.9rem;
}

.sign-out-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: #9AA5B5;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.sign-out-btn:hover {
    color: #FF5252;
    transform: scale(1.1);
    background: rgba(255, 82, 82, 0.1);
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
    .auth-btn {
        padding: 6px 12px;
        height: 40px;
        font-size: 0.75rem;
    }
    .user-profile {
        padding: 2px 2px 2px 8px;
        height: 40px;
    }
    .user-avatar {
        width: 32px;
        height: 32px;
        font-size: 0.8rem;
    }
    .sign-out-btn {
        width: 32px;
        height: 32px;
    }
}

@media (max-width: 480px) {
    .auth-btn {
        padding: 6px 10px;
        height: 36px;
        font-size: 0.7rem;
    }
    .auth-btn span {
        display: none;
    }
    .auth-btn i {
        font-size: 0.9rem;
        margin: 0;
    }
    .user-profile {
        padding: 2px;
        height: 36px;
    }
    .user-avatar {
        width: 28px;
        height: 28px;
        font-size: 0.7rem;
    }
    .sign-out-btn {
        width: 28px;
        height: 28px;
    }
}

/* Animation for user profile when appearing */
@keyframes profileSlideIn {
    from {
        opacity: 0;
        transform: translateX(10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.user-profile {
    animation: profileSlideIn 0.3s ease-out;
}

.kofi-link {
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #1E2630;
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
    overflow: visible;
    text-decoration: none;
    color: var(--primary);
}

.kofi-link:hover {
    transform: translateY(-3px) scale(1.05);
    border-color: var(--primary);
    background: var(--cyan-gradient);
    color: #0B0D10;
    box-shadow: 0 5px 20px rgba(64, 224, 255, 0.4);
}

.contrast-toggle {
    position: relative;
    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;
}

.contrast-toggle:hover {
    background: var(--cyan-gradient);
    color: #0B0D10;
    transform: translateY(-2px);
}

.coffee-cup {
    position: relative;
    width: 22px;
    height: 22px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.cup-body {
    position: relative;
    width: 18px;
    height: 16px;
    background: linear-gradient(135deg, #FFD700, #FFA500);
    border-radius: 0 0 8px 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    animation: cupFill 2s ease-in-out infinite alternate;
}

.cup-body::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 14px;
    height: 12px;
    background: linear-gradient(135deg, #FFE55C, #FFB347);
    border-radius: 0 0 6px 6px;
    opacity: 0.8;
}

.cup-handle {
    position: absolute;
    top: 2px;
    right: -5px;
    width: 5px;
    height: 8px;
    border: 2px solid #FFD700;
    border-left: none;
    border-radius: 0 4px 4px 0;
    opacity: 0.8;
}

.coffee-liquid {
    position: absolute;
    top: -2px;
    left: 2px;
    width: 14px;
    height: 3px;
    background: linear-gradient(90deg, #8B4513, #A0522D);
    border-radius: 2px;
    animation: liquidWave 2s ease-in-out infinite;
}

.coffee-steam {
    position: absolute;
    top: -8px;
    left: 5px;
    display: flex;
    gap: 2px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.kofi-link:hover .coffee-steam {
    opacity: 1;
}

.coffee-steam span {
    width: 2px;
    height: 8px;
    background: linear-gradient(to top, rgba(255, 255, 255, 0.8), transparent);
    border-radius: 1px;
    animation: steam 1.5s ease-in-out infinite;
}

.coffee-steam span:nth-child(1) { animation-delay: 0s; }
.coffee-steam span:nth-child(2) { animation-delay: 0.3s; }
.coffee-steam span:nth-child(3) { animation-delay: 0.6s; }

.kofi-tooltip {
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%) scale(0.8);
    background: var(--cyan-gradient);
    color: #0B0D10;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    box-shadow: 0 5px 15px rgba(64, 224, 255, 0.4);
    pointer-events: none;
    z-index: 10;
}

.kofi-tooltip::before {
    content: '';
    position: absolute;
    top: -4px;
    left: 50%;
    transform: translateX(-50%) rotate(45deg);
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 2px;
}

.kofi-link:hover .kofi-tooltip {
    opacity: 1;
    visibility: visible;
    bottom: -40px;
    transform: translateX(-50%) scale(1);
}

.kofi-link::after {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: var(--cyan-gradient);
    border-radius: 50%;
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s ease;
    filter: blur(10px);
}

.kofi-link:hover::after {
    opacity: 0.5;
}

@keyframes cupFill {
    0% { transform: scaleY(1); }
    100% { transform: scaleY(1.05); }
}

@keyframes liquidWave {
    0%, 100% { transform: translateX(0) scaleX(1); }
    25% { transform: translateX(1px) scaleX(1.05); }
    75% { transform: translateX(-1px) scaleX(0.95); }
}

@keyframes steam {
    0% { transform: translateY(0) scaleX(1); opacity: 0.8; }
    50% { transform: translateY(-5px) scaleX(1.5); opacity: 0.4; }
    100% { transform: translateY(-10px) scaleX(2); opacity: 0; }
}

.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);
    transition: var(--transition);
    flex-shrink: 0;
    cursor: pointer;
}

.mobile-menu-btn i {
    font-size: 1.1rem;
}

.mobile-menu-btn:hover {
    background: var(--cyan-gradient);
    color: #0B0D10;
    transform: translateY(-2px);
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(64, 224, 255, 0.3);
}

@media (max-width: 1024px) {
    .mobile-menu-btn {
        display: flex;
    }
}

.mobile-menu {
    position: fixed;
    top: 0;
    right: -100%;
    width: 280px;
    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;
    transition: var(--transition);
}

.mobile-menu-close:hover {
    background: var(--cyan-gradient);
    color: #0B0D10;
    transform: rotate(90deg);
}

.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);
    transform: translateX(5px);
}

.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;
}

/* ============ PAGE TITLE ============ */
.page-title {
    text-align: center;
    margin: 30px 20px 20px;
    padding: 0 20px;
}

.page-title h1 {
    font-size: 1.8rem;
    font-weight: 700;
    font-family: 'Plus Jakarta Sans', sans-serif;
    color: #E9EEF5;
    margin-bottom: 8px;
}

body.high-contrast .page-title h1 {
    color: #FFFFFF;
}

.page-title .gradient-text {
    background: var(--cyan-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.page-title p {
    color: #6B7A8F;
    font-size: 0.95rem;
    max-width: 700px;
    margin: 8px auto 0;
}

body.high-contrast .page-title p {
    color: #CCCCCC;
}

@media (max-width: 768px) {
    .page-title h1 {
        font-size: 1.5rem;
    }
    .page-title p {
        font-size: 0.85rem;
    }
}

/* ============ KEYBOARD SHORTCUT HINT ============ */
.shortcut-hint {
    position: fixed;
    bottom: 100px;
    right: 20px;
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid var(--primary);
    border-radius: 30px;
    padding: 8px 16px;
    color: var(--primary);
    font-size: 0.8rem;
    backdrop-filter: blur(8px);
    z-index: 999;
    pointer-events: none;
    animation: fadeInOut 3s ease;
}

@keyframes fadeInOut {
    0% { opacity: 0; transform: translateY(10px); }
    10% { opacity: 1; transform: translateY(0); }
    90% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(-10px); }
}

.shortcut-hint i {
    margin-right: 6px;
}

.shortcut-hint kbd {
    background: #0B0D10;
    border: 1px solid var(--primary);
    border-radius: 4px;
    padding: 2px 6px;
    margin: 0 2px;
    font-family: monospace;
}

/* ============ MAIN LAYOUT ============ */
.app-layout {
    display: flex;
    flex: 1;
    max-width: 1600px;
    margin: 0 auto;
    width: 100%;
    padding: 0 20px;
    gap: 24px;
    transition: all 0.3s ease;
    position: relative;
}

.main-content {
    flex: 1;
    min-width: 0;
    transition: all 0.3s ease;
    margin-left: 0;
}

.main-content.sidebar-hidden {
    margin-left: 0;
}

/* ============ GLOBAL CONTROLS BAR ============ */
.global-controls {
    background: rgba(21, 26, 33, 0.95);
    backdrop-filter: blur(20px);
    border: 0.5px solid var(--border);
    border-radius: 60px;
    padding: 8px 16px;
    margin-bottom: 20px;
    transition: all 0.2s ease, transform 0.3s ease;
    position: sticky;
    top: 80px;
    z-index: 50;
    box-shadow: var(--shadow-lg);
    width: 100%;
}

.global-controls.hidden-on-scroll {
    transform: translateY(calc(-100% - 10px));
}

.controls-collapsible {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    flex-wrap: wrap;
}

.controls-primary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

.control-item {
    display: flex;
    align-items: center;
    gap: 4px;
    background: #1E2630;
    padding: 4px 8px;
    border-radius: 30px;
    border: 1px solid var(--border);
}

.control-item label {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--primary);
    text-transform: uppercase;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 2px;
}

.control-item label i {
    font-size: 0.7rem;
}

.numeric-input {
    width: 45px;
    padding: 4px 4px;
    background: #151A21;
    border: 1px solid var(--border);
    border-radius: 30px;
    color: #E9EEF5;
    font-size: 0.75rem;
    text-align: center;
}

.font-select-sm {
    padding: 4px 20px 4px 8px;
    background: #151A21;
    border: 1px solid var(--border);
    border-radius: 30px;
    color: #E9EEF5;
    font-size: 0.7rem;
    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 6px center;
    min-width: 55px;
}

.icon-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #1E2630;
    border: 1px solid var(--border);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s;
}

.icon-btn:hover {
    background: var(--primary);
    color: #0B0D10;
    border-color: var(--primary);
    transform: translateY(-2px);
}

.icon-btn.active {
    background: var(--cyan-gradient);
    color: #0B0D10;
    border-color: var(--primary);
}

.icon-btn:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Segmented Control */
.segmented-control {
    display: flex;
    background: #1E2630;
    border: 1px solid var(--border);
    border-radius: 40px;
    padding: 3px;
    position: relative;
}

.segmented-option {
    padding: 6px 14px;
    border-radius: 30px;
    font-size: 0.8rem;
    color: #9AA5B5;
    cursor: pointer;
    white-space: nowrap;
    z-index: 1;
    position: relative;
    font-weight: 500;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.segmented-option.active {
    color: #0B0D10;
}

.segmented-highlight {
    position: absolute;
    top: 3px;
    bottom: 3px;
    left: 3px;
    width: calc(25% - 3px);
    background: var(--cyan-gradient);
    border-radius: 30px;
    transition: left 0.3s ease;
    z-index: 0;
}

/* Live Button */
.load-btn {
    background: #1E6F8F;
    border: none;
    border-radius: 30px;
    padding: 8px 18px;
    color: white;
    font-weight: 600;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
    min-height: 44px;
}

.load-btn:hover {
    background: var(--primary);
    color: #0B0D10;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(64, 224, 255, 0.3);
}

.load-btn i {
    font-size: 0.7rem;
}

/* Mobile more button */
.more-controls-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #1E2630;
    border: 1px solid var(--border);
    color: var(--primary);
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.8rem;
}

.controls-secondary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.controls-secondary.expanded {
    max-height: 100px;
    margin-top: 10px;
}

@media (min-width: 1025px) {
    .controls-secondary {
        display: none !important;
    }
    .more-controls-btn {
        display: none;
    }
}

@media (max-width: 1024px) and (min-width: 769px) {
    .controls-collapsible {
        gap: 8px;
    }
    .segmented-option {
        padding: 6px 12px;
        font-size: 0.7rem;
    }
}

/* Mobile styles */
@media (max-width: 768px) {
    .header-container {
        padding: 8px 16px;
        justify-content: center;
        gap: 10px;
    }
    .logo-link {
        margin-right: auto;
    }
    .action-buttons {
        margin-left: auto;
    }
    .nav-desktop {
        display: none;
    }
    .page-title {
        text-align: center;
        margin: 20px 15px;
    }
    .page-title h1 {
        font-size: 1.3rem;
        text-align: center;
    }
    .page-title p {
        font-size: 0.8rem;
        text-align: center;
        margin-left: auto;
        margin-right: auto;
    }
    .global-controls {
        padding: 8px 12px;
        width: 100%;
    }
    .controls-collapsible {
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
    }
    .controls-primary {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
    }
    .control-item {
        flex: 0 1 auto;
    }
    .segmented-control {
        margin: 0 auto;
        width: auto;
    }
    .text-input-wrapper {
        text-align: center;
        width: 100%;
    }
    .custom-input-field {
        text-align: center;
        margin: 0 auto;
        width: 100%;
    }
    .feature-toolbar {
        justify-content: center;
        width: 100%;
        margin: 15px auto;
        padding: 10px;
    }
    .feature-btn {
        text-align: center;
        justify-content: center;
    }
    .comparison-wrapper {
        flex-direction: column;
    }
    .swap-button {
        margin: 10px 0;
        transform: rotate(90deg);
    }
    .swap-button:hover {
        transform: rotate(270deg) scale(1.1);
    }
    .font-card {
        width: 100%;
        margin: 0 auto;
    }
    .card-header {
        text-align: center;
    }
    .header-row {
        justify-content: center;
    }
    .card-title {
        justify-content: center;
        width: 100%;
    }
    .font-selector-row {
        justify-content: center;
        flex-direction: column;
        align-items: stretch;
    }
    .font-select-main {
        width: 100%;
    }
    .smart-pair-btn {
        width: 100%;
        justify-content: center;
    }
    .preview-stage {
        text-align: center;
    }
    .preview-text {
        text-align: center;
        margin: 0 auto;
        width: 100%;
    }
    .apca-detail {
        left: 50%;
        transform: translateX(-50%);
        text-align: center;
        justify-content: center;
        flex-direction: column;
        gap: 3px;
        align-items: center;
        bottom: 4px;
    }
    .stage-actions {
        left: 50%;
        transform: translateX(-50%);
        right: auto;
        bottom: 45px;
    }
    .grid-toggle {
        left: 50%;
        transform: translateX(-50%);
        bottom: 10px;
    }
    .status-bar {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 10px;
    }
    .status-fonts {
        justify-content: center;
        width: 100%;
        flex-wrap: wrap;
    }
    .status-item {
        justify-content: center;
    }
    .pairing-score {
        justify-content: center;
        width: 100%;
    }
    .optical-size-bar {
        justify-content: center;
        text-align: center;
        flex-direction: column;
        align-items: center;
    }
    .optical-size-bar label {
        justify-content: center;
        width: 100%;
    }
    .optical-size-bar input {
        margin: 0 auto;
        width: 100%;
        max-width: 280px;
    }
    .fallback-panel {
        text-align: center;
    }
    .fallback-header {
        justify-content: center;
        text-align: center;
    }
    .fallback-grid {
        justify-content: center;
    }
    .fallback-card {
        text-align: center;
        margin: 0 auto;
        width: 100%;
    }
    #productionBundlePanel {
        text-align: center;
    }
    .production-bundle {
        text-align: left;
        margin: 10px auto;
        width: 100%;
    }
    .shortcut-hint {
        display: none;
    }
    .preview-text {
        font-size: 24px;
    }
    .preview-stage {
        min-height: 180px;
        padding: 20px 10px;
    }
}

@media (max-width: 480px) {
    .header-container {
        padding: 6px 10px;
    }
    .brand-name {
        font-size: 0.9rem;
    }
    .logo-icon {
        width: 28px;
        height: 28px;
    }
    .action-buttons {
        gap: 4px;
    }
    .kofi-link, .contrast-toggle {
        width: 32px;
        height: 32px;
    }
    .control-item {
        padding: 2px 6px;
    }
    .control-item label {
        font-size: 0.6rem;
    }
    .numeric-input {
        width: 38px;
        padding: 3px;
        font-size: 0.7rem;
    }
    .segmented-option {
        padding: 6px 8px;
        font-size: 0.65rem;
        min-width: 40px;
        min-height: 40px;
    }
    .page-title h1 {
        font-size: 1.1rem;
    }
    .feature-toolbar {
        padding: 8px;
    }
    .feature-btn {
        padding: 4px 8px;
        font-size: 0.65rem;
        min-width: 100px;
    }
    .apca-detail {
        flex-direction: column;
        gap: 2px;
        padding: 4px 8px;
        font-size: 0.55rem;
        bottom: 50px;
    }
    .stage-actions {
        bottom: 55px;
    }
    .grid-toggle {
        bottom: 10px;
    }
}

/* ============ PREDICTIVE PAIRING BANNER ============ */
.predictive-banner {
    background: linear-gradient(135deg, rgba(64, 224, 255, 0.1), rgba(0, 184, 212, 0.1));
    border: 1px solid var(--primary);
    border-radius: var(--radius-lg);
    padding: 16px 20px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    animation: slideIn 0.5s ease;
    position: relative;
}

.text-input-wrapper {
    margin-bottom: 24px;
    position: relative;
    width: 100%;
}

.text-input-wrapper i {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--primary);
    font-size: 1.1rem;
    z-index: 2;
    opacity: 0.7;
    transition: all 0.3s ease;
    pointer-events: none;
}

.custom-input-field {
    width: 100%;
    padding: 16px 24px 16px 50px;
    background: #1E2630;
    border: 2px solid var(--border);
    border-radius: 60px;
    color: #E9EEF5;
    font-size: 1rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.custom-input-field:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 4px 20px rgba(64, 224, 255, 0.3);
    background: #232B36;
}

.custom-input-field:focus + i {
    opacity: 1;
    transform: translateY(-50%) scale(1.1);
    color: var(--primary);
}

.custom-input-field::placeholder {
    color: #6B7A8F;
    font-weight: 400;
    opacity: 0.7;
}

@media (max-width: 768px) {
    .custom-input-field {
        padding: 14px 20px 14px 45px;
        font-size: 0.95rem;
    }
    .text-input-wrapper i {
        left: 16px;
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .custom-input-field {
        padding: 12px 16px 12px 40px;
    }
    .text-input-wrapper i {
        left: 14px;
        font-size: 0.9rem;
    }
}

.predictive-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--border);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.7rem;
}

.predictive-close:hover {
    background: var(--danger);
    color: white;
    border-color: var(--danger);
}

.predictive-content {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.predictive-icon {
    width: 40px;
    height: 40px;
    background: rgba(64, 224, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    font-size: 1.2rem;
}

.predictive-text h4 {
    font-size: 0.95rem;
    margin-bottom: 2px;
    color: #E9EEF5;
}

.predictive-text p {
    font-size: 0.8rem;
    color: #9AA5B5;
}

.predictive-suggestion {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #1E2630;
    padding: 6px 14px;
    border-radius: 40px;
    border: 1px solid var(--border);
}

.predictive-suggestion i {
    color: var(--primary);
}

.predictive-suggestion span {
    font-weight: 600;
    color: #E9EEF5;
    font-size: 0.85rem;
}

.predictive-suggestion button {
    background: var(--cyan-gradient);
    border: none;
    border-radius: 30px;
    padding: 6px 14px;
    color: #0B0D10;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    min-height: 40px;
}

.predictive-suggestion button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(64, 224, 255, 0.3);
}

.predictive-dismiss {
    background: none;
    border: 1px solid var(--border);
    border-radius: 30px;
    padding: 4px 12px;
    color: #9AA5B5;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
}

.predictive-dismiss:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* ============ URL PREVIEW WRAPPER ============ */
.url-preview-wrapper {
    background: #151A21;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 20px;
    display: none;
    position: relative;
}

.url-preview-wrapper.visible {
    display: block;
    animation: slideDown 0.3s ease;
}

.panel-close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #1E2630;
    border: 1px solid var(--border);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.8rem;
    z-index: 10;
}

.panel-close-btn:hover {
    background: var(--danger);
    color: white;
    border-color: var(--danger);
    transform: rotate(90deg);
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

.url-input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}

.url-input {
    flex: 1;
    padding: 10px 14px;
    background: #1E2630;
    border: 1px solid var(--border);
    border-radius: 40px;
    color: #E9EEF5;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.url-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(64, 224, 255, 0.2);
}

.url-actions {
    display: flex;
    gap: 10px;
}

.url-btn {
    padding: 10px 20px;
    border-radius: 40px;
    border: none;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.url-btn.primary {
    background: var(--cyan-gradient);
    color: #0B0D10;
}

.url-btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(64, 224, 255, 0.3);
}

.url-btn.secondary {
    background: #1E2630;
    border: 1px solid var(--primary);
    color: var(--primary);
}

.url-btn.secondary:hover {
    background: var(--primary);
    color: #0B0D10;
    transform: translateY(-2px);
}

.floating-or {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #6B7A8F;
    font-size: 0.8rem;
    margin: 8px 0;
}

.floating-or::before,
.floating-or::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(to right, transparent, var(--primary), transparent);
}

/* ============ PREVIEW CONTAINER ============ */
.preview-container {
    background: #151A21;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 20px;
    display: none;
    position: relative;
}

.preview-header {
    padding: 12px 16px;
    background: #1E2630;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.preview-tabs {
    display: flex;
    gap: 8px;
    background: #151A21;
    border: 1px solid var(--border);
    border-radius: 40px;
    padding: 3px;
}

.preview-tab {
    padding: 6px 16px;
    border-radius: 30px;
    font-size: 0.8rem;
    color: #9AA5B5;
    cursor: pointer;
    transition: all 0.2s;
    min-height: 40px;
    display: flex;
    align-items: center;
}

.preview-tab.active {
    background: var(--cyan-gradient);
    color: #0B0D10;
}

.preview-iframe {
    width: 100%;
    height: 400px;
    border: none;
    background: white;
}

.html-editor-container {
    width: 100%;
    height: 400px;
    background: #0B0D10;
    display: none;
    flex-direction: column;
}

.html-editor-container.active {
    display: flex;
}

.html-editor-split {
    display: flex;
    flex: 1;
    min-height: 0;
    flex-direction: row;
}

.html-editor-left {
    flex: 1;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border);
}

.html-editor-right {
    flex: 1;
    background: white;
    overflow: auto;
}

.html-editor-tabs {
    display: flex;
    gap: 2px;
    background: #151A21;
    padding: 6px 10px;
    border-bottom: 1px solid var(--border);
}

.html-editor-tab {
    padding: 6px 16px;
    border-radius: 30px;
    background: #1E2630;
    border: 1px solid var(--border);
    color: #9AA5B5;
    font-size: 0.75rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    min-height: 40px;
}

.html-editor-tab.active {
    background: var(--cyan-gradient);
    color: #0B0D10;
    border-color: var(--primary);
}

.html-editor-textarea {
    flex: 1;
    width: 100%;
    padding: 12px;
    background: #0B0D10;
    border: none;
    color: #E9EEF5;
    font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
    font-size: 13px;
    line-height: 1.5;
    resize: none;
    outline: none;
}

.html-editor-css {
    display: none;
    flex: 1;
    width: 100%;
    padding: 12px;
    background: #0B0D10;
    border: none;
    color: #E9EEF5;
    font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
    font-size: 13px;
    line-height: 1.5;
    resize: none;
    outline: none;
    border-top: 1px solid var(--border);
}

.html-editor-css.active {
    display: block;
}

.html-editor-toolbar {
    padding: 6px 10px;
    background: #151A21;
    border-bottom: 1px solid var(--border);
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.html-editor-btn {
    padding: 6px 14px;
    border-radius: 30px;
    background: #1E2630;
    border: 1px solid var(--border);
    color: var(--primary);
    font-size: 0.75rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s;
    min-height: 40px;
}

.html-editor-btn:hover {
    background: var(--primary);
    color: #0B0D10;
    border-color: var(--primary);
}

/* ============ COMPARISON CARDS ============ */
.comparison-wrapper {
    display: flex;
    align-items: stretch;
    gap: 20px;
    width: 100%;
    margin-bottom: 20px;
}

.font-card {
    flex: 1;
    min-width: 0;
    background: #151A21;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all 0.2s ease;
    position: relative;
}

.font-card.skeleton {
    background: #1E2630;
    pointer-events: none;
    border: 1px solid var(--border);
}

.font-card:hover {
    border-color: var(--primary);
    box-shadow: 0 0 0 1px rgba(64, 224, 255, 0.3);
}

.font-card.selected {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(64, 224, 255, 0.3);
    animation: pulse 0.5s ease;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(64, 224, 255, 0.5); }
    70% { box-shadow: 0 0 0 10px rgba(64, 224, 255, 0); }
    100% { box-shadow: 0 0 0 0 rgba(64, 224, 255, 0); }
}

.card-header {
    padding: 12px;
    border-bottom: 1px solid var(--border);
    background: #1E2630;
}

.header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    flex-wrap: wrap;
    gap: 6px;
}

.card-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    color: var(--primary);
    flex-wrap: wrap;
}

.color-controls {
    display: flex;
    align-items: center;
    gap: 4px;
}

.color-chip {
    width: 24px;
    height: 24px;
    border-radius: 24px;
    border: 2px solid #151A21;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: transform 0.2s;
}

.color-chip:hover {
    transform: scale(1.1);
}

input[type="color"] { 
    width: 0; 
    height: 0; 
    visibility: hidden; 
    position: absolute; 
}

.card-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.card-action-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #151A21;
    border: 1px solid var(--border);
    color: var(--primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    font-size: 0.75rem;
}

.card-action-btn:hover {
    background: var(--primary);
    color: #0B0D10;
    border-color: var(--primary);
    transform: translateY(-2px);
}

.card-action-btn:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.swap-card-btn {
    background: var(--cyan-gradient) !important;
    color: #0B0D10 !important;
    border-color: var(--primary) !important;
    animation: pulse 2s infinite;
}

.swap-card-btn:hover {
    transform: rotate(180deg) scale(1.1) !important;
    box-shadow: 0 0 20px rgba(64, 224, 255, 0.6) !important;
}

.font-selector-row {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.type-select {
    padding: 6px 22px 6px 12px;
    background: #151A21;
    border: 1px solid var(--border);
    border-radius: 30px;
    color: #E9EEF5;
    font-size: 0.75rem;
    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;
    transition: all 0.2s;
    min-width: 70px;
    min-height: 40px;
}

.type-select:hover {
    border-color: var(--primary);
}

.category-select {
    padding: 6px 22px 6px 12px;
    background: #151A21;
    border: 1px solid var(--border);
    border-radius: 30px;
    color: #E9EEF5;
    font-size: 0.75rem;
    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;
    transition: all 0.2s;
    min-width: 75px;
    min-height: 40px;
}

.category-select:hover {
    border-color: var(--primary);
}

.font-select-main {
    flex: 1;
    min-width: 140px;
    padding: 6px 24px 6px 12px;
    background: #151A21;
    border: 1px solid var(--border);
    border-radius: 30px;
    color: #E9EEF5;
    font-size: 0.8rem;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%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 10px center;
    cursor: pointer;
    transition: all 0.2s;
    max-height: 300px;
    overflow-y: auto;
    min-height: 40px;
}

.font-select-main:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(64, 224, 255, 0.2);
}

.font-select-main option {
    padding: 8px 12px;
    background: #151A21;
    color: #E9EEF5;
    border-bottom: 1px solid #273140;
    white-space: normal;
    min-height: 30px;
}

.font-select-main option:hover {
    background: var(--primary);
    color: #0B0D10;
}

.font-select-main option[disabled] {
    color: #9AA5B5;
    font-style: italic;
    background: #1E2630;
    cursor: default;
    pointer-events: none;
}

.font-select-main {
    scrollbar-width: thin;
    scrollbar-color: var(--primary) #273140;
}

.font-select-main::-webkit-scrollbar {
    width: 8px;
}

.font-select-main::-webkit-scrollbar-track {
    background: #273140;
    border-radius: 4px;
}

.font-select-main::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 4px;
}

.font-select-main::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

.smart-pair-btn {
    padding: 6px 14px;
    background: #1E2630;
    border: 1px solid var(--border);
    border-radius: 30px;
    color: var(--primary);
    font-size: 0.75rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    transition: all 0.2s;
    min-height: 40px;
}

.smart-pair-btn:hover {
    background: var(--primary);
    color: #0B0D10;
    transform: translateY(-2px);
}

.smart-pair-btn.predictive {
    animation: glow 2s infinite;
}

@keyframes glow {
    0% { box-shadow: 0 0 0 0 rgba(64, 224, 255, 0.5); }
    50% { box-shadow: 0 0 10px 5px rgba(64, 224, 255, 0.3); }
    100% { box-shadow: 0 0 0 0 rgba(64, 224, 255, 0); }
}

.info-tooltip {
    position: relative;
    display: inline-flex;
    margin-left: 4px;
    color: #6B7A8F;
    cursor: help;
    font-size: 0.7rem;
}

.info-tooltip:hover .tooltip-content {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.tooltip-content {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(5px);
    background: #0B0D10;
    border: 1px solid var(--primary);
    border-radius: 8px;
    padding: 8px 12px;
    width: 200px;
    font-size: 0.7rem;
    color: #E9EEF5;
    text-align: left;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-lg);
    pointer-events: none;
    white-space: normal;
}

.tooltip-content::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 5px;
    border-style: solid;
    border-color: var(--primary) transparent transparent transparent;
}

.feature-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 16px auto;
    padding: 12px 60px 12px 20px;
    background: #151A21;
    border-radius: 50px;
    border: 1px solid var(--border);
    align-items: center;
    justify-content: center;
    position: relative;
    width: fit-content;
    max-width: 100%;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.feature-toolbar .panel-close-btn {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    background: rgba(30, 38, 48, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: 1px solid var(--border);
    color: var(--primary);
    z-index: 10;
    transition: all 0.2s ease;
    backdrop-filter: blur(4px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.feature-toolbar .panel-close-btn:hover {
    background: #FF5252;
    color: white;
    border-color: #FF5252;
    transform: translateY(-50%) scale(1.1);
}

.feature-btn {
    padding: 8px 18px;
    border-radius: 40px;
    background: #1E2630;
    border: 1px solid var(--border);
    color: #E9EEF5;
    font-size: 0.8rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
    white-space: nowrap;
    font-weight: 500;
    letter-spacing: 0.3px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    min-height: 44px;
}

.feature-btn:hover {
    background: var(--primary);
    color: #0B0D10;
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(64, 224, 255, 0.3);
}

.feature-btn.active {
    background: var(--cyan-gradient);
    color: #0B0D10;
    border-color: var(--primary);
    box-shadow: 0 0 15px rgba(64, 224, 255, 0.5);
}

.feature-btn i {
    font-size: 0.9rem;
}

.feature-btn:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.shift-score-indicator {
    position: static;
    display: inline-block;
    background: #1E2630;
    border-color: var(--primary);
    margin-left: 10px;
    padding: 5px 12px;
    border-radius: 30px;
    font-size: 0.75rem;
    color: #FF5252;
    border: 1px solid #FF5252;
    font-weight: 600;
}

@media (max-width: 1024px) {
    .feature-toolbar {
        padding: 10px 50px 10px 16px;
        gap: 8px;
    }
    .feature-btn {
        padding: 6px 14px;
        font-size: 0.75rem;
    }
}

@media (max-width: 768px) {
    .feature-toolbar {
        flex-wrap: wrap;
        justify-content: center;
        width: 100%;
        border-radius: 30px;
        padding: 10px 40px 10px 12px;
    }
    .feature-btn {
        flex: 1 1 auto;
        min-width: 140px;
        padding: 6px 12px;
    }
    .feature-toolbar .panel-close-btn {
        right: 16px;
        width: 30px;
        height: 30px;
    }
}

@media (max-width: 480px) {
    .feature-toolbar {
        padding: 10px 35px 10px 10px;
    }
    .feature-btn {
        min-width: 120px;
        font-size: 0.7rem;
        padding: 5px 10px;
    }
    .feature-btn i {
        font-size: 0.8rem;
    }
    .feature-toolbar .panel-close-btn {
        right: 8px;
        width: 28px;
        height: 28px;
    }
}

.cls-ghost-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cls-ghost-layer .ghost-text {
    background: transparent !important;
    white-space: pre-wrap;
    text-align: center;
    padding: 4px;
    font-size: inherit;
    line-height: inherit;
    letter-spacing: inherit;
    font-weight: inherit;
    font-style: inherit;
    word-break: break-word;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-shadow: none;
    transition: all 0.2s ease;
}

.fallback-selector {
    position: absolute;
    top: 5px;
    left: 5px;
    z-index: 15;
    background: rgba(21, 26, 33, 0.9);
    border: 1px solid var(--primary);
    border-radius: 20px;
    padding: 4px 8px;
    font-size: 0.65rem;
    color: var(--primary);
    cursor: pointer;
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    gap: 4px;
    min-height: 32px;
}

.fallback-selector select {
    background: #151A21;
    border: 1px solid var(--border);
    border-radius: 16px;
    color: #E9EEF5;
    font-size: 0.65rem;
    padding: 2px 6px;
    outline: none;
}

.shift-score-indicator {
    position: absolute;
    top: 40px;
    left: 10px;
    background: rgba(0,0,0,0.7);
    color: #FF5252;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.6rem;
    border: 1px solid #FF5252;
    z-index: 6;
    pointer-events: none;
}

.wcag-compare-panel {
    margin-top: 10px;
    padding: 12px;
    background: #1E2630;
    border-radius: 12px;
    border: 1px solid var(--border);
    font-size: 0.7rem;
    position: relative;
}

.wcag-compare-panel .panel-close-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 28px;
    height: 28px;
    background: #151A21;
}

.wcag-compare-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 0;
    border-bottom: 1px solid #273140;
}

.wcag-compare-row:last-child {
    border-bottom: none;
}

.wcag-badge-mini {
    padding: 2px 6px;
    border-radius: 20px;
    font-size: 0.6rem;
    font-weight: 600;
}

.wcag-badge-mini.pass { background: rgba(76, 175, 80, 0.2); color: #4CAF50; border: 1px solid #4CAF50; }
.wcag-badge-mini.fail { background: rgba(255, 82, 82, 0.2); color: #FF5252; border: 1px solid #FF5252; }

.production-bundle {
    background: #0B0D10;
    padding: 16px;
    border-radius: 12px;
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 0.7rem;
    color: #E9EEF5;
    margin: 10px 0;
    border-left: 4px solid var(--primary);
    white-space: pre-wrap;
    word-break: break-word;
}

.preview-stage {
    padding: 30px 15px;
    min-height: 220px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: background 0.2s;
    background-size: 20px 20px !important;
}

.preview-stage.grid-bg {
    background-image: var(--grid-bg) !important;
}

.preview-text {
    font-size: 32px;
    line-height: 1.2;
    text-align: center;
    word-break: break-word;
    max-width: 100%;
    color: #E9EEF5;
    white-space: pre-wrap;
    cursor: text;
    transition: all 0.2s;
    padding: 4px;
    border-radius: 4px;
    position: relative;
    z-index: 10;
}

.preview-text[contenteditable="true"]:hover {
    background: rgba(64, 224, 255, 0.1);
}

.preview-text[contenteditable="true"]:focus {
    outline: 2px solid var(--primary);
    background: rgba(64, 224, 255, 0.05);
}

.wcag-indicator {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 10;
}

.wcag-badge {
    padding: 3px 8px;
    border-radius: 30px;
    font-size: 0.6rem;
    font-weight: 600;
    background: rgba(21, 26, 33, 0.9);
    border: 1px solid;
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    gap: 4px;
}

.wcag-badge.gold { border-color: #FFD700; color: #FFD700; }
.wcag-badge.silver { border-color: #C0C0C0; color: #C0C0C0; }
.wcag-badge.bronze { border-color: #cd7f32; color: #cd7f32; }
.wcag-badge.fail { border-color: #FF5252; color: #FF5252; }

.contrast-ratio {
    font-size: 0.55rem;
    opacity: 0.9;
    font-weight: 400;
}

.apca-detail {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(21, 26, 33, 0.95);
    backdrop-filter: blur(8px);
    border: 1px solid var(--primary);
    border-radius: 30px;
    padding: 3px 12px;
    font-size: 0.65rem;
    color: #9AA5B5;
    display: flex;
    gap: 12px;
    z-index: 10;
    white-space: nowrap;
}

@media (max-width: 480px) {
    .apca-detail {
        font-size: 0.55rem;
        padding: 3px 8px;
        gap: 6px;
    }
}

.min-size {
    display: flex;
    align-items: center;
    gap: 3px;
}

.min-size i {
    color: var(--primary);
    font-size: 0.6rem;
}

.min-size span {
    color: #E9EEF5;
    font-weight: 600;
}

.stage-actions {
    position: absolute;
    bottom: 8px;
    right: 8px;
    display: flex;
    gap: 4px;
    z-index: 10;
}

.stage-btn {
    padding: 3px 8px;
    background: #151A21;
    border: 1px solid var(--border);
    border-radius: 30px;
    color: var(--primary);
    font-size: 0.6rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 3px;
    transition: all 0.2s;
}

.stage-btn:hover {
    background: var(--primary);
    color: #0B0D10;
    transform: translateY(-2px);
}

.stage-btn.success {
    background: #4CAF50;
    color: #0B0D10;
    border-color: #4CAF50;
    animation: pulse 0.5s ease;
}

.stage-btn:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.grid-toggle {
    position: absolute;
    bottom: 8px;
    left: 8px;
    padding: 3px 8px;
    background: #151A21;
    border: 1px solid var(--border);
    border-radius: 30px;
    color: var(--primary);
    font-size: 0.6rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 3px;
    z-index: 10;
    transition: all 0.2s;
}

.grid-toggle:hover {
    background: var(--primary);
    color: #0B0D10;
}

.grid-toggle:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.empty-state {
    color: #6B7A8F;
    font-size: 0.85rem;
    text-align: center;
    padding: 15px;
    border: 2px dashed var(--border);
    border-radius: var(--radius-md);
    background: rgba(21, 26, 33, 0.5);
}

.variable-controls {
    padding: 12px;
    border-top: 1px solid var(--border);
    background: #1E2630;
    display: none;
    position: relative;
}

.variable-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 0.7rem;
    color: var(--primary);
    text-transform: uppercase;
}

.variable-axes {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 8px;
}

.card-footer {
    padding: 8px 12px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.7rem;
    background: #1E2630;
}

.font-badge {
    background: rgba(64, 224, 255, 0.1);
    padding: 2px 8px;
    border-radius: 30px;
    color: var(--primary);
}

.optical-size-bar {
    background: #151A21;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 10px 16px;
    margin: 16px 0;
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    position: relative;
}

.optical-size-bar label {
    display: flex;
    align-items: center;
    gap: 4px;
    color: var(--primary);
    font-size: 0.75rem;
    font-weight: 600;
}

.optical-size-bar input[type="range"] {
    flex: 1;
    max-width: 250px;
    height: 4px;
    -webkit-appearance: none;
    background: linear-gradient(to right, #273140, var(--primary));
    border-radius: 2px;
    appearance: none;
}

.optical-size-bar input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: #E9EEF5;
    border: 2px solid var(--primary);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
}

.optical-size-bar input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    background: var(--primary);
}

.optical-size-value {
    color: var(--primary);
    font-weight: 600;
    min-width: 45px;
    font-size: 0.75rem;
}

.fallback-panel {
    background: #151A21;
    border: 1px solid var(--primary);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin: 20px 0;
    display: none;
    position: relative;
}

.fallback-panel.visible {
    display: block;
    animation: slideDown 0.3s ease;
}

.fallback-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    padding-right: 30px;
}

.fallback-header i {
    font-size: 1.8rem;
    color: var(--primary);
    background: rgba(64, 224, 255, 0.1);
    padding: 10px;
    border-radius: 50%;
}

.fallback-header h3 {
    font-size: 1.1rem;
    color: #E9EEF5;
}

.fallback-header p {
    color: #6B7A8F;
    font-size: 0.85rem;
}

.fallback-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}

.fallback-card {
    background: #1E2630;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px;
}

.fallback-card .font-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 4px;
}

.match-score {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 20px;
    background: rgba(64, 224, 255, 0.1);
    color: var(--primary);
    font-size: 0.65rem;
    margin-bottom: 6px;
}

.metric-overrides {
    background: #0B0D10;
    padding: 10px;
    border-radius: 8px;
    font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
    font-size: 0.7rem;
    color: #E9EEF5;
    margin: 10px 0;
    border-left: 3px solid var(--primary);
    word-break: break-all;
}

.cls-impact {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 6px 0;
    font-size: 0.65rem;
}

.cls-meter {
    flex: 1;
    height: 4px;
    background: #1E2630;
    border-radius: 2px;
    overflow: hidden;
}

.cls-fill {
    height: 100%;
    background: linear-gradient(90deg, #4CAF50, #FFB74D, #FF5252);
    width: 0%;
    transition: width 0.3s;
}

.copy-btn {
    background: none;
    border: 1px solid var(--primary);
    color: var(--primary);
    padding: 6px 14px;
    border-radius: 30px;
    font-size: 0.7rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s;
    min-height: 40px;
}

.copy-btn:hover {
    background: var(--primary);
    color: #0B0D10;
}

.copy-btn:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.status-bar {
    position: sticky;
    bottom: 0;
    background: #151A21;
    border-top: 2px solid var(--primary);
    padding: 10px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 100;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.5);
    margin-top: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

body.high-contrast .status-bar {
    background: #000000;
    border-top: 2px solid #FFFF00;
}

.status-fonts {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.status-badge {
    background: var(--cyan-gradient);
    color: #0B0D10;
    padding: 3px 10px;
    border-radius: 40px;
    font-size: 0.7rem;
    font-weight: 600;
}

.status-name {
    font-weight: 600;
    color: #E9EEF5;
    font-size: 0.8rem;
}

body.high-contrast .status-name {
    color: #FFFFFF;
}

.status-type {
    color: #6B7A8F;
    font-size: 0.65rem;
}

.pairing-score {
    display: flex;
    align-items: center;
    gap: 8px;
}

.score-meter {
    width: 60px;
    height: 5px;
    background: #1E2630;
    border-radius: 3px;
    overflow: hidden;
}

.score-fill {
    height: 100%;
    background: var(--cyan-gradient);
    width: 0%;
    transition: width 0.3s;
}

.score-text {
    font-weight: 700;
    color: var(--primary);
    font-size: 0.8rem;
}

.modal-compact {
    background: #151A21;
    border-radius: 20px;
    padding: 20px;
    max-width: 360px;
    width: 100%;
    border: 1px solid var(--primary);
    box-shadow: var(--shadow-lg);
}

.modal-compact-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.modal-compact-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
    color: #E9EEF5;
}

.permission-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.95);
    backdrop-filter: blur(12px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    padding: 16px;
}

.modal-content-small {
    background: #151A21;
    border-radius: 24px;
    padding: 24px;
    max-width: 320px;
    width: 100%;
    border: 1px solid var(--primary);
    box-shadow: var(--shadow-lg);
}

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}

.allow-btn, .deny-btn {
    flex: 1;
    padding: 12px;
    border-radius: 40px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.8rem;
    min-height: 44px;
}

.allow-btn {
    background: var(--cyan-gradient);
    color: #0B0D10;
}

.allow-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(64, 224, 255, 0.3);
}

.deny-btn {
    background: #1E2630;
    border: 1px solid var(--border);
    color: #E9EEF5;
}

.deny-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

#toast {
    position: fixed;
    bottom: 80px;
    left: 20px;
    right: 20px;
    transform: translateY(80px);
    background: var(--cyan-gradient);
    color: #0B0D10;
    padding: 12px 20px;
    border-radius: 40px;
    font-size: 0.8rem;
    text-align: center;
    box-shadow: var(--shadow-lg);
    z-index: 2000;
    transition: transform 0.25s ease;
    width: auto;
    max-width: 300px;
    margin: 0 auto;
}

#toast.show {
    transform: translateY(0);
}

.metrics-inspector {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 20;
}

.newsletter-section {
    max-width: 450px;
    margin: 25px auto;
    padding: 20px;
    background: #1E2630;
    border-radius: 16px;
    text-align: center;
    border: 1px solid var(--border);
}

.newsletter-title {
    color: var(--primary);
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 6px;
}

.newsletter-description {
    color: #6B7A8F;
    font-size: 0.8rem;
    margin-bottom: 16px;
}

.newsletter-form {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

.newsletter-input {
    padding: 12px 16px;
    border-radius: 40px;
    border: 1px solid var(--border);
    background: #151A21;
    color: #E9EEF5;
    font-size: 0.85rem;
    flex: 1;
    min-width: 180px;
    min-height: 44px;
}

.newsletter-input:focus {
    outline: none;
    border-color: var(--primary);
}

.newsletter-button {
    padding: 12px 24px;
    border-radius: 40px;
    background: var(--cyan-gradient);
    color: #0B0D10;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.8rem;
    min-height: 44px;
}

.newsletter-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(64, 224, 255, 0.3);
}

.font-source-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 6px;
    border-radius: 20px;
    font-size: 0.6rem;
    font-weight: 600;
    background: rgba(64, 224, 255, 0.1);
    border: 1px solid var(--primary);
    color: var(--primary);
}

.font-source-badge i {
    font-size: 0.55rem;
}

.font-source-badge.system { background: rgba(156, 39, 176, 0.1); border-color: #9C27B0; color: #9C27B0; }
.font-source-badge.google { background: rgba(33, 150, 243, 0.1); border-color: #2196F3; color: #2196F3; }

.loading-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(64, 224, 255, 0.3);
    border-radius: 50%;
    border-top-color: var(--primary);
    animation: spin 0.6s linear infinite;
    margin-left: 6px;
}

.lazy-loading {
    opacity: 0.5;
    pointer-events: none;
}

body.high-contrast .swap-card-btn {
    background: #FFFF00 !important;
    color: #000000 !important;
    border-color: #FFFF00 !important;
}

/* ============ HOW-TO SECTION RESPONSIVE STYLES ============ */
/* How-to section responsive */
.how-to-use-section {
    background: linear-gradient(135deg, #151A21, #0B0D10);
    border: 1px solid #273140;
    border-radius: 24px;
    margin: 30px 0;
    overflow: hidden;
}

.how-to-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    background: #1E2630;
    border-bottom: 1px solid #273140;
    cursor: pointer;
}

.how-to-header i:first-child {
    font-size: 1.8rem;
    color: #40E0FF;
    margin-right: 12px;
}

.how-to-header h2 {
    flex: 1;
    font-size: 1.3rem;
    margin: 0;
    color: #E9EEF5;
}

.how-to-toggle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #151A21;
    border: 1px solid #273140;
    color: #40E0FF;
    cursor: pointer;
    transition: all 0.2s;
}

.how-to-toggle:hover {
    background: #40E0FF;
    color: #0B0D10;
    transform: scale(1.05);
}

.how-to-content {
    padding: 24px;
    transition: all 0.3s ease;
}

.how-to-content.collapsed {
    display: none;
}

.tutorial-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
}

.tutorial-step {
    display: flex;
    gap: 16px;
    background: #1E2630;
    border-radius: 16px;
    padding: 20px;
    transition: all 0.2s;
    border: 1px solid #273140;
}

.tutorial-step:hover {
    border-color: #40E0FF;
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.3);
}

.step-number {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #40E0FF, #00B8D4);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    font-weight: bold;
    color: #0B0D10;
    flex-shrink: 0;
}

.step-content {
    flex: 1;
}

.step-content h3 {
    font-size: 1rem;
    margin-bottom: 8px;
    color: #40E0FF;
}

.step-content h3 i {
    margin-right: 6px;
    font-size: 0.9rem;
}

.step-content p {
    font-size: 0.85rem;
    color: #9AA5B5;
    line-height: 1.5;
    margin-bottom: 10px;
}

.step-tip {
    background: rgba(64, 224, 255, 0.08);
    border-left: 3px solid #40E0FF;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.75rem;
    color: #C0C8D2;
}

.step-tip i {
    color: #FFD700;
    margin-right: 6px;
}

@media (max-width: 768px) {
    .how-to-use-section {
        margin: 15px;
    }
    .how-to-header {
        padding: 15px;
    }
    .how-to-header h2 {
        font-size: 1rem;
    }
    .tutorial-grid {
        grid-template-columns: 1fr;
    }
    .tutorial-step {
        padding: 15px;
    }
}

/* ============ END OF FILE ============ */