:root {
    --bg:       #f0f2f5;
    --surface:  #ffffff;
    --primary:  #2AABEE;
    --text:     #000000;
    --text-sub: #6b7280;
    --border:   #e5e7eb;
    --radius:   12px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg:       #0e1117;
        --surface:  #1c2333;
        --text:     #e8eaed;
        --text-sub: #9aa0a6;
        --border:   #2d3748;
    }
}

/* ── Icons ── */
.icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.icon::before {
    content: "";
    display: block;
    width: 1em;
    height: 1em;
    background-color: currentColor;
    mask-size: contain;
    mask-repeat: no-repeat;
    mask-position: center;
}

.icon-clock::before    { mask-image: url(/img/icons/clock.svg); }
.icon-ext::before      { mask-image: url(/img/icons/arrow-up-right-from-square.svg); }
.icon-empty::before    { mask-image: url(/img/icons/envelope-open.svg); }
.icon-search::before   { mask-image: url(/img/icons/magnifying-glass.svg); }

.icon-lg::before {
    width: 2.5em;
    height: 2.5em;
    vertical-align: middle;
    opacity: .4;
}

.post-title .icon-ext::before {
    width: 0.7em;
    height: 0.7em;
    opacity: .55;
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 15px;
    line-height: 1.6;
    background: var(--bg);
    color: var(--text);
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ── Channel Header ── */
.channel-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border-bottom: 1px solid var(--border);
    padding: 12px 0;
}

@media (prefers-color-scheme: dark) {
    .channel-header {
        background: rgba(28, 35, 51, 0.7);
    }
}

.channel-header-inner {
    max-width: 680px;
    margin: 0 auto;
    padding: 0 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.channel-avatar {
    display: block;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
}

.channel-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

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

.channel-name {
    font-weight: 700;
    font-size: 16px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.channel-desc {
    font-size: 13px;
    color: var(--text-sub);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Main Content ── */
.container {
    max-width: 680px;
    margin: 0 auto;
    padding: 24px 16px;
}

/* ── Post Card ── */
.post-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
    border: 1px solid var(--border);
}

.post-title {
    font-weight: 700;
    font-size: 16px;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.post-title a {
    color: var(--text);
}

.post-title a:hover {
    color: var(--primary);
    text-decoration: none;
}


.post-pubdate {
    font-size: 13px;
    color: var(--text-sub);
    font-style: italic;
    margin-bottom: 10px;
}

.post-excerpt {
    border-left: 3px solid var(--primary);
    margin: 10px 0;
    padding: 6px 12px;
    color: var(--text);
    font-size: 14px;
    line-height: 1.6;
}

.post-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 10px;
    font-size: 13px;
    color: var(--text-sub);
    gap: 8px;
}

.post-footer-left {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.post-domain {
    color: var(--text-sub);
    font-size: 13px;
}

.archive-link {
    color: var(--text-sub);
    font-size: 13px;
}

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

.post-permalink {
    color: var(--text-sub);
    font-size: 13px;
    white-space: nowrap;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

a.post-permalink:hover {
    color: var(--primary);
}

/* ── Pagination ── */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 24px;
    flex-wrap: wrap;
}

.pagination a,
.pagination span {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
}

.pagination a:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    text-decoration: none;
}

.pagination span {
    opacity: .45;
    cursor: default;
}

/* ── Auth / Login ── */
.auth-wrap {
    max-width: 360px;
    margin: 80px auto;
    padding: 0 16px;
}

.auth-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 32px;
    box-shadow: 0 2px 8px rgba(0,0,0,.1);
    border: 1px solid var(--border);
}

.auth-card h1 {
    font-size: 20px;
    margin-bottom: 20px;
}

/* ── Forms ── */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 5px;
    color: var(--text-sub);
    text-transform: uppercase;
    letter-spacing: .04em;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    transition: border-color .15s;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

/* ── Buttons ── */
.btn {
    display: inline-block;
    padding: 9px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: opacity .15s;
}

.btn:hover {
    opacity: .85;
    text-decoration: none;
}

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

.btn-danger {
    background: #ef4444;
    color: #fff;
}

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

/* ── Admin ── */
.admin-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.admin-header h1 {
    font-size: 16px;
    font-weight: 700;
}

.admin-header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
}

.admin-table th,
.admin-table td {
    text-align: left;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}

.admin-table th {
    font-weight: 600;
    color: var(--text-sub);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .05em;
    background: var(--bg);
}

.admin-table tr:last-child td {
    border-bottom: none;
}

.admin-table td:last-child {
    white-space: nowrap;
}

.admin-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

/* ── Alert ── */
.alert {
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 16px;
}

.alert-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-success {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.alert-warning {
    background: #fffbeb;
    color: #92400e;
    border: 1px solid #fcd34d;
}

@media (prefers-color-scheme: dark) {
    .alert-error   { background: #450a0a; color: #fca5a5; border-color: #7f1d1d; }
    .alert-success { background: #052e16; color: #86efac; border-color: #14532d; }
    .alert-warning { background: #1c1400; color: #fcd34d; border-color: #92400e; }
}

/* ── Empty State ── */
.empty-state {
    text-align: center;
    padding: 48px 16px;
    color: var(--text-sub);
}

.empty-state p {
    font-size: 15px;
    margin-top: 8px;
}

/* ── About ── */
.about-card p {
    margin-bottom: 14px;
}

.about-card p:last-child {
    margin-bottom: 0;
}

/* ── Legal Links ── */
.legal-links {
    position: fixed;
    bottom: 16px;
    right: 16px;
    display: flex;
    gap: 12px;
    font-size: 12px;
    transition: opacity .15s;
    z-index: 50;
    padding: 6px 12px;
    border-radius: var(--radius);
    background: rgba(240, 242, 245, .9);
}

@media (prefers-color-scheme: dark) {
    .legal-links {
        background: rgba(14, 17, 23, .9);
    }
}

.legal-links a {
    color: var(--text-sub);
}

.legal-links a:hover {
    text-decoration: none;
}

/* ── Admin Form ── */
.form-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 24px;
    border: 1px solid var(--border);
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
}

.form-card h2 {
    font-size: 18px;
    margin-bottom: 20px;
}

.form-footer {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 20px;
}
