:root {
    color-scheme: dark;
    --bg: #08101c;
    --panel: #111c2e;
    --panel-raised: #18253a;
    --text: #f4f7fb;
    --muted: #93a4bb;
    --border: rgba(148, 163, 184, 0.16);
    --border-strong: rgba(148, 163, 184, 0.3);
    --green: #4ade80;
    --green-bright: #8af0ad;
    --green-deep: #16a34a;
    --amber: #fbbf24;
    --red: #fb7185;
    --shadow: 0 22px 55px rgba(0, 0, 0, 0.3);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--bg);
    -webkit-text-size-adjust: 100%;
}

body {
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0;
    background:
        radial-gradient(circle at 12% -12%, rgba(34, 197, 94, 0.17), transparent 42%),
        radial-gradient(circle at 102% 0%, rgba(56, 189, 248, 0.08), transparent 38%),
        var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

button,
input {
    font: inherit;
}

button {
    -webkit-tap-highlight-color: transparent;
}

[hidden] {
    display: none !important;
}

.app {
    width: min(100%, 980px);
    margin: 0 auto;
    padding: clamp(20px, 3.8vw, 42px) clamp(18px, 4vw, 38px) 36px;
}

.hero {
    padding-top: max(0px, env(safe-area-inset-top));
}

.hero-top {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
}

.brand {
    display: flex;
    align-items: center;
    min-width: 0;
    gap: clamp(12px, 2.2vw, 20px);
}

.mark {
    display: grid;
    flex: none;
    width: clamp(52px, 8vw, 68px);
    height: clamp(52px, 8vw, 68px);
    place-items: center;
    border: 1px solid rgba(134, 239, 172, 0.3);
    border-radius: 20px;
    background: linear-gradient(145deg, #1f9d55, #126b39);
    box-shadow: 0 14px 34px rgba(22, 163, 74, 0.24), inset 0 1px rgba(255, 255, 255, 0.17);
    color: #d9ffe6;
}

.mark svg {
    width: 58%;
    height: 58%;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.6;
}

.mark .bull {
    fill: currentColor;
    stroke: none;
}

.eyebrow {
    margin: 0 0 5px;
    color: var(--green-bright);
    font-size: clamp(0.7rem, 1.2vw, 0.82rem);
    font-weight: 750;
    letter-spacing: 0.2em;
    line-height: 1;
    text-transform: uppercase;
}

h1 {
    margin: 0;
    font-size: clamp(2rem, 4.4vw, 3.15rem);
    font-weight: 780;
    letter-spacing: -0.035em;
    line-height: 1.02;
}

.counter {
    flex: none;
    text-align: right;
}

.counter-value {
    display: flex;
    align-items: baseline;
    justify-content: flex-end;
    color: var(--muted);
    font-size: clamp(2.35rem, 5.5vw, 3.65rem);
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.055em;
    line-height: 0.95;
    white-space: nowrap;
}

#checkedCount {
    color: var(--green);
}

.counter-divider {
    margin: 0 0.12em;
    color: rgba(148, 163, 184, 0.45);
    font-size: 0.6em;
    font-weight: 600;
}

.counter-total {
    color: var(--muted);
    font-size: 0.63em;
    font-weight: 700;
}

.counter-label {
    margin-top: 8px;
    color: var(--muted);
    font-size: clamp(0.72rem, 1.2vw, 0.82rem);
    font-weight: 650;
    letter-spacing: 0.04em;
}

.progress {
    height: 10px;
    margin-top: clamp(20px, 3.2vw, 30px);
    overflow: hidden;
    border: 1px solid rgba(148, 163, 184, 0.1);
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.13);
}

.progress-fill {
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--green-deep), var(--green));
    box-shadow: 0 0 20px rgba(74, 222, 128, 0.5);
    transition: width 320ms ease;
}

.toolbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    margin-top: 12px;
    padding: 12px 0 14px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
    background: rgba(8, 16, 28, 0.92);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
}

.toolbar-row {
    display: flex;
    align-items: center;
    width: 100%;
    gap: 14px;
}

.filters {
    display: flex;
    width: 100%;
    gap: 8px;
    padding: 5px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: rgba(17, 28, 46, 0.96);
    box-shadow: inset 0 1px rgba(255, 255, 255, 0.025);
}

.filter-tab {
    display: inline-flex;
    flex: 1 1 0;
    align-items: center;
    justify-content: center;
    min-width: 0;
    min-height: 50px;
    gap: 8px;
    padding: 0 10px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: var(--muted);
    font-size: clamp(0.86rem, 1.7vw, 0.98rem);
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
    touch-action: manipulation;
    transition: background 150ms ease, color 150ms ease, box-shadow 150ms ease;
}

.filter-tab:hover {
    color: var(--text);
}

.filter-tab[aria-pressed="true"] {
    background: rgba(74, 222, 128, 0.15);
    box-shadow: inset 0 0 0 1px rgba(74, 222, 128, 0.3);
    color: var(--green-bright);
}

.filter-tab:focus-visible {
    outline: 3px solid var(--green-bright);
    outline-offset: 2px;
}

.filter-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 26px;
    height: 24px;
    padding: 0 7px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.13);
    color: inherit;
    font-size: 0.78rem;
    font-variant-numeric: tabular-nums;
    line-height: 1;
}

.filter-tab[aria-pressed="true"] .filter-count {
    background: rgba(74, 222, 128, 0.18);
}

.filter-short {
    display: none;
}

.search-box {
    display: flex;
    flex: 1 1 auto;
    align-items: center;
    min-width: 0;
    height: clamp(56px, 8vw, 66px);
    gap: 12px;
    padding: 0 18px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: rgba(17, 28, 46, 0.96);
    box-shadow: inset 0 1px rgba(255, 255, 255, 0.025);
    transition: border-color 160ms ease, box-shadow 160ms ease;
}

.search-box:focus-within {
    border-color: rgba(74, 222, 128, 0.58);
    box-shadow: 0 0 0 4px rgba(74, 222, 128, 0.1);
}

.search-box svg {
    flex: none;
    width: 24px;
    height: 24px;
    fill: none;
    stroke: var(--muted);
    stroke-linecap: round;
    stroke-width: 2;
}

#searchInput {
    width: 100%;
    height: 100%;
    min-width: 0;
    padding: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--text);
    font-size: clamp(1.02rem, 2vw, 1.18rem);
    font-weight: 550;
}

#searchInput::placeholder {
    color: var(--muted);
    opacity: 0.85;
}

#searchInput::-webkit-search-cancel-button {
    filter: invert(1) opacity(0.55);
}

.connection {
    display: flex;
    flex: none;
    align-items: center;
    gap: 8px;
    padding: 0 4px;
    color: var(--muted);
    font-size: 0.86rem;
    font-weight: 600;
    white-space: nowrap;
}

.connection-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--muted);
}

.connection[data-state="online"] .connection-dot {
    background: var(--green);
    box-shadow: 0 0 0 4px rgba(74, 222, 128, 0.12);
}

.connection[data-state="saving"] .connection-dot {
    background: var(--amber);
    animation: pulse 1.15s ease-in-out infinite;
}

.connection[data-state="offline"] {
    color: var(--red);
}

.connection[data-state="offline"] .connection-dot {
    background: var(--red);
}

.people {
    display: flex;
    flex-direction: column;
    gap: 11px;
    margin-top: 4px;
}

.person {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto 48px;
    align-items: center;
    width: 100%;
    min-height: clamp(76px, 10.5vw, 88px);
    gap: clamp(10px, 2vw, 18px);
    padding: 12px 18px 12px clamp(18px, 3vw, 26px);
    border: 1px solid var(--border);
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(24, 37, 58, 0.98), rgba(17, 28, 46, 0.98));
    box-shadow: inset 0 1px rgba(255, 255, 255, 0.03), 0 10px 24px rgba(0, 0, 0, 0.1);
    color: var(--text);
    text-align: left;
    cursor: pointer;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    transition: background 150ms ease, border-color 150ms ease, box-shadow 150ms ease, transform 90ms ease;
}

.person:hover {
    border-color: var(--border-strong);
}

.person:active {
    transform: scale(0.996);
}

.person:focus-visible {
    outline: 3px solid var(--green-bright);
    outline-offset: 3px;
}

.person[aria-pressed="true"] {
    border-color: rgba(74, 222, 128, 0.48);
    background: linear-gradient(180deg, rgba(34, 197, 94, 0.18), rgba(34, 197, 94, 0.09));
    box-shadow: inset 0 1px rgba(255, 255, 255, 0.04), 0 10px 28px rgba(22, 163, 74, 0.1);
}

.person-name {
    min-width: 0;
    overflow-wrap: anywhere;
    color: var(--text);
    font-size: clamp(1.28rem, 2.9vw, 1.7rem);
    font-weight: 650;
    letter-spacing: -0.018em;
    line-height: 1.18;
    transition: color 150ms ease;
}

.person[aria-pressed="true"] .person-name {
    color: var(--green-bright);
}

.person-time {
    min-width: 44px;
    color: transparent;
    font-size: 0.88rem;
    font-weight: 650;
    font-variant-numeric: tabular-nums;
    text-align: right;
    transition: color 150ms ease;
}

.person[aria-pressed="true"] .person-time {
    color: var(--green);
}

.box {
    display: grid;
    width: 46px;
    height: 46px;
    place-items: center;
    border: 2px solid rgba(148, 163, 184, 0.38);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.018);
    transition: background 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.box svg {
    width: 28px;
    height: 28px;
    fill: none;
    stroke: #05351a;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 3.2;
    opacity: 0;
    transform: scale(0.65);
    transition: opacity 140ms ease, transform 140ms ease;
}

.person[aria-pressed="true"] .box {
    border-color: var(--green);
    background: var(--green);
    box-shadow: 0 6px 18px rgba(34, 197, 94, 0.32);
}

.person[aria-pressed="true"] .box svg {
    opacity: 1;
    transform: scale(1);
}

.message {
    margin-top: 18px;
    padding: clamp(42px, 7vw, 74px) 24px;
    border: 1px dashed var(--border-strong);
    border-radius: 22px;
    background: rgba(17, 28, 46, 0.55);
    text-align: center;
}

.message-icon {
    display: grid;
    min-height: 48px;
    place-items: center;
}

.message-icon.error {
    color: var(--red);
    font-size: 2.5rem;
    font-weight: 800;
    line-height: 1;
}

.spinner {
    width: 38px;
    height: 38px;
    border: 4px solid rgba(148, 163, 184, 0.18);
    border-top-color: var(--green);
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}

.message h2 {
    margin: 16px 0 8px;
    font-size: clamp(1.25rem, 2.8vw, 1.55rem);
    letter-spacing: -0.015em;
}

.message p {
    max-width: 46ch;
    margin: 0 auto;
    color: var(--muted);
    font-size: 1rem;
    line-height: 1.6;
}

.retry {
    min-height: 56px;
    margin-top: 24px;
    padding: 0 28px;
    border: 1px solid rgba(74, 222, 128, 0.4);
    border-radius: 14px;
    background: rgba(34, 197, 94, 0.14);
    color: var(--green-bright);
    font-size: 1.02rem;
    font-weight: 700;
    cursor: pointer;
}

.retry:focus-visible {
    outline: 3px solid var(--green-bright);
    outline-offset: 3px;
}

.no-results {
    padding: 48px 20px;
    color: var(--muted);
    font-size: 1.1rem;
    text-align: center;
}

.no-results.complete {
    color: var(--green-bright);
    font-weight: 650;
}

.noscript {
    margin-top: 24px;
    padding: 20px;
    border: 1px solid rgba(251, 113, 133, 0.3);
    border-radius: 16px;
    background: rgba(251, 113, 133, 0.08);
    color: var(--red);
    text-align: center;
}

footer {
    margin-top: 26px;
    padding-bottom: max(0px, env(safe-area-inset-bottom));
    color: var(--muted);
    font-size: 0.92rem;
    line-height: 1.55;
    text-align: center;
}

.toast {
    position: fixed;
    bottom: calc(22px + env(safe-area-inset-bottom));
    left: 50%;
    z-index: 50;
    max-width: calc(100vw - 32px);
    padding: 14px 20px;
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: 14px;
    background: #1e293b;
    box-shadow: var(--shadow);
    color: var(--text);
    font-size: 0.96rem;
    font-weight: 600;
    text-align: center;
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, 10px);
    transition: opacity 180ms ease, transform 180ms ease;
}

.toast.show {
    opacity: 1;
    transform: translate(-50%, 0);
}

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

@keyframes pulse {
    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.35;
    }
}

@media (max-width: 680px) {
    .app {
        padding-right: 14px;
        padding-left: 14px;
    }

    .hero-top {
        gap: 14px;
    }

    .counter-label {
        margin-top: 5px;
    }

    .connection {
        display: none;
    }

    .filters {
        gap: 6px;
    }

    .filter-tab {
        min-height: 48px;
    }

    .person {
        grid-template-columns: minmax(0, 1fr) 46px;
        gap: 12px;
        padding-right: 14px;
    }

    .person-time {
        display: none;
    }

    .box {
        width: 44px;
        height: 44px;
    }

    .box svg {
        width: 26px;
        height: 26px;
    }
}

@media (max-width: 520px) {
    .filter-long {
        display: none;
    }

    .filter-short {
        display: inline;
    }

    .filter-tab {
        gap: 6px;
        padding: 0 6px;
        font-size: 0.84rem;
    }

    .filter-count {
        min-width: 23px;
        height: 22px;
        padding: 0 6px;
        font-size: 0.74rem;
    }
}

@media (max-width: 420px) {
    .mark {
        width: 46px;
        height: 46px;
        border-radius: 15px;
    }

    h1 {
        font-size: 1.85rem;
    }

    .eyebrow {
        font-size: 0.64rem;
    }

    .counter-value {
        font-size: 2.15rem;
    }

    .counter-label {
        font-size: 0.68rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
