/* ============================================================
   MARIO SORTER — Dark trippy Super Mario theme
   Night-world palette: deep space bg, drifting neon blobs,
   coin gold / pipe green / mario red / sky cyan accents.
   Mobile-first: single column on phones, cards for rows.
   ============================================================ */

:root {
    --bg: #07060f;
    --card: rgba(19, 17, 38, .86);
    --card-solid: #131126;
    --card-2: #1b1836;
    --card-3: #0d0b1c;
    --line: #2a2650;
    --line-hi: #4a428f;
    --text: #f3f1ff;
    --dim: #aaa6cc;
    --faint: #6f6a99;
    --red: #ff3b4e;
    --red-dark: #a3122a;
    --coin: #ffcc1a;
    --coin-dark: #b98600;
    --pipe: #2bd96b;
    --pipe-dark: #0d8a3c;
    --sky: #3fd0ff;
    --pink: #ff4fd8;
    --violet: #8a5cff;
    --ok: #4cf08a;
    --bad: #ff5a6e;
    --radius: 14px;
    --head-font: 'Press Start 2P', 'Courier New', monospace;
    --body-font: 'Space Grotesk', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 15px; -webkit-text-size-adjust: 100%; }

body {
    font-family: var(--body-font);
    color: var(--text);
    min-height: 100vh;
    background: var(--bg);
    overflow-x: hidden;
}

/* ---------- trippy background: drifting neon blobs + pixel grid ---------- */
.bg-trip {
    position: fixed; inset: -20%;
    z-index: 0; pointer-events: none;
    background:
        radial-gradient(28% 32% at 18% 22%, rgba(255, 79, 216, .22), transparent 70%),
        radial-gradient(30% 34% at 82% 18%, rgba(63, 208, 255, .18), transparent 70%),
        radial-gradient(26% 30% at 70% 78%, rgba(43, 217, 107, .16), transparent 70%),
        radial-gradient(24% 28% at 25% 80%, rgba(255, 204, 26, .13), transparent 70%),
        radial-gradient(30% 30% at 50% 50%, rgba(138, 92, 255, .14), transparent 70%);
    filter: blur(20px);
    animation: trip 28s ease-in-out infinite alternate, hue 40s linear infinite;
}
body::after {
    content: '';
    position: fixed; inset: 0; z-index: 0; pointer-events: none;
    background-image:
        linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px);
    background-size: 24px 24px;
    mask-image: linear-gradient(180deg, transparent, #000 30%, #000 70%, transparent);
}
@keyframes trip {
    0%   { transform: translate(0, 0) rotate(0deg) scale(1); }
    50%  { transform: translate(3%, -2%) rotate(8deg) scale(1.08); }
    100% { transform: translate(-3%, 2%) rotate(-6deg) scale(1); }
}
@keyframes hue { to { filter: blur(20px) hue-rotate(360deg); } }

::selection { background: var(--coin); color: #1a1400; }

/* ============================================================
   HEADER
   ============================================================ */
header {
    position: sticky; top: 0; z-index: 50;
    display: flex; align-items: center; gap: 14px;
    padding: 12px 18px;
    padding-top: max(12px, env(safe-area-inset-top));
    background: rgba(7, 6, 15, .78);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--line);
}
header::after {
    content: '';
    position: absolute; left: 0; right: 0; bottom: -1px; height: 2px;
    background: linear-gradient(90deg, var(--red), var(--coin), var(--pipe), var(--sky), var(--pink), var(--red));
    background-size: 200% 100%;
    animation: rainbow 6s linear infinite;
    opacity: .85;
}
@keyframes rainbow { to { background-position: 200% 0; } }

.logo {
    font-family: var(--head-font);
    font-size: 14px; line-height: 1.4;
    color: var(--coin);
    text-shadow: 0 0 12px rgba(255, 204, 26, .55);
    white-space: nowrap;
    display: flex; align-items: center; gap: 10px;
}
.logo .mario { color: var(--red); text-shadow: 0 0 12px rgba(255, 59, 78, .7); }
.coin-spin {
    display: inline-block; font-size: 20px;
    animation: bob 1.4s ease-in-out infinite;
    filter: drop-shadow(0 0 8px rgba(255, 79, 216, .8));
}
@keyframes bob { 50% { transform: translateY(-4px) rotate(-8deg); } }

header .sub {
    color: var(--faint); font-size: 13px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
header .status {
    margin-left: auto;
    font-family: var(--head-font); font-size: 8px;
    color: var(--ok); white-space: nowrap;
    text-shadow: 0 0 8px rgba(76, 240, 138, .6);
}
header .status .dot { animation: blink 1.2s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* ============================================================
   LAYOUT
   ============================================================ */
main {
    position: relative; z-index: 1;
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr) 310px;
    gap: 16px;
    padding: 16px;
    align-items: start;
    max-width: 1820px; margin: 0 auto;
}
.col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.col-right { position: sticky; top: 74px; }

@media (max-width: 1280px) {
    main { grid-template-columns: 300px minmax(0, 1fr); }
    .col-right { grid-column: 1 / -1; position: static; }
}
@media (max-width: 900px) {
    main { grid-template-columns: 1fr; padding: 12px; gap: 12px; }
    .col { gap: 12px; }
    header .sub { display: none; }
}

/* ============================================================
   PANELS
   ============================================================ */
.panel {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: 0 10px 30px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.04);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    overflow: hidden;
}
.panel-head {
    display: flex; align-items: center; gap: 9px;
    padding: 12px 14px 10px;
    font-family: var(--head-font);
    font-size: 9px; line-height: 1.5; letter-spacing: .5px;
    color: var(--text);
    text-transform: uppercase;
    border-bottom: 1px solid var(--line);
    background: linear-gradient(90deg, rgba(43,217,107,.12), transparent 70%);
}
.panel-head .icon { font-size: 15px; }
.panel-head .count {
    margin-left: auto;
    font-family: var(--body-font);
    font-size: 12px; font-weight: 600; letter-spacing: 0; text-transform: none;
    color: var(--coin);
}
.panel-body { padding: 14px; }

/* ============================================================
   BUTTONS — flat neon blocks with a 3D lip
   ============================================================ */
button {
    font-family: var(--body-font);
    font-size: 14px; font-weight: 600;
    background: var(--card-2);
    color: var(--text);
    border: 1px solid var(--line-hi);
    border-radius: 10px;
    padding: 8px 14px;
    min-height: 38px;
    cursor: pointer;
    box-shadow: inset 0 -3px 0 rgba(0,0,0,.35);
    transition: transform .06s, filter .12s, background .12s, border-color .12s;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
}
button:hover { filter: brightness(1.18); }
button:active { transform: translateY(2px); box-shadow: inset 0 -1px 0 rgba(0,0,0,.35); }
button:disabled { opacity: .4; cursor: not-allowed; }
button:focus-visible { outline: 2px solid var(--coin); outline-offset: 2px; }

button.primary { background: var(--coin); border-color: var(--coin); color: #2a1d00;
    box-shadow: inset 0 -3px 0 var(--coin-dark), 0 0 18px rgba(255,204,26,.25); }
button.danger  { background: var(--red); border-color: var(--red); color: #fff;
    box-shadow: inset 0 -3px 0 var(--red-dark); }
button.go      { background: var(--pipe); border-color: var(--pipe); color: #032611;
    box-shadow: inset 0 -3px 0 var(--pipe-dark); }
button.ghost   { background: transparent; border-color: transparent; box-shadow: none; color: var(--dim); }
button.ghost:hover { color: var(--coin); }
button.small   { font-size: 12px; padding: 4px 11px; min-height: 30px; }
.full-btn { width: 100%; margin-top: 10px; }

/* segmented control */
.seg {
    display: inline-flex; gap: 2px; padding: 3px;
    background: var(--card-3); border: 1px solid var(--line); border-radius: 11px;
}
.seg button {
    background: transparent; border: 0; box-shadow: none;
    color: var(--dim); min-height: 32px; padding: 5px 12px; border-radius: 8px;
}
.seg button.on { background: var(--card-2); color: var(--coin); box-shadow: inset 0 0 0 1px var(--line-hi); }
.seg.full { display: flex; }
.seg.full button { flex: 1; }
.small-seg { margin-left: auto; }
.small-seg button { font-size: 12px; min-height: 24px; padding: 3px 9px; }

/* ============================================================
   INPUTS
   ============================================================ */
input[type="text"], input[type="search"], select, textarea {
    font-family: var(--body-font);
    font-size: 15px;
    background: var(--card-3);
    border: 1px solid var(--line);
    border-radius: 10px;
    color: var(--text);
    padding: 9px 12px;
    width: 100%;
    outline: none;
    transition: border-color .12s, box-shadow .12s;
}
input:focus, select:focus, textarea:focus { border-color: var(--coin); box-shadow: 0 0 0 3px rgba(255,204,26,.15); }
input::placeholder, textarea::placeholder { color: var(--faint); }
input[type="search"]::-webkit-search-cancel-button { display: none; }
select option { background: var(--card-solid); }
textarea { min-height: 180px; resize: vertical; font-size: 14px; line-height: 1.5; }

label.field-label {
    display: block;
    font-family: var(--head-font);
    font-size: 8px; line-height: 1.6;
    color: var(--coin);
    margin-bottom: 8px;
}
code {
    font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: .9em;
    color: var(--sky); background: rgba(63,208,255,.08);
    padding: 1px 5px; border-radius: 4px;
}

/* ============================================================
   LOAD PANEL
   ============================================================ */
.dropzone {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    border: 2px dashed var(--line-hi);
    border-radius: 12px;
    padding: 20px 10px;
    color: var(--dim); font-size: 13px;
    cursor: pointer;
    transition: border-color .15s, background .15s, color .15s;
    background: rgba(138,92,255,.05);
}
.dropzone b { font-family: var(--head-font); font-size: 9px; font-weight: 400; color: var(--text); }
.dropzone:hover, .dropzone.drag {
    border-color: var(--coin); color: var(--coin);
    background: rgba(255,204,26,.07);
}
.dropzone .big { font-size: 30px; margin-bottom: 4px; animation: bob 2s ease-in-out infinite; }

.file-row {
    font-size: 13px; color: var(--faint);
    margin-top: 10px; min-height: 18px; line-height: 1.5;
}
.file-row .name { color: var(--sky); font-weight: 600; word-break: break-all; }
.file-row .warn { color: var(--coin); }

.local-box {
    margin-top: 14px; padding: 12px;
    border: 1px solid var(--line); border-radius: 12px;
    background: var(--card-3);
    transition: border-color .2s, box-shadow .2s;
}
.local-box.attn {
    border-color: var(--coin);
    box-shadow: 0 0 0 3px rgba(255,204,26,.12), 0 0 22px rgba(255,204,26,.15);
    animation: attn 1.6s ease-in-out 3;
}
.local-box.done { border-color: var(--pipe-dark); }
@keyframes attn { 50% { box-shadow: 0 0 0 5px rgba(255,204,26,.25), 0 0 30px rgba(255,204,26,.3); } }
.local-hint { font-size: 12.5px; color: var(--faint); margin-top: 8px; line-height: 1.55; }
.local-hint strong { color: var(--coin); }
.local-box.done .local-hint strong { color: var(--ok); }

/* ============================================================
   SEARCH
   ============================================================ */
.search-wrap { position: relative; margin-bottom: 10px; }
.search-wrap input { padding-right: 34px; }
.search-wrap .clear {
    position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
    border: none; background: none; box-shadow: none;
    color: var(--faint); padding: 4px 8px; min-height: 0; font-size: 13px;
}
.search-wrap .clear:hover { color: var(--bad); }

/* ============================================================
   FLAGS
   ============================================================ */
.flg {
    width: 20px; height: 15px; object-fit: cover;
    border-radius: 3px; flex-shrink: 0; vertical-align: middle;
    box-shadow: 0 0 0 1px rgba(255,255,255,.15);
    background: var(--card-2);
}
.flg.lg { width: 24px; height: 18px; }
.flg-unknown {
    display: inline-flex; align-items: center; justify-content: center;
    width: 20px; height: 15px; border-radius: 3px; font-size: 9px; font-weight: 700;
    background: var(--line); color: var(--dim); vertical-align: middle;
}

/* ============================================================
   COUNTRY CHIPS
   ============================================================ */
.group-btns { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.chip-grid {
    display: flex; flex-wrap: wrap; gap: 6px;
    max-height: 200px; overflow-y: auto; padding: 2px;
}
.chip {
    display: inline-flex; align-items: center; gap: 6px;
    background: var(--card-3);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 4px 10px 4px 6px;
    font-size: 13px; font-weight: 600;
    cursor: pointer; user-select: none;
    color: var(--faint);
    transition: transform .06s, background .12s, border-color .12s, color .12s;
}
.chip:active { transform: scale(.95); }
.chip .flg { opacity: .45; filter: grayscale(.7); transition: opacity .12s, filter .12s; }
.chip .n { color: var(--faint); font-size: 11px; font-weight: 500; }
.chip.on {
    background: rgba(43,217,107,.14);
    border-color: var(--pipe);
    color: var(--text);
    box-shadow: 0 0 12px rgba(43,217,107,.18);
}
.chip.on .flg { opacity: 1; filter: none; }
.chip.on .n { color: var(--coin); }
.chip.nodata { border-style: dashed; }
.empty-note { color: var(--faint); font-size: 13px; padding: 6px 2px; }

/* ============================================================
   PROVIDER LIST — grouped by country
   ============================================================ */
.provider-list {
    max-height: 340px; overflow-y: auto;
    display: flex; flex-direction: column; gap: 4px;
    padding: 2px;
}
.prov-group {
    position: sticky; top: 0; z-index: 2;
    display: flex; align-items: center; gap: 8px;
    padding: 7px 8px; margin-top: 4px;
    background: var(--card-solid);
    border-bottom: 1px solid var(--line);
    font-size: 12px; font-weight: 700; color: var(--dim);
    text-transform: uppercase; letter-spacing: .4px;
    cursor: pointer;
}
.prov-group:first-child { margin-top: 0; }
.prov-group .gname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prov-group .gmeta { margin-left: auto; font-weight: 500; color: var(--faint); text-transform: none; letter-spacing: 0; white-space: nowrap; }
.prov-group:hover .gmeta { color: var(--coin); }
.prov-row {
    display: flex; align-items: center; gap: 9px;
    padding: 7px 10px;
    border: 1px solid transparent;
    border-radius: 9px;
    cursor: pointer;
    font-size: 14px;
    color: var(--faint);
    background: transparent;
    transition: color .1s, border-color .1s, background .1s;
    user-select: none;
}
.prov-row:hover { color: var(--text); background: rgba(255,255,255,.03); }
.prov-row.on { color: var(--text); background: rgba(43,217,107,.09); border-color: rgba(43,217,107,.35); }
.prov-row .tick {
    width: 18px; height: 18px; border-radius: 5px; flex-shrink: 0;
    border: 1.5px solid var(--line-hi);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 12px; color: transparent;
}
.prov-row.on .tick { background: var(--pipe); border-color: var(--pipe); color: #032611; }
.prov-row .swatch { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; box-shadow: 0 0 8px currentColor; }
.prov-row .pname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prov-row .iso-tag {
    margin-left: auto; display: inline-flex; align-items: center; gap: 5px;
    font-size: 11px; color: var(--faint); white-space: nowrap;
}
.prov-row .pn { color: var(--coin); font-weight: 600; }

/* ============================================================
   STATS
   ============================================================ */
.stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.stat {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 12px 14px;
    position: relative; overflow: hidden;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    --accent: var(--coin);
}
.stat::before {
    content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
    background: var(--accent); box-shadow: 0 0 14px var(--accent);
}
.stat.sky { --accent: var(--sky); }
.stat.red { --accent: var(--red); }
.stat.dim { --accent: var(--violet); }
.stat .label { font-family: var(--head-font); font-size: 7px; line-height: 1.5; color: var(--faint); text-transform: uppercase; }
.stat .value {
    font-family: var(--head-font); font-size: 19px; margin-top: 10px;
    color: var(--accent); text-shadow: 0 0 14px var(--accent);
    transition: transform .15s;
}
.stat .value.bump { animation: bump .3s ease-out; }
@keyframes bump { 40% { transform: translateY(-5px) scale(1.08); } }

/* ============================================================
   ACTION BAR
   ============================================================ */
.action-bar {
    display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
    padding: 12px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}
.action-bar .grow { flex: 1 1 260px; margin: 0; }
.action-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.action-bar .hint { font-size: 12px; color: var(--faint); width: 100%; }
kbd {
    font-family: ui-monospace, Menlo, monospace;
    background: var(--card-3); border: 1px solid var(--line-hi); border-radius: 5px;
    padding: 0 5px; font-size: 11px; color: var(--coin);
}

/* ============================================================
   TABLE
   ============================================================ */
.table-wrap {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: auto;
    max-height: calc(100vh - 290px);
    min-height: 220px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th {
    position: sticky; top: 0; z-index: 5;
    background: var(--card-solid);
    border-bottom: 1px solid var(--line-hi);
    color: var(--dim);
    text-align: left;
    font-family: var(--head-font);
    font-size: 8px; line-height: 1.5; font-weight: 400;
    padding: 12px;
    cursor: pointer; user-select: none; white-space: nowrap;
}
thead th:hover { color: var(--coin); }
thead th.sorted { color: var(--coin); }
thead th .arrow { font-size: 10px; margin-left: 3px; }
tbody td {
    padding: 9px 12px;
    border-bottom: 1px solid rgba(42,38,80,.7);
    white-space: nowrap;
}
tbody tr { cursor: pointer; transition: background .08s; }
tbody tr:hover td { background: rgba(255,204,26,.05); }
tbody tr.sel td { background: rgba(255,204,26,.13); }
tbody tr.sel td:first-child { box-shadow: inset 3px 0 0 var(--coin); }
td.idx { color: var(--faint); font-size: 12px; }
td.num { color: var(--sky); font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: 13.5px; }
td.city { color: var(--dim); }
td.flag-cell .country-code { color: var(--text); font-weight: 600; margin-left: 7px; vertical-align: middle; }
td .prov-dot {
    display: inline-block; width: 8px; height: 8px; border-radius: 50%;
    margin-right: 7px; vertical-align: middle; box-shadow: 0 0 8px currentColor;
}
td .prov-name { vertical-align: middle; }
td .prov-name.pseudo { color: var(--faint); font-style: italic; }
.type-tag { margin-left: 7px; font-size: 11.5px; color: var(--faint); }
.vr-hint { font-size: 11px; color: var(--faint); }
.badge {
    display: inline-block; border-radius: 6px;
    padding: 2px 7px; font-size: 11px; font-weight: 700; letter-spacing: .4px;
    background: rgba(76,240,138,.13); color: var(--ok);
    border: 1px solid rgba(76,240,138,.35);
}
.badge.bad { background: rgba(255,90,110,.12); color: var(--bad); border-color: rgba(255,90,110,.35); }
.badge.warn { background: rgba(255,204,26,.1); color: var(--coin); border-color: rgba(255,204,26,.3); font-weight: 500; letter-spacing: 0; }
.table-empty { text-align: center; padding: 56px 12px; color: var(--faint); font-size: 14px; }
.table-empty .big { font-size: 38px; display: block; margin-bottom: 10px; animation: bob 2s ease-in-out infinite; }
.more-btn { display: block; margin: 12px auto; }
.more-btn[hidden] { display: none; }

/* phones: rows become cards */
@media (max-width: 640px) {
    .table-wrap { max-height: none; overflow: visible; background: transparent; border: 0; backdrop-filter: none; -webkit-backdrop-filter: none; }
    table, tbody, tr, td { display: block; }
    thead { display: none; }
    tbody tr {
        display: grid;
        grid-template-columns: 1fr auto;
        gap: 4px 10px;
        padding: 12px 14px;
        margin-bottom: 8px;
        background: var(--card);
        border: 1px solid var(--line);
        border-radius: 12px;
    }
    tbody tr.sel { border-color: var(--coin); background: rgba(255,204,26,.08); }
    tbody td, tbody tr:hover td, tbody tr.sel td, tbody tr:nth-child(even) td { padding: 0; border: 0; background: none !important; box-shadow: none !important; white-space: normal; }
    td.idx { display: none; }
    td.num { grid-column: 1; grid-row: 1; font-size: 15px; min-width: 0; overflow-wrap: anywhere; }
    td.status { grid-column: 2; grid-row: 1; text-align: right; }
    td.flag-cell { grid-column: 1; grid-row: 2; font-size: 13px; min-width: 0; }
    td.prov { grid-column: 2; grid-row: 2; text-align: right; font-size: 13px; color: var(--dim); }
    td.city { grid-column: 1 / -1; grid-row: 3; font-size: 12px; color: var(--faint); }
    td.city:empty, td.city.blank { display: none; }
}

/* ============================================================
   AD BANNER — 622 × 52, scales down on narrow screens
   ============================================================ */
.ad-slot[hidden] { display: none; }
/* fills the right column, under the category panel */
.ad-slot { position: relative; }
.ad-banner {
    --ad-red: rgba(55, 0, 4, .6);        /* 60% dark red in the center */
    --ad-lime: #d4ff1f;                  /* lime-yellow neon on the edges */
    position: relative; display: block;
    width: 100%; aspect-ratio: 622 / 52;
    border-radius: 10px; overflow: hidden;
    border: 1px solid var(--ad-lime);
    background: var(--card-3);
    box-shadow: 0 0 10px rgba(212,255,31,.45), 0 0 22px rgba(212,255,31,.2);
    transition: transform .1s;
    animation: ad-edge-beat 2.4s ease-in-out infinite;
}
/* slow neon heartbeat on the edges (two soft beats, then rest) */
@keyframes ad-edge-beat {
    0%, 100% { box-shadow: 0 0 6px rgba(212,255,31,.35), 0 0 14px rgba(212,255,31,.12); border-color: rgba(212,255,31,.7); }
    15%      { box-shadow: 0 0 14px rgba(212,255,31,.9), 0 0 32px rgba(212,255,31,.45); border-color: #d4ff1f; }
    30%      { box-shadow: 0 0 8px rgba(212,255,31,.5), 0 0 18px rgba(212,255,31,.2); border-color: rgba(212,255,31,.8); }
    45%      { box-shadow: 0 0 12px rgba(212,255,31,.8), 0 0 28px rgba(212,255,31,.38); border-color: #d4ff1f; }
}
/* color mask over the media: dark red core → lime neon rim */
.ad-banner::after {
    content: '';
    position: absolute; inset: 0; z-index: 1;
    pointer-events: none;
    background: radial-gradient(ellipse 75% 90% at 50% 50%,
        var(--ad-red) 0%, var(--ad-red) 45%,
        rgba(55, 0, 4, .33) 70%,
        rgba(212, 255, 31, .35) 100%);
    box-shadow: inset 0 0 14px rgba(212,255,31,.75), inset 0 0 4px var(--ad-lime);
    border-radius: inherit;
}
a.ad-banner:active { transform: scale(.99); }
.ad-banner img, .ad-banner video {
    display: block; width: 100%; height: 100%; object-fit: cover;
    pointer-events: none;   /* clicks go to the link, even on video */
}
.ad-tag {
    position: absolute; top: 6px; right: 8px; z-index: 3;
    font-size: 10px; font-weight: 700; letter-spacing: 1px;
    padding: 2px 7px; border-radius: 5px;
    background: rgba(0,0,0,.6); color: var(--ad-lime);
}
/* small banner in the right column */
.ad-bottom .ad-banner { border-radius: 8px; }
.ad-bottom .ad-banner::after { box-shadow: inset 0 0 7px rgba(212,255,31,.75), inset 0 0 2px var(--ad-lime); }
.ad-bottom .ad-tag { top: 2px; right: 3px; font-size: 6px; letter-spacing: .4px; padding: 1px 3px; border-radius: 3px; }
@media (max-width: 640px) {
    .ad-banner { border-radius: 8px; }
    .ad-banner::after { box-shadow: inset 0 0 7px rgba(212,255,31,.75), inset 0 0 2px var(--ad-lime); }
    .ad-tag { top: 3px; right: 4px; font-size: 7px; letter-spacing: .5px; padding: 1px 4px; border-radius: 3px; }
}

/* ============================================================
   RIGHT COLUMN — category cards (one open at a time)
   ============================================================ */
.cat-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.cat {
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    padding: 12px 4px 10px; min-height: 70px;
    background: var(--card); border: 1px solid var(--line);
    border-radius: 12px;
    font-size: 12px; color: var(--dim);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}
.cat-cards.cat-3 { grid-template-columns: repeat(3, 1fr); }
.cat { position: relative; }
.cat .ci { font-size: 20px; transition: transform .2s; }
.cbadge {
    position: absolute; top: 6px; right: 6px;
    font-size: 10px; font-weight: 700; line-height: 1;
    padding: 3px 6px; border-radius: 999px;
    background: var(--card-3); color: var(--coin);
    border: 1px solid var(--line-hi);
}
.cbadge:empty { display: none; }
.cat.on {
    color: var(--coin); border-color: var(--coin);
    background: rgba(255,204,26,.08);
    box-shadow: 0 0 18px rgba(255,204,26,.18), inset 0 -3px 0 rgba(0,0,0,.35);
}
.cat.on .ci { transform: translateY(-2px) scale(1.15); }
.cat-panel { display: none; }
.cat-panel.show { display: block; animation: pop .2s ease-out; }
@keyframes pop { from { transform: translateY(6px); opacity: 0; } }

/* ============================================================
   VALIDATOR
   ============================================================ */
.validator-input { display: flex; gap: 8px; }
.validator-input input { flex: 1; }
.validator-result {
    margin-top: 12px;
    background: var(--card-3);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 14px; color: var(--faint);
    min-height: 40px;
}
.vr-line { display: flex; gap: 10px; padding: 4px 0; align-items: baseline; }
.vr-k { font-family: var(--head-font); font-size: 7px; color: var(--faint); min-width: 82px; text-transform: uppercase; }
.vr-v { color: var(--text); word-break: break-word; display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.vr-v.ok { color: var(--ok); }
.vr-v.err { color: var(--bad); }
.validator-verdict {
    margin-top: 10px;
    font-family: var(--head-font); font-size: 9px; line-height: 1.6;
    border-radius: 10px;
    padding: 12px; text-align: center;
    display: none;
}
.validator-verdict.show { display: block; animation: pop .2s ease-out; }
.validator-verdict.ok  { background: rgba(76,240,138,.12); color: var(--ok); border: 1px solid var(--ok); box-shadow: 0 0 20px rgba(76,240,138,.2); }
.validator-verdict.bad { background: rgba(255,90,110,.1); color: var(--bad); border: 1px solid var(--bad); box-shadow: 0 0 20px rgba(255,90,110,.18); }
.validator-note { margin-top: 12px; font-size: 12.5px; color: var(--faint); line-height: 1.55; }

/* ============================================================
   SORT / EXPORT
   ============================================================ */
.row { display: flex; gap: 8px; align-items: center; }
.row > * { flex: 1; }
.sort-chips { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.sort-chips button { text-align: left; font-weight: 500; color: var(--dim); }
.sort-chips button.on { color: var(--coin); border-color: var(--coin); background: rgba(255,204,26,.08); }
.export-fmt { display: flex; gap: 8px; }
.export-fmt button { flex: 1; min-height: 44px; }

/* ============================================================
   HELP
   ============================================================ */
.help-tabs { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; margin-bottom: 12px; }
.help-tab { font-size: 12.5px; font-weight: 500; color: var(--dim); text-align: left; }
.help-tab.on { color: var(--pipe); border-color: var(--pipe); background: rgba(43,217,107,.08); }
.help-section {
    display: none;
    background: var(--card-3);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 14px;
    font-size: 13.5px; line-height: 1.65;
    color: var(--dim);
}
.help-section.show { display: block; animation: pop .18s ease-out; }
.help-section h4 { font-family: var(--head-font); font-size: 8px; line-height: 1.7; color: var(--coin); margin-bottom: 8px; font-weight: 400; }
.help-section strong { color: var(--text); }
.help-section ul { padding-left: 18px; }
.help-section li, .help-section p { margin: 5px 0; }

/* ============================================================
   TOASTS / MODAL
   ============================================================ */
#toast-container {
    position: fixed; bottom: 16px; right: 16px;
    bottom: max(16px, env(safe-area-inset-bottom));
    display: flex; flex-direction: column; gap: 8px;
    z-index: 1000;
}
.toast {
    background: rgba(19,17,38,.95);
    border: 1px solid var(--ok);
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 14px; color: var(--text);
    min-width: 240px; max-width: 360px;
    box-shadow: 0 10px 30px rgba(0,0,0,.5), 0 0 18px rgba(76,240,138,.15);
    backdrop-filter: blur(10px);
    animation: slidein .2s ease-out;
    transition: opacity .3s, transform .3s;
}
.toast.error { border-color: var(--bad); box-shadow: 0 10px 30px rgba(0,0,0,.5), 0 0 18px rgba(255,90,110,.18); }
.toast.warn { border-color: var(--coin); box-shadow: 0 10px 30px rgba(0,0,0,.5), 0 0 18px rgba(255,204,26,.18); }
.toast.out { opacity: 0; transform: translateY(8px); }
.toast .t-title { font-family: var(--head-font); font-size: 7px; line-height: 1.6; color: var(--ok); margin-bottom: 4px; text-transform: uppercase; }
.toast.error .t-title { color: var(--bad); }
.toast.warn .t-title { color: var(--coin); }
@keyframes slidein { from { transform: translateY(14px); opacity: 0; } }
@media (max-width: 640px) {
    #toast-container { left: 12px; right: 12px; }
    .toast { min-width: 0; max-width: none; }
}

.modal-backdrop {
    position: fixed; inset: 0;
    background: rgba(4, 3, 12, .75);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: none; align-items: center; justify-content: center;
    z-index: 900; padding: 16px;
}
.modal-backdrop.show { display: flex; }
.modal {
    background: var(--card-solid);
    border: 1px solid var(--line-hi);
    border-radius: 16px;
    width: min(480px, 100%);
    box-shadow: 0 20px 60px rgba(0,0,0,.6), 0 0 40px rgba(138,92,255,.15);
    animation: pop .18s ease-out;
    overflow: hidden;
}
.modal .m-head {
    font-family: var(--head-font); font-size: 9px; line-height: 1.6;
    padding: 14px 16px; color: var(--coin);
    border-bottom: 1px solid var(--line);
}
.modal .m-body { padding: 16px; color: var(--dim); font-size: 15px; line-height: 1.6; }
.modal .m-foot { padding: 0 16px 16px; display: flex; justify-content: flex-end; gap: 8px; }

/* ============================================================
   SCROLLBARS / FOOTER / PHONE TWEAKS
   ============================================================ */
* { scrollbar-width: thin; scrollbar-color: var(--line-hi) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-hi); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: var(--violet); }

footer {
    position: relative; z-index: 1;
    text-align: center; padding: 18px 16px 28px;
    font-family: var(--head-font); font-size: 7px; line-height: 1.8;
    color: var(--faint);
}

.tg-link {
    display: block; width: fit-content; margin: 10px auto 0;
    font-family: var(--body-font); font-size: 13px; font-weight: 700;
    color: var(--sky); text-decoration: none;
    padding: 6px 14px; border-radius: 999px;
    border: 1px solid rgba(63,208,255,.4);
    background: rgba(63,208,255,.08);
    transition: background .15s, box-shadow .15s, color .15s;
}
.tg-link:hover { color: #fff; background: rgba(63,208,255,.2); box-shadow: 0 0 16px rgba(63,208,255,.35); }

@media (max-width: 640px) {
    header { padding: 10px 14px; }
    .logo { font-size: 11px; }
    header .status { font-size: 7px; }
    .stats-row { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .stat .value { font-size: 16px; }
    .action-bar .seg { display: flex; width: 100%; }
    .action-bar .seg button { flex: 1; }
    .action-btns { width: 100%; }
    .action-btns button { flex: 1; }
    .action-btns .ghost { flex: none; }
    .chip-grid { max-height: 170px; }
    .provider-list { max-height: 300px; }
    /* 16px inputs stop iOS from zooming on focus */
    input[type="text"], input[type="search"], select, textarea { font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}
