/* ==================================================================
   GMAIL CHECKER — LIQUID GLASS
   A cinematic near-black room with a few large panes of glass floating
   in it. Everything expensive (backdrop-filter, blend modes, animated
   blur) lives behind `html:not(.lite)` — Safari and phones get solid
   gradient equivalents that look the same and cost nothing.

   Material classes
     .lg    big tinted glass pane        (a handful per screen, no more)
     .lg-r  refractive pane              (Chromium gets the SVG displacement)
     .sheen pointer-lit specular highlight
     .pane  cheap inner surface          (NO backdrop-filter — never stack)
   ================================================================== */

:root {
    /* Room */
    --bg: #04050a;
    --bg-2: #070911;

    /* Ink */
    --text: #f3f2f6;
    --dim: #9aa0b2;
    --faint: #8e93a8;

    /* Accent — electric lime, secondary — cold periwinkle */
    --accent: #d8ff3f;
    --accent-ink: #131a00;
    --accent-soft: rgba(216, 255, 63, 0.13);
    --accent-glow: rgba(216, 255, 63, 0.3);
    --accent-2: #7aa2ff;
    --accent-2-soft: rgba(122, 162, 255, 0.14);

    /* Status */
    --live: #3ddc97;
    --die: #ff5f6a;
    --verify: #ffc53d;
    --notexist: #7d8296;
    --error: #ff9040;

    /* Glass */
    --glass: rgba(16, 18, 26, 0.36);
    --glass-r: rgba(18, 20, 28, 0.3);
    --line: rgba(255, 255, 255, 0.12);
    --line-2: rgba(255, 255, 255, 0.22);
    --line-soft: rgba(255, 255, 255, 0.07);

    /* Inner surfaces (no blur — these sit *on* the glass) */
    --pane: rgba(255, 255, 255, 0.045);
    --pane-2: rgba(255, 255, 255, 0.075);
    --sink: rgba(2, 3, 8, 0.34);

    /* Type — SF on Apple hardware, Inter everywhere else. One family for
       the whole UI; the monospace is reserved for addresses and keys. */
    --sans: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Inter', 'Segoe UI', Roboto, sans-serif;
    --disp: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Inter', 'Segoe UI', Roboto, sans-serif;
    --mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;

    /* Geometry */
    --r-xl: 30px;
    --r-lg: 24px;
    --r-md: 16px;
    --r-sm: 12px;

    --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
    --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ============ Reset / base ============ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
    font-size: 16px;
    background: var(--bg);
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--sans);
    font-size: 0.9rem;
    line-height: 1.55;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    min-height: 100svh;
    overflow-x: hidden;
}

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

.hidden { display: none !important; }
.muted { color: var(--dim); }
.ta-right { text-align: right; }

::selection { background: rgba(216, 255, 63, 0.26); color: #fff; }

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: var(--r-sm);
}

/* Scrollbars — thin and out of the way */
* { scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.16) transparent; }
*::-webkit-scrollbar { width: 6px; height: 6px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.14); border-radius: 99px; }
*::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.24); }

/* ==================================================================
   THE ROOM — a living backdrop behind every pane of glass
   Orbs are soft radial gradients (already blurry by construction) that
   only ever animate transform/opacity. No filter:blur on anything this
   large: that is a full-viewport gaussian re-render every frame.
   ================================================================== */
#wall {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    background:
        radial-gradient(120% 90% at 50% -10%, #0b1020 0%, transparent 60%),
        var(--bg);
    pointer-events: none;
}

.orb {
    position: absolute;
    border-radius: 50%;
    opacity: 0.85;
    will-change: transform;
}
.orb.o1 {
    width: 62vmax; height: 62vmax;
    top: -22vmax; left: -14vmax;
    background: radial-gradient(circle at 50% 50%,
        rgba(216, 255, 63, 0.16) 0%, rgba(216, 255, 63, 0.07) 32%, transparent 66%);
    animation: drift1 44s ease-in-out infinite alternate;
}
.orb.o2 {
    width: 70vmax; height: 70vmax;
    right: -26vmax; top: 6vmax;
    background: radial-gradient(circle at 50% 50%,
        rgba(122, 162, 255, 0.18) 0%, rgba(90, 110, 255, 0.08) 34%, transparent 68%);
    animation: drift2 58s ease-in-out infinite alternate;
}
.orb.o3 {
    width: 56vmax; height: 56vmax;
    left: 24vmax; bottom: -30vmax;
    background: radial-gradient(circle at 50% 50%,
        rgba(61, 220, 151, 0.13) 0%, rgba(20, 90, 120, 0.07) 36%, transparent 70%);
    animation: drift3 66s ease-in-out infinite alternate;
}
@keyframes drift1 { from { transform: translate3d(0, 0, 0) scale(1); }    to { transform: translate3d(7vmax, 5vmax, 0) scale(1.14); } }
@keyframes drift2 { from { transform: translate3d(0, 0, 0) scale(1.06); } to { transform: translate3d(-8vmax, 9vmax, 0) scale(1); } }
@keyframes drift3 { from { transform: translate3d(0, 0, 0) scale(1); }    to { transform: translate3d(9vmax, -7vmax, 0) scale(1.12); } }

/* colour grade — blend modes are Safari's most expensive trick, lite drops it */
.grade {
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    mix-blend-mode: overlay;
    background: linear-gradient(118deg, rgba(216, 255, 63, 0.1), transparent 44%, rgba(122, 162, 255, 0.13));
}

.vignette {
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background:
        radial-gradient(120% 96% at 50% 118%, rgba(2, 3, 8, 0.92), transparent 54%),
        radial-gradient(130% 80% at 50% -24%, rgba(2, 3, 8, 0.7), transparent 52%),
        radial-gradient(150% 110% at 50% 50%, transparent 50%, rgba(1, 2, 5, 0.68) 100%);
}

.grain {
    position: fixed;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    opacity: 0.05;
    mix-blend-mode: overlay;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.svgdefs { position: fixed; width: 0; height: 0; overflow: hidden; pointer-events: none; }

/* ==================================================================
   LIQUID GLASS MATERIAL
   ================================================================== */
.lg {
    position: relative;
    background: var(--glass);
    -webkit-backdrop-filter: blur(22px) saturate(1.7) brightness(1.06);
    backdrop-filter: blur(22px) saturate(1.7) brightness(1.06);
    border: 1px solid var(--line);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.16),
        inset 0 -1px 0 rgba(255, 255, 255, 0.04),
        inset 0 0 22px rgba(255, 255, 255, 0.03),
        0 24px 60px -18px rgba(0, 0, 0, 0.7);
}

.lg-r {
    position: relative;
    background: var(--glass-r);
    -webkit-backdrop-filter: blur(14px) saturate(1.8) brightness(1.08);
    backdrop-filter: blur(14px) saturate(1.8) brightness(1.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.22),
        inset 0 -1px 0 rgba(255, 255, 255, 0.05),
        inset 2px 4px 18px rgba(255, 255, 255, 0.05),
        0 18px 44px -14px rgba(0, 0, 0, 0.65);
}
/* Chromium only — feature-detected in the boot script */
html.refract .lg-r {
    -webkit-backdrop-filter: url(#lgRefract) blur(8px) saturate(1.8) brightness(1.08);
    backdrop-filter: url(#lgRefract) blur(8px) saturate(1.8) brightness(1.08);
}

/* pointer-lit specular sheen — --mx/--my are written by the boot script */
.sheen::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    background: radial-gradient(260px 170px at var(--mx, 50%) var(--my, -40%),
        rgba(255, 255, 255, 0.13), rgba(255, 255, 255, 0.04) 44%, transparent 72%);
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: 0;
}
.sheen.lit::after { opacity: 1; }

/* cheap inner surface — sits on the glass, never blurs the backdrop again */
.pane {
    background: var(--pane);
    border: 1px solid var(--line-soft);
    border-radius: var(--r-md);
}

/* ============ Custom cursor (fine pointers only) ============ */
.cur, .curR {
    position: fixed;
    top: 0; left: 0;
    z-index: 999;
    pointer-events: none;
    border-radius: 50%;
    mix-blend-mode: difference;
    opacity: 0;
    transition: opacity 0.3s ease, width 0.28s var(--spring), height 0.28s var(--spring);
}
.cur { width: 7px; height: 7px; background: #fff; margin: -3.5px 0 0 -3.5px; }
.curR { width: 32px; height: 32px; border: 1px solid rgba(255, 255, 255, 0.7); margin: -16px 0 0 -16px; }
body.cursor-on .cur, body.cursor-on .curR { opacity: 1; }
body.cursor-on.cur-hot .curR { width: 46px; height: 46px; margin: -23px 0 0 -23px; }
@media (pointer: fine) {
    body.cursor-on, body.cursor-on button, body.cursor-on a, body.cursor-on .stat, body.cursor-on label { cursor: none; }
    body.cursor-on input, body.cursor-on textarea, body.cursor-on select { cursor: auto; }
}

/* ============ Entrance choreography ============ */
.riser {
    opacity: 0;
    transform: translateY(18px);
    transition: opacity 0.75s var(--ease), transform 0.85s var(--ease);
}
#app.active .riser, .lock-screen.active .riser { opacity: 1; transform: none; }
#app.active .riser.d1 { transition-delay: 0.06s; }
#app.active .riser.d2 { transition-delay: 0.16s; }
#app.active .riser.d3 { transition-delay: 0.28s; }
#app.active .riser.d4 { transition-delay: 0.4s; }
#app.active .riser.d5 { transition-delay: 0.5s; }

/* ==================================================================
   CONTROLS
   ================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.005em;
    color: var(--text);
    background: var(--pane);
    border: 1px solid var(--line);
    border-radius: 999px;
    cursor: pointer;
    white-space: nowrap;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
    transition: background 0.25s, border-color 0.25s, color 0.2s,
                transform 0.3s var(--spring), box-shadow 0.3s;
}
.btn:hover {
    background: var(--pane-2);
    border-color: var(--line-2);
    transform: translateY(-1.5px);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 10px 22px -12px rgba(0, 0, 0, 0.8);
}
.btn:active { transform: translateY(0) scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-primary {
    color: var(--accent-ink);
    background: linear-gradient(180deg, #e6ff6d, var(--accent));
    border-color: rgba(216, 255, 63, 0.5);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), 0 10px 26px -12px var(--accent-glow);
}
.btn-primary:hover {
    background: linear-gradient(180deg, #eeff8e, #dfff58);
    border-color: rgba(216, 255, 63, 0.75);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), 0 16px 34px -12px var(--accent-glow);
}

.btn-ghost {
    color: var(--dim);
    background: rgba(255, 255, 255, 0.02);
    border-color: var(--line-soft);
    box-shadow: none;
}
.btn-ghost:hover { color: var(--text); background: var(--pane); border-color: var(--line); }

.btn-danger {
    color: var(--die);
    background: rgba(255, 95, 106, 0.06);
    border-color: rgba(255, 95, 106, 0.25);
    box-shadow: none;
}
.btn-danger:hover { background: rgba(255, 95, 106, 0.12); border-color: rgba(255, 95, 106, 0.5); }

.btn-sm { padding: 7px 14px; font-size: 0.76rem; }
.btn-lg { padding: 14px 22px; font-size: 0.92rem; }
.btn-block { width: 100%; }

.icon-btn {
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    flex: 0 0 auto;
    color: var(--dim);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--line-soft);
    border-radius: 11px;
    cursor: pointer;
    transition: color 0.2s, background 0.25s, border-color 0.25s, transform 0.3s var(--spring);
}
.icon-btn:hover { color: var(--text); background: var(--pane); border-color: var(--line); transform: scale(1.08); }
.icon-btn:active { transform: scale(0.94); }
.icon-btn.danger:hover { color: var(--die); background: rgba(255, 95, 106, 0.12); border-color: rgba(255, 95, 106, 0.4); }

.spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(0, 0, 0, 0.25);
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============ Inputs ============ */
.input {
    width: 100%;
    padding: 11px 15px;
    /* 16px minimum on coarse pointers — see the media query at the bottom */
    font-size: 0.86rem;
    color: var(--text);
    background: var(--sink);
    border: 1px solid var(--line-soft);
    border-radius: 14px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.25s, background 0.25s;
}
.input::placeholder { color: var(--faint); }
.input:hover { border-color: var(--line); }
.input:focus {
    border-color: rgba(216, 255, 63, 0.45);
    box-shadow: 0 0 0 3px var(--accent-soft);
    background: rgba(2, 3, 8, 0.5);
}
.input-lg { padding: 14px 18px; font-size: 0.95rem; border-radius: 16px; }
.input-row { display: flex; gap: 8px; }
.input-row .input { flex: 1; }
textarea.input { resize: vertical; min-height: 110px; font-family: var(--mono); font-size: 0.8rem; line-height: 1.7; }

.field-label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--faint);
}
.help { margin-top: 10px; font-size: 0.76rem; color: var(--faint); }

/* Select — native control, glass shell */
.select-field {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0 12px 0 14px;
    height: 38px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--line-soft);
    border-radius: 999px;
    cursor: pointer;
    transition: border-color 0.25s, background 0.25s;
}
.select-field:hover { border-color: var(--line); background: var(--pane); }
.select-field:focus-within { border-color: rgba(216, 255, 63, 0.45); box-shadow: 0 0 0 3px var(--accent-soft); }
.select-field > span {
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--faint);
    pointer-events: none;
}
.select-field select {
    appearance: none;
    -webkit-appearance: none;
    padding: 0 18px 0 0;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text);
    background: transparent;
    border: none;
    outline: none;
    cursor: pointer;
}
.select-field select option { background: #0b0d15; color: var(--text); }
.select-field::after {
    content: "";
    position: absolute;
    right: 14px;
    width: 7px; height: 7px;
    border-right: 1.6px solid var(--dim);
    border-bottom: 1.6px solid var(--dim);
    transform: translateY(-2px) rotate(45deg);
    pointer-events: none;
}

/* ============ Toggle ============ */
.toggle { position: relative; display: inline-block; flex: 0 0 auto; }
.toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle-slider {
    display: block;
    width: 46px;
    height: 27px;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid var(--line);
    border-radius: 999px;
    cursor: pointer;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.45);
    transition: background 0.3s var(--ease), border-color 0.3s;
}
.toggle-slider::before {
    content: "";
    position: absolute;
    top: 4px; left: 4px;
    width: 19px; height: 19px;
    background: var(--dim);
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
    transition: transform 0.34s var(--spring), background 0.3s;
}
.toggle input:checked + .toggle-slider { background: var(--accent); border-color: var(--accent); }
.toggle input:checked + .toggle-slider::before { transform: translateX(19px); background: var(--accent-ink); }
.toggle input:focus-visible + .toggle-slider { outline: 2px solid var(--accent); outline-offset: 3px; }

/* ==================================================================
   LOCK SCREEN
   ================================================================== */
.lock-screen {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 40;
    align-items: center;
    justify-content: center;
    padding: calc(24px + env(safe-area-inset-top)) 20px calc(24px + env(safe-area-inset-bottom));
    min-height: 100svh;
    overflow: hidden;
}
.lock-screen.active { display: flex; }

.lock-bg-media {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scale(1.06);
    animation: kenburns 42s ease-in-out infinite alternate;
}
@keyframes kenburns {
    from { transform: scale(1.05) translate(0, 0); }
    to   { transform: scale(1.13) translate(-1.4%, 1%); }
}

.lock-overlay {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(120% 90% at 50% 110%, rgba(2, 3, 8, 0.94), transparent 56%),
        radial-gradient(130% 80% at 50% -20%, rgba(2, 3, 8, 0.8), transparent 54%),
        linear-gradient(180deg, rgba(4, 5, 10, 0.7), rgba(4, 5, 10, 0.84));
}

.lock-card {
    position: relative;
    z-index: 1;
    /* the wall here is whatever photo/video the owner uploaded, so this
       pane carries more tint than the rest — the copy has to stay legible
       over a bright frame */
    background: rgba(13, 15, 23, 0.46);
    width: 100%;
    max-width: 400px;
    padding: 44px 36px 34px;
    border-radius: var(--r-xl);
    text-align: center;
    animation: lockIn 0.7s var(--ease) both;
}
@keyframes lockIn {
    from { opacity: 0; transform: translateY(26px) scale(0.97); }
    to   { opacity: 1; transform: none; }
}
.lock-card.shake { animation: shake 0.46s ease; }
@keyframes shake {
    20% { transform: translateX(-9px); }
    40% { transform: translateX(8px); }
    60% { transform: translateX(-5px); }
    80% { transform: translateX(4px); }
}

.lock-mark {
    display: inline-grid;
    place-items: center;
    width: 54px;
    height: 54px;
    margin-bottom: 20px;
    color: var(--accent-ink);
    background: linear-gradient(165deg, #eaff8a, var(--accent));
    border-radius: 17px;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.55),
        0 16px 40px -14px var(--accent-glow);
}
.lock-mark.dim {
    color: var(--dim);
    background: var(--pane);
    border: 1px solid var(--line);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

.lock-title {
    font-family: var(--disp);
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -0.025em;
}
.lock-sub { margin-top: 6px; font-size: 0.83rem; color: var(--dim); }

.lock-form { display: flex; flex-direction: column; gap: 11px; margin-top: 28px; }
.lock-form .input-lg { text-align: center; }

.lock-error {
    min-height: 18px;
    font-size: 0.76rem;
    font-weight: 500;
    color: var(--die);
}

.lock-locked-msg .big {
    margin-top: 4px;
    font-family: var(--disp);
    font-size: 1.32rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}


/* ==================================================================
   APP SHELL
   ================================================================== */
#app { display: none; position: relative; z-index: 3; }
#app.active { display: block; }

.shell {
    max-width: 1240px;
    margin: 0 auto;
    padding:
        calc(26px + env(safe-area-inset-top))
        calc(22px + env(safe-area-inset-right))
        calc(56px + env(safe-area-inset-bottom))
        calc(22px + env(safe-area-inset-left));
}

/* --- header: one long glass pill --- */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 13px 15px 13px 17px;
    border-radius: 999px;
    margin-bottom: 20px;
}

.brand { display: flex; align-items: center; gap: 13px; min-width: 0; }
.brand-mark {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    flex: 0 0 auto;
    color: var(--accent-ink);
    background: linear-gradient(165deg, #eaff8a, var(--accent));
    border-radius: 13px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55), 0 10px 24px -10px var(--accent-glow);
}
.brand-text { min-width: 0; }
.app-title {
    font-family: var(--disp);
    font-size: 1.02rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.15;
}
.app-tag {
    font-family: var(--sans);
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    color: var(--faint);
}

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

/* --- tabs: a floating glass segmented pill --- */
.tabs {
    position: relative;
    display: inline-flex;
    gap: 2px;
    padding: 5px;
    margin-bottom: 22px;
    border-radius: 999px;
    max-width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}
.tabs::-webkit-scrollbar { display: none; }

.tab-indicator {
    position: absolute;
    top: 5px;
    bottom: 5px;
    left: 0;
    width: 0;
    background: linear-gradient(180deg, #ffffff, #e6e5ec);
    border-radius: 999px;
    z-index: 0;
    box-shadow: 0 6px 18px -6px rgba(0, 0, 0, 0.75), inset 0 -1px 0 rgba(0, 0, 0, 0.08);
}
.tabs.ready .tab-indicator {
    transition: transform 0.42s var(--spring), width 0.42s var(--spring);
}

.tabs > .tab {
    position: relative;
    z-index: 1;
    padding: 9px 20px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--dim);
    background: transparent;
    border: none;
    border-radius: 999px;
    cursor: pointer;
    white-space: nowrap;
    transition: color 0.3s var(--ease);
}
.tabs > .tab:hover { color: var(--text); }
.tabs > .tab.active { color: #0a0b10; }
/* .ready is added by moveTabIndicator() once the pill has a real width —
   until then the active tab must not be dark ink on a 0px-wide pill */
.tabs:not(.ready) > .tab.active { color: var(--text); }

/* ============ Views ============ */
.view { display: none; }
.view.active { display: block; animation: viewIn 0.46s var(--ease) both; }
@keyframes viewIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: none; }
}

/* ============ Cards — the big panes ============ */
.card {
    position: relative;
    padding: 24px;
    border-radius: var(--r-lg);
    transition: border-color 0.3s, box-shadow 0.35s, transform 0.4s var(--ease);
}
.card:hover { border-color: var(--line-2); }
#view-settings .card + .card { margin-top: 16px; }
#view-results .card, #view-tasks .card { overflow: hidden; }

.card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}
.card-head-left { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.card-head-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.kicker {
    font-family: var(--sans);
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--faint);
}
.card-title {
    font-family: var(--disp);
    font-size: 1.06rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.count-chip {
    display: inline-flex;
    align-items: center;
    padding: 6px 13px;
    font-family: var(--sans);
    font-size: 0.74rem;
    font-weight: 500;
    color: var(--dim);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--line-soft);
    border-radius: 999px;
    font-variant-numeric: tabular-nums;
}
.count-chip strong { color: var(--accent); font-weight: 600; }

/* ==================================================================
   CHECKER
   ================================================================== */
.checker-grid {
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
    gap: 16px;
    align-items: stretch;
}
.results-card { display: flex; flex-direction: column; }

/* Editor */
.editor {
    display: flex;
    background: var(--sink);
    border: 1px solid var(--line-soft);
    border-radius: var(--r-md);
    overflow: hidden;
    box-shadow: inset 0 2px 12px rgba(0, 0, 0, 0.35);
    transition: border-color 0.25s, box-shadow 0.25s;
}
.editor:focus-within {
    border-color: rgba(216, 255, 63, 0.4);
    box-shadow: inset 0 2px 12px rgba(0, 0, 0, 0.35), 0 0 0 3px var(--accent-soft);
}
/* NOTE: .line-numbers and .editor textarea must share identical
   font-size + fixed pixel line-height + vertical padding, or the
   numbers drift out of sync with the text. */
.line-numbers {
    width: 46px;
    padding: 14px 10px 14px 0;
    font-family: var(--mono);
    font-size: 0.78rem;
    line-height: 22px;
    text-align: right;
    color: var(--faint);
    background: rgba(255, 255, 255, 0.02);
    border-right: 1px solid var(--line-soft);
    overflow: hidden;
    user-select: none;
    flex: 0 0 auto;
}
.line-numbers span { display: block; }
.editor textarea {
    flex: 1;
    min-height: 330px;
    padding: 14px 15px;
    font-family: var(--mono);
    font-size: 0.78rem;
    line-height: 22px;
    color: var(--text);
    background: transparent;
    border: none;
    outline: none;
    resize: none;
    white-space: pre;
    caret-color: var(--accent);
}
.editor textarea::placeholder { color: var(--faint); }

.check-row { display: flex; align-items: center; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.kbd-hint { display: inline-flex; gap: 3px; }
.kbd-hint kbd {
    font-family: var(--sans);
    font-size: 0.62rem;
    color: var(--faint);
    padding: 3px 7px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--line-soft);
    border-bottom-width: 2px;
    border-radius: 7px;
}

.timer {
    margin-left: auto;
    font-family: var(--sans);
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--faint);
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.04em;
    transition: color 0.3s;
}
.timer.running { color: var(--accent); text-shadow: 0 0 18px var(--accent-glow); }
.timer .sep { opacity: 0.45; margin: 0 1px; }

/* Progress */
.progress { display: flex; align-items: center; gap: 12px; margin-top: 16px; }
.progress-bar {
    flex: 1;
    height: 7px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 99px;
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.5);
}
.progress-fill {
    height: 100%;
    width: 0%;
    border-radius: 99px;
    background: linear-gradient(90deg, var(--accent), #a8e63a 50%, var(--accent));
    background-size: 200% 100%;
    box-shadow: 0 0 16px var(--accent-glow);
    animation: sheenslide 1.4s linear infinite;
    transition: width 0.45s var(--ease);
}
@keyframes sheenslide {
    from { background-position: 0% 0; }
    to   { background-position: -200% 0; }
}
.progress-text {
    font-family: var(--sans);
    font-size: 0.72rem;
    color: var(--dim);
    font-variant-numeric: tabular-nums;
}

/* ============ Stats ============ */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 9px;
}
.stat {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
    padding: 14px 15px;
    background: var(--pane);
    border: 1px solid var(--line-soft);
    border-radius: var(--r-md);
    cursor: pointer;
    text-align: left;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
    transition: background 0.25s, border-color 0.25s, transform 0.35s var(--spring), box-shadow 0.3s;
}
.stat:hover {
    background: var(--pane-2);
    border-color: var(--line);
    transform: translateY(-2px);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 12px 26px -14px rgba(0, 0, 0, 0.85);
}
.stat:active { transform: translateY(0) scale(0.98); }
.stat-num {
    font-family: var(--disp);
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
}
.stat-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--sans);
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--dim);
}

.dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    flex: 0 0 auto;
    display: inline-block;
}
.dot.all      { background: var(--accent); }
.dot.live     { background: var(--live); }
.dot.die      { background: var(--die); }
.dot.verify   { background: var(--verify); }
.dot.notexist { background: var(--notexist); }
.dot.error    { background: var(--error); }

/* ============ Ratio bar ============ */
.ratio-bar {
    display: flex;
    gap: 2px;
    height: 6px;
    margin-top: 14px;
    border-radius: 99px;
    overflow: hidden;
}
/* `.seg` is also the segmented-control class further down; reset what that
   pill rule leaks in, or the slices grow to 8px in a 6px clipped track and
   stop being proportional to their counts */
.ratio-bar .seg {
    display: block;
    height: 100%;
    min-width: 2px;
    padding: 0;
    border: 0;
    border-radius: 0;
    transition: flex 0.5s var(--ease);
}
.ratio-bar .seg.live     { background: var(--live); }
.ratio-bar .seg.die      { background: var(--die); }
.ratio-bar .seg.verify   { background: var(--verify); }
.ratio-bar .seg.notexist { background: var(--notexist); }
.ratio-bar .seg.error    { background: var(--error); }
.ratio-bar .seg.none     { background: rgba(255, 255, 255, 0.07); }

/* ============ Results table ============ */
#resultsTable {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    margin-top: 16px;
}
.results-table-head {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) 108px;
    gap: 10px;
    padding: 0 14px 9px;
    font-family: var(--sans);
    font-size: 0.66rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--faint);
    border-bottom: 1px solid var(--line-soft);
}
.results-list {
    flex: 1;
    max-height: 420px;
    overflow-y: auto;
    overscroll-behavior: contain;
}
.result-row {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) 108px;
    gap: 10px;
    align-items: center;
    padding: 9px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.045);
    transition: background 0.2s;
}
.result-row:hover { background: rgba(255, 255, 255, 0.04); }
.result-row:last-child { border-bottom: none; }
.col-i {
    font-family: var(--sans);
    font-size: 0.68rem;
    color: var(--faint);
    font-variant-numeric: tabular-nums;
}
.col-email {
    font-family: var(--mono);
    font-size: 0.76rem;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.col-status { display: flex; justify-content: flex-end; }

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 11px;
    font-size: 0.68rem;
    font-weight: 600;
    border: 1px solid transparent;
    border-radius: 999px;
    white-space: nowrap;
}
.status-pill::before {
    content: "";
    width: 5px; height: 5px;
    border-radius: 50%;
    background: currentColor;
}
.status-pill.live         { color: var(--live);     background: rgba(61, 220, 151, 0.1);  border-color: rgba(61, 220, 151, 0.24); }
.status-pill.die          { color: var(--die);      background: rgba(255, 95, 106, 0.1);  border-color: rgba(255, 95, 106, 0.24); }
.status-pill.verify_phone { color: var(--verify);   background: rgba(255, 197, 61, 0.1);  border-color: rgba(255, 197, 61, 0.24); }
.status-pill.not_exist    { color: var(--notexist); background: rgba(125, 130, 150, 0.12); border-color: rgba(125, 130, 150, 0.28); }
.status-pill.error        { color: var(--error);    background: rgba(255, 144, 64, 0.1);  border-color: rgba(255, 144, 64, 0.24); }

/* ============ Empty states ============ */
.results-empty, .empty-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 9px;
    padding: 48px 20px;
    text-align: center;
}
.results-empty { flex: 1; }
.em-icon {
    display: grid;
    place-items: center;
    width: 56px;
    height: 56px;
    margin-bottom: 4px;
    color: var(--faint);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--line-soft);
    border-radius: 18px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
.em-title {
    font-family: var(--disp);
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}
.em-sub { font-size: 0.79rem; color: var(--faint); max-width: 34ch; }

/* ==================================================================
   HISTORY
   ================================================================== */
/* segmented control (source filter) */
.seg {
    display: inline-flex;
    gap: 2px;
    padding: 3px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--line-soft);
    border-radius: 999px;
    flex: 0 0 auto;
}
.seg-btn {
    padding: 6px 15px;
    font-size: 0.74rem;
    font-weight: 600;
    color: var(--dim);
    background: transparent;
    border: none;
    border-radius: 999px;
    cursor: pointer;
    white-space: nowrap;
    transition: color 0.22s, background 0.28s var(--ease), box-shadow 0.28s;
}
.seg-btn:hover { color: var(--text); }
.seg-btn.active {
    color: #0a0b10;
    background: linear-gradient(180deg, #ffffff, #e6e5ec);
    box-shadow: 0 4px 12px -5px rgba(0, 0, 0, 0.8);
}

/* --- toolbar: search + filters --- */
.hist-toolbar {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 14px;
    margin-bottom: 16px;
    background: rgba(255, 255, 255, 0.028);
    border: 1px solid var(--line-soft);
    border-radius: var(--r-md);
}

.search-field {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 12px 0 15px;
    height: 44px;
    background: var(--sink);
    border: 1px solid var(--line-soft);
    border-radius: 999px;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: border-color 0.22s, box-shadow 0.25s;
}
.search-field:focus-within {
    border-color: rgba(216, 255, 63, 0.45);
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.3), 0 0 0 3px var(--accent-soft);
}
.search-field > svg { flex: 0 0 auto; color: var(--faint); }
.search-input {
    flex: 1;
    min-width: 0;
    /* 16px on coarse pointers — see the media query at the bottom */
    font-size: 0.86rem;
    font-weight: 500;
    color: var(--text);
    background: transparent;
    border: none;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}
.search-input::placeholder { color: var(--faint); font-weight: 400; }
.search-input::-webkit-search-cancel-button { display: none; }
.search-clear {
    display: grid;
    place-items: center;
    width: 26px; height: 26px;
    flex: 0 0 auto;
    color: var(--faint);
    background: rgba(255, 255, 255, 0.05);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: color 0.2s, background 0.2s, transform 0.28s var(--spring);
}
.search-clear:hover { color: var(--text); background: rgba(255, 255, 255, 0.12); transform: scale(1.12); }

.filter-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.filter-row .spacer { flex: 1 1 auto; }
.hist-count {
    font-family: var(--sans);
    font-size: 0.68rem;
    color: var(--faint);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.hist-count b { color: var(--accent); font-weight: 600; }

/* --- list --- */
.history-list { display: flex; flex-direction: column; gap: 10px; }

.history-item {
    padding: 16px 17px;
    background: var(--pane);
    border: 1px solid var(--line-soft);
    border-radius: var(--r-md);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07);
    animation: itemIn 0.5s var(--ease) both;
    transition: background 0.25s, border-color 0.25s, transform 0.35s var(--ease), box-shadow 0.3s;
}
.history-item:hover {
    background: var(--pane-2);
    border-color: var(--line);
    transform: translateY(-2px);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.13), 0 14px 30px -18px rgba(0, 0, 0, 0.9);
}
@keyframes itemIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: none; }
}

.hi-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; row-gap: 8px; }
.hi-when {
    font-family: var(--sans);
    font-size: 0.72rem;
    color: var(--dim);
    font-variant-numeric: tabular-nums;
}
.hi-name {
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--text);
    max-width: 26ch;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.hi-dur {
    font-family: var(--sans);
    font-size: 0.68rem;
    color: var(--faint);
}
.hi-actions { display: flex; gap: 6px; margin-left: auto; }

.chip {
    display: inline-flex;
    align-items: center;
    padding: 4px 11px;
    font-family: var(--sans);
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border: 1px solid transparent;
    border-radius: 999px;
    white-space: nowrap;
}
.chip-task   { color: var(--accent); background: var(--accent-soft); border-color: rgba(216, 255, 63, 0.26); }
.chip-manual { color: var(--dim);    background: rgba(255, 255, 255, 0.04); border-color: var(--line-soft); }

.history-item .ratio-bar { margin-top: 13px; }

.mono-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
    margin-top: 11px;
}
.ms {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--sans);
    font-size: 0.68rem;
    color: var(--faint);
    font-variant-numeric: tabular-nums;
}
.ms b { color: var(--text); font-weight: 600; }

/* --- pager --- */
.pager {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--line-soft);
}
.pager:empty { display: none; }
.pager-info {
    font-family: var(--sans);
    font-size: 0.68rem;
    color: var(--faint);
    font-variant-numeric: tabular-nums;
}
.pager-info b { color: var(--dim); font-weight: 600; }
.pager-nav { display: flex; align-items: center; gap: 5px; margin-left: auto; }
.page-btn {
    display: grid;
    place-items: center;
    min-width: 34px;
    height: 34px;
    padding: 0 10px;
    font-family: var(--sans);
    font-size: 0.72rem;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    color: var(--dim);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--line-soft);
    border-radius: 11px;
    cursor: pointer;
    transition: color 0.2s, background 0.25s, border-color 0.25s, transform 0.3s var(--spring);
}
.page-btn:hover:not(:disabled):not(.current) {
    color: var(--text);
    background: var(--pane);
    border-color: var(--line);
    transform: translateY(-1.5px);
}
.page-btn:disabled { opacity: 0.32; cursor: not-allowed; }
.page-btn.current {
    color: var(--accent-ink);
    background: linear-gradient(180deg, #e6ff6d, var(--accent));
    border-color: rgba(216, 255, 63, 0.5);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), 0 8px 18px -10px var(--accent-glow);
    cursor: default;
}
.page-gap {
    padding: 0 2px;
    font-family: var(--sans);
    font-size: 0.72rem;
    color: var(--faint);
    user-select: none;
}

/* ==================================================================
   TASKS
   ================================================================== */
.tasks-list { display: flex; flex-direction: column; gap: 10px; }

.task-item {
    padding: 17px;
    background: var(--pane);
    border: 1px solid var(--line-soft);
    border-radius: var(--r-md);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07);
    animation: itemIn 0.5s var(--ease) both;
    transition: background 0.25s, border-color 0.25s, transform 0.35s var(--ease), box-shadow 0.3s;
}
.task-item:hover {
    background: var(--pane-2);
    border-color: var(--line);
    transform: translateY(-2px);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.13), 0 14px 30px -18px rgba(0, 0, 0, 0.9);
}

.task-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}
.task-name {
    display: flex;
    align-items: center;
    gap: 9px;
    flex-wrap: wrap;
    font-family: var(--disp);
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: -0.015em;
    min-width: 0;
}
.task-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.task-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    font-family: var(--sans);
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border: 1px solid transparent;
    border-radius: 999px;
}
.task-status i { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.task-status.active  { color: var(--live);   background: rgba(61, 220, 151, 0.09); border-color: rgba(61, 220, 151, 0.24); }
.task-status.paused  { color: var(--faint);  background: rgba(255, 255, 255, 0.04); border-color: var(--line-soft); }
.task-status.running { color: var(--accent); background: var(--accent-soft); border-color: rgba(216, 255, 63, 0.32); }
.task-status.running i { animation: blink 1s ease-in-out infinite; }
@keyframes blink { 50% { opacity: 0.25; } }

.task-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 13px; }
.kv {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 5px 11px;
    font-family: var(--sans);
    font-size: 0.68rem;
    color: var(--text);
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid var(--line-soft);
    border-radius: 999px;
    font-variant-numeric: tabular-nums;
}
.kv em {
    font-style: normal;
    font-size: 0.63rem;
    font-weight: 500;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--faint);
}

.task-preview {
    margin-top: 11px;
    padding: 10px 13px;
    font-family: var(--mono);
    font-size: 0.7rem;
    color: var(--dim);
    background: var(--sink);
    border: 1px solid var(--line-soft);
    border-radius: var(--r-sm);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.task-item .ratio-bar { margin-top: 13px; }

.task-error {
    margin-top: 11px;
    padding: 9px 13px;
    font-size: 0.74rem;
    color: var(--die);
    background: rgba(255, 95, 106, 0.08);
    border: 1px solid rgba(255, 95, 106, 0.22);
    border-radius: var(--r-sm);
}

/* ==================================================================
   SETTINGS
   ================================================================== */
.row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}
.row-left { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.row-label { font-size: 0.88rem; font-weight: 600; }
.row-sub { font-size: 0.77rem; color: var(--faint); }

.bg-preview {
    position: relative;
    display: grid;
    place-items: center;
    height: 190px;
    background: var(--sink);
    border: 1px solid var(--line-soft);
    border-radius: var(--r-md);
    overflow: hidden;
    box-shadow: inset 0 2px 12px rgba(0, 0, 0, 0.4);
}
.bg-preview img, .bg-preview video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
#bgPlaceholder {
    font-family: var(--sans);
    font-size: 0.76rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    color: var(--faint);
}
.bg-actions { display: flex; gap: 8px; margin-top: 13px; flex-wrap: wrap; }

.api-key-display {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}
.api-key-value {
    flex: 1;
    min-width: 0;
    padding: 12px 15px;
    font-family: var(--mono);
    font-size: 0.78rem;
    color: var(--faint);
    background: var(--sink);
    border: 1px solid var(--line-soft);
    border-radius: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.api-key-value.set { color: var(--accent); }

/* one big settings pane, hairline-separated sections — cheaper and calmer
   than four stacked panes each running its own backdrop-filter */
.setting-block {
    padding: 24px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.09);
}
/* :first-of-type would look past .card-head, which is a div too */
.card-head + .setting-block { padding-top: 0; border-top: none; }
.setting-block:last-child { padding-bottom: 0; }
.block-head { display: flex; flex-direction: column; gap: 3px; margin-bottom: 15px; }

/* ==================================================================
   MODAL
   ================================================================== */
.modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 60;
    align-items: center;
    justify-content: center;
    padding: calc(20px + env(safe-area-inset-top)) 18px calc(20px + env(safe-area-inset-bottom));
    background: rgba(2, 3, 8, 0.5);
    -webkit-backdrop-filter: blur(10px) saturate(1.2);
    backdrop-filter: blur(10px) saturate(1.2);
}
.modal-backdrop.active { display: flex; animation: fadeIn 0.26s ease both; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
    position: relative;
    width: 100%;
    max-width: 660px;
    max-height: min(86svh, 820px);
    display: flex;
    flex-direction: column;
    border-radius: var(--r-xl);
    overflow: hidden;
}
/* opacity + transform only — an animated filter:blur() on a sheet this
   large is a full-viewport gaussian re-render on every frame */
.modal-backdrop.active .modal { animation: popIn 0.42s var(--spring) both; }
@keyframes popIn {
    from { opacity: 0; transform: translateY(26px) scale(0.96); }
    to   { opacity: 1; transform: none; }
}

.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 20px 22px 16px;
    border-bottom: 1px solid var(--line-soft);
}
.modal-title {
    font-family: var(--disp);
    font-size: 1.02rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}
.modal-body { padding: 20px 22px; overflow-y: auto; overscroll-behavior: contain; }
.modal-foot {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    padding: 14px 22px;
    border-top: 1px solid var(--line-soft);
    background: rgba(0, 0, 0, 0.18);
}
.modal-foot:empty { display: none; }

.form-stack { display: flex; flex-direction: column; gap: 17px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 17px; }
.form-grid .full { grid-column: 1 / -1; }

.detail-summary {
    padding: 15px 16px;
    margin-bottom: 16px;
    background: var(--pane);
    border: 1px solid var(--line-soft);
    border-radius: var(--r-md);
}
.detail-summary .hi-top { row-gap: 6px; }
.detail-summary .ratio-bar { margin-top: 12px; }

.modal .results-list { max-height: 340px; }
.modal-table {
    background: var(--sink);
    border: 1px solid var(--line-soft);
    border-radius: var(--r-md);
    overflow: hidden;
}
.modal-table .results-table-head { padding-top: 11px; }

/* ==================================================================
   TOAST
   ================================================================== */
.toast {
    position: fixed;
    left: 50%;
    bottom: calc(26px + env(safe-area-inset-bottom));
    z-index: 80;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px 12px 17px;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text);
    background: rgba(14, 16, 24, 0.72);
    -webkit-backdrop-filter: blur(18px) saturate(1.6);
    backdrop-filter: blur(18px) saturate(1.6);
    border: 1px solid var(--line);
    border-radius: 999px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 18px 44px -16px rgba(0, 0, 0, 0.9);
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, 22px);
    transition: opacity 0.32s var(--ease), transform 0.42s var(--spring);
}
.toast::before {
    content: "";
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--live);
    box-shadow: 0 0 10px currentColor;
    flex: 0 0 auto;
}
.toast.error::before { background: var(--die); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ==================================================================
   RESPONSIVE
   ================================================================== */
@media (max-width: 1020px) {
    .checker-grid { grid-template-columns: 1fr; }
    .editor textarea { min-height: 250px; }
    .results-empty { min-height: 220px; }
}

@media (max-width: 760px) {
    .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .filter-row .spacer { display: none; }
    .filter-row { gap: 7px; }
    .seg { width: 100%; }
    .seg-btn { flex: 1; padding: 7px 10px; text-align: center; }
}

@media (max-width: 640px) {
    .shell {
        padding:
            calc(18px + env(safe-area-inset-top))
            calc(14px + env(safe-area-inset-right))
            calc(44px + env(safe-area-inset-bottom))
            calc(14px + env(safe-area-inset-left));
    }
    .app-header { padding: 11px 12px 11px 13px; border-radius: var(--r-lg); }
    .app-tag { display: none; }
    .card { padding: 18px 16px; border-radius: var(--r-lg); }
    .form-grid { grid-template-columns: 1fr; }
    .hi-actions { width: 100%; margin-left: 0; }
    .kbd-hint { display: none; }
    .timer { margin-left: auto; }
    .lock-card { padding: 36px 24px 30px; }
    .results-table-head, .result-row { grid-template-columns: 30px minmax(0, 1fr) 94px; gap: 8px; }
    .pager { justify-content: center; }
    .pager-nav { margin-left: 0; width: 100%; justify-content: center; flex-wrap: wrap; }
    .pager-info { width: 100%; text-align: center; }
    .modal-head, .modal-body, .modal-foot { padding-left: 17px; padding-right: 17px; }
}

/* all four tabs have to fit a phone without a horizontal scroll */
@media (max-width: 430px) {
    .tabs { display: flex; width: 100%; }
    .tabs > .tab { flex: 1; padding: 9px 8px; font-size: 0.72rem; text-align: center; }
}

/* iOS auto-zooms any focused field under 16px and does not reliably
   zoom back out — every text field on a touch device gets 16px. */
@media (pointer: coarse) {
    .input, .search-input, textarea.input, .select-field select, .editor textarea {
        font-size: 16px;
    }
    .line-numbers { font-size: 16px; line-height: 24px; }
    .editor textarea { line-height: 24px; }
    .hi-actions, .task-actions { width: 100%; margin-left: 0; }
}

/* ==================================================================
   LITE PIPELINE
   Safari composites backdrop-filters and blend modes far slower than
   Chromium, and phones pay for all of it in battery and jank. Same
   look, none of the cost: solid gradients instead of live blur.
   ================================================================== */
html.lite .grade,
html.lite .grain { display: none; }

html.lite .orb { opacity: 0.7; animation: none; will-change: auto; }
html.lite #wall::after {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(3, 5, 9, 0.36);
}

html.lite .lg,
html.lite .lg-r,
html.lite .toast,
html.lite .modal-backdrop {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
}
html.lite .lg   { background: linear-gradient(180deg, rgba(30, 33, 44, 0.72), rgba(13, 15, 23, 0.82)); }
html.lite .lg-r { background: linear-gradient(180deg, rgba(33, 36, 48, 0.78), rgba(14, 16, 24, 0.86)); }
html.lite .lock-card { background: linear-gradient(180deg, rgba(24, 27, 38, 0.9), rgba(10, 12, 19, 0.94)); }
html.lite .modal { background: rgba(11, 13, 20, 0.97); }
html.lite .toast { background: rgba(15, 17, 25, 0.94); }
html.lite .modal-backdrop { background: rgba(2, 3, 8, 0.74); }

/* the pointer cursor and its blend mode are pure cost on touch devices */
html.lite .cur, html.lite .curR { display: none; }

/* no animated blur transitions anywhere in lite */
html.lite .riser, html.lite .modal, html.lite .lock-card { filter: none; }
html.lite .lock-bg-media { animation: none; }

/* ==================================================================
   REDUCED MOTION
   ================================================================== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-delay: 0s !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.12s !important;
    }
    .orb { animation: none; will-change: auto; }
    .lock-bg-media { animation: none; }
    .riser { opacity: 1; transform: none; }
    .btn:hover, .stat:hover, .history-item:hover, .task-item:hover, .page-btn:hover { transform: none; }
}
