/* nCore Stremio addons – shared UI
   Palette: deep pine ground, cream type, poppy for the one primary action per page. */
:root {
    --ground: #0e1f1c;
    --panel: #15302a;
    --panel-2: #1b3a33;
    --rule: #274a42;
    --rule-strong: #35635a;
    --ink: #f2ecdd;
    --ink-muted: #9bb5aa;
    --ink-faint: #6f8c81;
    --poppy: #e4473a;
    --poppy-deep: #c3352a;
    --amber: #e7b84c;
    --ok: #6fcf97;
    --display: 'Bricolage Grotesque', 'IBM Plex Sans', system-ui, sans-serif;
    --body: 'IBM Plex Sans', system-ui, -apple-system, sans-serif;
    --mono: 'JetBrains Mono', ui-monospace, Menlo, monospace;
    --radius: 10px;
    --radius-sm: 6px;
    --measure: 62ch;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { animation: none !important; transition: none !important; }
}
body {
    margin: 0;
    overflow-x: hidden;
    font-family: var(--body);
    font-size: 16px;
    line-height: 1.55;
    color: var(--ink);
    background: var(--ground);
    min-height: 100vh;
}
a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--rule-strong); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--amber); }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 3px; border-radius: 3px; }
h1, h2, h3 { font-family: var(--display); font-weight: 600; line-height: 1.1; letter-spacing: -0.01em; margin: 0; }
h1 { font-size: clamp(2.2rem, 5.5vw, 4rem); font-weight: 700; letter-spacing: -0.025em; }
h2 { font-size: clamp(1.4rem, 2.6vw, 1.9rem); }
h3 { font-size: 1.15rem; }
p { margin: 0; max-width: var(--measure); }
code { font-family: var(--mono); font-size: 0.85em; background: var(--panel-2); padding: 0.1em 0.4em; border-radius: 4px; }

/* ---------- frame ---------- */
.site { max-width: 1080px; margin: 0 auto; padding: 0 clamp(1rem, 4vw, 2.5rem) 4rem; }
.topbar {
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    padding: 1.1rem 0; border-bottom: 1px solid var(--rule); margin-bottom: clamp(2rem, 6vw, 4rem);
}
.wordmark { font-family: var(--display); font-weight: 700; font-size: 1.15rem; letter-spacing: -0.01em; text-decoration: none; display: inline-flex; align-items: center; gap: 0.55rem; white-space: nowrap; }
.wordmark i { width: 12px; height: 12px; border-radius: 2px; background: var(--poppy); display: inline-block; transform: rotate(12deg); }
.topnav { display: flex; gap: 1.4rem; font-size: 0.95rem; }
.topnav a { text-decoration: none; color: var(--ink-muted); }
.topnav a:hover, .topnav a[aria-current="page"] { color: var(--ink); }
@media (max-width: 560px) { .topnav { gap: 1rem; font-size: 0.9rem; } }

.masthead { display: grid; gap: 1.1rem; margin-bottom: clamp(2rem, 5vw, 3.5rem); }
.masthead p { font-size: 1.15rem; color: var(--ink-muted); max-width: 52ch; }
.lede { font-size: 1.05rem; color: var(--ink-muted); }

/* ---------- live poster strip (hub hero) ---------- */
.strip { position: relative; overflow: hidden; width: 100%; margin: 0 0 clamp(2.5rem, 6vw, 4rem); padding: 0.25rem 0; }
.strip::before, .strip::after { content: ""; position: absolute; top: 0; bottom: 0; width: 12%; z-index: 2; pointer-events: none; }
.strip::before { left: 0; background: linear-gradient(90deg, var(--ground), transparent); }
.strip::after { right: 0; background: linear-gradient(-90deg, var(--ground), transparent); }
.strip-track { display: flex; gap: 0.7rem; width: max-content; animation: strip-scroll 70s linear infinite; }
.strip:hover .strip-track { animation-play-state: paused; }
.strip img { height: 190px; aspect-ratio: 2 / 3; object-fit: cover; border-radius: var(--radius-sm); background: var(--panel); display: block; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35); }
.strip a { display: block; position: relative; flex: none; }
.strip a span { position: absolute; left: 0; right: 0; bottom: 0; padding: 1.4rem 0.5rem 0.4rem; font-size: 0.72rem; line-height: 1.2; color: var(--ink); background: linear-gradient(transparent, rgba(0,0,0,0.85)); border-radius: 0 0 var(--radius-sm) var(--radius-sm); opacity: 0; transition: opacity 0.2s; }
.strip a:hover span, .strip a:focus-visible span { opacity: 1; }
@keyframes strip-scroll { to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) { .strip-track { animation: none; flex-wrap: wrap; width: auto; } }
@media (max-width: 560px) { .strip img { height: 150px; } }
.strip-caption { font-size: 0.85rem; color: var(--ink-faint); margin-top: 0.6rem; padding: 0 clamp(1rem, 4vw, 2.5rem); }

/* ---------- addon rows (hub) ---------- */
.addons { display: grid; border-top: 1px solid var(--rule); }
.addon-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1rem 2rem; align-items: center; padding: 1.6rem 0; border-bottom: 1px solid var(--rule); }
.addon-row h2 { margin-bottom: 0.35rem; }
.addon-row h2 a { text-decoration: none; }
.addon-row h2 a:hover { color: var(--amber); }
.addon-row p { color: var(--ink-muted); max-width: 56ch; }
.addon-row .facts { display: flex; gap: 1.25rem; flex-wrap: wrap; margin-top: 0.6rem; font-size: 0.9rem; color: var(--ink-faint); }
.addon-row .facts b { color: var(--ink); font-weight: 500; }
.addon-row .actions { display: flex; gap: 0.6rem; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 680px) { .addon-row { grid-template-columns: 1fr; } .addon-row .actions { justify-content: flex-start; } }

/* ---------- buttons ---------- */
.btn {
    font: inherit; font-weight: 500; font-size: 0.95rem;
    display: inline-flex; align-items: center; gap: 0.5rem;
    padding: 0.7rem 1.15rem; border-radius: var(--radius-sm); border: 1px solid var(--rule-strong);
    background: var(--panel); color: var(--ink); cursor: pointer; text-decoration: none; white-space: nowrap;
    transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
.btn:hover { background: var(--panel-2); border-color: var(--ink-faint); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn-primary { background: var(--poppy); border-color: var(--poppy); color: #fff; }
.btn-primary:hover { background: var(--poppy-deep); border-color: var(--poppy-deep); }
.btn-quiet { background: transparent; border-color: transparent; color: var(--ink-muted); padding-inline: 0.6rem; }
.btn-quiet:hover { background: var(--panel); color: var(--ink); }
.btn-sm { padding: 0.4rem 0.7rem; font-size: 0.85rem; }
.btn.copied { border-color: var(--ok); color: var(--ok); }

/* ---------- status / footer ---------- */
.status { display: inline-flex; align-items: center; gap: 0.5rem; font-size: 0.9rem; color: var(--ink-muted); }
.status i { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px rgba(111, 207, 151, 0.18); }
.status.off i { background: var(--poppy); box-shadow: 0 0 0 3px rgba(228, 71, 58, 0.18); }
.site-footer { margin-top: 4rem; padding-top: 1.5rem; border-top: 1px solid var(--rule); font-size: 0.85rem; color: var(--ink-faint); display: grid; gap: 0.5rem; }
.site-footer a { color: var(--ink-muted); }

/* ---------- panels, url box, steps ---------- */
.panel { background: var(--panel); border: 1px solid var(--rule); border-radius: var(--radius); padding: 1.4rem; }
.panel + .panel { margin-top: 1rem; }
.panel h2 { margin-bottom: 0.5rem; }
.panel > p { color: var(--ink-muted); }
.url-box {
    font-family: var(--mono); font-size: 0.82rem; line-height: 1.5; word-break: break-all;
    background: var(--ground); border: 1px solid var(--rule); border-radius: var(--radius-sm);
    padding: 0.75rem 0.9rem; color: var(--ink-muted); margin-top: 0.9rem; user-select: all;
}
.btn-row { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-top: 1.1rem; }
.steps { margin: 1.25rem 0 0; padding: 0; list-style: none; counter-reset: step; display: grid; gap: 0.7rem; color: var(--ink-muted); }
.steps li { display: grid; grid-template-columns: 1.7rem 1fr; gap: 0.6rem; align-items: baseline; }
.steps li::before { counter-increment: step; content: counter(step); font-family: var(--display); font-weight: 700; color: var(--amber); }
.note { font-size: 0.9rem; color: var(--ink-faint); margin-top: 0.8rem; }
.two-col { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 2rem; align-items: start; }
@media (max-width: 860px) { .two-col { grid-template-columns: 1fr; } .install-panel { order: -1; position: static; } }
.sticky { position: sticky; top: 1rem; }

/* ---------- forms ---------- */
.field { display: grid; gap: 0.4rem; margin-bottom: 1.1rem; }
.field label { font-weight: 500; }
.field .hint { font-size: 0.85rem; color: var(--ink-faint); }
.field input[type="text"], .field input[type="file"], .field select, .field textarea {
    font: inherit; color: var(--ink); background: var(--ground); border: 1px solid var(--rule-strong);
    border-radius: var(--radius-sm); padding: 0.65rem 0.8rem; width: 100%;
}
.field input:focus, .field select:focus { border-color: var(--amber); outline: none; }
.field input[type="file"] { padding: 0.5rem; }
.field-row { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.field-row input { flex: 1 1 160px; }
.field-row input.short { flex: 0 0 6.5rem; }
.message { margin-top: 1rem; padding: 0.9rem 1rem; border-radius: var(--radius-sm); border: 1px solid var(--rule-strong); background: var(--panel-2); }
.message.success { border-color: var(--ok); }
.message.error { border-color: var(--poppy); }

/* ---------- catalog picker ---------- */
.presets { display: flex; gap: 0.5rem; flex-wrap: wrap; margin: 1rem 0 1.25rem; }
.category-panel { border-top: 1px solid var(--rule); padding: 1rem 0 0.5rem; }
.category-panel.category-drag-over { background: var(--panel); }
.category-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; cursor: pointer; user-select: none; padding: 0.25rem 0; }
.category-header-left { display: flex; align-items: center; gap: 0.7rem; }
.category-icon { font-size: 1.1rem; line-height: 1; }
.category-title { font-family: var(--display); font-weight: 600; font-size: 1.15rem; }
.category-card-drag-handle { cursor: grab; color: var(--ink-faint); font-size: 0.9rem; padding: 0 0.3rem; }
.category-card-drag-handle.dragging { opacity: 0.4; }
.category-badge { font-size: 0.85rem; color: var(--ink-faint); }
.category-chevron { color: var(--ink-faint); font-size: 0.75rem; transition: transform 0.2s; }
.category-panel.open .category-chevron { transform: rotate(180deg); }
.category-body { display: none; padding: 0.4rem 0 0.6rem; }
.category-panel.open .category-body { display: block; }
.category-tools { display: flex; justify-content: flex-end; gap: 0.35rem; font-size: 0.8rem; color: var(--ink-faint); margin-bottom: 0.2rem; }
.category-tools button { font: inherit; background: none; border: none; color: var(--ink-muted); cursor: pointer; padding: 0.15rem 0.35rem; border-radius: 4px; }
.category-tools button:hover { color: var(--ink); background: var(--panel); }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; padding: 0.55rem 0.4rem; border-radius: var(--radius-sm); }
.toggle-row:hover { background: var(--panel); }
.toggle-row.dragging { opacity: 0.4; }
.toggle-row.drag-over { box-shadow: inset 0 2px 0 var(--amber); }
.toggle-left { display: flex; align-items: center; gap: 0.6rem; min-width: 0; }
.drag-handle { cursor: grab; color: var(--ink-faint); font-size: 0.85rem; }
.item-icon { font-size: 0.95rem; }
.toggle-right { display: inline-flex; align-items: center; gap: 0.6rem; }
.home-btn { font: inherit; font-size: 0.85rem; background: none; border: 1px solid var(--rule); border-radius: var(--radius-sm); padding: 0.15rem 0.45rem; cursor: pointer; color: var(--ink-faint); filter: grayscale(1); opacity: 0.6; }
.home-btn.on { filter: none; opacity: 1; border-color: var(--amber); background: rgba(231, 184, 76, 0.12); }
.home-btn:hover { opacity: 1; }
.toggle-switch { position: relative; display: inline-block; width: 40px; height: 22px; flex: none; }
.toggle-switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-slider { position: absolute; inset: 0; background: var(--rule-strong); border-radius: 22px; cursor: pointer; transition: background 0.2s; }
.toggle-slider::before { content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; border-radius: 50%; background: var(--ink); transition: transform 0.2s; }
.toggle-switch input:checked + .toggle-slider { background: var(--poppy); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(18px); }
.toggle-switch input:focus-visible + .toggle-slider { outline: 2px solid var(--amber); outline-offset: 2px; }
.section-separator { font-size: 0.85rem; color: var(--ink-faint); margin: 0.9rem 0 0.5rem 0.4rem; }
.provider-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }
@media (max-width: 560px) { .provider-grid { grid-template-columns: 1fr; } }
.provider-card { border: 1px solid var(--rule); border-radius: var(--radius-sm); padding: 0.7rem 0.8rem; }
.provider-card-header { display: flex; align-items: center; gap: 0.55rem; margin-bottom: 0.4rem; }
.provider-logo { width: 22px; height: 22px; border-radius: 4px; display: inline-flex; align-items: center; justify-content: center; font-size: 0.7rem; font-weight: 700; color: #fff; }
.provider-logo.netflix { background: #e50914; }
.provider-logo.disney { background: #113ccf; }
.provider-logo.hbomax { background: #7b3fe4; }
.provider-logo.prime { background: #00a8e1; }
.provider-name { font-weight: 500; font-size: 0.95rem; }
.provider-toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; padding: 0.3rem 0; font-size: 0.9rem; color: var(--ink-muted); }
.install-panel .count { font-family: var(--display); font-size: 1.6rem; font-weight: 600; line-height: 1.15; }
.install-panel .count small { display: block; font-family: var(--body); font-size: 0.9rem; font-weight: 400; color: var(--ink-muted); margin-top: 0.2rem; }
.install-panel .field { margin: 1.1rem 0 0; }
.install-panel .field input { font-family: var(--mono); font-size: 0.8rem; }
.legend { font-size: 0.85rem; color: var(--ink-faint); margin-top: 0.5rem; }
