:root {
    --ink: #17181d;
    --muted: #6f7480;
    --line: #dfe3ea;
    --paper: #ffffff;
    --soft: #f4f7fb;
    --accent: #0f8b8d;
    --accent-dark: #096365;
    --warm: #f36f45;
    --danger: #b42318;
    --radius: 8px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    color: var(--ink);
    background: linear-gradient(180deg, #f8fafc 0%, #eef4f4 100%);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.5;
}

a {
    color: inherit;
}

main {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    padding: 34px 0 64px;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 16px max(16px, calc((100vw - 1180px) / 2));
    background: rgba(255, 255, 255, .88);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(16px);
}

.brand {
    font-weight: 800;
    text-decoration: none;
    letter-spacing: 0;
}

.topbar nav {
    display: flex;
    align-items: center;
    gap: 14px;
}

.button,
button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 18px;
    border: 0;
    border-radius: var(--radius);
    color: #fff;
    background: var(--accent);
    font: inherit;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}

.button:hover,
button:hover {
    background: var(--accent-dark);
}

.button-small {
    min-height: 34px;
    padding-inline: 12px;
    font-size: 14px;
}

.button-muted {
    color: var(--accent-dark);
    background: #dff1ef;
}

.button-muted:hover {
    color: #fff;
    background: var(--accent-dark);
}

.link-button {
    min-height: auto;
    padding: 0;
    color: var(--ink);
    background: transparent;
    border-radius: 0;
    font-weight: 600;
}

.link-button:hover {
    color: var(--accent-dark);
    background: transparent;
}

.danger {
    color: var(--danger);
}

.inline {
    display: inline;
}

.flash {
    width: min(1180px, calc(100% - 32px));
    margin: 18px auto 0;
    padding: 12px 14px;
    border-radius: var(--radius);
    border: 1px solid #b9e1da;
    background: #e8f7f4;
    color: #064e45;
}

.flash.warn {
    border-color: #ffd5a8;
    background: #fff4e6;
    color: #7a3b00;
}

.hero,
.dashboard-head,
.collection-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 380px;
    gap: 28px;
    align-items: start;
    padding: 42px 0;
}

.hero {
    min-height: 420px;
    grid-template-columns: minmax(0, 650px);
    align-items: center;
    background:
        linear-gradient(110deg, rgba(255,255,255,.95) 0%, rgba(255,255,255,.74) 48%, rgba(255,255,255,0) 72%),
        url("/assets/hero-news.jpg") center/cover;
    border-bottom: 1px solid var(--line);
    margin: -34px calc(50% - 50vw) 34px;
    padding-inline: max(16px, calc((100vw - 1180px) / 2));
}

.kicker {
    margin: 0 0 8px;
    color: var(--warm);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

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

h1 {
    max-width: 780px;
    font-size: clamp(36px, 5vw, 64px);
    line-height: 1.02;
    margin-bottom: 18px;
}

h2 {
    font-size: 22px;
}

.muted,
small {
    color: var(--muted);
}

.auth-panel,
.panel,
.create-card,
.settings-form,
.collection-card,
.entry {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: 0 14px 45px rgba(29, 37, 48, .08);
}

.auth-panel {
    width: min(460px, 100%);
    margin: 58px auto;
    padding: 28px;
}

.legal-page {
    width: min(860px, 100%);
    margin: 0 auto;
    padding: 26px 0 24px;
}

.legal-page h1 {
    font-size: clamp(34px, 5vw, 52px);
}

.legal-block {
    padding: 22px 0;
    border-top: 1px solid var(--line);
}

.legal-block h2 {
    margin-bottom: 10px;
}

.legal-block p {
    color: #30343b;
}

.form,
.create-card,
.settings-form,
.detected {
    display: grid;
    gap: 14px;
}

.form-link {
    color: var(--accent-dark);
    font-weight: 700;
    text-decoration: none;
}

.form-link:hover {
    text-decoration: underline;
}

.create-card,
.settings-form,
.panel {
    padding: 20px;
}

label {
    display: grid;
    gap: 6px;
    font-weight: 700;
}

input,
select {
    width: 100%;
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 9px 11px;
    background: #fff;
    color: var(--ink);
    font: inherit;
}

.check {
    grid-template-columns: auto 1fr;
    align-items: center;
    font-weight: 600;
}

.check input,
.choice input {
    width: 18px;
    min-height: 18px;
}

.collection-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
}

.collection-card {
    display: grid;
    gap: 8px;
    padding: 18px;
    text-decoration: none;
}

.collection-card strong {
    font-size: 20px;
}

.tag {
    display: inline-flex;
    position: relative;
    width: fit-content;
    align-items: center;
    min-height: 24px;
    padding: 0 9px;
    border-radius: 999px;
    background: #edf6f6;
    color: var(--accent-dark);
    font-size: 12px;
    font-weight: 800;
}

.feed-count {
    cursor: help;
    outline: none;
}

.feed-bubble {
    position: absolute;
    left: 0;
    top: calc(100% + 10px);
    z-index: 20;
    display: grid;
    gap: 6px;
    width: max-content;
    max-width: min(340px, calc(100vw - 48px));
    max-height: 260px;
    overflow: auto;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    box-shadow: 0 18px 48px rgba(29, 37, 48, .18);
    color: var(--ink);
    font-size: 13px;
    font-weight: 650;
    line-height: 1.35;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-4px);
    transition: opacity .16s ease, transform .16s ease;
}

.feed-bubble::before {
    content: "";
    position: absolute;
    left: 16px;
    top: -6px;
    width: 10px;
    height: 10px;
    border-left: 1px solid var(--line);
    border-top: 1px solid var(--line);
    background: #fff;
    transform: rotate(45deg);
}

.feed-bubble span {
    overflow-wrap: anywhere;
}

.feed-count:hover .feed-bubble,
.feed-count:focus .feed-bubble,
.feed-count:focus-within .feed-bubble {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.split {
    display: grid;
    grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr);
    gap: 18px;
}

.choice,
.source {
    display: grid;
    gap: 8px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--soft);
}

.choice {
    grid-template-columns: auto minmax(0, 1fr);
    align-items: start;
}

.choice small,
.source small {
    display: block;
    overflow-wrap: anywhere;
}

.source-list {
    display: grid;
    gap: 12px;
}

.feed-header {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 20px;
    padding: 34px 0 24px;
}

.feed-header h1 {
    margin-bottom: 0;
}

.limit-form {
    display: flex;
    align-items: end;
    gap: 10px;
}

.limit-form label {
    width: 120px;
}

.feed-list {
    display: grid;
    gap: 18px;
}

.entry {
    padding: 20px;
}

.entry-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    color: var(--muted);
    font-size: 14px;
}

.entry h2 {
    margin-bottom: 10px;
}

.entry h2 a {
    text-decoration-color: rgba(15, 139, 141, .35);
    text-underline-offset: 4px;
}

.video-frame {
    aspect-ratio: 16 / 9;
    width: min(760px, 100%);
    overflow: hidden;
    border-radius: var(--radius);
    background: #111;
}

.video-frame iframe {
    width: 100%;
    height: 100%;
    border: 0;
}

.video-consent {
    display: grid;
    gap: 16px;
    width: min(760px, 100%);
    min-height: 220px;
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background:
        linear-gradient(135deg, rgba(15, 139, 141, .14), rgba(243, 111, 69, .12)),
        #f8fbfc;
}

.video-consent strong {
    display: block;
    margin-bottom: 6px;
    font-size: 20px;
}

.video-consent p {
    max-width: 560px;
    margin: 0;
    color: var(--muted);
}

.video-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-self: end;
}

.pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding-top: 26px;
}

.empty {
    padding: 30px;
    border: 1px dashed var(--line);
    border-radius: var(--radius);
    background: rgba(255,255,255,.6);
    text-align: center;
}

@media (max-width: 840px) {
    main {
        width: min(100% - 24px, 1180px);
    }

    .hero,
    .dashboard-head,
    .collection-head,
    .split {
        grid-template-columns: 1fr;
    }

    .hero {
        min-height: 520px;
        background:
            linear-gradient(180deg, rgba(255,255,255,.96) 0%, rgba(255,255,255,.86) 62%, rgba(255,255,255,.46) 100%),
            url("/assets/hero-news.jpg") center/cover;
    }

    .feed-header,
    .limit-form {
        align-items: stretch;
        flex-direction: column;
    }

    .limit-form label {
        width: 100%;
    }
}

.field-hint {
    color: var(--muted);
    font-size: 13px;
    font-weight: 500;
    overflow-wrap: anywhere;
}

.site-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    padding: 24px 0 32px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 14px;
}

.site-footer nav {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
}

.site-footer a {
    color: var(--ink);
    font-weight: 700;
    text-decoration: none;
}

.site-footer a:hover {
    color: var(--accent-dark);
}

@media (max-width: 620px) {
    .site-footer {
        align-items: flex-start;
        flex-direction: column;
    }
}
