/* ==========================================================================
   Design tokens — איזה פונט זה
   ========================================================================== */
:root {
    /* Colors */
    --primary: #6366f1;           /* indigo-500 */
    --primary-hover: #4f46e5;     /* indigo-600 */
    --primary-soft: #eef2ff;      /* indigo-50 */
    --primary-border: #c7d2fe;    /* indigo-200 */
    --primary-ink: #3730a3;       /* indigo-800 */
    --primary-grad: linear-gradient(135deg, #6366f1 0%, #8b5cf6 60%, #a855f7 100%);
    --primary-grad-soft: linear-gradient(135deg, #eef2ff 0%, #f5f3ff 100%);

    --accent: #f59e0b;            /* amber-500 */
    --accent-hover: #d97706;
    --accent-soft: #fef3c7;
    --accent-ink: #92400e;

    --success: #10b981;
    --danger: #dc2626;
    --danger-soft: #fef2f2;
    --danger-border: #fecaca;

    --bg: #f7f7fb;
    --surface: #ffffff;
    --surface-2: #fafbfc;
    --text: #1a1a2e;              /* ≥4.5:1 on bg */
    --text-muted: #5a6072;        /* stronger than #718096 for a11y */
    --text-faint: #8a90a2;
    --border: #e5e7ec;
    --border-strong: #cbd2dc;

    /* Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-pill: 999px;

    /* Shadow */
    --shadow-sm: 0 1px 2px rgba(17, 24, 39, 0.04), 0 1px 3px rgba(17, 24, 39, 0.06);
    --shadow-md: 0 4px 12px rgba(17, 24, 39, 0.06), 0 2px 4px rgba(17, 24, 39, 0.04);
    --shadow-lg: 0 12px 32px rgba(99, 102, 241, 0.14), 0 4px 12px rgba(17, 24, 39, 0.06);

    /* Motion */
    --ease: cubic-bezier(.2, .8, .2, 1);
    --dur-fast: 150ms;
    --dur: 220ms;
    --dur-slow: 320ms;
}

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

html { scroll-behavior: smooth; }

body {
    font-family: 'Heebo', sans-serif;
    background: var(--bg);
    background-image:
        radial-gradient(1200px 600px at 90% -10%, rgba(139, 92, 246, 0.08), transparent 60%),
        radial-gradient(900px 500px at -10% 10%, rgba(99, 102, 241, 0.07), transparent 60%);
    background-attachment: fixed;
    color: var(--text);
    direction: rtl;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   Layout
   ========================================================================== */
.container {
    max-width: 860px;
    margin: 0 auto;
    padding: 2.5rem 1.5rem 4rem;
    transition: max-width var(--dur-slow) var(--ease);
}
.container.wide { max-width: 1200px; }

/* ==========================================================================
   Brand header (H1, subtitle, beta)
   ========================================================================== */
.brand-header {
    text-align: center;
    margin-bottom: 1.25rem;
    animation: fadeSlideIn 420ms var(--ease) both;
}

h1 {
    font-size: clamp(1.9rem, 4vw, 2.6rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text);
    margin: 0.25rem 0 0.35rem;
    line-height: 1.1;
}
.h1-accent {
    background: var(--primary-grad);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    display: inline-block;
    transform-origin: 50% 90%;
    animation: accentPop 520ms var(--ease) 180ms both;
}

.subtitle {
    color: var(--text-muted);
    font-size: 1rem;
    font-weight: 400;
    max-width: 34rem;
    margin: 0 auto;
    line-height: 1.5;
}

/* Beta badge */
.beta-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.75rem;
    background: var(--accent-soft);
    color: var(--accent-ink);
    border: 1px solid #fcd34d;
    border-radius: var(--radius-pill);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.15);
    cursor: help;
}
.beta-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.6);
    animation: pulseDot 1.8s ease-in-out infinite;
}
@keyframes pulseDot {
    0%, 100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.55); }
    50%      { box-shadow: 0 0 0 6px rgba(245, 158, 11, 0); }
}

.beta-note {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
    line-height: 1.5;
}
.inline-link {
    background: none;
    border: none;
    color: var(--primary);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    padding: 0;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}
.inline-link:hover { color: var(--primary-hover); }

/* ==========================================================================
   About button
   ========================================================================== */
.about-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 1.5rem;
    padding: 0.5rem 1.2rem;
    background: var(--surface);
    color: var(--primary);
    border: 1px solid var(--primary-border);
    border-radius: var(--radius-pill);
    font-size: 0.85rem;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: transform var(--dur) var(--ease), background var(--dur) var(--ease), color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.about-btn:hover {
    background: var(--primary);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}
.about-btn:active { transform: translateY(0); }
.about-btn:focus-visible {
    outline: 3px solid var(--primary-border);
    outline-offset: 2px;
}

/* ==========================================================================
   How it works card
   ========================================================================== */
.how-it-works {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.4rem;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}
.how-it-works-title {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text);
    margin-bottom: 0.8rem;
}
.how-it-works-steps {
    display: flex;
    gap: 1.5rem;
    font-size: 0.88rem;
    color: var(--text);
    line-height: 1.6;
    font-weight: 500;
}
.how-it-works-steps .step {
    flex: 1;
    display: flex;
    gap: 0.55rem;
    align-items: flex-start;
}
.step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--primary-grad);
    color: #fff;
    font-weight: 700;
    font-size: 0.75rem;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(99, 102, 241, 0.3);
}
.how-it-works-note {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 400;
    margin-top: 0.8rem;
    padding-top: 0.8rem;
    border-top: 1px solid var(--border);
    line-height: 1.75;
}
.how-it-works-note strong { color: var(--text); }

.pro-tip {
    background: var(--primary-grad-soft);
    border: 1px solid var(--primary-border);
    border-radius: var(--radius-md);
    padding: 0.8rem 1rem;
    margin-bottom: 0.8rem;
    font-size: 0.85rem;
    color: var(--text);
    line-height: 1.7;
}
.pro-tip strong { color: var(--primary-ink); }
.pro-tip-badge {
    display: inline-block;
    background: var(--primary);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.2rem 0.6rem;
    border-radius: var(--radius-pill);
    margin-left: 0.5rem;
    vertical-align: middle;
}

/* ==========================================================================
   Upload area
   ========================================================================== */
.upload-area {
    position: relative;
    border: 2px dashed var(--border-strong);
    border-radius: var(--radius-lg);
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease), transform var(--dur) var(--ease);
    background: var(--surface);
    margin-bottom: 1.5rem;
    overflow: hidden;
}
.upload-area::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--primary-grad-soft);
    opacity: 0;
    transition: opacity var(--dur) var(--ease);
    pointer-events: none;
}
.upload-area:hover, .upload-area.dragover {
    border-color: var(--primary);
    transform: translateY(-1px);
}
.upload-area.dragover { transform: translateY(-2px) scale(1.01); }
.upload-area:hover::before, .upload-area.dragover::before { opacity: 1; }
.upload-area > * { position: relative; z-index: 1; }

.upload-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 1rem;
    border-radius: var(--radius-md);
    background: var(--primary-grad);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 18px rgba(99, 102, 241, 0.3);
    transition: transform var(--dur) var(--ease);
}
.upload-area:hover .upload-icon { animation: bounceUp 600ms var(--ease); }
.upload-icon svg {
    width: 26px;
    height: 26px;
    fill: #fff;
}
.upload-area p {
    font-size: 0.98rem;
    color: var(--text);
    font-weight: 500;
    line-height: 1.6;
}
.browse-btn {
    display: inline-block;
    margin-top: 1.2rem;
    padding: 0.65rem 2rem;
    background: var(--primary-grad);
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.92rem;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease), filter var(--dur) var(--ease);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}
.browse-btn:hover {
    transform: translateY(-1px);
    filter: brightness(1.05);
    box-shadow: var(--shadow-lg);
}
.browse-btn:active { transform: translateY(0); }
.browse-btn:focus-visible {
    outline: 3px solid var(--primary-border);
    outline-offset: 2px;
}
input[type="file"] { display: none; }

/* ==========================================================================
   Font search
   ========================================================================== */
.font-search-section {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 1.4rem;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}
.font-search-title {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text);
    margin-bottom: 0.7rem;
}
.font-search-wrapper { position: relative; }
.font-search-input {
    width: 100%;
    padding: 0.7rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 0.92rem;
    font-family: inherit;
    direction: ltr;
    text-align: right;
    outline: none;
    transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
    background: var(--surface-2);
}
.font-search-input:focus {
    border-color: var(--primary);
    background: var(--surface);
    box-shadow: 0 0 0 4px var(--primary-soft);
}
.font-search-input::placeholder { color: var(--text-faint); }

.font-search-results {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    left: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    max-height: 260px;
    overflow-y: auto;
    z-index: 10;
    display: none;
    box-shadow: var(--shadow-lg);
    animation: fadeSlideIn 180ms var(--ease);
}
.font-search-results.active { display: block; }
.font-search-item {
    padding: 0.6rem 1rem;
    cursor: pointer;
    transition: background var(--dur-fast) var(--ease);
    border-bottom: 1px solid var(--border);
}
.font-search-item:last-child { border-bottom: none; }
.font-search-item:hover { background: var(--primary-soft); }
.font-search-item-name {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text);
}
.font-search-no-results {
    padding: 0.8rem 1rem;
    color: var(--text-faint);
    font-size: 0.85rem;
    text-align: center;
}

/* Font preview panel */
.font-preview-panel {
    display: none;
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 1.4rem;
    border: 1px solid var(--border);
    margin-top: 1rem;
    box-shadow: var(--shadow-sm);
}
.font-preview-panel.active {
    display: block;
    animation: fadeSlideIn var(--dur-slow) var(--ease);
}
.font-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.9rem;
}
.font-preview-name {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text);
}
.font-preview-close {
    background: none;
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    color: var(--text-faint);
    line-height: 1;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.font-preview-close:hover { background: var(--primary-soft); color: var(--primary); }
.font-preview-image {
    max-width: 100%;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    cursor: zoom-in;
    transition: transform var(--dur) var(--ease);
}
.font-preview-image:hover { transform: scale(1.01); }

/* ==========================================================================
   Loading overlay
   ========================================================================== */
.loading-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(247, 247, 251, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 100;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}
.loading-overlay.active {
    display: flex;
    animation: fadeSlideIn 200ms var(--ease);
}
.loading-overlay .spinner {
    position: relative;
    width: 56px;
    height: 56px;
    margin-bottom: 1.2rem;
}
.loading-overlay .spinner::before,
.loading-overlay .spinner::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 3px solid transparent;
}
.loading-overlay .spinner::before {
    border-top-color: var(--primary);
    border-right-color: var(--primary);
    animation: spin 0.9s linear infinite;
}
.loading-overlay .spinner::after {
    inset: 8px;
    border-bottom-color: #a855f7;
    border-left-color: #a855f7;
    animation: spin 1.4s linear infinite reverse;
}
.loading-overlay p {
    color: var(--text);
    font-size: 1rem;
    font-weight: 600;
    transition: opacity var(--dur) var(--ease);
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ==========================================================================
   Results wrapper + instructions
   ========================================================================== */
.results { display: none; }
.results.active {
    display: block;
    animation: fadeSlideIn var(--dur-slow) var(--ease);
}

.instructions {
    background: var(--primary-grad-soft);
    border: 1px solid var(--primary-border);
    border-radius: var(--radius-lg);
    padding: 1.1rem 1.3rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
}
.instructions-title {
    font-weight: 700;
    font-size: 1rem;
    color: var(--primary-ink);
    margin-bottom: 0.5rem;
}
.instructions-hero {
    font-size: 0.95rem;
    color: var(--text);
    font-weight: 500;
    line-height: 1.75;
    margin-bottom: 0.5rem;
}
.instructions-hero strong {
    background: var(--primary);
    color: #fff;
    padding: 0.1rem 0.45rem;
    border-radius: var(--radius-sm);
    font-weight: 700;
}
.instructions-sub {
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.7;
}

/* ==========================================================================
   Image section + crop
   ========================================================================== */
.image-section {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 1.4rem;
    box-shadow: var(--shadow-md);
    margin-bottom: 1.5rem;
}
.uploaded-image-container {
    position: relative;
    display: inline-block;
    max-width: 100%;
}
.image-wrapper { display: flex; justify-content: center; }
.uploaded-image {
    max-width: 100%;
    max-height: 400px;
    border-radius: var(--radius-md);
    object-fit: contain;
    display: block;
}

.crop-overlay {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    cursor: crosshair;
    border-radius: var(--radius-md);
    touch-action: none;
}

/* Pulsing crop hint */
.crop-hint-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    border-radius: var(--radius-md);
    border: 3px dashed var(--primary);
    animation: cropPulse 2s ease-in-out infinite;
    pointer-events: none;
    z-index: 1;
}
.crop-hint-label {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    background: var(--primary-grad);
    color: #fff;
    padding: 0.6rem 1.1rem;
    border-radius: var(--radius-pill);
    font-size: 0.88rem;
    font-weight: 600;
    pointer-events: none;
    z-index: 2;
    white-space: nowrap;
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.35);
    animation: float 2.4s ease-in-out infinite;
}
@keyframes cropPulse {
    0%, 100% { border-color: var(--primary); opacity: 1; }
    50%      { border-color: #a5b4fc; opacity: 0.55; }
}
@keyframes float {
    0%, 100% { transform: translate(-50%, -50%); }
    50%      { transform: translate(-50%, calc(-50% - 4px)); }
}

.crop-actions {
    display: none;
    justify-content: center;
    gap: 0.55rem;
    margin-top: 0.9rem;
}
.crop-actions.active {
    display: flex;
    animation: fadeSlideIn var(--dur) var(--ease);
}
.crop-btn {
    padding: 0.55rem 1.5rem;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease), filter var(--dur) var(--ease), background var(--dur) var(--ease);
}
.crop-btn-identify {
    background: var(--primary-grad);
    color: #fff;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}
.crop-btn-identify:hover { transform: translateY(-1px); filter: brightness(1.05); box-shadow: var(--shadow-lg); }
.crop-btn-identify:active { transform: translateY(0); }
.crop-btn-clear {
    background: var(--surface-2);
    color: var(--text-muted);
    border: 1px solid var(--border);
}
.crop-btn-clear:hover { background: var(--border); color: var(--text); }
.crop-btn:focus-visible { outline: 3px solid var(--primary-border); outline-offset: 2px; }

.retry-hint {
    text-align: center;
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: 0.7rem;
    line-height: 1.6;
}

/* ==========================================================================
   Predictions
   ========================================================================== */
.predictions-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.4rem;
}
.predictions-sub {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.75;
    margin-bottom: 1.1rem;
}
.prediction {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.9rem 1rem;
    border-radius: var(--radius-md);
    margin-bottom: 0.55rem;
    background: var(--surface);
    border: 1px solid var(--border);
    transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease);
    animation: fadeSlideIn var(--dur-slow) var(--ease) both;
}
.prediction:nth-child(1) { animation-delay:   0ms; }
.prediction:nth-child(2) { animation-delay:  60ms; }
.prediction:nth-child(3) { animation-delay: 120ms; }
.prediction:nth-child(4) { animation-delay: 180ms; }
.prediction:nth-child(5) { animation-delay: 240ms; }

.prediction:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-border);
}
.prediction:first-child {
    background: var(--primary-grad-soft);
    border-color: var(--primary-border);
    position: relative;
}
.prediction:first-child::before {
    content: '★';
    position: absolute;
    top: -8px;
    right: -8px;
    width: 26px;
    height: 26px;
    background: var(--primary-grad);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    box-shadow: 0 3px 8px rgba(99, 102, 241, 0.35);
}

.prediction-rank {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-faint);
    min-width: 1.5rem;
    text-align: center;
}
.prediction:first-child .prediction-rank {
    background: var(--primary-grad);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.prediction-info { flex: 1; min-width: 0; }
.prediction-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
}
.prediction-bar-container {
    width: 120px;
    height: 5px;
    background: var(--border);
    border-radius: var(--radius-pill);
    overflow: hidden;
    margin-top: 0.4rem;
}
.prediction-bar {
    height: 100%;
    background: var(--text-faint);
    border-radius: var(--radius-pill);
    transition: width 0.7s var(--ease);
}
.prediction:first-child .prediction-bar { background: var(--primary-grad); }

.prediction-confidence {
    font-size: 1rem;
    font-weight: 700;
    min-width: 3.5rem;
    text-align: center;
    direction: ltr;
    color: var(--text-muted);
}
.prediction:first-child .prediction-confidence { color: var(--primary-ink); }

.prediction-preview {
    max-width: 220px;
    max-height: 40px;
    border-radius: var(--radius-sm);
    opacity: 0.9;
    cursor: zoom-in;
    transition: transform var(--dur) var(--ease), opacity var(--dur) var(--ease);
}
.prediction-preview:hover { transform: scale(1.04); opacity: 1; }

/* ==========================================================================
   Buttons + misc
   ========================================================================== */
.actions {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 1.5rem;
}
.btn {
    padding: 0.65rem 1.6rem;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.92rem;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease), background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.btn-primary {
    background: var(--primary-grad);
    color: #fff;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}
.btn-primary:hover { transform: translateY(-1px); filter: brightness(1.05); }
.btn-secondary {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--surface-2); border-color: var(--border-strong); transform: translateY(-1px); }
.btn:focus-visible { outline: 3px solid var(--primary-border); outline-offset: 2px; }

.error {
    display: none;
    background: var(--danger-soft);
    color: var(--danger);
    padding: 0.8rem 1rem;
    border-radius: var(--radius-md);
    text-align: center;
    margin-bottom: 1rem;
    font-size: 0.92rem;
    font-weight: 500;
    border: 1px solid var(--danger-border);
}
.error.active {
    display: block;
    animation: shake 420ms var(--ease);
}
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-4px); }
    40%, 80% { transform: translateX(4px); }
}

.section-divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 2rem 0 1.25rem;
    color: var(--text-faint);
    font-size: 0.82rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.section-divider::before, .section-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* ==========================================================================
   Split layouts
   ========================================================================== */
.main-split {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
    animation: fadeSlideIn 420ms var(--ease) both;
}
.main-split-upload { flex: 1; min-width: 0; }
.main-split-info { flex: 0 0 40%; }

.results-split {
    display: none;
    gap: 1.5rem;
    align-items: flex-start;
}
.results-split.active {
    display: flex;
    animation: fadeSlideIn var(--dur-slow) var(--ease);
}
.results-split .image-side {
    flex: 0 0 45%;
    position: sticky;
    top: 1.5rem;
}
.results-split .predictions-side { flex: 1; min-width: 0; }

/* ==========================================================================
   Zoom lightbox
   ========================================================================== */
.zoom-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 15, 25, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 200;
    justify-content: center;
    align-items: center;
    cursor: zoom-out;
    padding: 2rem;
}
.zoom-overlay.active {
    display: flex;
    animation: fadeSlideIn 200ms var(--ease);
}
.zoom-overlay img {
    max-width: 90vw;
    max-height: 90vh;
    border-radius: var(--radius-md);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4);
    object-fit: contain;
}

/* ==========================================================================
   About modal
   ========================================================================== */
.about-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 15, 25, 0.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 300;
    justify-content: center;
    align-items: center;
    padding: 1.5rem;
}
.about-overlay.active {
    display: flex;
    animation: fadeSlideIn 200ms var(--ease);
}
.about-modal {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 2rem;
    max-width: 700px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
    direction: rtl;
    line-height: 1.8;
    font-size: 0.95rem;
    color: var(--text);
    box-shadow: 0 24px 60px rgba(15, 15, 25, 0.3);
    animation: fadeSlideIn var(--dur-slow) var(--ease);
}
.about-modal-close {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    background: var(--surface-2);
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    color: var(--text-muted);
    line-height: 1;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.about-modal-close:hover { background: var(--primary-soft); color: var(--primary); }

.about-modal h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
    margin: 1.5rem 0 0.6rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.about-modal h3::before {
    content: '';
    width: 4px;
    height: 18px;
    background: var(--primary-grad);
    border-radius: var(--radius-pill);
}
.about-modal h3:first-of-type { margin-top: 0.5rem; }
.about-modal p { margin-bottom: 0.8rem; }
.about-modal ul { padding-right: 1.2rem; margin-bottom: 0.8rem; }
.about-modal li { margin-bottom: 0.35rem; }
.about-modal .about-badge {
    display: block;
    background: var(--accent-soft);
    color: var(--accent-ink);
    padding: 0.8rem 1rem;
    border-radius: var(--radius-md);
    border: 1px solid #fcd34d;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 1rem;
    line-height: 1.7;
}

/* ==========================================================================
   Full font list
   ========================================================================== */
.font-list-toggle {
    display: block;
    margin: 1rem auto 0;
    padding: 0.55rem 1.5rem;
    background: var(--surface-2);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    font-size: 0.88rem;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.font-list-toggle:hover {
    background: var(--primary-soft);
    border-color: var(--primary-border);
    color: var(--primary-ink);
    transform: translateY(-1px);
}
.font-list-container {
    display: none;
    margin-top: 1rem;
    max-height: 500px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface-2);
    padding: 1rem;
}
.font-list-container.active {
    display: block;
    animation: fadeSlideIn var(--dur-slow) var(--ease);
}
.font-list-letter {
    font-size: 0.9rem;
    font-weight: 800;
    color: var(--primary);
    margin: 0.9rem 0 0.4rem;
    padding-bottom: 0.25rem;
    border-bottom: 1px solid var(--border);
}
.font-list-letter:first-child { margin-top: 0; }
.font-list-grid { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.font-list-item {
    display: inline-block;
    padding: 0.28rem 0.7rem;
    font-size: 0.82rem;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
    direction: ltr;
}
.font-list-item:hover {
    background: var(--primary-soft);
    border-color: var(--primary);
    color: var(--primary-ink);
    transform: translateY(-1px);
}
.font-list-count {
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-faint);
    margin-top: 0.6rem;
}

/* ==========================================================================
   Keyframes
   ========================================================================== */
@keyframes fadeSlideIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes accentPop {
    0%   { transform: scale(0.85); opacity: 0; }
    60%  { transform: scale(1.05); }
    100% { transform: scale(1); opacity: 1; }
}
@keyframes bounceUp {
    0%, 100% { transform: translateY(0); }
    40%      { transform: translateY(-4px); }
    70%      { transform: translateY(-1px); }
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 800px) {
    .container.wide { max-width: 860px; }
    .main-split { flex-direction: column; }
    .main-split-info { flex: none; width: 100%; }
    .results-split.active { flex-direction: column; }
    .results-split .image-side { flex: none; width: 100%; position: static; }
}
@media (max-width: 600px) {
    .container { padding: 1.5rem 1rem 3rem; }
    h1 { font-size: 1.75rem; }
    .how-it-works-steps { flex-direction: column; gap: 0.5rem; }
    .prediction { flex-wrap: wrap; }
    .prediction-preview { max-width: 100%; }
    .upload-area { padding: 2rem 1.25rem; }
}

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