.app {
    --bg: #f6f7fb;
    --card: #ffffff;
    --view-all: rgba(255, 255, 255, 0.3);
    --text: #0f1720;
    --muted: #6b7280;
    --accent: #e11d48;
    --header-blur: rgba(255,255,255,0.65);
    color-scheme: light;
    font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
    min-height: 100vh;
    /*background: linear-gradient(180deg,var(--bg), #eef2f7);*/
    background: var(--bg);
}
#theme-toggle:checked ~ .app {
    /*--bg: #071022;*/
    --bg: #1a222c;
    --card: #0b1220;
    --view-all: rgba(11, 18, 32, 0.3);
    --text: #e6eef8;
    --muted: #98a3b3;
    --accent: #f43f5e;
    --header-blur: rgba(6,10,18,0.6);
    color-scheme: dark;
}
* { 
    box-sizing: border-box; 
}
body,html { 
    margin:0; 
    padding:0; 
    height:100%; 
}
.wrap { 
    max-width:1100px; 
    margin:0 auto; 
    padding:0 16px; 
}
#theme-toggle { 
    position: absolute; 
    left:-9999px; 
}
header {
    position: sticky; top:0; z-index:50;
    backdrop-filter: blur(8px);
    background: linear-gradient(180deg,var(--header-blur), transparent);
    border-bottom: 1px solid rgba(0,0,0,0.04);
}
header .header-inner { 
    display:flex; 
    align-items:center; 
    justify-content:space-between; 
    gap:16px; 
    padding:12px 12px; 
}
.brand { 
    display:flex; 
    align-items:center; 
    gap:12px; 
    text-decoration:none; 
    color:inherit; 
    cursor:pointer;
}
.brand:focus-visible { 
    outline:2px solid rgba(37,99,235,0.45); 
    outline-offset:3px; 
    border-radius:8px; 
}
.logo { width:44px; 
    height:44px;
    display:inline-grid; 
    place-items:center; 
    border-radius:10px; 
    background:linear-gradient(135deg,var(--accent), #ff7aa2); 
    color:white; 
    font-weight:700; 
}
.brand .title { 
    font-size:18px; 
    font-weight:700; 
    color:var(--text); 
}
.brand .subtitle { 
    display:block; 
    font-size:12px; 
    color:var(--muted); 
    margin-top:2px; 
}
.actions { 
    display:flex; 
    gap:10px; 
    align-items:center; 
}
.btn { 
    display:inline-flex; 
    align-items:center; 
    gap:8px; 
    padding:8px 12px; 
    border-radius:10px; 
    background:var(--card); 
    border:1px solid rgba(0,0,0,0.06); 
    box-shadow:0 1px 0 rgba(255,255,255,0.03) inset; 
    color:var(--text); 
    font-weight:600; 
    cursor:pointer; 
    text-decoration:none; 
    white-space:nowrap; 
    text-align: center;
    justify-content: center;
}
@media (max-width:420px) {
    .btn { padding:7px 10px; font-size:14px; }
}
.btn.primary { 
    background: linear-gradient(90deg,var(--accent), #ff7aa2); 
    color:white; 
    border:0; 
}
.theme-toggle { 
    width:44px; 
    height:44px; 
    display:inline-grid; 
    place-items:center; 
    border-radius:10px; 
    background:var(--card); 
    cursor:pointer; 
    border:1px solid rgba(0,0,0,0.06); 
    transition: background-color .18s ease, color .18s ease; 
    background-color: rgba(255, 204, 133, 0.24); 
    color: #e5780b; 
}
.theme-toggle svg { 
    width:20px; 
    height:20px; 
    display:block; 
}
.theme-toggle .icon-sun, .theme-toggle svg.icon-sun { 
    display:inline-block; 
}
.theme-toggle .icon-moon, .theme-toggle svg.icon-moon { 
    display:none; 
}
#theme-toggle:checked ~ .app .theme-toggle .icon-sun { 
    display:none; 
}
#theme-toggle:checked ~ .app .theme-toggle .icon-moon { 
    display:inline-block; 
}
main { 
    padding:18px 0 60px; 
}
h1.page-title { 
    margin:8px 0 18px; 
    font-size:20px; 
    color:var(--text); 
}
.section { 
    margin:18px 0; 
}
.section h2 { 
    margin:0 0 12px; 
    font-size:16px; 
    color:var(--text); 
}
.grid {
    display:grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap:12px;
}
.card {
    background:var(--card);
    border-radius:12px;
    padding:12px;
    min-height:120px;
    display:flex; flex-direction:column; gap:8px;
    box-shadow: 0 6px 18px rgba(2,6,23,0.04);
    border:1px solid rgba(0,0,0,0.04);
    color:var(--text);
    text-decoration:none;
    overflow: hidden;
}
.card .thumb { 
    width:100%; 
    /*height:72px;*/ 
    border-radius:8px; 
    background:linear-gradient(180deg, rgba(0,0,0,0.04), rgba(0,0,0,0.02)); 
    display:block; 
}
.card .name { 
    font-weight:700; 
    font-size:14px; 
}
.card .meta { 
    font-size:12px; 
    color:var(--muted); 
}
.card .delta { 
    font-size:12px; 
    white-space: nowrap;
}
.delta.green {
    color: green;
}
.delta.red {
    color: red;
}
.delta.gray {
    color: gray;
}
.card.view-all { 
    display:flex; 
    align-items:center; 
    justify-content:center; 
    text-align:center; 
    font-weight:700; 
    color:var(--accent); 
    border:2px dashed rgba(0,0,0,0.06); 
    background: var(--view-all);
}
.card.gray{
    filter: grayscale(100%);
}
.card .status {
    position: absolute;
    top: 10px;
    right: 10px;
    color: red;
    transform: rotate(45deg);
    font-weight: bold;
}
footer { 
    padding:20px 0; 
    border-top:1px solid rgba(0,0,0,0.04); 
    color:var(--muted); 
    font-size:14px; 
    text-align: center;
}
@media (max-width:520px) {
    .brand .title { 
        font-size:16px; 
    }
    .logo { 
        width:40px; 
        height:40px; 
    }
    .grid { 
        grid-template-columns: repeat(2, 1fr); 
    }
}
.theme-toggle svg * { 
    stroke: currentColor; 
    fill: currentColor; 
}
#theme-toggle:checked ~ .app .theme-toggle { 
    background-color: rgba(56, 116, 255, 0.24); 
    color: #85a9ff; 
}
.chat-logo {
    background: radial-gradient(224.66% 112.22% at 34.26% 3.7%, #ff48b6, #ff8a35);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-transform: uppercase;
    font-weight: 600;
    font-size: 30px;
    line-height: 40px;
    width: 96px;
    height: 96px;
    margin: 0 auto;
    color: white;
}
.load-more {
    display:flex; 
    align-items:center; 
    justify-content: center;
    flex-direction: column;
    padding: 20px;
}
.loader {
    display: none;
    margin-left: 10px;
}
.disabled {
    pointer-events: none;
    opacity: 0.5;
}
.channel-card {
    display:flex;
    gap:18px;
    align-items:flex-start;
    background:var(--card);
    padding:18px;
    border-radius:14px;
    box-shadow:0 10px 30px rgba(2,6,23,0.06);
    border:1px solid rgba(0,0,0,0.04);
}
.logo-large {
    width:120px; 
    height:120px; 
    flex:0 0 120px; 
    border-radius:16px; 
    overflow:hidden; 
    display:block; 
    background:linear-gradient(180deg, rgba(0,0,0,0.04), rgba(0,0,0,0.02));
    text-decoration: none;
}
.logo-large.gray {
    filter: grayscale(100%);
}
.logo-large img { 
    width:100%; 
    height:100%; 
    object-fit:cover; 
    display:block; 
}
.channel-info { 
    flex:1; 
    display:flex; 
    flex-direction:column; 
    gap:10px; 
}
.channel-title { 
    display:flex; 
    align-items:center; 
    gap:12px; 
}
.channel-title h2 { 
    margin:0; 
    font-size:20px; 
    color:var(--text); 
}
.channel-sub { 
    font-size:13px; 
    color:var(--muted); 
}
.desc { 
    color:var(--text); 
    opacity:0.95; 
    line-height:1.45; 
}
.stats-row { 
    display:flex; 
    gap:12px; 
    align-items:center; 
    flex-wrap:wrap; 
}
.stat { 
    background:rgba(0,0,0,0.03); 
    padding:8px 12px; 
    border-radius:10px; 
    font-weight:700; 
    color:var(--text); 
    text-align: center;
}
.stat .label { 
    display:block; 
    font-size:12px; 
    color:var(--muted); 
    font-weight:600; 
}
.change-up { 
    background: rgba(16,163,127,0.06); 
    padding:6px 10px; 
    border-radius:10px; 
    font-weight:700; 
}
.change-up.green {
    color: green;
}
.change-up.red {
    color: red;
}
.change-up.gray {
    color: gray;
}
.change-down { 
    color: #dc2626; 
    background: rgba(239,68,68,0.06); 
    padding:6px 10px; 
    border-radius:10px; 
    font-weight:700; 
}
.chart-wrap { 
    width:260px; 
    max-width:100%; 
}
.chart { 
    width:100%; 
    height:72px; 
    background:transparent; 
    color: var(--accent);
}
.channel-actions { 
    display:flex; 
    gap:10px; 
    align-items:center; 
    margin-top:6px; 
}
.channel-deleted {
    padding:10px 14px; 
    border-radius:10px; 
    font-weight:700; 
    text-decoration:none; 
    display:inline-flex; 
    align-items:center; 
    gap:8px; 
    color:var(--accent);
    border: 2px dashed var(--accent);
}
.btn-visit { 
    padding:10px 14px; 
    border-radius:10px; 
    font-weight:700; 
    text-decoration:none; 
    display:inline-flex; 
    align-items:center; 
    gap:8px; 
    background:var(--accent); 
    color:white; 
}
.btn-visit.secondary { 
    background:transparent; 
    color:var(--text); 
    border:1px solid rgba(0,0,0,0.06); 
}
.feed { 
    margin-top:18px; 
    display:flex; 
    flex-direction:column; 
    gap:12px; 
}
.pinned { 
    background:linear-gradient(90deg, rgba(255,241,204,0.8), rgba(255,255,255,0.6)); 
    border-radius:12px; 
    padding:12px; 
    border:1px dashed rgba(0,0,0,0.04); 
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
}
.pinned .badge { 
    display:inline-block; 
    padding:4px 8px; 
    border-radius:8px; 
    background:var(--accent); 
    color:white; 
    font-weight:700; 
    font-size:12px; 
}
.post { 
    background:var(--card); 
    border-radius:12px; 
    padding:12px; 
    border:1px solid rgba(0,0,0,0.04); 
    box-shadow:0 8px 20px rgba(2,6,23,0.03); 
}
.post .meta { 
    display:flex; 
    gap:8px; 
    align-items:center; 
    color:var(--muted); 
    font-size:13px; 
    margin-bottom:8px; 
}
.post .text { 
    color:var(--text); 
    line-height:1.5; 
    margin-bottom:8px; 
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
}
.post img.post-media { 
    width:100%; 
    border-radius:10px;
    object-fit:cover; 
    max-height:360px; 
}
.post video, .post audio { 
    width:100%; 
    border-radius:8px; 
    background:#000; 
}
.post .system-msg {
    color:var(--text); 
}
.media-grid { 
    display:grid; 
    grid-template-columns: 
    repeat(auto-fit, minmax(160px, 1fr)); 
    gap:8px; 
    margin-top:8px; 
}
.media-item { 
    overflow:hidden; 
    border-radius:8px; 
    background:rgba(0,0,0,0.03); 
    display:block; 
}
.media-item img, .media-item video { 
    width:100%; 
    /*height:160px; */
    object-fit:cover; 
    display:block; 
}
.media-item video { 
    background:#000; 
}
@media (max-width:720px) {
    .channel-card { 
        flex-direction:column; 
        align-items:flex-start; 
    }
    .logo-large { 
        width:96px; 
        height:96px; 
    }
    .chart-wrap { 
        width:100%;
    }
}
.reactions {
    gap: 10px;
    display: flex;
    flex-wrap: wrap;
}
.reaction {
    border-radius: 15px;
    background: var(--bg);
    color: var(--text);
    padding: 5px 15px;
    font-size: 0.8em;
}
figure {
    margin: 0;
}
.add-container { 
    margin:28px 0; 
    display:flex; 
    flex-direction:column; 
    gap:12px; 
}
.add-form { 
    display:flex; 
    gap:10px; 
    align-items:center; 
}
.input-text { 
    flex:1; 
    padding:10px 12px; 
    border-radius:10px; 
    border:1px solid rgba(0,0,0,0.06); 
    background:var(--card); 
    color:var(--text); 
    font-size:15px; 
}
.input-text::placeholder { 
    color:var(--muted); 
}
.result-message { 
    margin-top:8px; 
    font-weight:600; 
    color:var(--muted); 
}
.result-message.success { 
    color: #16a34a; 
}
.result-message.error { 
    color: #dc2626; 
}
@media (max-width:520px) {
    .add-form { 
        flex-direction:column; 
        align-items:stretch; 
    }
    .btn { 
        width:100%; 
    }
}
.note {
    color: var(--muted);
    font-size: 13px;
    margin-top: 8px;
}
.contact {
    color: var(--muted);
    font-size: 13px;
    margin-top: 8px;
}
.contact a {
    text-decoration: none;
    color: var(--accent);
}
.media-notification {
    flex-direction:column; 
    color: var(--text);
    display: flex;
    text-align: center;
    gap: 10px;
}
.media-notification img {
    width: 100%;
}
.media-forward span {
    color:var(--muted); 
    font-size:13px; 
    margin-bottom:8px; 
}
.media-forward-from {
    margin-bottom:8px; 
} 
.media-forward-from a {
    text-decoration: none;
    color: var(--text);
    display: flex;
    gap: 10px;
}
.media-forward-from a img{
    border-radius: 50%;
    width: 16px; 
    height: 16px; 
    background: none center center / cover; 
    object-fit: cover;
} 
.media-reply {
    color: var(--text);
    display: flex;
    gap: 10px;
    border-left: 2px solid var(--muted);
    padding: 5px;
}
.media-reply img {
    width: 32px; 
    height: 32px; 
    background: none center center / cover; 
    object-fit: cover;
}
.media-reply span {
    color:var(--muted); 
    font-size:13px; 
    margin-bottom:8px; 
}