/* Glacier (docs/Design.md): vidro azul-gelo sobre navy. Profundidade por blur/opacidade, não por sombra. */
:root {
    --primary: #7dd3fc;
    --primary-strong: #bae6fd;
    --tertiary: #c8a0f0;
    --background: #0a0e1a;
    --on-surface: #e8f1fb;
    --on-surface-variant: #9fb3c8;
    --danger: #f87171;
    --ok: #4ade80;
    --warn: #fbbf24;
    --glass: rgba(15, 21, 36, 0.6);
    --glass-2: rgba(15, 21, 36, 0.75);
    --line: rgba(125, 211, 252, 0.12);
    --line-soft: rgba(255, 255, 255, 0.07);
    --radius: 12px;
    --gutter: clamp(1rem, 4vw, 2rem);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    min-height: 100vh;
    color: var(--on-surface);
    font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
    line-height: 1.5;
    background:
        radial-gradient(900px 520px at 8% -8%, rgba(125, 211, 252, 0.11), transparent 62%),
        radial-gradient(760px 520px at 100% 0%, rgba(200, 160, 240, 0.09), transparent 60%),
        var(--background);
    background-attachment: fixed;
}
a { color: var(--primary); text-underline-offset: 3px; }
a:hover { color: var(--primary-strong); }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 6px; }
::selection { background: rgba(125, 211, 252, 0.3); }
h1, h2, h3 { font-weight: 600; letter-spacing: 0.01em; line-height: 1.25; }
h1 { margin: 0 0 0.25rem; font-size: 1.7rem; }
h2 { margin: 0 0 0.75rem; font-size: 1.1rem; }
h3 { margin: 0 0 0.5rem; font-size: 1rem; }
p { margin: 0 0 0.75rem; }
code, pre, .mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
code { background: rgba(125, 211, 252, 0.1); padding: 0.05rem 0.35rem; border-radius: 4px; font-size: 0.85em; }

/* ---- estrutura ---- */
.skip-link { position: absolute; left: -999px; top: 0.5rem; background: var(--background); padding: 0.5rem 1rem; border-radius: 8px; z-index: 100; }
.skip-link:focus { left: 0.5rem; }
.site-header {
    position: sticky; top: 0; z-index: 20;
    display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap;
    padding: 0.8rem var(--gutter);
    background: rgba(10, 14, 26, 0.72);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: 0.6rem; color: var(--on-surface); text-decoration: none; font-weight: 700; letter-spacing: 0.02em; }
.brand:hover { color: var(--on-surface); }
.brand-mark { width: 26px; height: 26px; }
.site-nav { display: flex; gap: 0.25rem; }
.site-nav a { padding: 0.4rem 0.9rem; border-radius: 8px; text-decoration: none; color: var(--on-surface-variant); font-weight: 600; font-size: 0.92rem; }
.site-nav a:hover { color: var(--primary); background: rgba(125, 211, 252, 0.07); }
.site-nav a[aria-current="page"] { color: var(--primary); background: rgba(125, 211, 252, 0.13); box-shadow: inset 0 0 0 1px rgba(125, 211, 252, 0.25); }
.site-header-end { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.auth-lock-btn {
    display: inline-flex; align-items: center; gap: 0.4rem;
    padding: 0.4rem 0.7rem; border-radius: 8px;
    border: 1px solid var(--line-soft); background: transparent; color: var(--on-surface-variant);
    font-size: 0.85rem; font-weight: 600; text-decoration: none; cursor: pointer;
}
.auth-lock-btn:hover { color: var(--primary); border-color: rgba(125, 211, 252, 0.35); background: rgba(125, 211, 252, 0.06); }
.auth-lock-btn svg { width: 16px; height: 16px; }
.auth-gate { display: flex; gap: 2rem; align-items: flex-start; flex-wrap: wrap; }
.auth-gate-art { color: var(--primary); width: 190px; text-align: center; }
.auth-gate-art svg { width: 84px; height: 84px; opacity: 0.85; }
main { padding: 1.75rem var(--gutter) 3rem; max-width: 90vw; margin: 0 auto; }
.site-footer { text-align: center; padding: 1.5rem var(--gutter) 2.5rem; color: var(--on-surface-variant); font-size: 0.8rem; }
main > * + * { margin-top: 1.5rem; }

.page-head { margin-bottom: 0; }
.page-head .lead { color: var(--on-surface-variant); margin: 0.25rem 0 0; max-width: 62ch; }
.crumbs { display: inline-block; margin-bottom: 0.4rem; font-size: 0.85rem; text-decoration: none; color: var(--on-surface-variant); }
.crumbs:hover { color: var(--primary); }
.head-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; }
.export-area { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }

/* ---- vidro ---- */
.glass {
    background: var(--glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.4rem;
    box-shadow: 0 0 30px rgba(125, 211, 252, 0.04);
}
.glass-elevated { background: var(--glass-2); backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px); }
.glass.tight { padding: 1rem 1.15rem; }
.card-title { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; margin-bottom: 0.75rem; }
.card-title h2 { margin: 0; }

/* ---- layout util ---- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 1.25rem; }
.row { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.stack > * + * { margin-top: 1rem; }
.field { display: flex; flex-direction: column; gap: 0.3rem; min-width: 0; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; align-items: end; }
.grow { flex: 1 1 220px; min-width: 0; }
.hint { color: var(--on-surface-variant); font-size: 0.8rem; }
.muted { color: var(--on-surface-variant); font-size: 0.85rem; }
.empty-state { color: var(--on-surface-variant); font-style: italic; }
.table-wrap { overflow-x: auto; }
[hidden] { display: none !important; }

/* ---- botões ---- */
button, .btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
    background: rgba(125, 211, 252, 0.12);
    border: 1px solid rgba(125, 211, 252, 0.35);
    color: var(--primary);
    padding: 0.5rem 1.05rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600; font-family: inherit; font-size: 0.9rem; line-height: 1.3;
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}
button:hover, .btn:hover { background: rgba(125, 211, 252, 0.24); color: var(--primary-strong); }
button.primary, .btn.primary { background: rgba(125, 211, 252, 0.28); border-color: rgba(125, 211, 252, 0.7); color: #e6f6ff; }
button.primary:hover, .btn.primary:hover { background: rgba(125, 211, 252, 0.4); box-shadow: 0 0 16px rgba(125, 211, 252, 0.25); }
button.ghost, .btn.ghost { background: transparent; border-color: var(--line-soft); color: var(--on-surface-variant); }
button.ghost:hover, .btn.ghost:hover { color: var(--on-surface); border-color: rgba(125, 211, 252, 0.35); background: rgba(125, 211, 252, 0.06); }
button.sm, .btn.sm { padding: 0.25rem 0.7rem; font-size: 0.8rem; }
button:disabled { opacity: 0.4; cursor: not-allowed; box-shadow: none; }
button.danger { color: var(--danger); border-color: rgba(248, 113, 113, 0.4); background: rgba(248, 113, 113, 0.08); }
button.danger:hover { background: rgba(248, 113, 113, 0.2); color: #fecaca; }
button.htmx-request, form.htmx-request button[type=submit] { opacity: 0.6; pointer-events: none; }
details.collapse > summary { cursor: pointer; padding: 0.4rem 0; margin-bottom: 0.6rem; color: var(--on-surface-variant); font-weight: 600; }
details.collapse > summary:hover { color: var(--primary); }
details > summary { list-style: none; }
details > summary::-webkit-details-marker { display: none; }
summary.btn::before { content: "+"; font-weight: 700; }
details[open] > summary.btn::before { content: "–"; }

/* ---- formulários ---- */
label { font-size: 0.85rem; color: var(--on-surface-variant); font-weight: 500; }
input[type=text], input[type=number], input[type=search], input[type=file], select, textarea {
    background: rgba(10, 14, 26, 0.6);
    border: 1px solid rgba(125, 211, 252, 0.2);
    color: var(--on-surface);
    padding: 0.5rem 0.8rem;
    border-radius: 8px;
    font-family: inherit; font-size: 0.9rem; max-width: 100%;
}
input[type=checkbox] { accent-color: var(--primary); width: 1rem; height: 1rem; }
input[type=range] { accent-color: var(--primary); width: 100%; margin: 0.35rem 0 0; cursor: pointer; }
.slider-head { display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem; }
.slider-head output { color: var(--primary-strong); font-weight: 600; font-variant-numeric: tabular-nums; }
.slider-scale { display: flex; justify-content: space-between; color: var(--on-surface-variant); font-size: 0.75rem; font-variant-numeric: tabular-nums; }
select option { background: #0f1524; color: var(--on-surface); }
input::placeholder, textarea::placeholder { color: rgba(159, 179, 200, 0.55); }
input[type=file]::file-selector-button {
    background: rgba(125, 211, 252, 0.15); border: 1px solid rgba(125, 211, 252, 0.4); color: var(--primary);
    border-radius: 6px; padding: 0.3rem 0.8rem; margin-right: 0.75rem; font-family: inherit; font-weight: 600; cursor: pointer;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 12px rgba(125, 211, 252, 0.25); }
input:user-invalid, textarea:user-invalid { border-color: rgba(248, 113, 113, 0.6); }

/* zona de soltar arquivo: o input continua sendo o de sempre, só ganha uma área grande e legível */
.dropzone {
    position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.25rem;
    padding: 1.6rem 1rem; text-align: center; cursor: pointer;
    border: 1.5px dashed rgba(125, 211, 252, 0.35); border-radius: var(--radius);
    background: rgba(10, 14, 26, 0.4); transition: border-color 0.15s, background 0.15s;
}
.dropzone:hover, .dropzone.is-over { border-color: var(--primary); background: rgba(125, 211, 252, 0.07); }
.dropzone.has-file { border-style: solid; border-color: rgba(74, 222, 128, 0.5); background: rgba(74, 222, 128, 0.05); }
.dropzone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.dropzone .dz-title { font-weight: 600; color: var(--on-surface); font-size: 0.95rem; }
.dropzone .dz-sub { color: var(--on-surface-variant); font-size: 0.8rem; }
.dropzone.compact { padding: 0.7rem 1rem; flex-direction: row; gap: 0.6rem; justify-content: flex-start; text-align: left; }

/* ---- feedback ---- */
.error { color: var(--danger); font-size: 0.9rem; margin: 0.5rem 0 0; }
.success { color: var(--ok); font-size: 0.95rem; }
.warn-text { color: var(--warn); font-size: 0.9rem; }
pre {
    background: rgba(10, 14, 26, 0.8);
    border: 1px solid rgba(125, 211, 252, 0.15);
    border-radius: 8px; padding: 1rem; overflow: auto; font-size: 0.82rem; max-height: 480px; margin: 0;
}
pre.err { white-space: pre-wrap; color: var(--danger); max-height: 220px; margin-top: 0.75rem; }
.callout { display: flex; gap: 0.7rem; align-items: flex-start; border-radius: 10px; padding: 0.75rem 1rem; border: 1px solid rgba(125, 211, 252, 0.25); background: rgba(125, 211, 252, 0.07); font-size: 0.9rem; }
.callout > .ico { font-size: 1.1rem; line-height: 1.4; }
.callout p { margin: 0; }
.callout.warn { border-color: rgba(251, 191, 36, 0.4); background: rgba(251, 191, 36, 0.08); }
.callout.ok { border-color: rgba(74, 222, 128, 0.4); background: rgba(74, 222, 128, 0.07); }
.callout.danger { border-color: rgba(248, 113, 113, 0.45); background: rgba(248, 113, 113, 0.08); }
.callout.best { border-color: rgba(200, 160, 240, 0.45); background: rgba(200, 160, 240, 0.1); color: var(--tertiary); font-weight: 600; }
.banner { border-radius: 10px; padding: 0.8rem 1rem; margin-bottom: 1rem; background: rgba(125, 211, 252, 0.08); border: 1px solid rgba(125, 211, 252, 0.25); }
.banner.best { background: rgba(200, 160, 240, 0.1); border-color: rgba(200, 160, 240, 0.4); color: var(--tertiary); font-weight: 600; }
.banner.warn { background: rgba(251, 191, 36, 0.08); border-color: rgba(251, 191, 36, 0.4); }
.banner-top { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; }
.banner small { color: var(--on-surface-variant); font-weight: 400; }

.htmx-indicator { display: none; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { display: inline-flex; align-items: center; gap: 0.5rem; color: var(--on-surface-variant); }
.busy-indicator { display: none; color: var(--on-surface-variant); font-size: 0.88rem; }
form.is-busy .busy-indicator { display: inline-flex; align-items: center; gap: 0.5rem; }
.spinner { display: inline-block; vertical-align: -0.15em; width: 1em; height: 1em; border-radius: 50%; border: 2px solid rgba(125, 211, 252, 0.25); border-top-color: var(--primary); animation: spin 0.8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }

.toast-region { position: fixed; right: 1rem; bottom: 1rem; z-index: 50; display: flex; flex-direction: column; gap: 0.5rem; max-width: min(92vw, 380px); }
.toast { padding: 0.7rem 1rem; border-radius: 10px; font-size: 0.9rem; background: rgba(15, 21, 36, 0.92); backdrop-filter: blur(24px); border: 1px solid rgba(125, 211, 252, 0.35); animation: toast-in 0.2s ease-out; }
.toast.ok { border-color: rgba(74, 222, 128, 0.5); }
.toast.warn { border-color: rgba(251, 191, 36, 0.5); }
.toast.error { border-color: rgba(248, 113, 113, 0.55); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---- listas, chips ---- */
ul.list-plain { list-style: none; padding: 0; margin: 0; }
ul.list-plain li { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 0.6rem 0; border-bottom: 1px solid var(--line-soft); }
ul.list-plain li:last-child { border-bottom: none; }
.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chip { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.25rem 0.35rem 0.25rem 0.8rem; border-radius: 999px; font-size: 0.85rem; background: rgba(125, 211, 252, 0.09); border: 1px solid rgba(125, 211, 252, 0.2); }
.chip button { all: unset; cursor: pointer; width: 1.35rem; height: 1.35rem; line-height: 1.3rem; text-align: center; border-radius: 50%; color: var(--on-surface-variant); font-size: 1rem; }
.chip button:hover { background: rgba(248, 113, 113, 0.2); color: var(--danger); }
.chip button:focus-visible { outline: 2px solid var(--primary); }
.meta { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.6rem; }
.meta span { padding: 0.15rem 0.7rem; border-radius: 999px; font-size: 0.78rem; color: var(--on-surface-variant); border: 1px solid var(--line-soft); background: rgba(255, 255, 255, 0.03); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0.75rem; }
.stat { padding: 0.8rem 1rem; border-radius: 10px; border: 1px solid var(--line); background: rgba(10, 14, 26, 0.45); }
.stat b { display: block; font-size: 1.5rem; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat span { color: var(--on-surface-variant); font-size: 0.78rem; }
.stat.accent b { color: var(--primary); }
.stat.warn b { color: var(--warn); }
.stat.tertiary b { color: var(--tertiary); }

/* ---- passos (home) ---- */
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; counter-reset: step; list-style: none; padding: 0; margin: 0; }
.steps li { position: relative; padding: 1rem 1rem 1rem 3.2rem; border-radius: var(--radius); border: 1px solid var(--line); background: rgba(10, 14, 26, 0.4); }
.steps li::before { counter-increment: step; content: counter(step); position: absolute; left: 1rem; top: 1rem; width: 1.6rem; height: 1.6rem; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 0.85rem; color: var(--background); background: var(--primary); }
.steps li:nth-child(2)::before { background: var(--tertiary); }
.steps li:nth-child(3)::before { background: var(--ok); }
.steps a { font-weight: 600; text-decoration: none; }
.steps p { margin: 0.25rem 0 0; font-size: 0.85rem; color: var(--on-surface-variant); }

/* ---- cartões de tema ---- */
.theme-card { display: flex; flex-direction: column; gap: 0.5rem; text-align: center; padding: 0.9rem; text-decoration: none; color: inherit; transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s; }
a.theme-card:hover { transform: translateY(-3px); border-color: rgba(125, 211, 252, 0.4); box-shadow: 0 0 30px rgba(125, 211, 252, 0.12); color: inherit; }
.theme-card img, .theme-card .poster-placeholder {
    width: 100%; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 8px;
    background: linear-gradient(160deg, rgba(125, 211, 252, 0.12), rgba(200, 160, 240, 0.12));
    display: flex; align-items: center; justify-content: center; padding: 0.75rem;
    color: var(--on-surface-variant); font-weight: 600; text-align: center;
}
.theme-card .counts { display: flex; justify-content: center; gap: 0.4rem; flex-wrap: wrap; }
.pill { display: inline-block; padding: 0.05rem 0.55rem; border-radius: 999px; font-size: 0.75rem; border: 1px solid var(--line-soft); color: var(--on-surface-variant); }
.pill.warn { color: var(--warn); border-color: rgba(251, 191, 36, 0.4); }
.pill.ok { color: var(--ok); border-color: rgba(74, 222, 128, 0.35); }

/* ---- abas só com CSS (radios escondidos): trocar de aba não recarrega nem perde o que foi digitado ---- */
.tabs > input.tab-radio { position: absolute; opacity: 0; pointer-events: none; }
.tab-bar { display: flex; gap: 0.5rem; margin-bottom: 1rem; flex-wrap: wrap; }
.tab-bar label { cursor: pointer; padding: 0.45rem 1.1rem; border-radius: 8px; font-weight: 600; font-size: 0.9rem; color: var(--on-surface-variant); border: 1px solid rgba(125, 211, 252, 0.2); }
.tab-bar label:hover { color: var(--primary); }
.tab-bar .count { opacity: 0.7; font-weight: 500; margin-left: 0.25rem; }
.tab-panel { display: none; }
#tab-names:checked ~ .panel-names, #tab-quotes:checked ~ .panel-quotes,
#tab-lib:checked ~ .panel-lib, #tab-up:checked ~ .panel-up,
#src-file:checked ~ .panel-file, #src-lib:checked ~ .panel-libsrc { display: block; }
#tab-names:checked ~ .tab-bar label[for=tab-names], #tab-quotes:checked ~ .tab-bar label[for=tab-quotes],
#tab-lib:checked ~ .tab-bar label[for=tab-lib], #tab-up:checked ~ .tab-bar label[for=tab-up],
#src-file:checked ~ .tab-bar label[for=src-file], #src-lib:checked ~ .tab-bar label[for=src-lib] { color: var(--primary); border-color: rgba(125, 211, 252, 0.5); background: rgba(125, 211, 252, 0.12); }
.tabs > input.tab-radio:focus-visible ~ .tab-bar { outline: 2px solid var(--primary); outline-offset: 4px; border-radius: 8px; }

/* ---- tabelas ---- */
table.data { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
table.data th, table.data td { text-align: left; padding: 0.6rem 0.7rem; border-bottom: 1px solid var(--line-soft); }
table.data th { color: var(--on-surface-variant); font-weight: 600; font-size: 0.75rem; letter-spacing: 0.05em; text-transform: uppercase; white-space: nowrap; }
table.data th a { color: inherit; text-decoration: none; cursor: pointer; }
table.data th a:hover { color: var(--primary); }
table.data th.sorted a { color: var(--primary); }
table.data th.sorted a::after { content: " ↓"; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data tbody tr:hover td { background: rgba(125, 211, 252, 0.04); }
table.data tr.leader td { background: rgba(125, 211, 252, 0.08); }
table.data tr.leader td:first-child { box-shadow: inset 3px 0 0 var(--primary); }
.rank { display: inline-grid; place-items: center; min-width: 1.7rem; height: 1.7rem; border-radius: 50%; font-weight: 700; font-size: 0.85rem; }
.rank.r1 { background: rgba(251, 191, 36, 0.2); color: #fde68a; box-shadow: inset 0 0 0 1px rgba(251, 191, 36, 0.5); }
.rank.r2 { background: rgba(203, 213, 225, 0.16); color: #e2e8f0; box-shadow: inset 0 0 0 1px rgba(203, 213, 225, 0.4); }
.rank.r3 { background: rgba(251, 146, 60, 0.16); color: #fdba74; box-shadow: inset 0 0 0 1px rgba(251, 146, 60, 0.4); }
.score-cell { min-width: 9rem; }
.score-cell .bar { display: block; height: 4px; margin-top: 0.3rem; border-radius: 999px; background: rgba(255, 255, 255, 0.07); overflow: hidden; }
.score-cell .bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), var(--tertiary)); border-radius: 999px; }

/* ---- badges ---- */
.badge { display: inline-block; padding: 0.1rem 0.6rem; border-radius: 999px; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.04em; border: 1px solid transparent; vertical-align: middle; white-space: nowrap; }
.badge.OPEN { color: var(--on-surface-variant); border-color: rgba(159, 179, 200, 0.4); }
.badge.RUNNING { color: var(--primary); border-color: rgba(125, 211, 252, 0.5); background: rgba(125, 211, 252, 0.1); animation: pulse 1.8s ease-in-out infinite; }
.badge.FINISHED, .badge.DONE { color: var(--ok); border-color: rgba(74, 222, 128, 0.4); }
.badge.STOPPED, .badge.CANCELLED, .badge.PENDING { color: var(--on-surface-variant); border-color: rgba(159, 179, 200, 0.3); }
.badge.TIMEOUT { color: var(--warn); border-color: rgba(251, 191, 36, 0.5); background: rgba(251, 191, 36, 0.08); }
.badge.ERROR { color: var(--danger); border-color: rgba(248, 113, 113, 0.5); background: rgba(248, 113, 113, 0.08); }
@keyframes pulse { 50% { box-shadow: 0 0 12px rgba(125, 211, 252, 0.35); } }

/* ---- progresso ---- */
.progress { height: 6px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); overflow: hidden; margin-top: 0.6rem; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), var(--tertiary)); transition: width 0.4s; }

/* ---- confrontos ---- */
.filters { display: flex; gap: 0.4rem; flex-wrap: wrap; margin: 0.25rem 0 0.75rem; }
.filters a { padding: 0.2rem 0.75rem; border-radius: 999px; font-size: 0.8rem; font-weight: 600; text-decoration: none; cursor: pointer; color: var(--on-surface-variant); border: 1px solid var(--line-soft); }
.filters a:hover { color: var(--primary); border-color: rgba(125, 211, 252, 0.35); }
.filters a.on { color: var(--primary); border-color: rgba(125, 211, 252, 0.5); background: rgba(125, 211, 252, 0.12); }
.filters .n { opacity: 0.65; margin-left: 0.2rem; font-weight: 500; }
.match-row { display: grid; grid-template-columns: 6.5rem 1fr auto; gap: 0.75rem; align-items: center; padding: 0.55rem 0; border-bottom: 1px solid var(--line-soft); }
.match-row:last-child { border-bottom: none; }
.match-row .vs { color: var(--on-surface-variant); margin: 0 0.3rem; font-size: 0.85rem; }
.winner { color: var(--primary); font-weight: 700; }
.now-running { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.5rem; font-size: 0.88rem; color: var(--on-surface-variant); }

/* matriz de confrontos */
table.cross { border-collapse: separate; border-spacing: 3px; font-size: 0.78rem; font-variant-numeric: tabular-nums; }
table.cross th { font-weight: 600; color: var(--on-surface-variant); padding: 0.3rem 0.5rem; white-space: nowrap; max-width: 9rem; overflow: hidden; text-overflow: ellipsis; }
table.cross thead th { font-size: 0.72rem; }
table.cross tbody th { text-align: right; }
table.cross td { padding: 0; text-align: center; border-radius: 6px; min-width: 4.6rem; background: rgba(255, 255, 255, 0.03); }
table.cross td a { display: block; padding: 0.35rem 0.4rem; text-decoration: none; color: inherit; border-radius: 6px; }
table.cross td.win { background: rgba(74, 222, 128, 0.13); color: #bbf7d0; }
table.cross td.loss { background: rgba(248, 113, 113, 0.11); color: #fecaca; }
table.cross td.draw { background: rgba(159, 179, 200, 0.14); }
table.cross td.diag { background: transparent; }
table.cross td a:hover { box-shadow: inset 0 0 0 1px var(--primary); }
.legend { display: flex; gap: 1rem; flex-wrap: wrap; font-size: 0.78rem; color: var(--on-surface-variant); margin-top: 0.6rem; }
.legend i { display: inline-block; width: 0.7rem; height: 0.7rem; border-radius: 3px; margin-right: 0.35rem; vertical-align: -1px; }
.legend .w { background: rgba(74, 222, 128, 0.5); } .legend .l { background: rgba(248, 113, 113, 0.5); } .legend .d { background: rgba(159, 179, 200, 0.5); }
.winner-line { color: var(--primary); font-weight: 700; }
.versus { display: grid; grid-template-columns: 1fr auto 1fr; gap: 1rem; align-items: center; text-align: center; margin: 0.5rem 0 1.25rem; }
.versus .side b { display: block; font-size: 1.05rem; }
.versus .side .big { font-size: 2.2rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.versus .side .winner { display: block; font-size: 0.8rem; margin-top: 0.15rem; }
.versus .side.win .big, .versus .side.win b { color: var(--primary); }
.versus .mid { color: var(--on-surface-variant); font-weight: 700; }

/* ---- ofuscar ---- */
.opt-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; }
.opt { display: flex; gap: 0.7rem; align-items: flex-start; padding: 0.9rem 1rem; border-radius: 10px; border: 1px solid var(--line); background: rgba(10, 14, 26, 0.35); cursor: pointer; }
.opt:has(input:checked) { border-color: rgba(125, 211, 252, 0.5); background: rgba(125, 211, 252, 0.07); }
.opt input { margin-top: 0.2rem; }
.opt b { display: block; color: var(--on-surface); font-weight: 600; font-size: 0.92rem; }
.opt span { color: var(--on-surface-variant); font-size: 0.8rem; }
.code-block { border: 1px solid rgba(125, 211, 252, 0.15); border-radius: 10px; overflow: hidden; background: rgba(10, 14, 26, 0.8); }
.code-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; padding: 0.45rem 0.75rem; border-bottom: 1px solid var(--line-soft); font-size: 0.8rem; color: var(--on-surface-variant); }
.code-block pre { border: none; border-radius: 0; background: transparent; max-height: 460px; }

/* ---- comparação original × ofuscado, estilo GitLab (lado a lado / unificado) ---- */
#resultado:has(#compare-area .diff) .code-block { display: none; }
.diff { border: 1px solid rgba(125, 211, 252, 0.15); border-radius: 10px; overflow: hidden; background: rgba(10, 14, 26, 0.8); }
.diff-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; flex-wrap: wrap; padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--line-soft); font-size: 0.8rem; }
.diff-stats { display: flex; gap: 0.6rem; align-items: baseline; }
.diff-add { color: var(--ok); font-weight: 700; }
.diff-del { color: var(--danger); font-weight: 700; }
.diff-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; align-items: center; }
.seg { display: inline-flex; gap: 0.25rem; }
.diff-scroll { max-height: 640px; overflow: auto; }
.diff-table { width: 100%; border-collapse: collapse; table-layout: fixed; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 0.78rem; line-height: 1.5; }
.diff-table.split { min-width: 760px; }
.diff-table th { position: sticky; top: 0; z-index: 1; background: #0f1524; text-align: left; font-family: Inter, system-ui, sans-serif; font-size: 0.75rem; font-weight: 600; color: var(--on-surface-variant); padding: 0.3rem 0.6rem; border-bottom: 1px solid var(--line-soft); }
.diff-table col.ln { width: 3.4rem; }
.diff-table col.sign { width: 1.4rem; }
.diff-table td { padding: 0 0.5rem; vertical-align: top; }
.diff-table td.ln { text-align: right; color: rgba(159, 179, 200, 0.55); user-select: none; border-right: 1px solid var(--line-soft); font-variant-numeric: tabular-nums; }
.diff-table td.sign { color: var(--on-surface-variant); user-select: none; text-align: center; padding: 0; }
.diff-table td.code { white-space: pre-wrap; overflow-wrap: anywhere; }
.diff-table td.code::after { content: "\200b"; } /* linha vazia não pode colapsar a altura da linha da tabela */
.diff-table td.ln + td.code + td.ln { border-left: 1px solid var(--line-soft); }
.diff-table td.del, .diff-table tr.del td { background: rgba(248, 113, 113, 0.10); }
.diff-table td.add, .diff-table tr.add td { background: rgba(74, 222, 128, 0.10); }
.diff-table td.ln.del, .diff-table tr.del td.ln { background: rgba(248, 113, 113, 0.20); }
.diff-table td.ln.add, .diff-table tr.add td.ln { background: rgba(74, 222, 128, 0.20); }
.diff-table td.del.blank, .diff-table tr.del.blank td { background: rgba(248, 113, 113, 0.045); }
.diff-table td.add.blank, .diff-table tr.add.blank td { background: rgba(74, 222, 128, 0.045); }
.diff-table td.ln.del.blank, .diff-table tr.del.blank td.ln { background: rgba(248, 113, 113, 0.09); }
.diff-table td.ln.add.blank, .diff-table tr.add.blank td.ln { background: rgba(74, 222, 128, 0.09); }
.diff-table td.empty { background: repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.035) 0 6px, transparent 6px 12px); }
.diff-table .w { font-style: normal; border-radius: 3px; }
.diff-table td.del .w, .diff-table tr.del .w { background: rgba(248, 113, 113, 0.38); }
.diff-table td.add .w, .diff-table tr.add .w { background: rgba(74, 222, 128, 0.36); }
.diff-fold td { padding: 0.2rem 0.6rem; background: rgba(125, 211, 252, 0.06); border-top: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); }
.diff-unfold { display: inline; background: none; border: none; padding: 0; color: var(--primary); font: inherit; font-size: 0.75rem; cursor: pointer; }
.diff-unfold:hover { color: var(--primary-strong); background: none; text-decoration: underline; }
.verify-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0.75rem; margin-top: 0.75rem; }
.verify-table { margin-top: 0.75rem; }
#download-area .label-risky { display: none; }
#download-area[data-verdict=diff] .label-ok, #download-area[data-verdict=error] .label-ok { display: none; }
#download-area[data-verdict=diff] .label-risky, #download-area[data-verdict=error] .label-risky { display: inline; }
#download-area[data-verdict=diff] button, #download-area[data-verdict=error] button { color: var(--danger); border-color: rgba(248, 113, 113, 0.45); background: rgba(248, 113, 113, 0.08); }

/* ---- páginas vazias/erro ---- */
.empty-page { text-align: center; padding: 3rem 1.5rem; }
.empty-code { font-size: 4rem; font-weight: 700; line-height: 1; margin: 0 0 0.5rem; background: linear-gradient(90deg, var(--primary), var(--tertiary)); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---- responsivo ---- */
@media (max-width: 640px) {
    main { max-width: 100%; }
    .hide-sm { display: none; }
    h1 { font-size: 1.4rem; }
    .glass { padding: 1.1rem; }
    .match-row { grid-template-columns: 1fr auto; }
    .match-row > :first-child { grid-column: 1 / -1; }
    .versus { grid-template-columns: 1fr; }
    .versus .mid { display: none; }
    .site-header { padding-top: 0.6rem; padding-bottom: 0.6rem; }
    .site-nav { flex-wrap: wrap; }
    .site-nav a { padding: 0.35rem 0.6rem; }
    .toast-region { left: 1rem; right: 1rem; max-width: none; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
@media print {
    body { background: #fff; color: #000; }
    .site-header, .site-footer, .toast-region, button { display: none !important; }
    .glass { background: none; border-color: #ccc; box-shadow: none; backdrop-filter: none; }
}

/* ---- biblioteca de robôs ---- */
#import-area:empty { display: none; }
.picker { max-height: 260px; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0.4rem; padding: 0.6rem; border: 1px solid var(--line); border-radius: 10px; background: rgba(10, 14, 26, 0.35); }
.pick { display: flex; gap: 0.6rem; align-items: flex-start; padding: 0.4rem 0.6rem; border-radius: 8px; cursor: pointer; font-size: 0.88rem; color: var(--on-surface); }
.pick:hover { background: rgba(125, 211, 252, 0.07); }
.pick:has(input:checked) { background: rgba(125, 211, 252, 0.12); box-shadow: inset 0 0 0 1px rgba(125, 211, 252, 0.3); }
.pick:has(input:disabled) { opacity: 0.6; cursor: default; }
/* ---- log ao vivo do campeonato ---- */
.log-box { max-height: 320px; overflow-y: auto; padding: 0.6rem 0.8rem; border: 1px solid var(--line); border-radius: 10px; background: rgba(10, 14, 26, 0.55); }
.log-lines { list-style: none; margin: 0; padding: 0; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 0.8rem; line-height: 1.55; }
.log-line { display: flex; gap: 0.75rem; }
.log-line time { flex: none; color: rgba(159, 179, 200, 0.6); }
.log-line span { min-width: 0; overflow-wrap: anywhere; color: var(--on-surface); }
.log-line.ok span { color: var(--ok); }
.log-line.warn span { color: var(--warn); }
.log-line.error span { color: var(--danger); }
.log-empty { color: var(--on-surface-variant); font-style: italic; }
.picker-head { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.picker-bar { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.picker-bar input[type=search] { flex: 1 1 220px; max-width: 320px; }
.picker-bar .pill { margin-left: auto; }
.pick input { margin-top: 0.2rem; }
.pick .muted { display: block; font-size: 0.75rem; }
table.review td { vertical-align: top; }
table.review input[type=text] { width: 100%; min-width: 9rem; }
.name-cell { display: flex; gap: 0.4rem; align-items: center; flex-wrap: wrap; }
.name-cell input { flex: 1 1 9rem; }
.name-status { display: block; min-height: 1.1rem; margin-top: 0.2rem; }
ul.report .hint { margin-top: 0.15rem; }
.bulk-bar { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; padding-top: 0.5rem; border-top: 1px solid var(--line-soft); }
.filters-bar { align-items: center; }
.meta span span { border: none; background: none; padding: 0; }
table.review input[name=package] { min-width: 12rem; }
table.review .name-cell .btn, table.review .name-cell button { white-space: normal; text-align: left; }
