:root {
    color-scheme: light;
    --bg: #f4f6f8;
    --surface: #ffffff;
    --surface-2: #eef3f1;
    --text: #18212f;
    --muted: #627084;
    --line: #d7dde5;
    --accent: #18735f;
    --accent-dark: #0d5d4b;
    --danger: #9a3412;
    --danger-bg: #fff2e8;
    --warning-bg: #fff8df;
    --warning-text: #744c00;
    --shadow: 0 18px 48px rgba(24, 33, 47, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.5;
}

a {
    color: inherit;
}

button,
input {
    font: inherit;
}

.shell {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
    padding: 32px 0 48px;
}

.workspace {
    display: grid;
    gap: 20px;
}

.topbar,
.section-head {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 16px;
}

.eyebrow {
    margin: 0 0 4px;
    color: var(--accent);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 0;
    font-size: clamp(2rem, 5vw, 4.5rem);
    line-height: 0.95;
}

h2 {
    margin-bottom: 0;
    font-size: 1.25rem;
}

h3 {
    margin-bottom: 6px;
    font-size: 1.02rem;
}

.status-pill,
.section-head > span {
    flex: 0 0 auto;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 7px 12px;
    background: var(--surface);
    color: var(--muted);
    font-size: 0.88rem;
    font-weight: 700;
}

.scan-form,
.panel,
.results,
.empty-state {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.scan-form {
    display: grid;
    gap: 12px;
    padding: 18px;
}

.scan-form > label:not(.check-row) {
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 700;
}

.input-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
}

.input-row input {
    width: 100%;
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 13px 14px;
    color: var(--text);
    background: #fbfcfd;
    outline: none;
}

.input-row input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(24, 115, 95, 0.14);
}

.input-row button,
.copy-btn,
.open-btn {
    border: 0;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 800;
    text-decoration: none;
    white-space: nowrap;
}

.input-row button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0 18px;
    background: var(--accent);
    color: #fff;
}

.input-row button:hover,
.copy-btn:hover {
    background: var(--accent-dark);
}

.check-row {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    color: var(--muted);
    font-size: 0.92rem;
}

.check-row input {
    width: 17px;
    height: 17px;
    accent-color: var(--accent);
}

.notice {
    margin-bottom: 0;
    color: var(--muted);
    font-size: 0.92rem;
}

.is-hidden {
    display: none !important;
}

.input-row button:disabled {
    cursor: wait;
    opacity: 0.72;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(120px, 1fr)) minmax(240px, 2.2fr);
    gap: 12px;
}

.metric {
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    padding: 14px;
}

.metric span {
    display: block;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
}

.metric strong {
    display: block;
    overflow: hidden;
    margin-top: 6px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.panel {
    padding: 16px;
}

.panel p,
.empty-state p {
    margin-bottom: 0;
    color: var(--muted);
}

.error-panel {
    border-color: #fed7aa;
    background: var(--danger-bg);
    color: var(--danger);
}

.warning-panel {
    border-color: #f5d876;
    background: var(--warning-bg);
    color: var(--warning-text);
}

.results {
    display: grid;
    gap: 16px;
    padding: 18px;
}

.result-list {
    display: grid;
    gap: 10px;
}

.result-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 16px;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px;
    background: #fbfcfd;
}

.result-main {
    min-width: 0;
}

.result-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 0.82rem;
}

.result-meta span {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 2px 8px;
    background: var(--surface);
}

.result-meta .kind {
    border-color: transparent;
    background: #dff4ec;
    color: #0d5d4b;
    font-weight: 900;
}

.result-meta .hls,
.result-meta .dash {
    background: #e7ecfb;
    color: #29437a;
}

.media-url {
    display: block;
    overflow-wrap: anywhere;
    color: #1c4f75;
    font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
    font-size: 0.9rem;
    text-decoration: none;
}

.media-url:hover {
    text-decoration: underline;
}

.actions {
    display: flex;
    gap: 8px;
}

.copy-btn,
.open-btn {
    min-width: 68px;
    padding: 9px 12px;
    text-align: center;
}

.copy-btn {
    background: var(--accent);
    color: #fff;
}

.open-btn {
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--text);
}

.open-btn:hover {
    background: var(--surface-2);
}

.empty-state {
    padding: 18px;
    box-shadow: none;
}

@media (max-width: 760px) {
    .shell {
        width: min(100% - 20px, 1120px);
        padding-top: 18px;
    }

    .topbar,
    .section-head,
    .result-item {
        align-items: stretch;
        flex-direction: column;
    }

    .topbar,
    .section-head {
        display: grid;
    }

    h1 {
        font-size: 2.7rem;
    }

    .input-row,
    .summary-grid,
    .result-item {
        grid-template-columns: 1fr;
    }

    .input-row button {
        justify-content: center;
        min-height: 46px;
    }

    .actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }
}
