:root {
    --bg: #ffffff;
    --card: #ffffff;
    --text: #0f1419;
    --muted: #536471;
    --line: #eff3f4;
    --border: #cfd9de;
    --hover: rgba(15, 20, 25, 0.1);
    --accent: #1d9bf0;
    --live: #f4212e;
    --ink: #0f1419;
    --radius: 16px;
    --feed: 600px;
    --side: 320px;
    --font: "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
}

.app {
    display: grid;
    grid-template-columns: var(--side) var(--feed) minmax(0, 1fr);
    max-width: 1280px;
    margin: 0 auto;
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    background: #fff;
    color: var(--text);
    padding: 8px 16px 20px 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: inherit;
    padding: 10px 14px;
    border-radius: 999px;
    width: fit-content;
}
.brand:hover { background: var(--hover); }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 22px; letter-spacing: -0.03em; }
.brand-text small { color: var(--muted); font-size: 13px; margin-top: 3px; }

.live-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--live);
    box-shadow: 0 0 0 0 rgba(244, 33, 46, 0.55);
    animation: pulse 1.8s infinite;
    flex-shrink: 0;
}
@keyframes pulse {
    70% { box-shadow: 0 0 0 8px rgba(244, 33, 46, 0); }
}

.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.sidebar-foot {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 4px 14px 14px;
    max-width: 280px;
}
.footer-legal {
    margin: 0;
    color: var(--muted);
    font-size: 11px;
    font-weight: 400;
    line-height: 1.35;
}
.footer-links {
    margin: 0;
    font-size: 13px;
    line-height: 1.3;
    color: var(--muted);
}
.footer-sep { color: var(--muted); }
.nav-archive {
    color: var(--text);
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
}
.nav-archive:hover { text-decoration: underline; }
.nav-admin {
    color: var(--muted);
    text-decoration: none;
    font-size: 13px;
    font-weight: 400;
}
.nav-admin:hover { color: var(--text); }
.nav-link {
    display: flex;
    align-items: center;
    gap: 18px;
    color: var(--text);
    text-decoration: none;
    font-size: 20px;
    font-weight: 500;
    padding: 12px 16px;
    border-radius: 999px;
    width: fit-content;
    max-width: 100%;
}
.nav-link:hover { background: var(--hover); }
.nav-link.is-active { font-weight: 800; }
.nav-ico { color: var(--text); display: flex; }

.feed {
    width: 100%;
    min-width: 0;
    border-left: 1px solid var(--line);
    border-right: 1px solid var(--line);
    padding: 0 0 64px;
}
.rail { min-width: 0; }

.feed-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    position: sticky;
    top: 0;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    z-index: 2;
    border-bottom: 1px solid var(--line);
}
.feed-head h1 { margin: 0; font-size: 20px; letter-spacing: -0.03em; }

.seo-text {
    margin: 0;
    padding: 14px 16px 8px;
    color: var(--muted);
    font-size: 15px;
    line-height: 1.5;
}
.feed-count {
    margin: 0;
    padding: 0 16px 12px;
    color: var(--muted);
    font-size: 13px;
    border-bottom: 1px solid var(--line);
}

.menu-btn {
    display: none;
    width: 40px;
    height: 40px;
    border: 0;
    background: transparent;
    padding: 10px 8px;
    cursor: pointer;
}
.menu-btn span {
    display: block;
    height: 2px;
    background: var(--text);
    margin: 5px 0;
    border-radius: 2px;
}

.cards { display: flex; flex-direction: column; }

.card {
    background: var(--card);
    border-bottom: 1px solid var(--line);
    overflow: hidden;
}
.card:hover { background: #f7f9f9; }

.card-main {
    display: block;
    padding: 12px 16px 4px;
    text-decoration: none;
    color: inherit;
}

.card-media {
    aspect-ratio: 1.91 / 1;
    background: #d6d9db;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.card-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.card-media--empty {
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #e8f5fd, #1d9bf0);
    color: #fff;
    font-weight: 700;
    letter-spacing: -0.02em;
    border: 0;
}

.card-body { padding: 12px 2px 6px; }
.card-body h2 {
    margin: 0;
    font-size: 17px;
    line-height: 1.3;
    letter-spacing: -0.02em;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.card-body p {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.card-meta {
    margin-top: 8px;
    color: var(--muted);
    font-size: 13px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.card-share {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0 8px 8px 10px;
}
.share-btn {
    width: 36px;
    height: 36px;
    border: 0;
    background: transparent;
    border-radius: 999px;
    color: var(--muted);
    cursor: pointer;
    display: grid;
    place-items: center;
}
.share-btn:hover { background: #e8f5fd; color: var(--accent); }
.share-btn.is-copied { color: #00ba7c; background: #e6f8ef; }

.empty {
    margin: 28px 16px;
    padding: 28px;
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    color: var(--muted);
}

.pager {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 20px 16px 0;
}
.pager a {
    min-width: 40px;
    height: 36px;
    padding: 0 12px;
    display: grid;
    place-items: center;
    border: 1px solid var(--border);
    border-radius: 999px;
    text-decoration: none;
    color: var(--text);
    font-size: 14px;
    background: #fff;
}
.pager a.is-active,
.pager a:hover {
    background: var(--ink);
    color: #fff;
    border-color: var(--ink);
}

.scrim {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 20, 25, 0.4);
    z-index: 8;
}

.admin-body { background: #f7f9f9; }
.admin {
    max-width: 720px;
    margin: 0 auto;
    padding: 28px 16px 64px;
}
.admin-head {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    margin-bottom: 18px;
}
.admin-head h1 { margin: 0; font-size: 22px; text-align: center; }
.admin-head a { color: var(--accent); text-decoration: none; font-weight: 600; }
.admin-head a:last-child { text-align: right; }

body.admin-app {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    min-height: 100vh;
    background: #fff;
}
.admin-side { border-right: 1px solid var(--line); }
.admin-main {
    min-width: 0;
    padding: 0 28px 64px;
    max-width: 780px;
}
.admin-page-head { margin: 0 -28px 18px; padding-left: 16px; padding-right: 16px; }
.admin-main .flash { margin-top: 8px; }
.box textarea.code {
    min-height: 160px;
    font-family: Consolas, "Courier New", monospace;
    font-size: 13px;
    line-height: 1.45;
}

.box {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 18px;
    margin-bottom: 14px;
}
.box h2 { margin: 0 0 6px; font-size: 16px; }
.hint { margin: 0 0 14px; color: var(--muted); font-size: 13px; }
.box label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 6px; }
.box label:first-of-type { margin-top: 0; }
.box input, .inline input, .box textarea, .inline select {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 12px;
    font: inherit;
    background: #fff;
}
.box input, .inline input, .inline select { height: 42px; }
.box textarea { min-height: 88px; resize: vertical; }
.box button, .inline button, .ghost, .danger {
    height: 42px;
    border: 0;
    border-radius: 999px;
    padding: 0 16px;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    background: var(--ink);
    color: #fff;
    margin-top: 10px;
}
.ghost { background: #eef1f2; color: var(--text); }
.danger { background: #f8d7da; color: #842029; }
.inline {
    display: grid;
    grid-template-columns: 1fr 1.4fr auto;
    gap: 8px;
    margin-top: 12px;
    align-items: end;
}
.inline-4 { grid-template-columns: 1fr 1.3fr 110px auto; }
.inline button { margin-top: 0; }
.stack button { margin-top: 14px; }
.rows { list-style: none; margin: 0; padding: 0; }
.rows li {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
}
.rows li:last-child { border-bottom: 0; }
.rows strong { display: block; }
.rows small { color: var(--muted); word-break: break-all; }
.row-actions { display: flex; gap: 6px; }
.row-actions button { margin-top: 0; }
.flash {
    background: #d1f7c4;
    color: #0f5132;
    padding: 10px 12px;
    border-radius: 10px;
    margin-bottom: 12px;
}
.flash--err { background: #f8d7da; color: #842029; }

@media (max-width: 1080px) {
    .app { grid-template-columns: 88px var(--feed); max-width: 760px; }
    .rail { display: none; }
    .app .brand-text, .app .nav-link span { display: none; }
    .app .sidebar-foot { display: none; }
    .app .nav-link, .app .brand { padding: 12px; }
    .app .sidebar { padding: 8px; align-items: center; }
}

@media (max-width: 860px) {
    .app { grid-template-columns: 1fr; max-width: none; }
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        width: min(86vw, 340px);
        align-items: stretch;
        padding: 12px 16px 20px;
        transform: translateX(-105%);
        transition: transform 0.2s ease;
        z-index: 9;
        border-right: 1px solid var(--line);
        box-shadow: 8px 0 24px rgba(15, 20, 25, 0.08);
    }
    .app .brand-text, .app .nav-link span { display: block; }
    .app .sidebar-foot { display: flex; }
    .app .nav-link, .app .brand { padding: 12px 16px; }
    body.nav-open .sidebar { transform: none; }
    body.nav-open .scrim { display: block; }
    .menu-btn { display: block; }
    .feed { border: 0; }
    .inline { grid-template-columns: 1fr; }
    body.admin-app { grid-template-columns: 1fr; }
    .admin-main { padding: 0 16px 48px; max-width: none; }
    .admin-page-head { margin: 0 -16px 18px; }
}
