/* Responsive adaptation of new_design. State classes are used by index.php. */
:root {
    color-scheme: dark;
    --bg-primary: #07090e;
    --bg-secondary: #0b0d14;
    --bg-card: #10131d;
    --accent: #53fc18;
    --accent-glow: rgba(83, 252, 24, .18);
    --accent-secondary: #c084fc;
    --text-primary: #f5f5f7;
    --text-secondary: #b5b5c0;
    --text-muted: #9696a5;
    --border: rgba(255, 255, 255, .08);
    --live-red: #ff646b;
    --panel: linear-gradient(135deg, rgba(22, 26, 39, .78), rgba(14, 17, 26, .94));
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-width: 280px;
    min-height: 100vh;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}
::selection { background: var(--accent); color: var(--bg-primary); }
a { color: inherit; -webkit-tap-highlight-color: transparent; }
button, a { touch-action: manipulation; }
a:focus-visible, button:focus-visible, video:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 4px;
}
img, svg { max-width: 100%; }
.bg-gradient {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
        radial-gradient(ellipse at 20% 8%, rgba(16, 185, 129, .09), transparent 45%),
        radial-gradient(ellipse at 85% 65%, rgba(126, 34, 206, .075), transparent 45%),
        var(--bg-primary);
}
.bg-grid { display: none; }
.container {
    width: 100%;
    max-width: 520px;
    margin: 0 auto;
    padding: 32px 20px 16px;
}
#content { min-width: 0; }
.profile-column, .media-column { min-width: 0; }
.profile-section, .live-card, .category-card, .vod-card, .clip-card, .social-link {
    background: var(--panel);
    border: 1px solid var(--border);
}
.profile-section {
    position: relative;
    overflow: hidden;
    text-align: center;
    padding: 30px 24px 24px;
    border-radius: 24px;
    margin-bottom: 24px;
    background: linear-gradient(180deg, rgba(16, 185, 129, .13), transparent 115px), var(--panel);
}
.avatar-wrapper { position: relative; display: inline-block; margin: 0 0 17px; }
.avatar {
    display: block;
    width: 120px;
    height: 120px;
    object-fit: cover;
    border-radius: 50%;
    padding: 5px;
    background: var(--bg-secondary);
    border: 2px solid #34d399;
    box-shadow: 0 0 0 4px var(--bg-secondary), 0 0 24px rgba(16, 185, 129, .12);
}
.verified-badge { position: absolute; bottom: 0; right: 0; width: 28px; height: 28px; }
.verified-badge svg { width: 100%; height: 100%; }
.username { display: flex; justify-content: center; align-items: center; gap: 8px; font-size: 28px; font-weight: 800; letter-spacing: -1px; }
.username-text { overflow-wrap: anywhere; }
.verified-badge-inline { display: inline-flex; flex-shrink: 0; }
.verified-badge-inline svg { width: 21px; height: 21px; }
.bio { margin: 8px auto 0; color: var(--text-secondary); font-size: 13px; max-width: 36ch; overflow-wrap: anywhere; }
.bio:empty { display: none; }
.stats-row {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 20px;
    padding: 12px 16px;
    border-radius: 16px;
    background: rgba(255, 255, 255, .035);
    border: 1px solid rgba(255, 255, 255, .045);
}
.stat { min-width: 0; padding: 0 26px; }
.stat + .stat { border-left: 1px solid rgba(255, 255, 255, .1); }
.stat-value { color: var(--accent); font-size: 20px; font-weight: 800; line-height: 1.3; font-variant-numeric: tabular-nums; }
.stat-label { margin-top: 2px; font-size: 10px; font-weight: 600; letter-spacing: .8px; text-transform: uppercase; color: var(--text-secondary); }

.live-card { border-radius: 24px; padding: 22px; margin-bottom: 26px; border-color: rgba(16, 185, 129, .32); }
.live-card.offline { border-color: var(--border); }
#live-content { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 14px 8px; }
.live-indicator, .offline-indicator {
    display: inline-flex;
    width: fit-content;
    align-items: center;
    gap: 7px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .6px;
    text-transform: uppercase;
}
.live-indicator { grid-area: 1 / 1; background: rgba(239, 68, 68, .13); border: 1px solid rgba(239, 68, 68, .28); color: var(--live-red); }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--live-red); animation: livePulse 2s ease-in-out infinite; }
@keyframes livePulse { 50% { opacity: .4; } }
.offline-indicator { background: rgba(255, 255, 255, .04); border: 1px solid var(--border); color: var(--text-secondary); }
.stream-title { grid-area: 2 / 1 / auto / -1; font-size: 16px; font-weight: 700; line-height: 1.6; overflow-wrap: anywhere; }
.stream-meta { display: contents; }
.viewer-count { grid-area: 1 / 2; display: flex; align-items: center; gap: 4px; padding: 4px 8px; border: 1px solid var(--border); border-radius: 999px; background: rgba(255, 255, 255, .04); color: var(--text-secondary); font-size: 10px; white-space: nowrap; }
.viewer-count svg { width: 13px; height: 13px; }
.stream-category { grid-area: 3 / 1 / auto / -1; display: flex; gap: 6px; align-items: center; width: fit-content; max-width: 100%; padding: 4px 9px; border-radius: 8px; border: 1px solid rgba(16, 185, 129, .3); background: rgba(6, 78, 59, .2); color: #6ee7b7; font-size: 11px; overflow-wrap: anywhere; }
.stream-tags { grid-area: 4 / 1 / auto / -1; display: flex; flex-wrap: wrap; gap: 6px; }
.stream-tags:empty { display: none; }
.tag { padding: 3px 8px; border: 1px solid var(--border); background: rgba(255, 255, 255, .025); color: var(--text-secondary); border-radius: 6px; font-size: 10px; overflow-wrap: anywhere; max-width: 100%; }
.watch-btn { grid-area: 5 / 1 / auto / -1; display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 12px; background: var(--accent); color: #071005; border-radius: 15px; text-decoration: none; font-size: 13px; font-weight: 800; letter-spacing: .7px; text-transform: uppercase; box-shadow: 0 0 25px -4px var(--accent-glow); transition: filter .2s; }
.watch-btn::after, .donate-btn::after { content: '↗'; font-size: 18px; line-height: 1; margin-left: 4px; }
.stream-embed { grid-area: 6 / 1 / auto / -1; aspect-ratio: 16 / 9; overflow: hidden; background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 16px; }
.stream-embed iframe { display: block; width: 100%; height: 100%; border: 0; }
.offline-message { padding: 16px 0 0; color: var(--text-secondary); font-size: 13px; text-align: center; }

.section-title { display: flex; align-items: center; gap: 8px; color: var(--text-secondary); font-size: 10px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; margin: 0 4px 12px; }
.donate-section { margin-bottom: 24px; }
.donate-btn { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 56px; padding: 14px 12px; border-radius: 16px; background: linear-gradient(105deg, #ea580c, #ed8008, #f97316); box-shadow: 0 0 24px -8px rgba(249, 115, 22, .25); color: #fff; font-size: 14px; font-weight: 700; text-decoration: none; transition: filter .2s; }
.donate-btn img { flex-shrink: 0; width: 22px; height: 22px; object-fit: contain; }
.social-link-wide { display: grid; grid-template-columns: 20px minmax(0, 1fr) 20px; align-items: center; gap: 12px; padding: 15px 16px; min-height: 56px; margin-bottom: 12px; border-radius: 16px; text-decoration: none; background: linear-gradient(105deg, #f97316, #df277d 52%, #9333ea); color: #fff; font-size: 14px; font-weight: 700; box-shadow: 0 0 24px -8px rgba(168, 85, 247, .2); }
.social-link-wide::after { content: '›'; justify-self: end; font-size: 24px; font-weight: 400; line-height: 1; }
.social-link-wide svg { flex-shrink: 0; width: 20px; height: 20px; }
.social-link-wide span { overflow-wrap: anywhere; text-align: center; }
.social-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 30px; }
.social-link { display: flex; justify-content: center; align-items: center; gap: 9px; min-height: 48px; padding: 12px; border-radius: 15px; text-decoration: none; font-size: 12px; font-weight: 600; transition: border-color .2s, background .2s; }
.social-link svg, .social-link img { flex-shrink: 0; width: 16px; height: 16px; object-fit: contain; }
.social-link.instagram svg { color: #f472b6; }
.social-link.youtube svg { color: #f87171; }
.social-link.discord svg { color: #a5b4fc; }
.social-link.blerp img { border-radius: 50%; }
.icon-white { filter: brightness(0) invert(1); }

.categories-section, .vod-section, .clips-section { margin-bottom: 30px; }
.category-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.category-card { padding: 16px; border-radius: 16px; }
.category-name { font-size: 12px; font-weight: 700; margin-bottom: 6px; overflow-wrap: anywhere; }
.category-viewers { display: flex; align-items: center; gap: 6px; color: var(--text-secondary); font-size: 10px; }
.category-viewers::before { content: ''; width: 5px; height: 5px; flex-shrink: 0; border-radius: 50%; background: var(--accent); }
.category-card:nth-child(even) .category-viewers::before { background: var(--accent-secondary); }
.vod-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.vod-card { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 16px; text-decoration: none; transition: border-color .2s; }
.vod-thumb { position: relative; flex: 0 0 32%; min-width: 0; aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden; background: var(--bg-secondary); }
.vod-thumb img, .clip-thumb img, .offline-latest-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.vod-duration, .clip-duration, .offline-latest-duration { position: absolute; right: 5px; bottom: 5px; padding: 2px 5px; background: rgba(0, 0, 0, .85); color: #fff; font-size: 9px; font-weight: 600; border-radius: 4px; }
.vod-info { flex: 1; min-width: 0; }
.vod-title, .clip-title, .offline-latest-title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; font-weight: 700; }
.vod-title { font-size: 12px; line-height: 1.5; margin-bottom: 7px; }
.vod-meta { display: flex; gap: 4px 10px; flex-wrap: wrap; font-size: 10px; color: var(--text-secondary); }
.vod-card::after { content: ''; flex-shrink: 0; width: 26px; height: 26px; border-radius: 50%; background: rgba(255, 255, 255, .06) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23b5b5c0' d='m9 6 9 6-9 6z'/%3E%3C/svg%3E") center / 18px no-repeat; }
.offline-latest-card { display: block; border: 1px solid var(--border); border-radius: 16px; background: var(--bg-secondary); overflow: hidden; text-decoration: none; }
.offline-latest-thumb { position: relative; aspect-ratio: 16 / 9; background: #080a0f; }
.offline-latest-badge { position: absolute; top: 10px; left: 10px; padding: 4px 8px; border: 1px solid var(--border); border-radius: 6px; background: rgba(0, 0, 0, .7); color: #fff; font-size: 10px; font-weight: 600; }
.offline-latest-play { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); display: flex; justify-content: center; align-items: center; width: 48px; height: 48px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 24px var(--accent-glow); }
.offline-latest-play svg { width: 23px; height: 23px; fill: var(--bg-primary); margin-left: 3px; }
.offline-latest-info { padding: 16px; }
.offline-latest-label { font-size: 9px; letter-spacing: .8px; text-transform: uppercase; color: var(--accent); margin-bottom: 6px; }
.offline-latest-title { font-size: 14px; margin-bottom: 8px; }
.offline-latest-meta { display: flex; flex-wrap: wrap; gap: 6px; font-size: 10px; color: var(--text-secondary); }
.offline-latest-cta { display: inline-flex; margin-top: 12px; padding: 7px 12px; background: var(--accent); color: var(--bg-primary); border-radius: 8px; font-size: 11px; font-weight: 700; }

.clips-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.clip-card { display: flex; flex-direction: column; min-width: 0; padding: 10px; border-radius: 16px; text-decoration: none; transition: border-color .2s; }
.clip-thumb { position: relative; aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden; background: var(--bg-secondary); }
.clip-thumb img { transition: transform .25s; }
.clip-views { position: absolute; top: 6px; left: 6px; display: flex; align-items: center; gap: 4px; padding: 2px 6px; background: var(--accent); color: var(--bg-primary); border-radius: 5px; font-size: 10px; font-weight: 800; }
.clip-views svg { width: 12px; height: 12px; }
.clip-info { display: flex; flex: 1; flex-direction: column; padding-top: 9px; }
.clip-title { font-size: 11px; line-height: 1.5; margin-bottom: 6px; }
.clip-meta { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 4px 8px; margin-top: auto; color: var(--text-secondary); font-size: 9px; }
.clip-creator { overflow-wrap: anywhere; color: #dddde4; }
.vod-empty, .clip-empty { grid-column: 1 / -1; padding: 22px 16px; text-align: center; border: 1px solid var(--border); border-radius: 16px; color: var(--text-secondary); font-size: 12px; background: var(--panel); }

.clip-modal-overlay { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(0, 0, 0, .85); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.clip-modal { position: relative; width: 100%; max-width: 640px; max-height: 90vh; max-height: 90dvh; overflow-y: auto; overscroll-behavior: contain; border: 1px solid var(--border); border-radius: 20px; background: var(--bg-card); box-shadow: 0 24px 80px rgba(0, 0, 0, .6); }
.clip-modal-close { position: absolute; top: 8px; right: 8px; z-index: 2; display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; border: 1px solid rgba(255, 255, 255, .15); border-radius: 50%; color: #fff; background: rgba(0, 0, 0, .8); font-size: 18px; cursor: pointer; }
.clip-modal-video-wrap { position: relative; aspect-ratio: 16 / 9; background: #000; }
.clip-modal-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.clip-modal-info { padding: 16px; }
.clip-modal-title { font-size: 14px; font-weight: 700; overflow-wrap: anywhere; }
.clip-modal-meta { color: var(--text-secondary); font-size: 11px; margin-top: 6px; overflow-wrap: anywhere; }
.vod-modal { max-width: 960px; }
.vod-modal-status { margin-top: 12px; color: var(--text-secondary); font-size: 13px; }
.vod-modal-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 12px; margin-top: 12px; font-size: 12px; }
.vod-modal-actions a { display: inline-flex; align-items: center; min-height: 44px; color: var(--accent); text-decoration: none; }
.vod-modal-retry { min-height: 44px; padding: 8px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-secondary); color: var(--text-primary); font: inherit; cursor: pointer; }
.footer { border-top: 1px solid var(--border); margin-top: 36px; padding: 24px 10px; text-align: center; font-size: 10px; line-height: 1.9; color: var(--text-muted); }
.footer a { color: var(--accent); text-decoration: none; }
.loading { min-height: 65vh; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.loading-spinner { width: 38px; height: 38px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { margin-top: 18px; color: var(--text-secondary); font-size: 13px; }
.error-state { padding: 50px 20px; border: 1px solid var(--border); border-radius: 24px; background: var(--panel); text-align: center; }
.error-icon { font-size: 36px; margin-bottom: 16px; }
.error-message { color: var(--text-secondary); font-size: 14px; overflow-wrap: anywhere; }
.hidden { display: none !important; }

@media (min-width: 1024px) {
    .container { max-width: 1240px; padding: 48px 32px 20px; }
    #content {
        display: grid;
        grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
        align-items: start;
        gap: 32px;
    }
    .profile-column, .media-column {
        align-self: stretch;
        display: flex;
        flex-direction: column;
    }
    .profile-column > *, .media-column > * { flex-shrink: 0; }
    .profile-column .vod-section, .media-column .clips-section {
        display: flex;
        flex-direction: column;
        flex: 1 0 auto;
        margin-bottom: 0;
    }
    .profile-column .vod-grid, .media-column .clips-grid {
        flex: 1 0 auto;
        grid-auto-rows: 1fr;
    }
    .footer { grid-column: 1 / -1; margin-top: 16px; }
    .error-state { max-width: 480px; margin-inline: auto; }
    .section-title { font-size: 11px; }
    .category-name { font-size: 14px; }
    .category-viewers { font-size: 11px; }
    .vod-card { padding: 16px; gap: 16px; }
    .vod-thumb { flex-basis: 28%; }
    .vod-title { font-size: 14px; }
    .vod-meta { font-size: 11px; }
    .clip-title { font-size: 13px; }
    .clip-meta { font-size: 11px; }
}

@media (hover: hover) {
    .watch-btn:hover, .donate-btn:hover, .social-link-wide:hover { filter: brightness(1.1); }
    .social-link:hover, .vod-card:hover, .clip-card:hover, .offline-latest-card:hover { border-color: rgba(255, 255, 255, .25); }
    .clip-card:hover .clip-thumb img { transform: scale(1.035); }
    .vod-card:hover .vod-title, .clip-card:hover .clip-title { color: var(--accent); }
}
@media (max-width: 480px) {
    .container { padding: 20px 16px 12px; }
    .profile-section { padding: 26px 20px 20px; }
    .live-card { padding: 18px; }
    .avatar { width: 112px; height: 112px; }
    .username { font-size: 26px; }
    .vod-card { gap: 10px; padding: 10px; }
    .vod-card::after { display: none; }
    .vod-title { font-size: 11px; }
}
@media (max-width: 399px) {
    .container { padding-right: 12px; padding-left: 12px; }
    .profile-section, .live-card { border-radius: 20px; }
    .live-card { padding: 16px; }
    .stat { padding: 0 20px; }
    .stream-title { font-size: 14px; }
    .clips-grid, .category-grid { grid-template-columns: minmax(0, 1fr); }
    .clip-title { font-size: 13px; }
    .clip-meta { font-size: 11px; }
    .donate-btn, .social-link-wide { font-size: 12px; }
    .clip-modal-overlay { padding: 10px; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}
