* {
    box-sizing: border-box;
}

:root {
    color-scheme: dark;
    --bg: #0d0e10;
    --surface: #15171a;
    --surface-2: #1b1e22;
    --border: #2b2f35;
    --text: #f2f3f5;
    --muted: #9da3ad;
    --accent: #f2f3f5;
    --danger: #ff7070;
    --success: #76d39a;
    --radius: 14px;
    --max: 760px;
}

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

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
}

a {
    color: inherit;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    padding: 18px 28px;
    border-bottom: 1px solid rgba(255,255,255,.07);
    background: rgba(13,14,16,.92);
    backdrop-filter: blur(12px);
}

.brand {
    font-weight: 650;
    letter-spacing: -.02em;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.hello,
.text-link {
    color: var(--muted);
    font-size: .9rem;
}

.text-link {
    text-decoration: none;
}

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

.feed {
    width: min(100% - 32px, var(--max));
    margin: 0 auto;
    padding: 28px 0 80px;
}

.post {
    padding: 42px 0 54px;
    border-bottom: 1px solid var(--border);
}

.post:first-child {
    padding-top: 24px;
}

.post-date {
    color: var(--muted);
    font-size: .78rem;
    letter-spacing: .1em;
    text-transform: uppercase;
    margin-bottom: 14px;
}

.post-title {
    margin: 0 0 14px;
    font-size: clamp(1.5rem, 4vw, 2.1rem);
    letter-spacing: -.035em;
}

.post-content {
    white-space: normal;
    color: #d9dce1;
    line-height: 1.72;
    font-size: 1.02rem;
}

.carousel {
    position: relative;
    margin-top: 26px;
    overflow: hidden;
    border-radius: var(--radius);
    background: #090a0c;
    border: 1px solid var(--border);
}

.carousel-track {
    display: flex;
    transition: transform .25s ease;
}

.carousel-slide {
    min-width: 100%;
    display: grid;
    place-items: center;
    min-height: 220px;
}

.carousel-slide img {
    display: block;
    width: 100%;
    max-height: 720px;
    object-fit: contain;
}

.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 50%;
    background: rgba(0,0,0,.62);
    color: white;
    font-size: 28px;
    cursor: pointer;
}

.carousel-btn.prev { left: 12px; }
.carousel-btn.next { right: 12px; }

.carousel-dots {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 12px;
    display: flex;
    justify-content: center;
    gap: 7px;
}

.dot {
    width: 7px;
    height: 7px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(255,255,255,.38);
    cursor: pointer;
}

.dot.active {
    background: white;
}

.media-links {
    display: grid;
    gap: 10px;
    margin-top: 20px;
}

.media-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 16px 18px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    text-decoration: none;
    transition: border-color .15s ease, background .15s ease;
}

.media-card:hover {
    background: var(--surface-2);
    border-color: #444a53;
}

.media-card-label {
    font-weight: 600;
}

.media-card-host {
    color: var(--muted);
    font-size: .85rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.empty-state {
    padding: 80px 0;
    text-align: center;
    color: var(--muted);
}

.auth-page {
    display: grid;
    place-items: center;
    padding: 24px;
}

.login-card {
    width: min(100%, 390px);
    padding: 34px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: 0 20px 70px rgba(0,0,0,.28);
}

.login-brand {
    margin-bottom: 34px;
    font-size: 1.15rem;
}

.login-card h1 {
    margin: 6px 0 24px;
    letter-spacing: -.03em;
}

label {
    display: block;
    margin: 18px 0 8px;
    font-size: .9rem;
    color: #dfe2e7;
}

input,
textarea,
select {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #101215;
    color: var(--text);
    padding: 12px 13px;
    font: inherit;
    outline: none;
}

input:focus,
textarea:focus,
select:focus {
    border-color: #626975;
    box-shadow: 0 0 0 3px rgba(255,255,255,.06);
}

textarea {
    resize: vertical;
}

button,
.primary-button,
.secondary-button,
.danger-button {
    font: inherit;
}

.primary-button,
.secondary-button,
.danger-button {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    min-height: 44px;
    padding: 10px 16px;
    border-radius: 10px;
    cursor: pointer;
    text-decoration: none;
    border: 1px solid transparent;
}

.primary-button {
    width: 100%;
    margin-top: 24px;
    background: var(--accent);
    color: #0d0e10;
    font-weight: 650;
}

.button-link {
    margin-top: 16px;
}

.secondary-button {
    background: transparent;
    border-color: var(--border);
    color: var(--text);
}

.danger-button {
    background: var(--danger);
    color: #170707;
    font-weight: 650;
}

.alert {
    padding: 12px 14px;
    margin: 16px 0;
    border-radius: 10px;
    font-size: .9rem;
}

.alert.error {
    background: rgba(255,112,112,.1);
    border: 1px solid rgba(255,112,112,.25);
    color: #ffb0b0;
}

.alert.success {
    background: rgba(118,211,154,.1);
    border: 1px solid rgba(118,211,154,.25);
    color: #a8edbf;
}

.admin-shell {
    width: min(100% - 32px, 1100px);
    margin: 0 auto;
    padding: 42px 0 80px;
}

.admin-shell.narrow {
    width: min(100% - 32px, 760px);
}

.admin-header,
.page-heading {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 20px;
    margin-bottom: 28px;
}

.page-heading h1,
.admin-header h1 {
    margin: 4px 0 0;
    font-size: clamp(1.7rem, 4vw, 2.5rem);
    letter-spacing: -.04em;
}

.eyebrow {
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .11em;
    font-size: .72rem;
}

.inline-button {
    width: auto;
    margin-top: 0;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0,1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.stat-card {
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}

.stat-card strong,
.stat-card span {
    display: block;
}

.stat-card strong {
    font-size: 1.7rem;
}

.stat-card span {
    margin-top: 5px;
    color: var(--muted);
    font-size: .88rem;
}

.admin-menu {
    display: grid;
    grid-template-columns: repeat(2, minmax(0,1fr));
    gap: 12px;
}

.admin-card {
    padding: 22px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    text-decoration: none;
}

.admin-card:hover {
    background: var(--surface-2);
}

.admin-card strong,
.admin-card span {
    display: block;
}

.admin-card span {
    margin-top: 7px;
    color: var(--muted);
    line-height: 1.5;
    font-size: .9rem;
}

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 720px;
}

.data-table th,
.data-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
}

.data-table th {
    color: var(--muted);
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .08em;
}

.data-table tr:last-child td {
    border-bottom: 0;
}

.actions {
    white-space: nowrap;
}

.actions a {
    margin-right: 12px;
    text-decoration: none;
    color: #d9dce1;
}

.actions a:hover {
    text-decoration: underline;
}

.danger-link {
    color: #ff9c9c !important;
}

.admin-form {
    padding: 26px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}

.form-section {
    margin-top: 30px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.section-title {
    font-weight: 650;
}

.help,
.muted {
    color: var(--muted);
    font-size: .84rem;
    line-height: 1.5;
}

.media-row {
    display: grid;
    grid-template-columns: 120px 1fr 42px;
    gap: 8px;
    margin: 10px 0;
}

.secondary-button {
    margin-top: 12px;
}

.icon-button {
    border: 1px solid var(--border);
    border-radius: 10px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font-size: 1.25rem;
}

.button-row {
    display: flex;
    gap: 10px;
    margin-top: 24px;
}

.button-row .primary-button,
.button-row .secondary-button,
.button-row .danger-button {
    width: auto;
    margin-top: 0;
}

.confirm-card {
    padding: 30px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}

.confirm-card h1 {
    margin: 8px 0 16px;
}

.danger-text {
    color: #ffadad;
}

@media (max-width: 700px) {
    .topbar {
        align-items: flex-start;
        padding: 16px;
    }

    .hello {
        display: none;
    }

    .feed,
    .admin-shell,
    .admin-shell.narrow {
        width: min(100% - 24px, var(--max));
    }

    .admin-menu,
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .admin-header,
    .page-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .inline-button {
        width: 100%;
    }

    .login-card {
        padding: 24px;
    }

    .media-row {
        grid-template-columns: 1fr 42px;
    }

    .media-row select {
        grid-column: 1 / -1;
    }

    .media-row input {
        grid-column: 1;
    }

    .media-row .icon-button {
        grid-column: 2;
        grid-row: 2;
    }

    .media-card {
        align-items: flex-start;
        flex-direction: column;
    }
}
