/* =========================================================
   SINSUBZ — "PROJECTION ROOM" REDESIGN
   Warm cinema palette · glass surfaces · motion

   NOTE: script.js injects some of its own styles at runtime
   (search results, Sinhala cards, translation status, the
   subtitle editor). Rules below that target those components
   are scoped under `.app` so they stay in control, and the
   JS-owned layout rules (poster sizes etc.) are left alone.
========================================================= */

/* ---------------------------------------------------------
   TOKENS
--------------------------------------------------------- */

:root {
    --font-display: 'Sora', 'Noto Sans Sinhala', system-ui, sans-serif;
    --font-body: 'Plus Jakarta Sans', 'Noto Sans Sinhala', system-ui, sans-serif;

    --bg: #07080d;
    --bg-soft: #0d0f18;

    --surface: rgba(255, 255, 255, 0.045);
    --surface-2: rgba(255, 255, 255, 0.075);
    --surface-solid: #11131d;

    --line: rgba(255, 255, 255, 0.09);
    --line-strong: rgba(255, 255, 255, 0.18);

    --text: #f2f4fa;
    --text-2: #c9c5d4;
    --muted: #9391a3;
    --muted-2: #6f6d80;

    --amber: #8ab4ff;
    --rose: #9a8bff;
    --violet: #c58bff;
    --teal: #36e0c8;

    --grad: linear-gradient(135deg, #7fb4ff 0%, #8f86ff 55%, #c58bff 100%);
    --grad-cool: linear-gradient(135deg, #36e0c8, #4aa8ff);

    --glow: rgba(120, 140, 255, 0.35);

    --radius-lg: 28px;
    --radius: 20px;
    --radius-sm: 14px;

    --shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
    --ease: cubic-bezier(0.22, 1, 0.36, 1);

    --header-h: 72px;
}

html[data-theme="light"] {
    --bg: #f4f6fc;
    --bg-soft: #e9eef9;

    --surface: rgba(255, 255, 255, 0.72);
    --surface-2: rgba(255, 255, 255, 0.92);
    --surface-solid: #ffffff;

    --line: rgba(30, 40, 80, 0.11);
    --line-strong: rgba(30, 40, 80, 0.22);

    --text: #141828;
    --text-2: #3d3748;
    --muted: #6b6578;
    --muted-2: #8a8497;

    --glow: rgba(100, 120, 240, 0.28);

    --amber: #3f5bdc;
    --rose: #6a55e8;
    --violet: #8b4fe0;
    --teal: #0aa392;
    --shadow: 0 24px 60px rgba(30, 40, 90, 0.14);
}

/* ---------------------------------------------------------
   RESET / BASE
--------------------------------------------------------- */

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

html {
    scroll-behavior: smooth;
    scroll-padding-top: 84px;
    -webkit-text-size-adjust: 100%;
}

body {
    min-height: 100vh;
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    transition: background 0.4s ease, color 0.4s ease;
}

button,
input,
select,
textarea {
    font: inherit;
    color: inherit;
}

button {
    border: 0;
    background: none;
    cursor: pointer;
}

img {
    display: block;
    max-width: 100%;
}

a {
    color: inherit;
    text-decoration: none;
}

::selection {
    background: rgba(143, 134, 255, 0.4);
    color: #fff;
}

:focus-visible {
    outline: 2px solid var(--amber);
    outline-offset: 3px;
}

/* thin scrollbars */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--line-strong) transparent;
}

/* ---------------------------------------------------------
   AMBIENT BACKGROUND + FILM GRAIN
--------------------------------------------------------- */

/* Soft glow made with a radial gradient instead of filter: blur().
   A 110px blur on fixed, animated layers is re-rasterised while
   scrolling and is the main cause of lag on phones. */
.ambient {
    position: fixed;
    z-index: -3;
    border-radius: 50%;
    background: radial-gradient(circle at center, var(--c) 0%, transparent 68%);
    opacity: 0.3;
    pointer-events: none;
    will-change: transform;
}

.ambient-one {
    --c: #2f6bff;
    width: 640px;
    height: 640px;
    top: -220px;
    left: -240px;
    animation: drift 26s ease-in-out infinite alternate;
}

.ambient-two {
    --c: #7a4bff;
    width: 600px;
    height: 600px;
    top: 38%;
    right: -260px;
    opacity: 0.24;
    animation: drift 32s ease-in-out infinite alternate-reverse;
}

.ambient-three {
    --c: #00bfd0;
    width: 520px;
    height: 520px;
    bottom: -200px;
    left: 30%;
    opacity: 0.16;
    animation: drift 28s ease-in-out infinite alternate;
}

html[data-theme="light"] .ambient {
    opacity: 0.22;
}

@keyframes drift {
    from { transform: translate3d(0, 0, 0) scale(1); }
    to   { transform: translate3d(60px, 40px, 0) scale(1.15); }
}

body::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 100;
    pointer-events: none;
    opacity: 0.05;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
    mix-blend-mode: overlay;
}

html[data-theme="light"] body::after {
    opacity: 0.035;
}

/* ---------------------------------------------------------
   SCROLL PROGRESS + REVEAL
--------------------------------------------------------- */

.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    width: 100%;
    z-index: 200;
    transform-origin: left;
    transform: scaleX(0);
    background: var(--grad);
}

.reveal {
    opacity: 0;
    transform: translateY(28px);
    transition: opacity 0.8s var(--ease), transform 0.8s var(--ease);
    transition-delay: var(--d, 0s);
}

.reveal.in {
    opacity: 1;
    transform: none;
}

/* if JS never runs, never hide content */
.no-js .reveal {
    opacity: 1;
    transform: none;
}

/* ---------------------------------------------------------
   LAYOUT
--------------------------------------------------------- */

.app {
    width: min(100%, 1120px);
    margin: 0 auto;
    padding: 0 20px 60px;
}

/* ---------------------------------------------------------
   HEADER
--------------------------------------------------------- */

.top-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 90;
    height: var(--header-h);
    padding: 0 max(20px, calc((100vw - 1120px) / 2 + 20px));
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    transition: background 0.35s ease, backdrop-filter 0.35s ease,
        border-color 0.35s ease, height 0.35s var(--ease);
    border-bottom: 1px solid transparent;
    color: var(--text);
}

.top-header.scrolled {
    height: 62px;
    background: color-mix(in srgb, var(--bg) 72%, transparent);
    backdrop-filter: blur(18px) saturate(1.4);
    -webkit-backdrop-filter: blur(18px) saturate(1.4);
    border-bottom-color: var(--line);
}

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

.brand-logo {
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid var(--line-strong);
    background: var(--surface);
    box-shadow: 0 0 0 0 var(--glow);
    transition: box-shadow 0.4s ease, transform 0.4s var(--ease);
}

.brand:hover .brand-logo {
    transform: rotate(-6deg) scale(1.06);
    box-shadow: 0 0 28px var(--glow);
}

.brand-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.brand-title {
    font-family: var(--font-display);
    font-size: 21px;
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.4px;
}

.brand-title span {
    background: var(--grad);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.brand-subtitle {
    font-size: 11px;
    letter-spacing: 1.6px;
    text-transform: uppercase;
    color: var(--muted);
    font-weight: 600;
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
    margin-right: 10px;
}

.header-nav a {
    position: relative;
    padding: 8px 14px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-2);
    border-radius: 999px;
    transition: color 0.25s ease, background 0.25s ease;
}

.header-nav a:hover {
    color: var(--text);
    background: var(--surface-2);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.theme-toggle,
.settings-button {
    height: 44px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--line);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: transform 0.3s var(--ease), border-color 0.3s ease,
        box-shadow 0.3s ease, background 0.3s ease;
}

.settings-button {
    width: 44px;
}

.theme-toggle {
    position: relative;
    width: 84px;
    padding: 0 6px;
    justify-content: space-between;
}

.theme-toggle:hover,
.settings-button:hover {
    transform: translateY(-2px);
    border-color: var(--amber);
    box-shadow: 0 8px 26px var(--glow);
}

.settings-button:hover i {
    animation: spinOnce 0.7s var(--ease);
}

@keyframes spinOnce {
    to { transform: rotate(180deg); }
}

.theme-sun,
.theme-moon {
    position: relative;
    z-index: 2;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 14px;
    color: var(--muted);
    transition: color 0.3s ease;
}

/* sliding knob */
.theme-toggle::before {
    content: "";
    position: absolute;
    z-index: 1;
    top: 5px;
    left: 5px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--grad);
    box-shadow: 0 4px 16px var(--glow);
    transition: transform 0.45s var(--ease);
    /* dark theme = moon active → knob on the right */
    transform: translateX(42px);
}

html[data-theme="light"] .theme-toggle::before {
    transform: translateX(0);
}

html[data-theme="dark"] .theme-moon,
html[data-theme="light"] .theme-sun {
    color: #fff;
}

/* ---------------------------------------------------------
   HERO
--------------------------------------------------------- */

.hero {
    position: relative;
    min-height: 640px;
    /* full-bleed: break out of the centered .app column */
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    padding-top: var(--header-h);
    overflow: hidden;
    display: grid;
    align-items: center;
    isolation: isolate;
}

.hero-banner {
    position: absolute;
    inset: 0;
    z-index: -3;
    overflow: hidden;
    -webkit-mask-image: linear-gradient(#000 62%, transparent 100%);
    mask-image: linear-gradient(#000 62%, transparent 100%);
}

.hero-banner img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    filter: brightness(0.62) saturate(1.15) contrast(1.05);
    animation: kenBurns 28s ease-in-out infinite alternate;
    will-change: transform;
}

@keyframes kenBurns {
    from { transform: scale(1.04) translate3d(0, 0, 0); }
    to   { transform: scale(1.16) translate3d(-1.5%, -1%, 0); }
}

.hero-overlay {
    position: absolute;
    inset: 0;
    z-index: -2;
    pointer-events: none;
    -webkit-mask-image: linear-gradient(#000 62%, transparent 100%);
    mask-image: linear-gradient(#000 62%, transparent 100%);
    background:
        radial-gradient(60% 70% at 78% 40%, transparent 0%, rgba(7, 8, 13, 0.55) 100%),
        linear-gradient(90deg, rgba(7, 8, 13, 0.96) 0%, rgba(7, 8, 13, 0.72) 42%, rgba(7, 8, 13, 0.25) 100%),
        linear-gradient(180deg, rgba(7, 8, 13, 0.5), transparent 30%);
}

html[data-theme="light"] .hero-overlay {
    /* bottom fade first so it sits on top and blends into the page */
    background:
        linear-gradient(180deg, rgba(10, 8, 16, 0.4), transparent 28%),
        linear-gradient(90deg, rgba(10, 8, 16, 0.9) 0%, rgba(10, 8, 16, 0.6) 45%, rgba(10, 8, 16, 0.2) 100%);
}

/* over the dark hero the header keeps light text until it turns solid */
html[data-theme="light"] .top-header:not(.scrolled) {
    --text: #f2f4fa;
    --text-2: #e3dfeb;
    --muted: #c3bfd0;
    --surface: rgba(255, 255, 255, 0.1);
    --surface-2: rgba(255, 255, 255, 0.18);
    --line: rgba(255, 255, 255, 0.2);
}

/* light beam sweeping across the hero */
.hero::before {
    content: "";
    position: absolute;
    z-index: -1;
    top: -20%;
    bottom: -20%;
    width: 38%;
    left: -50%;
    transform: skewX(-18deg);
    pointer-events: none;
    background: linear-gradient(90deg, transparent, rgba(143, 180, 255, 0.1), transparent);
    animation: beam 9s ease-in-out infinite;
}

@keyframes beam {
    0%   { left: -50%; }
    55%  { left: 120%; }
    100% { left: 120%; }
}

.hero-content {
    position: relative;
    z-index: 2;
    width: min(100%, 1120px);
    margin: 0 auto;
    padding: 60px 20px 120px;
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
    align-items: center;
    gap: 40px;
}

.hero-copy {
    min-width: 0;
}

.hero-star {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 18px;
    padding: 7px 14px 7px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1.4px;
    text-transform: uppercase;
    color: var(--amber);
    background: rgba(127, 180, 255, 0.1);
    border: 1px solid rgba(127, 180, 255, 0.3);
}

.hero-star::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--amber);
    box-shadow: 0 0 0 0 rgba(127, 180, 255, 0.7);
    animation: ping 2s ease-out infinite;
}

@keyframes ping {
    to { box-shadow: 0 0 0 10px rgba(127, 180, 255, 0); }
}

.hero h1 {
    font-family: var(--font-display);
    font-size: clamp(38px, 5.6vw, 72px);
    font-weight: 800;
    line-height: 1.04;
    letter-spacing: -2px;
    color: #fff;
}

.hero h1 span {
    display: inline-block;
    background: linear-gradient(100deg, #7fb4ff, #8f86ff, #c58bff, #7fb4ff);
    background-size: 250% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: gradientSlide 6s linear infinite;
}

@keyframes gradientSlide {
    to { background-position: 250% 0; }
}

.hero-content p {
    max-width: 520px;
    margin-top: 22px;
    color: #cfcbd9;
    font-size: 18px;
    line-height: 1.7;
}

.hero-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    width: 100%;
    max-width: 540px;
    margin-top: 30px;
}

.hero-actions .btn {
    width: 100%;
    padding: 0 18px;
    white-space: nowrap;
}

/* app build has only 3 buttons: let the last one fill the row */
.hero-actions .btn:last-child:nth-child(odd) {
    grid-column: 1 / -1;
}

.btn {
    position: relative;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 52px;
    padding: 0 26px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 15px;
    transition: transform 0.3s var(--ease), box-shadow 0.3s ease, background 0.3s ease;
}

.btn-primary {
    color: #0b0d1f;
    background: var(--grad);
    box-shadow: 0 10px 32px var(--glow);
}

.btn-ghost {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.22);
    backdrop-filter: blur(10px);
}

.btn:hover {
    transform: translateY(-3px);
}

.btn-primary:hover {
    box-shadow: 0 16px 42px var(--glow);
}

.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.16);
}

/* shimmer sweep for all primary-style buttons */
.btn-primary::after,
#searchBtn::after,
#translateBtn::after,
.upload-btn::after,
.select-title-btn::after {
    content: "";
    position: absolute;
    inset: 0;
    transform: translateX(-120%) skewX(-20deg);
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.45), transparent);
    transition: transform 0.7s var(--ease);
    pointer-events: none;
}

.btn-primary:hover::after,
#searchBtn:hover::after,
#translateBtn:hover:not(:disabled)::after,
.upload-btn:hover::after,
.select-title-btn:hover::after {
    transform: translateX(120%) skewX(-20deg);
}

/* ripple (added by ui.js) */
.ripple {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    background: rgba(255, 255, 255, 0.5);
    transform: scale(0);
    animation: ripple 0.65s ease-out forwards;
}

@keyframes ripple {
    to { transform: scale(4); opacity: 0; }
}

/* subtitle "stage" — a faux video frame with animated subtitles */
.hero-stage {
    position: relative;
    justify-self: end;
    width: min(100%, 440px);
    aspect-ratio: 16 / 10;
    border-radius: 22px;
    overflow: hidden;
    background:
        radial-gradient(80% 90% at 30% 20%, rgba(110, 140, 255, 0.5), transparent 60%),
        radial-gradient(70% 80% at 90% 90%, rgba(122, 75, 255, 0.55), transparent 60%),
        #10121c;
    border: 1px solid rgba(255, 255, 255, 0.16);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55), 0 0 60px rgba(120, 130, 255, 0.18);
    transform: perspective(1000px) rotateY(-8deg) rotateX(3deg);
    animation: floatStage 7s ease-in-out infinite;
}

@keyframes floatStage {
    0%, 100% { transform: perspective(1000px) rotateY(-8deg) rotateX(3deg) translateY(0); }
    50%      { transform: perspective(1000px) rotateY(-5deg) rotateX(2deg) translateY(-12px); }
}

.stage-bar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 12px 14px;
    background: linear-gradient(rgba(0, 0, 0, 0.5), transparent);
}

.stage-bar i {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.35);
}

.stage-bar i:nth-child(1) { background: #ff5f57; }
.stage-bar i:nth-child(2) { background: #febc2e; }
.stage-bar i:nth-child(3) { background: #28c840; }

.stage-badge {
    margin-left: auto;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1px;
    padding: 3px 8px;
    border-radius: 6px;
    color: #fff;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.stage-play {
    position: absolute;
    top: 46%;
    left: 50%;
    width: 64px;
    height: 64px;
    transform: translate(-50%, -50%);
    display: grid;
    place-items: center;
    border-radius: 50%;
    font-size: 22px;
    color: #fff;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(8px);
}

.stage-play::after {
    content: "";
    position: absolute;
    inset: -1px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.5);
    animation: pulseRing 2.6s ease-out infinite;
}

@keyframes pulseRing {
    from { transform: scale(1); opacity: 0.8; }
    to   { transform: scale(1.7); opacity: 0; }
}

.stage-subs {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 34px;
    padding: 0 18px;
    text-align: center;
    min-height: 66px;
}

.stage-line {
    display: block;
    margin: 0 auto;
    width: fit-content;
    max-width: 100%;
    padding: 3px 10px;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.62);
    font-size: 14px;
    line-height: 1.5;
    color: #fff;
}

.stage-line.si {
    margin-top: 5px;
    font-weight: 600;
    color: #cfe0ff;
}

.stage-line.is-in {
    animation: lineIn 0.6s var(--ease) both;
}

.stage-line.is-out {
    animation: lineOut 0.4s ease both;
}

@keyframes lineIn {
    from { opacity: 0; transform: translateY(8px); filter: blur(4px); }
    to   { opacity: 1; transform: none; filter: none; }
}

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

.stage-timeline {
    position: absolute;
    left: 14px;
    right: 14px;
    bottom: 14px;
    height: 4px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.2);
    overflow: hidden;
}

.stage-timeline::after {
    content: "";
    display: block;
    height: 100%;
    width: 100%;
    transform-origin: left;
    background: var(--grad);
    animation: timeline 12s linear infinite;
}

@keyframes timeline {
    from { transform: scaleX(0); }
    to   { transform: scaleX(1); }
}

/* ---------------------------------------------------------
   SEARCH CARD
--------------------------------------------------------- */

.search-section {
    position: relative;
    z-index: 10;
    margin-top: -64px;
}

.search-card {
    position: relative;
    padding: 24px;
    border-radius: var(--radius-lg);
    background: color-mix(in srgb, var(--surface-solid) 82%, transparent);
    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);
    box-shadow: var(--shadow);
    isolation: isolate;
}

/* animated gradient border */
.search-card::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    padding: 1.5px;
    border-radius: inherit;
    background: conic-gradient(from var(--angle, 0deg),
        rgba(127, 180, 255, 0.9), rgba(143, 134, 255, 0.15) 25%,
        rgba(197, 139, 255, 0.8) 50%, rgba(143, 134, 255, 0.15) 75%,
        rgba(127, 180, 255, 0.9));
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
    animation: borderSpin 8s linear infinite;
}

@property --angle {
    syntax: "<angle>";
    initial-value: 0deg;
    inherits: false;
}

@keyframes borderSpin {
    to { --angle: 360deg; }
}

.search-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
}

.search-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
    min-width: 0;
}

.search-input-wrap i {
    position: absolute;
    left: 22px;
    font-size: 18px;
    color: var(--muted);
    pointer-events: none;
    transition: color 0.3s ease, transform 0.3s var(--ease);
}

.search-input-wrap:focus-within i {
    color: var(--amber);
    transform: scale(1.15);
}

.search-input-wrap input {
    width: 100%;
    height: 64px;
    padding: 0 22px 0 58px;
    border-radius: var(--radius);
    font-size: 16px;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--line);
    outline: none;
    transition: border-color 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
}

.search-input-wrap input::placeholder {
    color: var(--muted-2);
}

.search-input-wrap input:focus {
    border-color: var(--amber);
    background: var(--surface-2);
    box-shadow: 0 0 0 4px rgba(127, 180, 255, 0.14);
}

#searchBtn {
    position: relative;
    overflow: hidden;
    height: 64px;
    min-width: 150px;
    padding: 0 28px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-weight: 700;
    font-size: 16px;
    color: #0b0d1f;
    background: var(--grad);
    box-shadow: 0 10px 28px var(--glow);
    transition: transform 0.3s var(--ease), box-shadow 0.3s ease, opacity 0.3s ease;
}

#searchBtn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 16px 38px var(--glow);
}

#searchBtn:active {
    transform: scale(0.97);
}

#searchBtn:disabled {
    opacity: 0.75;
    cursor: progress;
}

.category-chips {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 18px;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
}

.category-chips::-webkit-scrollbar {
    display: none;
}

.category-chip {
    position: relative;
    flex: 0 0 auto;
    min-height: 44px;
    padding: 0 18px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-2);
    background: var(--surface);
    border: 1px solid var(--line);
    transition: transform 0.3s var(--ease), color 0.25s ease,
        background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.category-chip:hover {
    transform: translateY(-2px);
    color: var(--text);
    border-color: var(--line-strong);
}

.category-chip.active {
    color: #0b0d1f;
    background: var(--grad);
    border-color: transparent;
    box-shadow: 0 8px 24px var(--glow);
}

.category-chip.active i {
    animation: chipPop 0.5s var(--ease);
}

@keyframes chipPop {
    0%   { transform: scale(0.4) rotate(-30deg); }
    70%  { transform: scale(1.3) rotate(8deg); }
    100% { transform: scale(1) rotate(0); }
}

#searchStatus {
    margin-top: 14px;
    min-height: 20px;
    font-size: 13px;
    font-weight: 500;
    color: var(--muted);
}

#searchStatus:not(:empty) {
    animation: fadeUp 0.4s var(--ease);
}

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

/* ---------------------------------------------------------
   CATEGORY GRID (TMDB posters) — built by script.js
--------------------------------------------------------- */

.category-results {
    width: 100%;
    margin-top: 16px;
}

.category-results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 16px;
    width: 100%;
}

.category-card {
    position: relative;
    min-width: 0;
    overflow: hidden;
    border-radius: var(--radius-sm);
    background: var(--surface);
    border: 1px solid var(--line);
    transition: transform 0.4s var(--ease), border-color 0.3s ease, box-shadow 0.4s ease;
    animation: cardIn 0.7s var(--ease) both;
}

.category-card:nth-child(1)  { animation-delay: 0.02s; }
.category-card:nth-child(2)  { animation-delay: 0.06s; }
.category-card:nth-child(3)  { animation-delay: 0.10s; }
.category-card:nth-child(4)  { animation-delay: 0.14s; }
.category-card:nth-child(5)  { animation-delay: 0.18s; }
.category-card:nth-child(6)  { animation-delay: 0.22s; }
.category-card:nth-child(7)  { animation-delay: 0.26s; }
.category-card:nth-child(8)  { animation-delay: 0.30s; }
.category-card:nth-child(n+9) { animation-delay: 0.34s; }

/* ---------------------------------------------------------
   CATEGORY PAGER (next / previous page + slide animation)
--------------------------------------------------------- */

.category-stage {
    position: relative;
    overflow: hidden;
    padding: 10px 6px 14px;
    margin: -10px -6px -14px;
}

.category-results-grid.page-in-next { animation: pageInNext 0.5s var(--ease) both; }
.category-results-grid.page-in-prev { animation: pageInPrev 0.5s var(--ease) both; }
.category-results-grid.page-out-next { animation: pageOutNext 0.26s ease-in both; pointer-events: none; }
.category-results-grid.page-out-prev { animation: pageOutPrev 0.26s ease-in both; pointer-events: none; }

/* the grid itself slides, so the cards must not replay their own entrance */
.category-results-grid.page-in-next .category-card,
.category-results-grid.page-in-prev .category-card { animation: none; }

@keyframes pageInNext  { from { opacity: 0; transform: translateX(70px); }  to { opacity: 1; transform: none; } }
@keyframes pageInPrev  { from { opacity: 0; transform: translateX(-70px); } to { opacity: 1; transform: none; } }
@keyframes pageOutNext { to { opacity: 0; transform: translateX(-70px); } }
@keyframes pageOutPrev { to { opacity: 0; transform: translateX(70px); } }

.category-pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    margin-top: 22px;
    animation: fadeUp 0.6s var(--ease) both;
}

.category-page-btn {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid var(--line);
    background: var(--surface);
    color: inherit;
    font-size: 0.9rem;
    cursor: pointer;
    transition: transform 0.25s var(--ease), background 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease, opacity 0.25s ease;
}

.category-page-btn:hover:not(:disabled) {
    transform: scale(1.12);
    border-color: rgba(127, 180, 255, 0.6);
    background: linear-gradient(135deg, #7fb4ff, #b784ff);
    color: #0b0d17;
    box-shadow: 0 10px 26px rgba(127, 140, 255, 0.35);
}

.category-page-btn:active:not(:disabled) { transform: scale(0.94); }

.category-page-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.category-dots {
    display: flex;
    align-items: center;
    gap: 8px;
}

.category-dot {
    width: 9px;
    height: 9px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: rgba(160, 170, 200, 0.4);
    cursor: pointer;
    transition: width 0.35s var(--ease), background 0.35s ease;
}

.category-dot.active {
    width: 28px;
    background: linear-gradient(90deg, #7fb4ff, #b784ff);
}

.category-page-count {
    font-size: 0.85rem;
    opacity: 0.65;
    min-width: 44px;
    text-align: center;
}

@media (prefers-reduced-motion: reduce) {
    .category-results-grid.page-in-next,
    .category-results-grid.page-in-prev,
    .category-results-grid.page-out-next,
    .category-results-grid.page-out-prev { animation-duration: 0.01s; }
}

@keyframes cardIn {
    from { opacity: 0; transform: translateY(26px) scale(0.96); }
    to   { opacity: 1; transform: none; }
}

.category-card:hover {
    transform: translateY(-8px);
    border-color: rgba(127, 180, 255, 0.55);
    box-shadow: 0 22px 46px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(127, 180, 255, 0.2);
}

.category-poster-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 2 / 3;
    overflow: hidden;
}

.category-poster {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: var(--surface-solid);
    transition: transform 0.8s var(--ease);
}

.category-card:hover .category-poster {
    transform: scale(1.08);
}

.category-poster-wrap::after {
    content: "";
    position: absolute;
    inset: auto 0 0 0;
    height: 45%;
    pointer-events: none;
    background: linear-gradient(transparent, rgba(7, 8, 13, 0.75));
}

.category-poster-empty {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 34px;
    background: var(--surface-solid);
}

.category-type-badge {
    position: absolute;
    z-index: 2;
    top: 8px;
    left: 8px;
    padding: 4px 9px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: #fff;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(6px);
    border: 1px solid rgba(255, 255, 255, 0.16);
}

.category-card-info {
    padding: 11px 11px 12px;
}

.category-card-info h3 {
    font-size: 13px;
    font-weight: 700;
    line-height: 1.3;
    min-height: 34px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: var(--text);
}

.category-card-meta {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 6px;
    font-size: 11px;
    color: var(--muted);
}

.category-card-meta span + span::before {
    content: "•";
    margin-right: 5px;
}

.category-select-btn {
    width: 100%;
    margin-top: 10px;
    padding: 9px 4px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 700;
    color: #0b0d1f;
    background: var(--grad);
    transition: transform 0.25s var(--ease), filter 0.25s ease;
}

.category-select-btn:hover {
    transform: translateY(-1px);
    filter: brightness(1.1);
}

.category-loading {
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 13px;
    color: var(--muted);
}

.category-spinner,
.search-spinner,
.status-spinner,
.mini-spinner {
    border-radius: 50%;
    border: 3px solid var(--line-strong);
    border-top-color: var(--amber);
    animation: spin 0.75s linear infinite;
}

.category-spinner {
    width: 22px;
    height: 22px;
}

.search-spinner {
    width: 17px;
    height: 17px;
    border-color: rgba(26, 15, 8, 0.25);
    border-top-color: #0b0d1f;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.category-empty {
    padding: 36px 16px;
    text-align: center;
    color: var(--muted);
    font-size: 15px;
}

.category-empty p {
    margin: 6px 0;
    font-size: 13px;
}

.category-retry-btn {
    margin-top: 12px;
    padding: 9px 18px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 13px;
    color: #0b0d1f;
    background: var(--grad);
}

.search-loading {
    display: inline-flex;
    align-items: center;
    gap: 9px;
}

/* ---------------------------------------------------------
   SEARCH RESULTS (list) — built by script.js
   (layout/poster sizing is owned by script.js)
--------------------------------------------------------- */

.app .search-result-card {
    padding: 14px;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--line);
    transition: transform 0.35s var(--ease), border-color 0.3s ease, box-shadow 0.3s ease;
    animation: cardIn 0.6s var(--ease) both;
}

.app .search-result-card:hover {
    transform: translateY(-3px);
    border-color: rgba(127, 180, 255, 0.5);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.3);
}

.app .result-poster {
    background: var(--surface-solid);
}

.app .result-info h3 {
    margin-bottom: 8px;
    font-size: 17px;
    font-weight: 700;
    line-height: 1.3;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.result-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 12px;
    color: var(--muted);
}

.result-meta span {
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--surface-2);
}

.select-title-btn {
    position: relative;
    overflow: hidden;
    margin-top: 12px;
    padding: 9px 18px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
    color: #0b0d1f;
    background: var(--grad);
    box-shadow: 0 6px 18px var(--glow);
    transition: transform 0.3s var(--ease), box-shadow 0.3s ease;
}

.select-title-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 26px var(--glow);
}

/* ---------------------------------------------------------
   SINHALA STATUS / SOURCES
--------------------------------------------------------- */

.app .sinhala-status {
    margin-top: 12px;
}

.app .sinhala-checking {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0;
    border: 0;
    background: none;
    font-size: 12px;
    color: var(--muted);
    animation: blink 1.4s ease-in-out infinite;
}

@keyframes blink {
    50% { opacity: 0.45; }
}

.app .sinhala-not-found,
.app .sinhala-first-not-found {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--amber);
    background: rgba(127, 180, 255, 0.08);
    border: 1px solid rgba(127, 180, 255, 0.22);
}

.app .sinhala-first-not-found {
    margin: 16px 0 22px;
    animation: fadeUp 0.5s var(--ease);
}

.app .sinhala-available,
.app .sinhala-first-card {
    padding: 16px 18px;
    border-radius: var(--radius);
    background: linear-gradient(135deg, rgba(54, 224, 200, 0.12), rgba(74, 168, 255, 0.1));
    border: 1px solid rgba(54, 224, 200, 0.35);
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.22);
    animation: fadeUp 0.5s var(--ease);
}

.app .sinhala-first-card {
    margin: 16px 0 24px;
}

.app .sinhala-available strong,
.app .sinhala-first-header strong {
    color: var(--teal);
}

html[data-theme="light"] .app .sinhala-available strong,
html[data-theme="light"] .app .sinhala-first-header strong {
    color: #0b8f7d;
}

.app .sinhala-first-header small {
    color: var(--muted);
}

.app .sinhala-first-icon {
    background: rgba(54, 224, 200, 0.14);
    border: 1px solid rgba(54, 224, 200, 0.3);
}

.app .sinhala-source-link,
.app .sinhala-first-source {
    border-radius: 999px;
    color: var(--text);
    background: var(--surface-2);
    border: 1px solid var(--line-strong);
    transition: transform 0.3s var(--ease), background 0.3s ease, border-color 0.3s ease;
}

.app .sinhala-source-link:hover,
.app .sinhala-first-source:hover {
    transform: translateY(-2px);
    background: rgba(54, 224, 200, 0.18);
    border-color: var(--teal);
    box-shadow: 0 8px 22px rgba(54, 224, 200, 0.16);
}

.app .english-subtitle-heading {
    margin: 8px 0 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--line);
    color: var(--text);
}

/* English subtitle result rows */

.app .subtitle-result-card {
    padding: 15px 16px;
    border-radius: var(--radius-sm);
    background: var(--surface);
    border: 1px solid var(--line);
    animation: cardIn 0.5s var(--ease) both;
}

.app .subtitle-result-card:nth-child(2) { animation-delay: 0.04s; }
.app .subtitle-result-card:nth-child(3) { animation-delay: 0.08s; }
.app .subtitle-result-card:nth-child(4) { animation-delay: 0.12s; }
.app .subtitle-result-card:nth-child(5) { animation-delay: 0.16s; }
.app .subtitle-result-card:nth-child(n+6) { animation-delay: 0.2s; }

.app .subtitle-result-card:hover {
    transform: translateX(4px);
    border-color: rgba(127, 180, 255, 0.5);
}

.app .subtitle-result-info strong {
    color: var(--text);
}

.app .subtitle-meta,
.app .subtitle-type {
    color: var(--muted);
}

.app .subtitle-select-btn {
    border-radius: 999px;
    padding: 9px 18px;
    color: #0b0d1f;
    background: var(--grad);
}

.app .subtitle-empty {
    background: var(--surface);
    color: var(--muted);
}

.app .subtitle-loading {
    padding: 34px 20px;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--line);
    color: var(--muted);
}

.app .subtitle-loading strong {
    color: var(--text);
}

.status-spinner {
    width: 34px;
    height: 34px;
    margin: 0 auto 14px;
}

.mini-spinner {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-width: 2px;
}

/* ---------------------------------------------------------
   TRANSLATION STATUS / PROGRESS (shared by JS UIs)
--------------------------------------------------------- */

.app .translation-status {
    padding: 34px 24px !important;
    text-align: center;
    border-radius: var(--radius-lg) !important;
    color: var(--text);
    background: linear-gradient(160deg, var(--surface-2), var(--surface)) !important;
    border: 1px solid var(--line-strong) !important;
    box-shadow: var(--shadow) !important;
    animation: fadeUp 0.5s var(--ease);
}

.app .translation-status h2,
.app .translation-status h3 {
    font-family: var(--font-display);
    color: var(--text);
}

.app .translation-status h2 {
    font-size: 24px;
}

.app .translation-status.success {
    border-color: rgba(54, 224, 200, 0.5) !important;
    box-shadow: 0 24px 70px rgba(54, 224, 200, 0.14) !important;
}

.app .translation-status.error {
    border-color: rgba(255, 92, 122, 0.5) !important;
}

.app .translation-icon,
.app .translation-complete-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 20px;
    font-size: 28px;
    background: rgba(127, 180, 255, 0.12);
    border: 1px solid rgba(127, 180, 255, 0.35);
    animation: translationPulse 2s ease-in-out infinite;
}

.app .translation-complete-icon {
    color: var(--teal);
    background: rgba(54, 224, 200, 0.12);
    border-color: rgba(54, 224, 200, 0.4);
    animation: popIn 0.7s var(--ease) both;
}

@keyframes popIn {
    from { transform: scale(0.3) rotate(-25deg); opacity: 0; }
    to   { transform: none; opacity: 1; }
}

@keyframes translationPulse {
    0%, 100% { transform: scale(1);    box-shadow: 0 0 0 rgba(127, 180, 255, 0); }
    50%      { transform: scale(1.05); box-shadow: 0 0 30px rgba(127, 180, 255, 0.25); }
}

.app .translation-subtitle {
    margin: 8px 0 22px;
    color: var(--muted);
    font-size: 14px;
}

.translation-progress-row {
    display: flex;
    align-items: center;
    gap: 14px;
}

.app .progress-track,
.progress-bar {
    position: relative;
    flex: 1;
    height: 10px;
    margin: 0;
    overflow: hidden;
    border-radius: 999px;
    background: var(--surface-2);
}

.app .progress-fill,
#progressFill {
    position: relative;
    width: 0%;
    height: 100%;
    border-radius: inherit;
    background: var(--grad);
    box-shadow: 0 0 18px var(--glow);
    transition: width 0.45s var(--ease);
    overflow: hidden;
}

/* moving stripes inside every progress fill */
.app .progress-fill::after,
#progressFill::after,
#uploadTranslateFill::after {
    content: "";
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(-45deg,
        rgba(255, 255, 255, 0.22) 0 10px, transparent 10px 20px);
    background-size: 28px 28px;
    animation: stripes 0.9s linear infinite;
}

@keyframes stripes {
    to { background-position: 28px 0; }
}

#uploadTranslateFill {
    position: relative;
    overflow: hidden;
}

.app .progress-percent {
    min-width: 46px;
    text-align: right;
    font-weight: 800;
    color: var(--amber);
}

.app .translation-count {
    margin-top: 16px;
    font-weight: 700;
    color: var(--text);
}

.app .translation-status-text,
.app .translation-file-name {
    margin-top: 8px;
    font-size: 12px;
    color: var(--muted);
    word-break: break-all;
}

/* episode selector */

.app .episode-selector {
    margin-top: 6px;
    padding: 24px;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--line);
    animation: fadeUp 0.5s var(--ease);
}

.episode-selector h2 {
    font-family: var(--font-display);
    font-size: 22px;
}

.episode-selector > p {
    color: var(--muted);
    font-size: 14px;
}

.episode-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-top: 16px;
}

.episode-fields label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    color: var(--muted);
}

#seasonInput,
#episodeInput {
    width: 100%;
    height: 50px;
    margin-top: 6px;
    padding: 0 14px;
    border-radius: 12px;
    outline: none;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--line);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

#seasonInput:focus,
#episodeInput:focus {
    border-color: var(--amber);
    box-shadow: 0 0 0 4px rgba(127, 180, 255, 0.14);
}

#findSubtitleBtn {
    width: 100%;
    min-height: 50px;
    margin-top: 16px;
    font-size: 15px;
}

/* ---------------------------------------------------------
   FEATURE CARDS
--------------------------------------------------------- */

.quick-actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-top: 26px;
}

.quick-action-card {
    position: relative;
    min-height: 210px;
    padding: 28px;
    overflow: hidden;
    border-radius: var(--radius-lg);
    background: var(--surface);
    border: 1px solid var(--line);
    transition: transform 0.45s var(--ease), border-color 0.3s ease, box-shadow 0.45s ease;
}

.quick-action-card::before {
    content: "";
    position: absolute;
    width: 240px;
    height: 240px;
    right: -80px;
    bottom: -110px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(143, 134, 255, 0.5), transparent 70%);
    transition: transform 0.7s var(--ease), opacity 0.4s ease;
    opacity: 0.6;
}

.quick-action-card:nth-child(2)::before {
    background: radial-gradient(circle, rgba(122, 75, 255, 0.55), transparent 70%);
}

.quick-action-card:hover {
    transform: translateY(-6px);
    border-color: var(--line-strong);
    box-shadow: var(--shadow);
}

.quick-action-card:hover::before {
    transform: scale(1.4);
    opacity: 1;
}

.quick-action-icon {
    position: relative;
    z-index: 2;
    width: 58px;
    height: 58px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 18px;
    font-size: 24px;
    color: var(--amber);
    background: rgba(127, 180, 255, 0.12);
    border: 1px solid rgba(127, 180, 255, 0.3);
    transition: transform 0.5s var(--ease);
}

.quick-action-card:nth-child(2) .quick-action-icon {
    color: var(--violet);
    background: rgba(179, 107, 255, 0.12);
    border-color: rgba(179, 107, 255, 0.35);
}

.quick-action-card:hover .quick-action-icon {
    transform: rotate(-8deg) scale(1.1);
}

.quick-action-card h3 {
    position: relative;
    z-index: 2;
    margin-top: 18px;
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 700;
}

.quick-action-card p {
    position: relative;
    z-index: 2;
    max-width: 260px;
    margin-top: 8px;
    font-size: 14px;
    color: var(--muted);
}

.quick-action-card .arrow {
    position: absolute;
    z-index: 2;
    right: 22px;
    bottom: 22px;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: var(--text);
    background: var(--surface-2);
    border: 1px solid var(--line-strong);
    transition: transform 0.4s var(--ease), background 0.3s ease, color 0.3s ease;
}

.quick-action-card:hover .arrow {
    transform: translateX(4px);
    color: #0b0d1f;
    background: var(--grad);
    border-color: transparent;
}

/* ---------------------------------------------------------
   HOW IT WORKS
--------------------------------------------------------- */

.steps {
    margin-top: 56px;
}

.section-head {
    text-align: center;
    max-width: 560px;
    margin: 0 auto 32px;
}

.section-eyebrow {
    display: inline-block;
    margin-bottom: 10px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--amber);
}

.section-head h2 {
    font-family: var(--font-display);
    font-size: clamp(26px, 4vw, 38px);
    line-height: 1.15;
    letter-spacing: -1px;
}

.steps-grid {
    position: relative;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.steps-grid::before {
    content: "";
    position: absolute;
    top: 50px;
    left: 12%;
    right: 12%;
    height: 2px;
    background: linear-gradient(90deg, var(--amber), var(--rose), var(--violet));
    opacity: 0.35;
}

.step-card {
    position: relative;
    padding: 24px 18px;
    text-align: center;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--line);
    transition: transform 0.4s var(--ease), border-color 0.3s ease;
}

.step-card:hover {
    transform: translateY(-6px);
    border-color: var(--line-strong);
}

.step-num {
    position: relative;
    z-index: 1;
    width: 52px;
    height: 52px;
    margin: 0 auto 14px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 17px;
    color: #0b0d1f;
    background: var(--grad);
    box-shadow: 0 8px 24px var(--glow);
}

.step-card h3 {
    font-family: var(--font-display);
    font-size: 16px;
    margin-bottom: 4px;
}

.step-card p {
    font-size: 13px;
    color: var(--muted);
}

/* ---------------------------------------------------------
   UPLOAD
--------------------------------------------------------- */

.upload-section {
    position: relative;
    margin-top: 26px;
    min-height: 240px;
    padding: 34px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    overflow: hidden;
    border-radius: var(--radius-lg);
    border: 2px dashed var(--line-strong);
    background: var(--surface);
    transition: border-color 0.35s ease, background 0.35s ease, transform 0.4s var(--ease);
}

.upload-section:hover,
.upload-section.drag-over {
    border-color: var(--amber);
    background: rgba(127, 180, 255, 0.06);
}

.upload-section.drag-over {
    transform: scale(1.015);
}

.upload-section::before {
    content: "";
    position: absolute;
    width: 320px;
    height: 320px;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: radial-gradient(circle, rgba(143, 134, 255, 0.18), transparent 65%);
    pointer-events: none;
}

.upload-icon {
    position: relative;
    z-index: 2;
    width: 72px;
    height: 72px;
    display: grid;
    place-items: center;
    border-radius: 24px;
    font-size: 30px;
    color: var(--amber);
    background: rgba(127, 180, 255, 0.12);
    border: 1px solid rgba(127, 180, 255, 0.32);
    animation: bob 3.2s ease-in-out infinite;
}

@keyframes bob {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-8px); }
}

.upload-section h3 {
    position: relative;
    z-index: 2;
    margin-top: 16px;
    font-family: var(--font-display);
    font-size: 20px;
}

.upload-section p {
    position: relative;
    z-index: 2;
    margin-top: 6px;
    font-size: 14px;
    color: var(--muted);
}

#subtitleFile {
    display: none;
}

#fileName {
    position: relative;
    z-index: 2;
    margin-top: 10px;
    font-size: 13px;
    font-weight: 600;
    color: var(--teal);
    word-break: break-all;
}

#fileName:not(:empty)::before {
    content: "✓ ";
}

.upload-section label.upload-btn,
.upload-btn {
    position: relative;
    z-index: 2;
    overflow: hidden;
    margin-top: 18px;
    min-width: 230px;
    min-height: 54px;
    padding: 0 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border-radius: 999px;
    font-weight: 700;
    color: #0b0d1f;
    background: var(--grad);
    box-shadow: 0 10px 30px var(--glow);
    cursor: pointer;
    transition: transform 0.3s var(--ease), box-shadow 0.3s ease;
}

.upload-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 16px 40px var(--glow);
}

/* ---------------------------------------------------------
   TRANSLATION SETTINGS + MAIN ACTIONS
--------------------------------------------------------- */

.movie-details,
#movieDetails {
    display: none !important;
}

.settings-section {
    margin-top: 26px;
    padding: 22px 24px;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--line);
}

.settings-section label {
    display: block;
    margin-bottom: 10px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    color: var(--muted);
}

#language {
    width: 100%;
    height: 52px;
    padding: 0 16px;
    border-radius: 14px;
    outline: none;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--line);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

#language:focus {
    border-color: var(--amber);
    box-shadow: 0 0 0 4px rgba(127, 180, 255, 0.14);
}

#language option {
    color: #111;
}

#translateBtn,
#downloadBtn {
    position: relative;
    overflow: hidden;
    width: 100%;
    min-height: 58px;
    margin-top: 18px;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border-radius: var(--radius);
    font-size: 16px;
    font-weight: 700;
    transition: transform 0.3s var(--ease), box-shadow 0.3s ease, opacity 0.3s ease;
}

#translateBtn {
    color: #0b0d1f;
    background: var(--grad);
    box-shadow: 0 12px 34px var(--glow);
}

#downloadBtn {
    color: #04231f;
    background: var(--grad-cool);
    box-shadow: 0 12px 34px rgba(54, 224, 200, 0.25);
}

#translateBtn:hover:not(:disabled),
#downloadBtn:hover:not(:disabled) {
    transform: translateY(-3px);
}

#translateBtn:not(:disabled) {
    animation: readyGlow 2.4s ease-in-out infinite;
}

@keyframes readyGlow {
    0%, 100% { box-shadow: 0 12px 34px var(--glow); }
    50%      { box-shadow: 0 12px 56px rgba(143, 134, 255, 0.6); }
}

#translateBtn:disabled,
#downloadBtn:disabled {
    opacity: 0.38;
    cursor: not-allowed;
    box-shadow: none;
    filter: grayscale(0.4);
}

#progressContainer {
    margin-top: 20px;
    padding: 20px;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--line);
}

#progressText {
    font-size: 13px;
    color: var(--muted);
}

#progressPercent {
    float: right;
    font-weight: 800;
    color: var(--amber);
}

.progress-bar {
    margin-top: 12px;
}

/* #preview is replaced by the subtitle editor — keep it neutral */
#preview {
    margin-top: 0;
}

#historySection,
.history-section {
    display: none !important;
}

.ad-container {
    margin-top: 24px;
    text-align: center;
}

/* ---------------------------------------------------------
   SUBTITLE EDITOR
   (script.js injects its own dark styles; these overrides
    keep it consistent with the theme)
--------------------------------------------------------- */

.app .sinsubz-editor {
    margin: 26px 0;
    padding: 22px;
    border-radius: var(--radius-lg);
    color: var(--text);
    background: var(--surface-solid);
    border: 1px solid var(--line-strong);
    box-shadow: var(--shadow);
    animation: fadeUp 0.6s var(--ease);
}

.app .sinsubz-editor .se-tab,
.app .sinsubz-editor .se-settings-button,
.app .sinsubz-editor .se-pagination button,
.app .sinsubz-editor #seApplySync {
    border-radius: 999px;
    color: var(--text-2);
    background: var(--surface);
    border: 1px solid var(--line);
    transition: transform 0.25s var(--ease), background 0.25s ease, border-color 0.25s ease;
}

.app .sinsubz-editor .se-tab:hover,
.app .sinsubz-editor .se-pagination button:hover:not(:disabled) {
    transform: translateY(-2px);
    border-color: var(--amber);
}

.app .sinsubz-editor .se-tab.active,
.app .sinsubz-editor #seApplySync {
    color: #0b0d1f;
    background: var(--grad);
    border-color: transparent;
    font-weight: 700;
}

.app .sinsubz-editor .se-settings,
.app .sinsubz-editor .se-sync,
.app .sinsubz-editor .se-subtitle-row {
    background: var(--surface);
    border: 1px solid var(--line);
}

.app .sinsubz-editor .se-subtitle-row {
    transition: border-color 0.25s ease;
}

.app .sinsubz-editor .se-subtitle-row:focus-within {
    border-color: var(--amber);
}

.app .sinsubz-editor .se-settings select,
.app .sinsubz-editor .se-sync input,
.app .sinsubz-editor .se-search-row input,
.app .sinsubz-editor .se-time-fields input,
.app .sinsubz-editor .se-subtitle-text {
    color: var(--text);
    background: var(--bg-soft);
    border: 1px solid var(--line);
    font-family: var(--font-body);
}

.app .sinsubz-editor .se-subtitle-text:focus,
.app .sinsubz-editor input:focus,
.app .sinsubz-editor select:focus {
    outline: none;
    border-color: var(--amber);
    box-shadow: 0 0 0 3px rgba(127, 180, 255, 0.14);
}

.app .sinsubz-editor .se-row-number {
    color: var(--amber);
}

.app .sinsubz-editor .se-settings label,
.app .sinsubz-editor .se-sync label,
.app .sinsubz-editor #sePageLabel,
.app .sinsubz-editor .se-help,
.app .sinsubz-editor .se-sync p,
.app .sinsubz-editor #seSubtitleCount {
    color: var(--muted);
}

.app .sinsubz-editor .se-raw-pane {
    color: var(--text-2);
    background: var(--bg-soft);
    border: 1px solid var(--line);
}

/* progress card created by script.js for uploaded SRT files */
#uploadTranslationProgress {
    border-radius: var(--radius) !important;
    color: var(--text) !important;
    background: var(--surface-solid) !important;
    border: 1px solid var(--line-strong) !important;
}

#uploadTranslationProgress #uploadTranslatePercent {
    color: var(--amber) !important;
}

#uploadTranslationProgress #uploadTranslateFill {
    background: var(--grad) !important;
}

#uploadTranslationProgress #uploadTranslateStatus {
    color: var(--muted) !important;
}

/* ---------------------------------------------------------
   SEO + FOOTER
--------------------------------------------------------- */

.seo-info {
    margin-top: 56px;
    padding: 30px;
    border-radius: var(--radius-lg);
    background: var(--surface);
    border: 1px solid var(--line);
}

.seo-info h2 {
    margin-bottom: 12px;
    font-family: var(--font-display);
    font-size: 22px;
}

.seo-info h3 {
    margin: 20px 0 6px;
    font-family: var(--font-display);
    font-size: 16px;
    color: var(--amber);
}

.seo-info p {
    font-size: 14px;
    line-height: 1.8;
    color: var(--muted);
}

footer {
    margin-top: 48px;
    padding: 28px 0 8px;
    text-align: center;
    font-size: 13px;
    color: var(--muted);
    border-top: 1px solid var(--line);
}

footer p + p {
    margin-top: 4px;
}

.legal-links {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px 22px;
    margin: 16px 0;
}

.legal-links a {
    position: relative;
    font-weight: 600;
    color: var(--text-2);
    transition: color 0.25s ease;
}

.legal-links a::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -3px;
    height: 2px;
    transform: scaleX(0);
    transform-origin: left;
    background: var(--grad);
    transition: transform 0.35s var(--ease);
}

.legal-links a:hover {
    color: var(--text);
}

.legal-links a:hover::after {
    transform: scaleX(1);
}

/* back-to-top */

.to-top {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 80;
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: #0b0d1f;
    background: var(--grad);
    box-shadow: 0 10px 28px var(--glow);
    opacity: 0;
    transform: translateY(20px) scale(0.8);
    pointer-events: none;
    transition: opacity 0.35s ease, transform 0.35s var(--ease);
}

.to-top.show {
    opacity: 1;
    transform: none;
    pointer-events: auto;
}

.to-top.show:hover {
    transform: translateY(-4px);
}

/* ---------------------------------------------------------
   LEGAL / INFO PAGES  (about, contact, privacy, terms)
--------------------------------------------------------- */

.legal-page {
    padding: 28px 16px 60px;
}

.legal-container,
.legal-page .container {
    width: 100%;
    max-width: 880px;
    margin: 0 auto;
}

.legal-header {
    text-align: center;
    padding: 20px 0 34px;
}

.back-home,
.legal-page nav a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 18px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-2);
    background: var(--surface);
    border: 1px solid var(--line);
    transition: transform 0.3s var(--ease), color 0.25s ease, border-color 0.25s ease;
}

.back-home:hover,
.legal-page nav a:hover {
    transform: translateX(-4px);
    color: var(--text);
    border-color: var(--amber);
}

.legal-page nav {
    margin-bottom: 24px;
}

.legal-logo {
    width: 84px;
    height: 84px;
    margin: 28px auto 18px;
    border-radius: 26px;
    overflow: hidden;
    border: 1px solid var(--line-strong);
    box-shadow: 0 0 50px var(--glow);
    animation: bob 4s ease-in-out infinite;
}

.legal-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.legal-header h1 {
    font-family: var(--font-display);
    font-size: clamp(32px, 6vw, 48px);
    letter-spacing: -1.5px;
    background: var(--grad);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.legal-header p {
    margin-top: 6px;
    color: var(--muted);
}

.legal-content,
.legal-page .card {
    padding: clamp(22px, 4vw, 40px);
    border-radius: var(--radius-lg);
    background: color-mix(in srgb, var(--surface-solid) 85%, transparent);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    animation: fadeUp 0.7s var(--ease);
}

.legal-page .card h1 {
    font-family: var(--font-display);
    font-size: clamp(28px, 5vw, 40px);
    letter-spacing: -1px;
    line-height: 1.2;
}

.legal-content h2,
.legal-page .card h2 {
    margin: 32px 0 10px;
    font-family: var(--font-display);
    font-size: 20px;
    color: var(--amber);
}

.legal-content h2:first-child {
    margin-top: 0;
}

.legal-content p,
.legal-content li,
.legal-page .card p,
.legal-page .card li {
    font-size: 15px;
    line-height: 1.85;
    color: var(--text-2);
}

.legal-page .card ul {
    padding-left: 22px;
}

.legal-page .card a,
.legal-content p a {
    color: var(--amber);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.legal-page .updated {
    margin: 6px 0 18px;
    font-size: 13px;
    color: var(--muted);
}

.legal-footer,
.legal-page .container > footer {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px 14px;
    margin-top: 32px;
    padding-top: 22px;
    font-size: 13px;
    color: var(--muted);
}

.legal-footer a:hover {
    color: var(--amber);
}

.about-steps {
    display: grid;
    gap: 14px;
    margin: 18px 0 8px;
}

.about-step {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 18px 20px;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--line);
    transition: transform 0.35s var(--ease), border-color 0.3s ease;
}

.about-step:hover {
    transform: translateX(6px);
    border-color: var(--amber);
}

.about-step > strong {
    flex: 0 0 52px;
    height: 52px;
    display: grid;
    place-items: center;
    border-radius: 16px;
    font-family: var(--font-display);
    font-size: 17px;
    color: #0b0d1f;
    background: var(--grad);
}

.about-step h3 {
    font-family: var(--font-display);
    font-size: 16px;
}

.about-step p {
    margin: 0;
    font-size: 14px;
}

.contact-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    margin-top: 22px;
}

.contact-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--line);
    transition: transform 0.4s var(--ease), border-color 0.3s ease, box-shadow 0.4s ease;
}

.contact-card:hover {
    transform: translateY(-6px);
    border-color: var(--amber);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.3);
}

.contact-icon {
    flex: 0 0 52px;
    height: 52px;
    display: grid;
    place-items: center;
    border-radius: 16px;
    font-size: 22px;
    color: var(--amber);
    background: rgba(127, 180, 255, 0.12);
    border: 1px solid rgba(127, 180, 255, 0.3);
}

.contact-card h3 {
    font-family: var(--font-display);
    font-size: 16px;
}

.contact-card p {
    margin: 2px 0 0;
    font-size: 13px;
    word-break: break-all;
    color: var(--muted);
}

/* ---------------------------------------------------------
   RESPONSIVE
--------------------------------------------------------- */

@media (max-width: 960px) {
    .hero-content {
        grid-template-columns: 1fr;
        padding-bottom: 130px;
    }

    .hero-stage {
        justify-self: start;
        width: min(100%, 420px);
        transform: none;
        animation: none;
    }

    .steps-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .steps-grid::before {
        display: none;
    }
}

@media (max-width: 720px) {
    .header-nav {
        display: none;
    }
}

@media (max-width: 640px) {
    .app {
        padding: 0 14px 50px;
    }

    .hero {
        min-height: 0;
    }

    .top-header {
        padding: 0 14px;
    }

    .brand-subtitle {
        display: none;
    }

    .theme-toggle {
        width: 78px;
    }

    .theme-toggle::before {
        transform: translateX(36px);
    }

    html[data-theme="light"] .theme-toggle::before {
        transform: translateX(0);
    }

    .hero-content {
        padding: 36px 14px 120px;
        gap: 32px;
    }

    .hero h1 {
        letter-spacing: -1.2px;
    }

    .hero-content p {
        font-size: 16px;
    }

    .hero-actions {
        grid-template-columns: 1fr;
        max-width: none;
    }

    .search-section {
        margin-top: -80px;
    }

    .search-card {
        padding: 16px;
        border-radius: 24px;
    }

    .search-row {
        grid-template-columns: 1fr;
    }

    .search-input-wrap input {
        height: 58px;
    }

    #searchBtn {
        width: 100%;
        height: 56px;
    }

    .category-results-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .quick-actions {
        grid-template-columns: 1fr;
    }

    .quick-action-card {
        min-height: 0;
        padding: 22px;
    }

    .quick-action-card p {
        max-width: 78%;
    }

    .steps-grid {
        grid-template-columns: 1fr;
    }

    .app .sinsubz-editor {
        padding: 14px;
    }

    .to-top {
        right: 14px;
        bottom: 14px;
    }

    .about-step {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ---------------------------------------------------------
   PERFORMANCE — phones / touch screens
   Heavy GPU effects are what make scrolling stutter on mobile,
   so they are switched off here. Desktop keeps the full look.
--------------------------------------------------------- */

@media (max-width: 960px), (hover: none) {

    /* live blur of whatever is behind an element */
    *,
    *::before,
    *::after {
        -webkit-backdrop-filter: none !important;
        backdrop-filter: none !important;
    }

    /* header was glass; make it (almost) solid instead */
    .top-header.scrolled {
        background: color-mix(in srgb, var(--bg) 94%, transparent);
    }

    /* full-screen film grain with mix-blend-mode */
    body::after {
        display: none;
    }

    /* endless decorative animations that repaint every frame */
    .ambient {
        animation: none;
        will-change: auto;
    }

    .hero-banner img,
    .hero::before,
    .hero-star::before,
    .search-card::before,
    .upload-icon,
    #translateBtn:not(:disabled),
    .legal-logo {
        animation: none;
        will-change: auto;
    }

    .hero h1 span {
        animation: none;
        background-size: 100% 100%;
    }
}

/* skip painting sections that are far off-screen */
.steps,
.settings-section,
.seo-info,
footer {
    content-visibility: auto;
    contain-intrinsic-size: auto 560px;
}

/* ---------------------------------------------------------
   REDUCED MOTION
--------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    .reveal {
        opacity: 1;
        transform: none;
    }
}


/* =========================================================
   SYNC SUBTITLES (hero button + sync section)
========================================================= */

.btn-sync {
    position: relative;
    color: #fff;
    background: linear-gradient(135deg, rgba(54, 224, 200, 0.22), rgba(143, 134, 255, 0.28));
    border: 1px solid rgba(54, 224, 200, 0.55);
    backdrop-filter: blur(10px);
    box-shadow: 0 0 0 0 rgba(54, 224, 200, 0.45);
    animation: syncPulse 2.6s ease-out infinite;
}

.btn-sync i {
    color: var(--teal);
    animation: syncSpin 3.2s linear infinite;
}

.btn-sync:hover {
    background: linear-gradient(135deg, rgba(54, 224, 200, 0.34), rgba(143, 134, 255, 0.4));
}

.btn-sync:hover i {
    animation-duration: 0.9s;
}

.btn-sync .sync-ring {
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, 0.28) 50%, transparent 70%);
    transform: translateX(-130%);
    animation: syncSweep 3.4s var(--ease) infinite;
    pointer-events: none;
}

.btn-sync.is-clicked i {
    animation: syncSpin 0.6s linear 2;
}

@keyframes syncSpin {
    to { transform: rotate(360deg); }
}

@keyframes syncPulse {
    0%   { box-shadow: 0 0 0 0 rgba(54, 224, 200, 0.45); }
    70%  { box-shadow: 0 0 0 16px rgba(54, 224, 200, 0); }
    100% { box-shadow: 0 0 0 0 rgba(54, 224, 200, 0); }
}

@keyframes syncSweep {
    0%, 55% { transform: translateX(-130%); }
    100%    { transform: translateX(130%); }
}

/* section */

.sync-section {
    position: relative;
    margin-top: 26px;
    padding: 34px 22px 30px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--line-strong);
    background: var(--surface);
    scroll-margin-top: calc(var(--header-h) + 16px);
    transition: box-shadow 0.5s ease, border-color 0.5s ease;
}

.sync-section.arrive {
    animation: syncArrive 1.6s ease-out 1;
}

@keyframes syncArrive {
    0%   { box-shadow: 0 0 0 0 rgba(54, 224, 200, 0.55); border-color: var(--teal); }
    60%  { box-shadow: 0 0 0 22px rgba(54, 224, 200, 0); border-color: var(--teal); }
    100% { box-shadow: 0 0 0 0 rgba(54, 224, 200, 0); }
}

.sync-lead {
    margin-top: 8px;
    font-size: 14px;
    color: var(--muted);
}

.sync-steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
    margin-top: 26px;
}

.sync-card {
    position: relative;
    padding: 20px;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: var(--surface-2);
    transition: opacity 0.4s ease, transform 0.4s var(--ease), border-color 0.4s ease;
}

.sync-card.is-locked {
    opacity: 0.45;
    pointer-events: none;
}

.sync-card.is-done {
    border-color: rgba(54, 224, 200, 0.55);
}

.sync-card-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.sync-card-head h3 {
    font-family: var(--font-display);
    font-size: 16px;
    color: var(--text);
}

.sync-num {
    flex: none;
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    font-weight: 800;
    font-size: 14px;
    color: #0b0d1f;
    background: var(--grad);
}

.sync-card.is-done .sync-num {
    background: var(--grad-cool);
}

.sync-pick {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    min-height: 48px;
    padding: 0 18px;
    border-radius: 999px;
    border: 1px dashed var(--line-strong);
    font-weight: 700;
    font-size: 14px;
    color: var(--text);
    cursor: pointer;
    transition: border-color 0.3s ease, background 0.3s ease, transform 0.3s var(--ease);
}

.sync-pick:hover {
    border-color: var(--teal);
    background: rgba(54, 224, 200, 0.08);
    transform: translateY(-2px);
}

.sync-info {
    margin-top: 14px;
    font-size: 13px;
    line-height: 1.7;
    color: var(--text-2);
    word-break: break-word;
}

.sync-info strong {
    color: var(--text);
}

.sync-info .ok {
    color: var(--teal);
    font-weight: 700;
}

.sync-info .bad {
    color: #ff8a8a;
    font-weight: 700;
}

.sync-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.sync-tags span {
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    color: var(--text);
    background: rgba(143, 134, 255, 0.18);
    border: 1px solid rgba(143, 134, 255, 0.4);
}

.sync-empty {
    font-size: 13px;
    color: var(--muted);
}

.sync-go {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    max-width: 360px;
    min-height: 54px;
    margin: 24px auto 0;
    border: 0;
    border-radius: 999px;
    font-family: inherit;
    font-weight: 800;
    font-size: 15px;
    color: #0b0d1f;
    background: var(--grad-cool);
    box-shadow: 0 10px 30px rgba(54, 224, 200, 0.3);
    cursor: pointer;
    transition: transform 0.3s var(--ease), opacity 0.3s ease;
}

.sync-go:hover:not(:disabled) {
    transform: translateY(-3px);
}

.sync-go:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.sync-note {
    margin-top: 12px;
    text-align: center;
    font-size: 13px;
    color: var(--muted);
}

@media (prefers-reduced-motion: reduce) {
    .btn-sync,
    .btn-sync i,
    .btn-sync .sync-ring,
    .sync-section.arrive {
        animation: none;
    }
}


/* ---------- Sync: candidates, result ---------- */

.sync-spin {
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-right: 8px;
    vertical-align: -2px;
    border-radius: 50%;
    border: 2px solid var(--line-strong);
    border-top-color: var(--teal);
    animation: syncSpin 0.8s linear infinite;
}

.sync-select {
    width: 100%;
    margin-bottom: 12px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid var(--line-strong);
    font-family: inherit;
    font-size: 13px;
    color: var(--text);
    background: var(--surface-solid);
}

.sync-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 340px;
    overflow-y: auto;
}

.sync-cand {
    display: block;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: var(--surface);
    cursor: pointer;
    transition: border-color 0.25s ease, background 0.25s ease;
}

.sync-cand:hover {
    border-color: var(--line-strong);
}

.sync-cand.is-selected {
    border-color: var(--teal);
    background: rgba(54, 224, 200, 0.08);
}

.sync-cand input {
    display: none;
}

.sync-cand-name {
    font-size: 12.5px;
    line-height: 1.5;
    color: var(--text);
    word-break: break-all;
}

.sync-cand-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}

.sync-cand-meta span {
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-2);
    background: rgba(255, 255, 255, 0.07);
}

.sync-cand-meta .hit {
    color: #0b0d1f;
    background: var(--teal);
}

.sync-cand-meta .best {
    color: #0b0d1f;
    background: var(--grad);
}

.sync-result {
    margin-top: 28px;
    padding: 22px;
    border-radius: var(--radius);
    border: 1px solid rgba(54, 224, 200, 0.45);
    background: var(--surface-2);
}

.sync-result[hidden] {
    display: none;
}

.sync-result h3 {
    font-family: var(--font-display);
    font-size: 18px;
    color: var(--text);
}

.sync-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    margin-top: 14px;
}

.sync-stat {
    padding: 12px;
    border-radius: 12px;
    background: var(--surface);
    border: 1px solid var(--line);
}

.sync-stat small {
    display: block;
    font-size: 11px;
    color: var(--muted);
}

.sync-stat b {
    display: block;
    margin-top: 4px;
    font-size: 15px;
    color: var(--text);
}

.sync-stat.good b { color: var(--teal); }
.sync-stat.mid b  { color: #ffd166; }
.sync-stat.low b  { color: #ff8a8a; }

.sync-warn {
    margin-top: 12px;
    font-size: 13px;
    line-height: 1.7;
    color: #ffd166;
}

.sync-tune {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 16px;
    font-size: 13px;
    color: var(--text-2);
}

.sync-tune button {
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid var(--line-strong);
    font-family: inherit;
    font-weight: 700;
    font-size: 12px;
    color: var(--text);
    background: var(--surface);
    cursor: pointer;
}

.sync-tune button:hover {
    border-color: var(--teal);
}

.sync-tune strong {
    margin-left: 6px;
    color: var(--teal);
}

.sync-preview {
    margin-top: 16px;
    display: grid;
    gap: 8px;
}

.sync-prev-row {
    padding: 10px 12px;
    border-radius: 12px;
    background: var(--surface);
    border: 1px solid var(--line);
    font-size: 12.5px;
    line-height: 1.6;
    color: var(--text-2);
}

.sync-prev-row .t-old {
    color: var(--muted);
    text-decoration: line-through;
}

.sync-prev-row .t-new {
    color: var(--teal);
    font-weight: 700;
}

.sync-prev-row .txt {
    margin-top: 2px;
    color: var(--text);
    white-space: pre-line;
}

.sync-privacy {
    margin-top: 12px;
    padding: 10px 12px;
    border-radius: 12px;
    font-size: 12.5px;
    line-height: 1.6;
    color: var(--text-2);
    background: rgba(54, 224, 200, 0.07);
    border: 1px solid rgba(54, 224, 200, 0.28);
}

.sync-privacy i {
    margin-right: 6px;
    color: var(--teal);
}

.sync-titlebar {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.sync-titlebar[hidden] {
    display: none;
}

.sync-titlebar .sync-select {
    flex: 1;
    margin-bottom: 0;
}

.sync-titlebar button {
    flex: none;
    padding: 0 16px;
    border: 0;
    border-radius: 12px;
    font-family: inherit;
    font-weight: 700;
    font-size: 13px;
    color: #0b0d1f;
    background: var(--grad-cool);
    cursor: pointer;
}

/* ---------- IMDb rating label (filled in by applyImdbRatings in script.js) ---------- */
.imdb-slot {
    display: none;
}

.imdb-slot.has-rating {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 7px 2px 3px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
    line-height: 1;
    color: #fff;
    background: rgba(0, 0, 0, 0.66);
    backdrop-filter: blur(6px);
    border: 1px solid rgba(255, 255, 255, 0.16);
}

.imdb-slot b {
    padding: 2px 4px;
    border-radius: 4px;
    font-size: 8.5px;
    font-weight: 900;
    letter-spacing: 0.2px;
    color: #000;
    background: #f5c518;
}

.imdb-slot em {
    font-style: normal;
}

/* on category posters: top-right corner (the Movie / TV badge is top-left) */
.category-poster-wrap .imdb-slot.has-rating {
    position: absolute;
    z-index: 2;
    top: 8px;
    right: 8px;
}

/* in the search result row: a normal pill next to the year (undo the generic meta-pill look) */
.result-meta .imdb-slot.has-rating {
    padding: 2px 8px 2px 3px;
    background: rgba(0, 0, 0, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #fff;
}


/* ---------------------------------------------------------
   SEARCH SUGGESTIONS dropdown
--------------------------------------------------------- */

.suggest-box {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    right: 0;
    z-index: 60;
    padding: 8px;
    max-height: 420px;
    overflow-y: auto;
    border-radius: var(--radius);
    background: rgba(18, 20, 34, 0.96);
    border: 1px solid rgba(127, 180, 255, 0.35);
    box-shadow: 0 26px 60px rgba(0, 0, 0, 0.55), 0 0 0 4px rgba(127, 180, 255, 0.08);
    backdrop-filter: blur(18px);
    transform-origin: top center;
    animation: suggestIn 0.28s var(--ease) both;
}

.suggest-box[hidden] { display: none; }

html[data-theme="light"] .suggest-box {
    background: rgba(255, 255, 255, 0.97);
    box-shadow: 0 22px 50px rgba(30, 40, 80, 0.2);
}

@keyframes suggestIn {
    from { opacity: 0; transform: translateY(-8px) scaleY(0.96); }
    to   { opacity: 1; transform: none; }
}

.suggest-item,
.suggest-skeleton {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 8px 10px;
    border-radius: 14px;
}

.suggest-item {
    cursor: pointer;
    animation: suggestRow 0.35s var(--ease) both;
    transition: background 0.2s ease, transform 0.25s var(--ease);
}

@keyframes suggestRow {
    from { opacity: 0; transform: translateX(-10px); }
    to   { opacity: 1; transform: none; }
}

.suggest-item.active {
    background: rgba(127, 180, 255, 0.16);
    transform: translateX(4px);
}

.suggest-thumb {
    flex: 0 0 auto;
    width: 40px;
    height: 58px;
    border-radius: 8px;
    object-fit: cover;
    background: rgba(255, 255, 255, 0.07);
}

.suggest-thumb-empty {
    display: grid;
    place-items: center;
    font-size: 18px;
}

.suggest-text {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.suggest-text strong {
    font-size: 15px;
    font-weight: 600;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.suggest-text small {
    font-size: 12.5px;
    opacity: 0.6;
}

.suggest-arrow {
    position: static !important;
    font-size: 13px !important;
    opacity: 0;
    transition: opacity 0.2s ease;
    transform: none !important;
}

.suggest-item.active .suggest-arrow { opacity: 0.7; }

.suggest-empty {
    padding: 18px 14px;
    font-size: 14px;
    opacity: 0.65;
    text-align: center;
}

.suggest-skeleton .suggest-lines {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.suggest-skeleton .suggest-lines i {
    display: block;
    height: 10px;
    width: 70%;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.08);
}

.suggest-skeleton .suggest-lines i + i { width: 40%; }

.suggest-skeleton .suggest-thumb,
.suggest-skeleton .suggest-lines i {
    background: linear-gradient(90deg, rgba(255,255,255,0.05) 25%, rgba(255,255,255,0.13) 50%, rgba(255,255,255,0.05) 75%);
    background-size: 200% 100%;
    animation: suggestShimmer 1.2s linear infinite;
}

@keyframes suggestShimmer {
    from { background-position: 200% 0; }
    to   { background-position: -200% 0; }
}

@media (max-width: 640px) {
    .suggest-box { max-height: 340px; }
    .suggest-thumb { width: 36px; height: 52px; }
}

@media (prefers-reduced-motion: reduce) {
    .suggest-box, .suggest-item { animation: none; }
}
