:root {
    color-scheme: light;
    --bg: #f5f7f8;
    --ink: #142127;
    --muted: #61717a;
    --line: #d8e1e5;
    --panel: #ffffff;
    --panel-soft: #eef4f5;
    --brand: #0f766e;
    --brand-dark: #115e59;
    --accent: #b45309;
    --danger: #b42318;
    --ok: #137333;
    --shadow: rgba(20, 33, 39, 0.08);
}

html[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0d1418;
    --ink: #edf4f5;
    --muted: #a9b7bd;
    --line: #26363d;
    --panel: #121d22;
    --panel-soft: #17262c;
    --brand: #2dd4bf;
    --brand-dark: #5eead4;
    --accent: #fbbf24;
    --danger: #fb7185;
    --ok: #86efac;
    --shadow: rgba(0, 0, 0, 0.3);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.app-body .text-slate-500,
.app-body .text-slate-600,
.app-body .text-slate-900 {
    color: inherit !important;
}

.hidden {
    display: none !important;
}

.app-header {
    position: sticky;
    top: 0;
    z-index: 30;
    border-bottom: 1px solid var(--line);
    background: color-mix(in srgb, var(--panel) 94%, transparent);
    backdrop-filter: blur(10px);
}

.brand-lockup {
    display: inline-flex;
    align-items: center;
    gap: 0.7rem;
    color: var(--ink);
    text-decoration: none;
}

.brand-mark {
    display: inline-flex;
    width: 2.25rem;
    height: 2.25rem;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: var(--ink);
    color: var(--panel);
    font-weight: 800;
    letter-spacing: 0;
}

.status-pill,
.icon-link {
    display: inline-flex;
    min-height: 2rem;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--muted);
    font-size: 0.82rem;
    line-height: 1;
    text-decoration: none;
}

html[data-theme="dark"] .status-pill,
html[data-theme="dark"] .icon-link,
html[data-theme="dark"] .tool-btn,
html[data-theme="dark"] .field,
html[data-theme="dark"] .filter-field {
    background: var(--panel);
}

.status-pill {
    padding: 0 0.65rem;
    cursor: pointer;
}

.status-pill.private {
    color: var(--accent);
    border-color: #f3d6a9;
    background: #fff8ec;
}

.status-pill.open {
    color: var(--brand-dark);
    border-color: #b9ded9;
    background: #edf8f6;
}

.status-pill.premium-active {
    color: var(--accent);
    border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
    background: color-mix(in srgb, var(--accent) 12%, var(--panel));
}

.status-pill.free-mode {
    color: var(--ok);
    border-color: color-mix(in srgb, var(--ok) 38%, var(--line));
    background: color-mix(in srgb, var(--ok) 12%, var(--panel));
}

.icon-link {
    width: 2rem;
    font-size: 1rem;
}

.icon-link:hover {
    border-color: #aab9c0;
    color: var(--ink);
}

.control-panel,
.results-shell {
    min-width: 0;
}

.control-panel {
    display: grid;
    align-content: start;
    gap: 1rem;
}

@media (min-width: 1024px) {
    .control-panel {
        position: sticky;
        top: 5rem;
        max-height: calc(100vh - 6rem);
        overflow: auto;
        padding-right: 0.15rem;
    }
}

.form-label {
    display: block;
    margin-bottom: 0.35rem;
    color: #33434b;
    font-size: 0.86rem;
    font-weight: 650;
}

.field,
.filter-field {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    color: var(--ink);
    outline: none;
    transition: border-color 0.14s ease, box-shadow 0.14s ease;
}

.field {
    min-height: 2.85rem;
    padding: 0.7rem 0.8rem;
}

.filter-field {
    min-height: 2.35rem;
    padding: 0.45rem 0.7rem 0.45rem 2rem;
    font-size: 0.9rem;
}

.field:focus,
.filter-field:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.primary-btn,
.tool-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    border-radius: 8px;
    font-weight: 700;
    line-height: 1;
    transition: background 0.14s ease, border-color 0.14s ease, color 0.14s ease, transform 0.14s ease;
}

.primary-btn {
    min-height: 2.85rem;
    border: 1px solid var(--brand);
    background: var(--brand);
    color: #fff;
    padding: 0 1rem;
}

.primary-btn.compact {
    min-height: 2.35rem;
    white-space: nowrap;
}

.primary-btn:hover {
    background: var(--brand-dark);
}

.primary-btn:active,
.tool-btn:active {
    transform: translateY(1px);
}

.tool-btn {
    min-height: 2.35rem;
    border: 1px solid var(--line);
    background: #fff;
    color: #33434b;
    padding: 0 0.75rem;
    font-size: 0.88rem;
}

.tool-btn:hover {
    border-color: #aab9c0;
    color: var(--ink);
}

.tool-btn:disabled {
    cursor: not-allowed;
    opacity: 0.45;
}

.metrics-panel,
.toolbar {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
}

.status-filters {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.status-filter {
    min-height: 2.35rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    color: var(--muted);
    padding: 0 0.7rem;
    font-size: 0.86rem;
    font-weight: 750;
    cursor: pointer;
}

.status-filter.active {
    color: var(--ink);
    border-color: #9aaab1;
    background: var(--panel-soft);
}

.status-filter.valid {
    border-color: color-mix(in srgb, var(--ok) 35%, var(--line));
    color: var(--ok);
}

.status-filter.valid.active {
    background: color-mix(in srgb, var(--ok) 16%, var(--panel));
}

.status-filter.invalid {
    border-color: color-mix(in srgb, var(--danger) 35%, var(--line));
    color: var(--danger);
}

.status-filter.invalid.active {
    background: color-mix(in srgb, var(--danger) 14%, var(--panel));
}

.metrics-panel {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow: hidden;
}

.metric-row {
    display: flex;
    min-height: 4.25rem;
    flex-direction: column;
    justify-content: center;
    gap: 0.35rem;
    border-bottom: 1px solid var(--line);
    padding: 0.8rem;
    color: var(--muted);
    font-size: 0.82rem;
}

.metric-row:nth-child(odd) {
    border-right: 1px solid var(--line);
}

.metric-row:nth-last-child(-n + 2) {
    border-bottom: 0;
}

.metric-row strong {
    color: var(--ink);
    font-size: 1.35rem;
    line-height: 1;
}

.metric-row.valid strong {
    color: var(--ok);
}

.metric-row.invalid strong {
    color: var(--danger);
}

.metric-row.pending strong {
    color: var(--accent);
}

.toolbar {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.5rem;
    padding: 0.6rem;
}

.results-shell {
    display: grid;
    gap: 1rem;
}

.results-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    border-bottom: 1px solid var(--line);
    padding-bottom: 0.9rem;
}

.filter-wrap {
    position: relative;
    width: min(100%, 18rem);
}

.filter-wrap i {
    pointer-events: none;
    position: absolute;
    left: 0.65rem;
    top: 50%;
    transform: translateY(-50%);
}

.results-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 0.85rem;
}

.profile-card {
    display: grid;
    min-width: 0;
    gap: 0.75rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    padding: 0.9rem;
    box-shadow: 0 4px 14px var(--shadow);
    cursor: pointer;
}

.profile-card:hover,
.profile-card:focus-visible {
    border-color: #b6c4ca;
    outline: none;
    box-shadow: 0 6px 18px var(--shadow);
}

.card-header {
    display: grid;
    grid-template-columns: 2.25rem minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.75rem;
}

.platform-icon {
    display: inline-flex;
    width: 2.25rem;
    height: 2.25rem;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: var(--panel-soft);
    color: var(--ink);
    font-size: 1.1rem;
}

.platform-info {
    min-width: 0;
}

.platform-info h3 {
    margin: 0;
    overflow: hidden;
    color: var(--ink);
    font-size: 0.98rem;
    font-weight: 750;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.platform-info p,
.card-meta {
    overflow-wrap: anywhere;
    color: var(--muted);
    font-size: 0.78rem;
}

.card-meta {
    display: grid;
    gap: 0.35rem;
    border-top: 1px solid var(--line);
    padding-top: 0.7rem;
}

.status-badge {
    display: inline-flex;
    min-height: 1.65rem;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: 0 0.55rem;
    font-size: 0.72rem;
    font-weight: 800;
    line-height: 1;
    white-space: nowrap;
}

.status-badge.valid {
    background: #e6f4ea;
    color: var(--ok);
}

.status-badge.invalid {
    background: #fce8e6;
    color: var(--danger);
}

.status-badge.pending {
    background: #fff3d8;
    color: var(--accent);
}

.visit-link {
    display: inline-flex;
    width: fit-content;
    align-items: center;
    gap: 0.35rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--brand-dark);
    font-size: 0.84rem;
    font-weight: 700;
    padding: 0.45rem 0.65rem;
    text-decoration: none;
}

.visit-link:hover {
    border-color: #9ccac4;
    background: #edf8f6;
}

.results-container.details-hidden .card-meta {
    display: none;
}

.empty-state {
    display: flex;
    min-height: 10rem;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    border: 1px dashed #bdcbd1;
    border-radius: 8px;
    color: var(--muted);
}

.empty-state i {
    font-size: 1.35rem;
}

.loading-inline {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    color: var(--muted);
}

.loading-spinner,
.spinner-xl {
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}

.loading-spinner {
    width: 1.4rem;
    height: 1.4rem;
    border: 3px solid #c7d4d8;
    border-top-color: var(--brand);
}

.spinner-xl {
    width: 3rem;
    height: 3rem;
    border: 5px solid #d3dee2;
    border-top-color: var(--brand);
}

.overlay-loader {
    display: flex;
    height: 100%;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.9rem;
    color: var(--ink);
    font-weight: 700;
}

.console-panel {
    overflow: hidden;
    border: 1px solid #22333a;
    border-radius: 8px;
    background: #101c22;
    color: #b8f3d1;
}

.console-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #263a42;
    padding: 0.75rem 0.9rem;
    color: #d7ffe7;
    font-size: 0.82rem;
    font-weight: 750;
}

#console {
    max-height: 16rem;
    overflow: auto;
    padding: 0.9rem;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.78rem;
    line-height: 1.45;
}

.cookie-banner {
    position: fixed;
    inset: auto 0 0 0;
    z-index: 60;
    border-top: 1px solid var(--line);
    background: color-mix(in srgb, var(--panel) 97%, transparent);
    box-shadow: 0 -10px 30px var(--shadow);
}

.cookie-inner {
    display: flex;
    width: min(100%, 78rem);
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin: 0 auto;
    padding: 1rem;
}

.cookie-inner a {
    color: var(--brand-dark);
    font-weight: 650;
    text-decoration: underline;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 70;
    display: grid;
    place-items: center;
    padding: 1rem;
    background: rgba(6, 18, 24, 0.5);
    backdrop-filter: blur(6px);
}

.modal-card {
    position: relative;
    display: grid;
    width: min(100%, 26rem);
    gap: 0.85rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    color: var(--ink);
    padding: 1.25rem;
    box-shadow: 0 20px 60px var(--shadow);
}

.modal-card h2 {
    margin: 0;
    font-size: 1.25rem;
}

.modal-copy {
    margin: 0;
    color: var(--muted);
}

.modal-icon {
    display: inline-flex;
    width: 2.5rem;
    height: 2.5rem;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: color-mix(in srgb, var(--accent) 18%, var(--panel));
    color: var(--accent);
    font-size: 1.25rem;
}

.modal-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    display: inline-flex;
    width: 2rem;
    height: 2rem;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    color: var(--muted);
    cursor: pointer;
}

.premium-form {
    display: grid;
    gap: 0.75rem;
}

.premium-form label {
    display: grid;
    gap: 0.35rem;
    color: var(--muted);
    font-size: 0.86rem;
    font-weight: 650;
}

.form-error {
    margin: 0;
    color: var(--danger);
    font-size: 0.86rem;
}

.ghost-btn {
    min-height: 2.5rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    font-weight: 750;
    cursor: pointer;
}

.ghost-btn:hover {
    background: var(--panel-soft);
    color: var(--ink);
}

.doc-shell {
    width: min(100%, 64rem);
    margin: 0 auto;
    padding: 2rem 1rem 4rem;
}

.doc-panel {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    color: var(--ink);
    padding: clamp(1.2rem, 3vw, 2rem);
    box-shadow: 0 8px 28px var(--shadow);
}

.doc-kicker {
    display: inline-flex;
    margin-bottom: 0.75rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 750;
    padding: 0.25rem 0.65rem;
}

.doc-panel h1,
.doc-panel h2 {
    color: var(--ink);
}

.doc-panel h1 {
    margin: 0 0 1rem;
    font-size: clamp(1.8rem, 4vw, 2.6rem);
}

.doc-panel h2 {
    margin-top: 1.5rem;
    font-size: 1.1rem;
}

.doc-panel p,
.doc-panel li {
    color: var(--muted);
    line-height: 1.7;
}

.doc-panel a {
    color: var(--brand-dark);
    font-weight: 700;
}

.doc-footer {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 2rem;
    border-top: 1px solid var(--line);
    padding-top: 1rem;
    color: var(--muted);
}

.fade-in {
    animation: fadeInUp 0.18s ease forwards;
}

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

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.platform-icon.facebook {
    background: #e8f0fe;
    color: #1877f2;
}

.platform-icon.instagram {
    background: #fde7f0;
    color: #c13584;
}

.platform-icon.linkedin {
    background: #e6f2fa;
    color: #0a66c2;
}

.platform-icon.youtube {
    background: #fde8e8;
    color: #ff0000;
}

.platform-icon.github {
    background: #eceff3;
    color: #24292f;
}

.platform-icon.reddit {
    background: #fff0e8;
    color: #ff4500;
}

.platform-icon.twitch {
    background: #f3ecff;
    color: #6441a5;
}

.platform-icon.telegram,
.platform-icon.bluesky {
    background: #e7f5ff;
    color: #1684d8;
}

.platform-icon.mastodon {
    background: #edf0ff;
    color: #595aff;
}

.platform-icon.medium,
.platform-icon.threads,
.platform-icon.x {
    background: #eceff3;
    color: #111827;
}

.platform-icon.pinterest {
    background: #fde8ec;
    color: #bd081c;
}

.platform-icon.soundcloud {
    background: #fff2e5;
    color: #ff7700;
}

.platform-icon.spotify {
    background: #e7f7ed;
    color: #1db954;
}

@media (max-width: 768px) {
    .results-topbar,
    .cookie-inner {
        align-items: stretch;
        flex-direction: column;
    }

    .filter-wrap {
        width: 100%;
    }

    .status-filters {
        width: 100%;
    }

    .status-filter {
        flex: 1;
    }
}

@media (max-width: 480px) {
    .toolbar {
        grid-template-columns: 1fr;
    }

    .metrics-panel {
        grid-template-columns: 1fr;
    }

    .metric-row,
    .metric-row:nth-child(odd) {
        border-right: 0;
    }

    .metric-row:nth-last-child(2) {
        border-bottom: 1px solid var(--line);
    }
}

@media (prefers-reduced-motion: reduce) {
    .loading-spinner,
    .spinner-xl,
    .fade-in {
        animation: none;
    }
}
