/* ════════════════════════════════════════════════════════════════
   CCCC · Conservative Classification for Creative Content
   Pro pixel-gamer dark IDE redesign
   ════════════════════════════════════════════════════════════════ */

@font-face {
    font-family: 'Handjet';
    src: url('assets/fonts/Handjet-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Handjet';
    src: url('assets/fonts/Handjet-SemiBold.ttf') format('truetype');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Handjet';
    src: url('assets/fonts/Handjet-Bold.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

:root {
    /* — Neutrals (pro dark) — */
    --ink-0: #07080b;          /* deepest void */
    --ink-1: #0d0f14;          /* page bg */
    --ink-2: #14171e;          /* panel */
    --ink-3: #1a1e27;          /* raised surface */
    --ink-4: #232834;          /* input rest */
    --ink-5: #2d3340;          /* input hover */

    --line: #262b36;           /* hairline */
    --line-bright: #3a4150;    /* visible border */
    --line-dim: #1c2028;

    --text-0: #eef0f5;         /* primary */
    --text-1: #a2abbd;         /* secondary */
    --text-2: #6a7385;         /* muted */
    --text-3: #454c5b;         /* hint */

    /* — Accent (the one lime that runs the show) — */
    --acc: #c8ff5e;
    --acc-dim: #95c63a;
    --acc-deep: #2e3a14;
    --acc-glow: rgba(200, 255, 94, 0.35);

    /* — Severity (kept; tuned for dark) — */
    --accent-red: #ff5a5a;
    --accent-orange: #ff9a3c;
    --accent-yellow: #ffd84a;
    --accent-blue: #5aa8ff;
    --accent-green: var(--acc);

    /* — Semantic (modal) — */
    --theme-purple: #b07cff;
    --mech-teal: #34d0b8;

    /* — Type — */
    --font-en: 'Silkscreen', 'JetBrains Mono', monospace;
    --font-mono: 'JetBrains Mono', ui-monospace, monospace;
    --font-ar: 'Handjet', 'Tahoma', sans-serif;

    /* — Canvas (preserved; sizes used inside #preview-canvas) — */
    --canvas-title-size: 5.5cqw;
    --canvas-genre-size: 2.8cqw;
    --canvas-synopsis-size: 3.2cqw;
    --canvas-v-title-size: 10cqw;
}

* { box-sizing: border-box; }

html, body { background: var(--ink-1); }

body {
    margin: 0;
    padding: 0;
    color: var(--text-0);
    font-family: var(--font-ar);
    direction: rtl;
    min-height: 100vh;
    background:
        radial-gradient(1200px 600px at 80% -10%, rgba(200, 255, 94, 0.04), transparent 60%),
        radial-gradient(900px 500px at 10% 110%, rgba(90, 168, 255, 0.04), transparent 60%),
        var(--ink-1);
    background-attachment: fixed;
    /* Subtle pixel grid */
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.012) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.012) 1px, transparent 1px),
        radial-gradient(1200px 600px at 80% -10%, rgba(200, 255, 94, 0.05), transparent 60%),
        radial-gradient(900px 500px at 10% 110%, rgba(90, 168, 255, 0.04), transparent 60%);
    background-size: 24px 24px, 24px 24px, 100% 100%, 100% 100%;
    background-position: 0 0, 0 0, 0 0, 0 0;
    -webkit-font-smoothing: antialiased;
    font-variant-ligatures: normal;
    font-feature-settings: "liga" 1;
}

.hidden { display: none !important; }

/* ───────────────── App Shell ───────────────── */

.app-shell {
    max-width: 1680px;
    margin: 0 auto;
    padding: 18px 22px 28px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

/* ───────────────── Topbar ───────────────── */

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 10px 16px;
    background: var(--ink-2);
    border: 1px solid var(--line);
    border-radius: 6px;
    position: relative;
    overflow: hidden;
    flex-wrap: wrap;
}

.topbar::before {
    content: '';
    position: absolute;
    inset: 0 0 auto 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--acc-glow), transparent);
    opacity: 0.6;
}

.topbar-brand {
    display: flex;
    align-items: center;
    gap: 18px;
}

.brand-mark {
    display: flex;
    gap: 2px;
    font-family: var(--font-en);
    font-size: 24px;
    line-height: 1;
    background: var(--ink-3);
    padding: 8px 10px;
    border: 1px solid var(--line-bright);
    border-radius: 4px;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03), 0 1px 0 rgba(0, 0, 0, 0.4);
}
.brand-c {
    color: var(--acc);
    text-shadow: 0 0 8px var(--acc-glow);
    letter-spacing: 1px;
}
.brand-c:nth-child(2) { color: var(--text-0); text-shadow: none; }
.brand-c:nth-child(3) { color: var(--text-0); text-shadow: none; }
.brand-c:nth-child(4) { color: var(--acc); text-shadow: 0 0 8px var(--acc-glow); }

.brand-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.brand-en {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.5px;
    color: var(--text-2);
    text-transform: uppercase;
}
.brand-ar {
    font-family: var(--font-ar);
    font-size: 20px;
    font-weight: 600;
    color: var(--text-0);
    line-height: 1.1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar-status {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-1);
    text-transform: uppercase;
}
.status-dot {
    width: 8px; height: 8px;
    background: var(--acc);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--acc-glow), 0 0 0 3px rgba(200, 255, 94, 0.1);
    animation: blink 2.4s infinite ease-in-out;
}
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }
.status-sep { color: var(--text-3); }
.status-url { color: var(--text-0); }

/* ───────────────── Main Grid ───────────────── */

.card-container {
    display: grid;
    grid-template-columns: 340px minmax(0, 1fr);
    gap: 16px;
    align-items: stretch;
}

/* ───────────────── Stage (Preview, Left) ───────────────── */

.stage {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
}

.stage-header,
.section-head,
.ratings-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.kicker {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-1);
    text-transform: uppercase;
}
.kicker-dot {
    width: 6px; height: 6px;
    background: var(--acc);
    box-shadow: 0 0 6px var(--acc-glow);
    display: inline-block;
}
.kicker-dot-warn { background: var(--accent-orange); box-shadow: 0 0 6px rgba(255, 154, 60, 0.45); }
.kicker-meta {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-2);
    letter-spacing: 0.8px;
    direction: ltr;
}

.stage-frame {
    background: var(--ink-2);
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 10px;
    position: relative;
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.02) inset, 0 20px 60px rgba(0, 0, 0, 0.45);
}
.stage-frame::before {
    content: '';
    position: absolute;
    inset: 4px;
    border: 1px dashed rgba(255, 255, 255, 0.04);
    border-radius: 4px;
    pointer-events: none;
}

/* corner ticks */
.stage-frame::after {
    content: '';
    position: absolute;
    top: -1px; left: -1px; right: -1px; bottom: -1px;
    background:
        linear-gradient(var(--acc), var(--acc)) top left / 14px 1px no-repeat,
        linear-gradient(var(--acc), var(--acc)) top left / 1px 14px no-repeat,
        linear-gradient(var(--acc), var(--acc)) top right / 14px 1px no-repeat,
        linear-gradient(var(--acc), var(--acc)) top right / 1px 14px no-repeat,
        linear-gradient(var(--acc), var(--acc)) bottom left / 14px 1px no-repeat,
        linear-gradient(var(--acc), var(--acc)) bottom left / 1px 14px no-repeat,
        linear-gradient(var(--acc), var(--acc)) bottom right / 14px 1px no-repeat,
        linear-gradient(var(--acc), var(--acc)) bottom right / 1px 14px no-repeat;
    pointer-events: none;
    opacity: 0.45;
    border-radius: 6px;
}

/* ─── Footer (Export) ─── */
.card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: var(--ink-2);
    border: 1px solid var(--line);
    border-radius: 6px;
}
.footer-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-2);
    letter-spacing: 0.8px;
    direction: ltr;
}
.footer-tag {
    background: var(--ink-4);
    color: var(--text-1);
    padding: 3px 8px;
    border-radius: 3px;
    border: 1px solid var(--line);
    letter-spacing: 1.2px;
}
.footer-actions { display: flex; gap: 8px; }

#copy-btn, #export-btn {
    font-family: var(--font-ar);
    font-weight: 700;
    font-size: 18px;
    padding: 10px 22px;
    border-radius: 4px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: transform 0.08s ease, box-shadow 0.15s ease, background 0.15s ease;
    border: 1px solid var(--line-bright);
    line-height: 1;
}
#copy-btn .btn-icon, #export-btn .btn-icon {
    font-family: var(--font-mono);
    font-size: 16px;
    opacity: 0.9;
}
#copy-btn {
    background: var(--ink-4);
    color: var(--text-0);
}
#copy-btn:hover { background: var(--ink-5); }
#export-btn {
    background: var(--acc);
    color: var(--ink-0);
    border-color: var(--acc-dim);
    box-shadow: 0 0 0 1px rgba(200, 255, 94, 0.15), 0 6px 22px rgba(200, 255, 94, 0.18);
}
#export-btn:hover {
    background: #d9ff7a;
    box-shadow: 0 0 0 1px rgba(200, 255, 94, 0.3), 0 8px 28px rgba(200, 255, 94, 0.28);
    transform: translateY(-1px);
}
#export-btn:active { transform: translateY(0); }

/* ───────────────── Control Panel (Right) ───────────────── */

.top-controls {
    background: var(--ink-2);
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 22px;
    min-width: 0;
}

.panel-section { display: flex; flex-direction: column; gap: 10px; }

.section-head {
    padding-bottom: 8px;
    border-bottom: 1px dashed var(--line);
    margin-bottom: 4px;
}

.control-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.control-label {
    min-width: 96px;
    color: var(--text-1);
    font-family: var(--font-ar);
    font-size: 18px;
    font-weight: 600;
    text-align: right;
    white-space: nowrap;
}

/* ─── Orientation Selector ─── */
.orientation-selector {
    display: inline-flex;
    background: var(--ink-3);
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 3px;
    gap: 2px;
}
.orient-btn {
    background: transparent;
    border: none;
    color: var(--text-1);
    padding: 8px 12px;
    font-family: var(--font-ar);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 3px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: color 0.12s, background 0.12s;
    line-height: 1;
}
.orient-btn:hover { color: var(--text-0); background: rgba(255, 255, 255, 0.025); }
.orient-btn.active {
    background: var(--ink-1);
    color: var(--acc);
    box-shadow: inset 0 0 0 1px var(--line-bright), 0 1px 0 rgba(0,0,0,0.4);
}
.orient-icon {
    display: inline-block;
    border: 1.5px solid currentColor;
    border-radius: 1px;
}
.orient-icon-h { width: 16px; height: 11px; }
.orient-icon-v { width: 11px; height: 16px; }

/* ─── Custom Dropdown ─── */
.custom-dropdown { position: relative; font-family: var(--font-ar); flex: 1; min-width: 140px; }
.dropdown-toggle {
    width: 100%;
    background: var(--ink-3);
    border: 1px solid var(--line-bright);
    color: var(--text-0);
    padding: 9px 12px;
    font-family: inherit;
    cursor: pointer;
    font-size: 17px;
    font-weight: 600;
    border-radius: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: border-color 0.15s, background 0.15s;
}
.dropdown-toggle:hover { background: var(--ink-4); border-color: var(--text-3); }
.dropdown-toggle .chev {
    color: var(--text-2);
    font-family: var(--font-mono);
    font-size: 12px;
    margin-right: 0;
    margin-left: 6px;
    transition: transform 0.15s;
}
.custom-dropdown:has(.dropdown-menu.show) .dropdown-toggle .chev { transform: rotate(180deg); }

.dropdown-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    left: 0;
    background: var(--ink-3);
    border: 1px solid var(--line-bright);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(0, 0, 0, 0.4);
    z-index: 100;
    display: none;
    border-radius: 4px;
    overflow: hidden;
    padding: 4px;
}
.dropdown-menu.show { display: block; }
.dropdown-item {
    padding: 8px 12px;
    color: var(--text-1);
    cursor: pointer;
    border-radius: 3px;
    text-align: right;
    font-size: 16px;
    transition: background 0.1s, color 0.1s;
}
.dropdown-item:hover { background: var(--ink-4); color: var(--text-0); }
.dropdown-item.active {
    background: var(--acc-deep);
    color: var(--acc);
}

/* ─── Search Wrappers ─── */
.search-wrapper {
    flex: 1;
    min-width: 0;
    position: relative;
    background: var(--ink-3);
    border: 1px solid var(--line-bright);
    border-radius: 4px;
    height: 40px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 12px;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.search-wrapper:focus-within {
    border-color: var(--acc-dim);
    box-shadow: 0 0 0 3px rgba(200, 255, 94, 0.08);
}
.search-prompt {
    font-family: var(--font-mono);
    color: var(--acc);
    font-size: 16px;
    line-height: 1;
}
.search-hint {
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: 1px;
    color: var(--text-3);
    background: var(--ink-1);
    border: 1px solid var(--line);
    padding: 3px 6px;
    border-radius: 3px;
    margin-right: auto; /* RTL: pushes to the LEFT (visual end) */
}

#search-query, #reviewer-name-input {
    width: 100%;
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    font-family: var(--font-ar);
    font-size: 16px;
    color: var(--text-0);
}
#search-query::placeholder, #reviewer-name-input::placeholder { color: var(--text-3); }

/* ─── Search Results ─── */
#search-results {
    position: absolute !important;
    top: calc(100% + 6px) !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    box-sizing: border-box !important;
    max-height: 250px !important;
    border-radius: 4px !important;
    z-index: 99999 !important;
    background-color: var(--ink-3) !important;
    border: 1px solid var(--line-bright) !important;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5) !important;
    color: var(--text-0);
}
.search-result-item {
    padding: 10px;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    overflow: hidden !important;
    position: relative;
    transition: background 0.12s;
}
.search-result-item:hover { background: var(--ink-4); }
.search-result-item:last-child { border-bottom: none; }
.search-result-item img { width: 30px; height: 45px; object-fit: cover; border-radius: 2px; }
.search-result-item span {
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    min-width: 0 !important;
    flex: 1 !important;
    font-size: 15px;
}

/* ─── Size Controls (Synopsis Size) ─── */
.size-controls {
    flex: 1;
    display: flex;
    gap: 4px;
    background: var(--ink-3);
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 3px;
}
.size-btn {
    flex: 1;
    padding: 7px 4px;
    background: transparent;
    border: none;
    color: var(--text-2);
    cursor: pointer;
    font-family: var(--font-ar);
    font-size: 14px;
    font-weight: 600;
    border-radius: 3px;
    transition: all 0.12s;
    line-height: 1;
}
.size-btn[data-size="auto"] { font-family: var(--font-mono); font-size: 10px; letter-spacing: 1px; }
.size-btn:hover { background: rgba(255, 255, 255, 0.03); color: var(--text-0); }
.size-btn.active {
    background: var(--ink-1);
    color: var(--acc);
    box-shadow: inset 0 0 0 1px var(--line-bright);
}

/* ───────────────── Ratings Section ───────────────── */

.ratings-section {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding-top: 14px;
    border-top: 1px dashed var(--line);
}
.ratings-head {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    flex-wrap: nowrap;
}
.ratings-title {
    font-family: var(--font-ar);
    font-size: 26px;
    font-weight: 700;
    color: var(--text-0);
    margin: 0;
    line-height: 1.05;
    white-space: nowrap;
}

.tags-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 12px;
    background: var(--ink-1);
    border: 1px solid var(--line);
    border-radius: 4px;
}

.category-tag {
    background: var(--ink-3);
    border: 1px solid var(--line-bright);
    color: var(--text-1);
    padding: 6px 10px 6px 8px;
    border-radius: 3px;
    font-family: var(--font-ar);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.12s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    line-height: 1;
}
.category-tag:hover {
    background: var(--ink-4);
    color: var(--text-0);
    border-color: var(--text-3);
    transform: translateY(-1px);
}
.category-tag .plus-icon {
    color: var(--acc);
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1;
}
.category-tag.selected {
    background: var(--acc-deep);
    border-color: var(--acc-dim);
    color: var(--acc);
}
.category-tag.selected .plus-icon { color: var(--acc); transform: rotate(45deg); }

/* ─── Rating Bars ─── */
.ratings-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.rating-row {
    display: flex;
    align-items: center;
    gap: 10px;
    opacity: 1;
}
@keyframes fadeInRow {
    from { opacity: 0; transform: translateX(8px); }
    to { opacity: 1; transform: translateX(0); }
}
.rating-row-label {
    width: 88px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-align: right;
    font-family: var(--font-ar);
    font-size: 16px;
    font-weight: 600;
    color: var(--text-0);
    flex-shrink: 0;
    line-height: 1;
}
.remove-slider-btn {
    background: transparent;
    border: none;
    color: var(--text-3);
    font-size: 18px;
    cursor: pointer;
    padding: 0 4px;
    transition: color 0.12s;
    line-height: 1;
    font-family: var(--font-mono);
}
.remove-slider-btn:hover { color: var(--accent-red); }

.rating-bar-container {
    flex: 1;
    display: flex;
    height: 30px;
    border: 1px solid var(--line-bright);
    border-radius: 3px;
    position: relative;
    cursor: pointer;
    background: var(--ink-1);
    overflow: hidden;
    padding: 2px;
    gap: 2px;
}
.bar-segment {
    flex: 1;
    transition: filter 0.2s, opacity 0.2s, box-shadow 0.2s, background-color 0.2s;
    border-radius: 2px;
    position: relative;
}
/* Rest state — muted */
.seg-red    { order: 4; background-color: rgba(255, 90, 90, 0.30); }
.seg-orange { order: 3; background-color: rgba(255, 154, 60, 0.30); }
.seg-yellow { order: 2; background-color: rgba(255, 216, 74, 0.30); }
.seg-gray   { order: 1; background-color: rgba(255, 255, 255, 0.06); }

/* Pixel dotted texture on each segment */
.bar-segment::after {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(90deg, rgba(0,0,0,0.18) 0 2px, transparent 2px 4px);
    border-radius: 2px;
    pointer-events: none;
    opacity: 0.6;
}

/* When a level is active, light the matching segment fully */
.rating-bar-container.active-1 .seg-red    { background-color: rgb(255, 90, 90);  box-shadow: 0 0 12px rgba(255, 90, 90, 0.55); }
.rating-bar-container.active-2 .seg-orange { background-color: rgb(255, 154, 60); box-shadow: 0 0 12px rgba(255, 154, 60, 0.5); }
.rating-bar-container.active-3 .seg-yellow { background-color: rgb(255, 216, 74); box-shadow: 0 0 12px rgba(255, 216, 74, 0.45); }

.rating-knob {
    position: absolute;
    width: 18px; height: 18px;
    background: var(--text-0);
    border: 2px solid var(--ink-0);
    border-radius: 50%;
    top: 50%;
    transform: translate(50%, -50%);
    right: 12.5%;
    pointer-events: none;
    transition: right 0.2s ease;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.15), 0 4px 10px rgba(0, 0, 0, 0.5);
}

/* ─── Toggles ─── */
.toggles-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 10px;
    background: var(--ink-1);
    border: 1px solid var(--line);
    border-radius: 4px;
    justify-content: flex-start;
}
.toggle-badge {
    background: transparent;
    border: 1px solid transparent;
    padding: 6px 10px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    border-radius: 3px;
    transition: all 0.12s;
    font-family: var(--font-ar);
    flex-shrink: 0;
}
.toggle-badge:hover { background: rgba(255, 255, 255, 0.02); }
.toggle-badge span:not(.toggle-square) {
    font-size: 14px;
    color: var(--text-2);
    font-weight: 600;
    white-space: nowrap;
    line-height: 1;
}
.toggle-badge.active span:not(.toggle-square) { color: var(--text-0); }

.toggle-square {
    width: 30px; height: 16px;
    background: var(--ink-4);
    border: 1px solid var(--line-bright);
    position: relative;
    flex-shrink: 0;
    border-radius: 8px;
    transition: background 0.2s, border-color 0.2s;
}
.toggle-square::after {
    content: '';
    position: absolute;
    top: 1px;
    left: 1px;
    width: 12px;
    height: 12px;
    background: var(--text-2);
    border-radius: 50%;
    transition: left 0.2s, background 0.2s;
}
.toggle-badge.active .toggle-square {
    background: var(--acc);
    border-color: var(--acc-dim);
    box-shadow: 0 0 10px var(--acc-glow);
}
.toggle-badge.active .toggle-square::after {
    left: 15px;
    background: var(--ink-0);
}

/* ─── Warning Text ─── */
.warning-text {
    margin-top: 6px;
    padding: 12px 14px;
    background: var(--ink-1);
    border: 1px solid var(--line);
    border-radius: 4px;
    font-size: 14px;
    color: var(--text-1);
    text-align: center;
    font-family: var(--font-ar);
    line-height: 1.5;
}
.warn-prefix {
    color: var(--accent-orange);
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 1px;
    font-weight: 700;
    margin-left: 6px;
    direction: rtl;
    display: inline-block;
}
.warning-text a {
    color: var(--acc);
    text-decoration: none;
    border-bottom: 1px dashed rgba(200, 255, 94, 0.4);
    padding-bottom: 1px;
    transition: color 0.12s, border-color 0.12s;
}
.warning-text a:hover { color: #e2ff8a; border-bottom-color: var(--acc); }

/* ═══════════════════════════════════════════════════════════════════
   PREVIEW CANVAS — html2canvas-SAFE ZONE
   No backdrop-filter, no mix-blend, no complex grid, no heavy shadows.
   ═══════════════════════════════════════════════════════════════════ */

.info-panel {
    background-color: #000;
    border: 1px solid #222;
    position: relative;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;
    container-type: size;
    border-radius: 3px;
}

.info-panel.horizontal {
    aspect-ratio: 16 / 9;
    width: 100%;
}
.info-panel.vertical {
    width: 100%;
    aspect-ratio: 4 / 5;
    height: auto;
    max-height: min(720px, 80vh);
    max-width: calc(min(720px, 80vh) * 0.8);
    margin: 0 auto;
}

.canvas-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
    background: #000;
}
.bg-image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0.9;
    z-index: 1;
}

/* Fallback for when browsers (e.g. Brave) block Javascript Canvas Manipulation */
.fallback-css-blur {
    filter: blur(9px);
    -webkit-filter: blur(9px);
    transform: scale(1.1); /* Prevents transparent bleeding on the edges */
}
.bg-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 2;
}
.vertical .bg-overlay { background: rgba(0, 0, 0, 0.70); }

.canvas-content {
    position: relative;
    z-index: 5;
    width: 100%;
    height: 100%;
    padding: 2cqw;
    display: flex;
    gap: 2cqw;
    box-sizing: border-box;
    pointer-events: none;
}
.canvas-content > * { pointer-events: auto; }
.horizontal .canvas-content { flex-direction: row; }

.horizontal .poster-column {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    gap: 15px;
}
.horizontal .poster-container {
    height: calc(100% - 50px);
    max-height: 100%;
    aspect-ratio: 1 / 1.414;
    flex-shrink: 1;
    min-height: 0;
    border: 2px solid rgba(255, 255, 255, 0.25);
    box-shadow: 8px 8px 0 rgba(0, 0, 0, 0.5);
    overflow: hidden;
    border-radius: 2px;
}

.poster-div {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    display: block;
    position: relative;
    cursor: default;
}
.poster-div.manual-mode { cursor: pointer; }

/* Preview demo placeholder for the poster slot */
.poster-div.demo-poster {
    background:
        repeating-linear-gradient(135deg, rgba(255,255,255,0.05) 0 14px, rgba(255,255,255,0.02) 14px 28px),
        linear-gradient(180deg, #2a2f3b, #14171e);
}
.poster-div.demo-poster::after {
    content: 'POSTER';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.25);
    font-family: var(--font-en);
    font-size: 2cqw;
    letter-spacing: 4px;
}

.upload-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    font-size: 1.2rem;
    font-weight: bold;
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
}
.poster-div.manual-mode.empty-poster .upload-overlay { opacity: 1; }
.poster-div.manual-mode:not(.empty-poster):hover .upload-overlay { opacity: 0; }

.vertical .poster-div {
    background-size: cover;
    background-position: center top;
    aspect-ratio: 4 / 5;
    width: 100%;
    height: auto;
}

.info-content-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    text-align: right;
    color: white;
    container-type: inline-size;
}

.header-info { text-align: right; margin: 0; padding: 0; }



.header-info h2 {
    font-family: var(--font-ar);
    font-weight: 900;
    font-variation-settings: "wght" 900;
    font-size: var(--canvas-title-size);
    margin: 0;
    padding: 0;
    line-height: 1.05;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    direction: auto;
    unicode-bidi: isolate;
    color: #fff;
}
/* 70% multiplier for 2-line horizontal titles */
.horizontal-has-2-line-title .header-info h2 { 
    font-size: calc(var(--canvas-title-size) * 0.7) !important; 
}

.genre-row {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 1.5cqw;
}
.horizontal .genre-row { margin-top: 5px !important; }

.genre-label {
    font-size: var(--canvas-genre-size);
    color: var(--accent-yellow);
    opacity: 1;
    margin-top: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}
.genre-pill {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--acc);
    border-radius: 4px;
    padding: 2px 8px 4px;
    color: var(--acc);
    font-size: 0.9em;
    white-space: nowrap;
    line-height: 1.2;
    display: flex;
    align-items: center;
}
.stats-pill {
    border-color: var(--accent-blue);
    color: var(--accent-blue);
}
.horizontal .genre-label { font-size: calc(var(--canvas-genre-size) * 0.7) !important; margin-top: 0 !important; }

.score-badge {
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(0, 0, 0, 0.4);
    padding: 2px 8px 4px;
    border-radius: 4px;
    border: 1px solid var(--accent-yellow);
    color: var(--accent-yellow);
    font-family: var(--font-en);
    font-size: calc(var(--canvas-genre-size) * 0.9);
    direction: ltr;
    line-height: 1.2;
    height: fit-content;
}
.horizontal .score-badge { font-size: calc(var(--canvas-genre-size) * 0.7 * 0.9) !important; }
.score-badge.hidden { display: none !important; }
.score-icon { color: var(--accent-yellow); }

.synopsis-wrapper {
    margin-top: 1cqw;
    flex: 1;
    overflow: hidden;
}
.horizontal .synopsis-wrapper {
    max-height: none !important;
    overflow: hidden;
}
.horizontal #synopsis-text {
    min-height: 100%;
    -webkit-line-clamp: 8 !important;
    line-clamp: 8 !important;
    max-height: none !important;
}
#synopsis-text {
    width: 100%;
    background: transparent;
    border: none;
    color: #eee;
    font-family: var(--font-ar);
    font-size: var(--canvas-synopsis-size);
    line-height: 1.15;
    letter-spacing: 0;
    outline: none;
    direction: rtl;
    text-align: right;
    unicode-bidi: embed;
    padding: 1cqw 0;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    line-clamp: 4;
    -webkit-box-orient: vertical;
}
#synopsis-text:focus { outline: none; }

#synopsis-text.scale-medium  { font-size: calc(var(--canvas-synopsis-size) * 0.85) !important; }
#synopsis-text.scale-heavy   { font-size: calc(var(--canvas-synopsis-size) * 0.75) !important; }
#synopsis-text.scale-extreme {
    font-size: calc(var(--canvas-synopsis-size) * 0.65) !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 3 !important;
    line-clamp: 3 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
}

#synopsis-text.manual-size-sm { font-size: calc(var(--canvas-synopsis-size) * 0.7) !important; }
#synopsis-text.manual-size-md { font-size: calc(var(--canvas-synopsis-size) * 0.85) !important; }
#synopsis-text.manual-size-lg { font-size: var(--canvas-synopsis-size) !important; }
#synopsis-text.manual-size-xl { font-size: calc(var(--canvas-synopsis-size) * 1.15) !important; }

[contenteditable]:empty:before {
    content: attr(placeholder);
    color: #888;
    pointer-events: none;
    display: block;
}

/* Vertical layout (preserved) */
.vertical .canvas-content {
    display: block !important;
    position: relative;
    padding: 0 !important;
    width: 100%; height: 100%;
}
.vertical .poster-column { display: contents; }
.vertical .poster-container {
    position: absolute !important;
    top: 22%; right: 5%;
    width: 44% !important;
    height: 52.8% !important;
    max-height: 52.8% !important;
    flex-shrink: 0;
    z-index: 15;
    border: 2px solid rgba(255, 255, 255, 0.25);
    margin: 0 !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
    border-radius: 2px;
}
.vertical .poster-div {
    width: 100%;
    height: 100%;
    background-size: cover !important;
    background-position: center !important;
}
.vertical #poster-img { opacity: 1; filter: none; }

.vertical .canvas-bg { height: 100%; width: 100%; z-index: 1; pointer-events: none; }

.vertical .info-content-right {
    display: block !important;
    width: 100%; height: 100%;
    position: static;
    pointer-events: none;
}
.vertical .info-content-right > * { pointer-events: auto; }
.vertical .header-info {
    position: absolute !important;
    top: 3%; left: 0; right: 0; width: 100%;
    display: flex !important;
    flex-direction: column;
    align-items: center;
    text-align: center;
    z-index: 10;
    margin: 0 !important;
    padding: 0 5%;
    box-sizing: border-box;
}
.vertical .classification-label { width: 100%; text-align: center !important; margin-bottom: 6px; }
.vertical .header-info h2 {
    -webkit-line-clamp: 2 !important;
    line-clamp: 2 !important;
    overflow: hidden !important;
    display: -webkit-box !important;
    -webkit-box-orient: vertical !important;
    font-size: calc(var(--canvas-v-title-size) * 0.9);
    text-shadow: 0.5cqw 0.5cqw 2cqw rgba(0, 0, 0, 1);
    text-align: center;
    margin-bottom: 5px;
}
.vertical .header-info h2[data-length="medium"] { font-size: calc(var(--canvas-v-title-size) * 1.1); }
.vertical .header-info h2[data-length="long"]   { font-size: calc(var(--canvas-v-title-size) * 0.9); }
.vertical .header-info h2[data-length="xl"]     { font-size: calc(var(--canvas-v-title-size) * 0.7); }
.vertical .header-info h2.title-scale-1 { font-size: calc(var(--canvas-v-title-size) * 0.75) !important; }
.vertical .header-info h2.title-scale-2 { font-size: calc(var(--canvas-v-title-size) * 0.6) !important; }
.vertical .header-info h2.title-scale-3 { font-size: calc(var(--canvas-v-title-size) * 0.5) !important; }

/* 70% of the base 0.9 multiplier for 2-line titles */
.vertical.has-2-line-title .header-info h2 { 
    font-size: calc(var(--canvas-v-title-size) * 0.63) !important; 
}
.vertical .genre-label { display: flex !important; flex-wrap: nowrap !important; overflow: visible; }
.vertical .genre-row {
    flex-wrap: nowrap !important;
    width: 100%;
    justify-content: center;
    overflow: visible;
}
.vertical .genre-row.genre-scale-1 .genre-pill, .vertical .genre-row.genre-scale-1 .score-badge { font-size: calc(var(--canvas-genre-size) * 0.85); padding: 0.4cqw 0.9cqw; }
.vertical .genre-row.genre-scale-2 .genre-pill, .vertical .genre-row.genre-scale-2 .score-badge { font-size: calc(var(--canvas-genre-size) * 0.7); padding: 0.3cqw 0.7cqw; }
.vertical .genre-row.genre-scale-3 .genre-pill, .vertical .genre-row.genre-scale-3 .score-badge { 
    font-size: calc(var(--canvas-genre-size) * 0.6); 
    padding: 0.2cqw 0.5cqw; 
    flex-shrink: 1 !important; 
    overflow: hidden; 
    text-overflow: ellipsis; 
}
.vertical .genre-row .genre-pill, .vertical .score-badge { flex-shrink: 0 !important; white-space: nowrap !important; overflow: visible !important; min-width: 0; }
.vertical .synopsis-wrapper {
    position: absolute !important;
    top: 26%; left: 5%;
    width: 42% !important;
    height: 52.8% !important;
    max-height: 52.8% !important;
    overflow: hidden !important;
    margin: 0 !important;
    display: block !important;
}
.vertical #synopsis-text {
    font-size: calc(var(--canvas-synopsis-size) * 0.8) !important;
    display: -webkit-box !important;
    -webkit-box-orient: vertical !important;
    -webkit-line-clamp: 24 !important;
    overflow: hidden !important;
    text-shadow: 0 2px 6px rgba(0,0,0,0.8);
    text-align: start !important;
}
.vertical .genre-row {
    margin-top: 1cqw !important;
    margin-bottom: 1cqw !important;
    justify-content: center !important;
}

/* Watermark — fancy chrome outside canvas; flat inside it */
.modern-watermark {
    font-family: var(--font-ar);
    color: rgba(255, 255, 255, 0.92);
    background: rgba(0, 0, 0, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 16px;
    padding: 4px 16px;
    font-size: 1.6cqw;
    font-weight: 600;
    align-self: center;
    direction: rtl;
    opacity: 1;
    letter-spacing: normal !important;
}
.vertical .modern-watermark { font-size: 2.4cqw; padding: 5px 22px; }
.modern-watermark .watermark-label {
    color: var(--acc);
    font-weight: 800;
    margin-left: 4px;
}
.modern-watermark.hidden { display: none !important; }
.horizontal .modern-watermark.vertical-only { display: none !important; }
.vertical .modern-watermark.horizontal-only { display: none !important; }

/* Stickers */
.stickers-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-top: auto;
    width: 100%;
}
.vertical .stickers-grid-canvas {
    position: absolute !important;
    bottom: 1.5% !important; left: 1.5% !important; right: 1.5% !important; width: auto !important;
    display: flex !important;
    align-items: flex-end !important;
    justify-content: center !important;
    flex-wrap: nowrap !important;
    z-index: 10;
    margin: 0 !important;
    padding: 0 !important;
    pointer-events: auto;
    max-width: 100% !important;
}
.vertical .modern-watermark.vertical-only {
    position: absolute !important;
    top: 100% !important;
    bottom: auto !important;
    left: 50%;
    width: auto !important;
    /* margin-top is handled dynamically by JS! */
    transform: translateX(-50%) !important;
    display: flex;
    justify-content: center;
    box-sizing: border-box;
    margin: 0 !important;
    white-space: nowrap;
    pointer-events: auto;
    z-index: 15;
}

.stickers-grid-canvas {
    display: flex;
    flex-wrap: nowrap;
    justify-content: center;
    gap: 0.4cqw;
    padding: 1cqw 1cqw 0 1cqw;
    width: 100%;
    min-width: 0;
}
.horizontal .stickers-grid-canvas { width: 100%; align-self: flex-start; max-width: 100%; }
.vertical .stickers-container { order: 3; margin-top: 0; width: 100%; }
.vertical .stickers-grid-canvas {
    background: transparent;
    margin-top: 0;
}

.sticker-item {
    aspect-ratio: 1 / 1;
    background: transparent;
    border: none;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    padding: 0.8cqw 0.8cqw 0 0.8cqw;
    flex: 0 1 auto;
    width: 18%;
    max-width: 19.4cqh;
    min-width: 0;
}
.sticker-item img { width: 100%; height: 100%; object-fit: contain; }

/* Demo sticker placeholders */
.sticker-placeholder {
    width: 100%;
    aspect-ratio: 1 / 1;
    background:
        repeating-linear-gradient(135deg, rgba(255,255,255,0.05) 0 8px, transparent 8px 16px),
        rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    position: relative;
}
.sticker-placeholder::before {
    content: attr(data-label);
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.75);
    font-size: 1.8cqw;
    font-family: var(--font-ar);
    font-weight: 800;
    text-shadow: 0 1px 2px rgba(0,0,0,0.6);
}

.classification-label {
    font-size: 1.5rem;
    color: rgba(255, 255, 255, 0.85);
    margin-bottom: 12px;
    font-family: var(--font-ar);
}
.horizontal .classification-label {
    font-size: 1.4cqw;
    margin-bottom: 1cqw;
}

/* ───────────────── Modal ───────────────── */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(7, 8, 11, 0.85);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}
.modal-content {
    background-color: var(--ink-2);
    border: 1px solid var(--line-bright);
    border-radius: 6px;
    width: 100%;
    max-width: 1080px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.7);
    color: var(--text-0);
    overflow: hidden;
    opacity: 1;
}
@keyframes modalSlide {
    from { transform: translateY(16px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

@keyframes slideUpSnap {
    0% {
        transform: translateY(100vh);
        opacity: 0;
    }
    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-slide-up {
    animation: slideUpSnap 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.modal-header {
    background: var(--ink-3);
    padding: 14px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--line);
}
.modal-title-wrap { display: flex; flex-direction: column; gap: 4px; }
.modal-header h2 {
    margin: 0;
    font-size: 26px;
    font-family: var(--font-ar);
    font-weight: 700;
    color: var(--text-0);
    line-height: 1;
}

.close-btn {
    background: var(--ink-4);
    color: var(--text-1);
    border: 1px solid var(--line-bright);
    font-size: 22px;
    width: 36px; height: 36px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    border-radius: 4px;
    font-family: var(--font-mono);
    transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.close-btn:hover { background: var(--accent-red); color: #fff; border-color: var(--accent-red); }

.modal-header-actions { display: flex; align-items: center; gap: 8px; }
.guide-expand-btn { text-decoration: none; font-size: 16px; }
.guide-expand-btn:hover { background: var(--acc-deep); color: var(--acc); border-color: var(--acc); }

.modal-body {
    padding: 24px;
    overflow-y: auto;
    scroll-behavior: smooth;
    flex: 1;
}
.modal-section { margin-bottom: 32px; }
.modal-section:last-child { margin-bottom: 0; }

.section-title {
    font-size: 22px;
    color: var(--text-0);
    border-bottom: 1px dashed var(--line);
    margin: 0 0 16px 0;
    padding-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-ar);
    font-weight: 700;
}
.section-num {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--acc);
    background: var(--acc-deep);
    border: 1px solid rgba(200, 255, 94, 0.25);
    padding: 4px 8px;
    border-radius: 3px;
    letter-spacing: 1px;
}

.semantic-legend {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.legend-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--ink-3);
    padding: 6px 12px;
    border-radius: 3px;
    border: 1px solid var(--line);
    font-size: 14px;
    color: var(--text-1);
}
.legend-dot {
    width: 8px; height: 8px;
    display: inline-block;
}
.theme-badge .legend-dot   { background-color: var(--theme-purple); box-shadow: 0 0 6px rgba(176, 124, 255, 0.5); }
.warning-badge .legend-dot { background-color: var(--accent-red);   box-shadow: 0 0 6px rgba(255, 90, 90, 0.5); }
.mechanic-badge .legend-dot{ background-color: var(--mech-teal);    box-shadow: 0 0 6px rgba(52, 208, 184, 0.5); }

.modal-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.modal-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    background: var(--ink-3);
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 4px;
    transition: background 0.15s, border-color 0.15s, transform 0.15s;
    cursor: default;
}
.modal-item:hover { background: var(--ink-4); border-color: var(--line-bright); transform: translateY(-1px); }

.modal-item.warning-card  { border-right: 3px solid var(--accent-red); }
.modal-item.theme-card    { border-right: 3px solid var(--theme-purple); }
.modal-item.mechanic-card { border-right: 3px solid var(--mech-teal); }

.modal-item img {
    width: 80px; height: 80px;
    object-fit: contain;
    flex-shrink: 0;
    background: var(--ink-1);
    padding: 6px;
    border-radius: 3px;
    border: 1px solid var(--line);
}
.item-text strong {
    display: block;
    font-size: 18px;
    color: var(--text-0);
    margin-bottom: 4px;
    font-family: var(--font-ar);
    font-weight: 800;
}
.item-text p {
    margin: 0;
    font-size: 15px;
    line-height: 1.5;
    color: var(--text-1);
}

/* Exceptions */
.exceptions-card {
    background: rgba(52, 208, 184, 0.06);
    border: 1px solid rgba(52, 208, 184, 0.18);
    border-right: 3px solid var(--mech-teal);
    border-radius: 4px;
    padding: 16px;
}
.exceptions-desc {
    margin: 0 0 14px 0;
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-1);
}
.exceptions-icons {
    display: flex;
    gap: 10px;
    flex-wrap: nowrap;
    justify-content: flex-start;
}
.exceptions-icons img {
    width: 90px; height: 90px;
    object-fit: contain;
    flex-shrink: 1;
    min-width: 0;
}

/* Grade cards */
.grades-container { display: flex; flex-direction: column; gap: 10px; }
.grade-card {
    border-radius: 4px;
    border: 1px solid var(--line);
    overflow: hidden;
    transition: transform 0.15s, border-color 0.15s;
    background: var(--ink-3);
}
.grade-card:hover { transform: translateY(-1px); border-color: var(--line-bright); }

.grade-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
}
.grade-badge {
    width: 38px; height: 38px;
    border-radius: 4px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 18px;
    font-weight: 900;
    font-family: var(--font-en);
    flex-shrink: 0;
    line-height: 1;
}
.grade-badge.red    { background: var(--accent-red);    color: #fff; box-shadow: 0 0 14px rgba(255, 90, 90, 0.45); }
.grade-badge.orange { background: var(--accent-orange); color: #fff; box-shadow: 0 0 14px rgba(255, 154, 60, 0.4); }
.grade-badge.yellow { background: var(--accent-yellow); color: #000; box-shadow: 0 0 14px rgba(255, 216, 74, 0.4); }

.grade-title {
    font-size: 20px;
    font-weight: 700;
    font-family: var(--font-ar);
    flex: 1;
}
.grade-meta {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-2);
    letter-spacing: 1.2px;
}

.grade-red    { border-right: 3px solid var(--accent-red); }
.grade-red    .grade-title { color: #ff8585; }
.grade-orange { border-right: 3px solid var(--accent-orange); }
.grade-orange .grade-title { color: #ffb874; }
.grade-yellow { border-right: 3px solid var(--accent-yellow); }
.grade-yellow .grade-title { color: #ffe68a; }

.grade-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1px;
    background: var(--line);
}
.grade-desc {
    padding: 12px 16px;
    background: var(--ink-3);
}
.grade-desc-label {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: var(--text-2);
    margin-bottom: 6px;
}
.grade-desc p {
    margin: 0;
    font-size: 15px;
    line-height: 1.55;
    color: var(--text-1);
}

/* Modal scrollbar */
.modal-body::-webkit-scrollbar { width: 8px; }
.modal-body::-webkit-scrollbar-track { background: var(--ink-1); }
.modal-body::-webkit-scrollbar-thumb { background: var(--line-bright); border-radius: 4px; }
.modal-body::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

/* ───────────────── Responsive ───────────────── */

@media (max-width: 880px) {
    .card-container { grid-template-columns: 1fr; }
    .info-panel.horizontal { aspect-ratio: 16 / 9; }
}

@media (max-width: 768px) {
    .app-shell { padding: 12px; gap: 12px; }
    .topbar { flex-direction: column; align-items: flex-start; gap: 10px; }
    .top-controls { padding: 14px; }
    .control-row { gap: 8px; }
    .control-label { min-width: 0; font-size: 16px; }
    .ratings-title { font-size: 22px; }
    #copy-btn, #export-btn { padding: 9px 16px; font-size: 16px; }
    .modal-grid { grid-template-columns: 1fr; }
    .modal-content { max-width: 95vw; }
    .grade-body { grid-template-columns: 1fr; }
}

/* ════════════════════════════════════════════════════════════════
   EXPORT MODE — html2canvas resolution overrides (preserved)
   ════════════════════════════════════════════════════════════════ */

.export-mode {
    --canvas-title-size: 106px;
    --canvas-genre-size: 54px;
    --canvas-synopsis-size: 40px;
    --canvas-v-title-size: 114px;
    width: 1920px !important;
    min-width: 1920px !important;
    max-width: none !important;
}
.export-mode.vertical .poster-div {
    background-size: cover !important;
    background-position: center !important;
}
.export-mode #synopsis-text { line-height: 1.15 !important; }
.export-mode.vertical {
    width: 1200px !important;
    min-width: 1200px !important;
    max-width: none !important;
    height: 1800px !important;
    aspect-ratio: 2 / 3 !important;
    position: relative !important;
}
.export-mode.vertical .canvas-content { justify-content: space-between !important; }
.export-mode.vertical .stickers-container { margin-top: 0 !important; }

#preview-canvas.export-mode.vertical {
    width: 1200px !important;
    height: 1500px !important;
    max-width: none !important;
    max-height: none !important;
    margin: 0 !important;
}
#preview-canvas.export-mode.horizontal {
    width: 1920px !important;
    height: 1080px !important;
    max-width: none !important;
    max-height: none !important;
    margin: 0 !important;
}
.export-mode .classification-label {
    font-size: 28px !important;
    margin-bottom: 20px !important;
}
.export-mode.vertical .classification-label {
    font-size: 50px !important;
    margin-bottom: 15px !important;
}
.export-mode.vertical.has-2-line-title .classification-label {
    font-size: 36px !important;
    margin-bottom: 8px !important;
}
.export-mode.vertical.has-2-line-title .header-info h2 {
    font-size: 71.8px !important; /* Exactly 70% of 102.6px base */
}
.export-mode.vertical .poster-container {
    top: 330px !important; right: 60px !important;
    width: 528px !important; height: 792px !important;
    max-height: 792px !important; max-width: 528px !important;
    aspect-ratio: unset !important;
    margin-bottom: 0 !important;
}
.export-mode.vertical .synopsis-wrapper {
    top: 330px !important; left: 60px !important;
    width: 504px !important; height: 792px !important;
    max-height: 792px !important;
}
.export-mode.vertical .genre-row {
    margin: 12px 0 0 0 !important;
    justify-content: center !important;
}
.export-mode .header-info h2 {
    display: block !important;
    overflow: hidden !important;
    max-height: 2.2em !important;
    margin-bottom: 8px !important;
}
.export-mode.horizontal-has-2-line-title .header-info h2 {
    font-size: 74.2px !important; /* Exactly 70% of 106px base */
}
.export-mode.vertical .header-info {
    padding: 0 60px !important;
    box-sizing: border-box !important;
}
.export-mode #synopsis-text {
    display: block !important;
    overflow: hidden !important;
    max-height: 870px !important;
}
.export-mode .modern-watermark {
    background-color: rgba(0, 0, 0, 0.5) !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    border-radius: 40px !important;
    opacity: 1 !important;
    padding: 12px 32px !important;
    font-size: 32px !important;
    letter-spacing: normal !important;
}
.export-mode.vertical .modern-watermark {
    font-size: 36px !important;
    padding: 14px 38px !important;
    top: 100% !important;
    bottom: auto !important;
    left: 0 !important;
    right: 0 !important;
    margin-left: auto !important;
    margin-right: auto !important;
    width: max-content !important;
    transform: none !important;
    /* margin-top is handled dynamically by JS! */
}
/* Obsolete Export-mode few-icons removed because Flexbox now self-regulates */
/* Fix html2canvas cqw/vh bugs for horizontal stickers */
.export-mode.horizontal .stickers-grid-canvas {
    gap: 12px !important;
    padding: 24px 24px 0 24px !important;
    align-items: flex-end !important;
    max-width: 100% !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
}
.export-mode.horizontal .sticker-item {
    padding: 14px 14px 0 14px !important;
    width: 210px !important;
    flex-shrink: 1 !important;
    align-self: auto !important;
}
.export-mode.horizontal .sticker-item img {
    width: 100% !important;
    height: auto !important;
    object-fit: contain !important;
}
.export-mode.horizontal .stickers-container {
    max-height: 260px !important;
    margin-top: auto !important;
}
.export-mode .sticker-placeholder::before {
    font-size: 34px !important;
}

.export-mode.vertical .stickers-grid-canvas {
    gap: 18px !important;
    align-items: flex-end !important;
    max-width: 100% !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
}

/* Vertical stickers: Self-Regulating Flexbox tied to JS Allocator */
.vertical .sticker-item {
    aspect-ratio: 1 / 1 !important;
    height: 100% !important;
    max-height: 100% !important;
    width: auto !important;
    flex: 0 0 auto !important; /* DO NOT shrink. JS explicitly calculates pixel width */
    min-width: 0 !important;
    min-height: 0 !important;
    padding: 0 !important;
    align-self: flex-end !important;
}
.vertical .sticker-item img {
    width: 100% !important;
    height: 100% !important;
    display: block !important;
    object-fit: contain !important;
}

/* Export vertical: Same logic, inherits perfectly */
.export-mode.vertical .sticker-item {
    flex-shrink: 0 !important;
}
.export-mode.vertical .sticker-placeholder::before {
    font-size: 22px !important;
}
