/* Portal "Co se resi?" (AI ukol #221) - tmavy vzhled s barvou loga #64829E a znackou CSR #D91818 / #FFD400 */
:root {
    --csr-bg: #000;
    --csr-card: #111;
    --csr-line: #222;
    --csr-text: #f2f2f2;
    --csr-muted: #8a96a3;
    --csr-logo: #64829E;
    --csr-red: #D91818;
    --csr-yellow: #FFD400;
}

html, body {
    background: var(--csr-bg);
    color: var(--csr-text);
    margin: 0;
    font-family: Bahnschrift, 'Segoe UI', -apple-system, Roboto, Arial, sans-serif;
    -webkit-text-size-adjust: 100%;
}

/* jemna modra zare loga nahore (AI ukol #1363), clip = nic nevyjede do strany a lepiva hlavicka funguje dal */
body {
    background: radial-gradient(1100px 520px at 50% -160px, rgba(100, 130, 158, 0.28), transparent 70%) no-repeat, var(--csr-bg);
    overflow-x: clip;
}

img {
    max-width: 100%;
}

a {
    color: inherit;
}

.csr-header {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: calc(10px + env(safe-area-inset-top)) max(16px, calc((100% - 1280px) / 2 + 16px)) 10px;
    /* hlavicka ladi s kartami (AI ukol #1363 v3): stejna modra jako zare v pozadi, bez sede cary - jen jemny stin */
    background: linear-gradient(180deg, rgba(22, 30, 39, 0.82), rgba(10, 13, 17, 0.72));
    -webkit-backdrop-filter: blur(14px) saturate(140%);
    backdrop-filter: blur(14px) saturate(140%);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
}

.csr-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    font-weight: 700;
    font-size: 18px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* logo = zaobleny ctverec s otaznikem v barvach loga, dole cerveno-zluty prouzek jako u nadpisu */
.csr-brand-mark {
    position: relative;
    width: 34px;
    height: 34px;
    line-height: 34px;
    text-align: center;
    border-radius: 10px;
    background: linear-gradient(135deg, #7d9bb8, #3b5168);
    box-shadow: 0 4px 14px rgba(100, 130, 158, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.25);
    color: #fff;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: 0;
    overflow: hidden;
}

.csr-brand-mark::after {
    content: "";
    position: absolute;
    inset: auto 0 0 0;
    height: 4px;
    background: linear-gradient(90deg, var(--csr-red), var(--csr-yellow));
}

/* plna barva misto prechodu pres background-clip:text - na iOS (Safari/Brave) text splyval s pozadim (AI ukol #1363) */
.csr-brand-name {
    color: #f2f6fa;
    text-shadow: 0 1px 10px rgba(100, 130, 158, 0.45);
}

/* odkaz na YouTube jako pilulka (jako "ZIVE" a pocty komentaru) */
.csr-yt {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 14px 6px 11px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: #fff;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: background 0.15s, border-color 0.15s;
}

.csr-yt:hover {
    background: rgba(217, 24, 24, 0.18);
    border-color: rgba(217, 24, 24, 0.55);
}

.csr-main {
    max-width: 1280px;
    margin: 0 auto;
    padding: 12px 16px 40px;
}

.csr-intro {
    text-align: center;
    padding: 10px 0 20px;
}

.csr-intro h1 {
    margin: 0 0 6px;
    font-size: 30px;
    text-transform: uppercase;
}

.csr-intro p {
    color: var(--csr-muted);
    max-width: 560px;
    margin: 0 auto;
}

.csr-logo {
    width: 140px;
    height: 140px;
}

/* uvod na hlavni strance (AI ukol #262): logo vlevo, nadpis a text vedle nej */
.csr-intro-side {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 18px;
    text-align: left;
}

.csr-intro-side .csr-logo {
    flex: 0 0 auto;
    width: 110px;
    height: 110px;
    mix-blend-mode: lighten; /* gif ma cerne pozadi - na barevne karte zmizi */
}

.csr-intro-side p {
    margin: 0;
}

/* uvod jako karta s prechodem barev loga (AI ukol #1363) */
.csr-intro-side {
    margin: 6px 0 22px;
    padding: 18px 22px;
    border: 1px solid rgba(100, 130, 158, 0.35);
    border-radius: 20px;
    background: linear-gradient(135deg, rgba(100, 130, 158, 0.22), rgba(17, 17, 17, 0.6) 60%);
}

.csr-intro-side h1 {
    color: #f2f6fa;
    text-shadow: 0 1px 12px rgba(100, 130, 158, 0.45);
}

.csr-intro-side h1::after {
    content: "";
    display: block;
    width: 48px;
    height: 4px;
    margin-top: 6px;
    border-radius: 2px;
    background: linear-gradient(90deg, var(--csr-red), var(--csr-yellow));
}

@media (max-width: 520px) {
    .csr-intro-side {
        gap: 12px;
        padding: 14px;
        margin-bottom: 18px;
        border-radius: 16px;
        justify-content: flex-start;
    }

    .csr-intro-side .csr-logo {
        width: 56px;
        height: 56px;
    }

    .csr-intro-side h1 {
        font-size: 22px;
    }

    .csr-intro-side p {
        font-size: 14px;
        line-height: 1.4;
    }
}

.csr-muted {
    color: var(--csr-muted);
}

.csr-feed {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
    gap: 16px;
}

.csr-feed-small {
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr));
}

.csr-card {
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, #14181d, var(--csr-card));
    border: 1px solid #222830;
    border-radius: 16px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
    overflow: hidden;
    text-decoration: none;
    transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}

.csr-card:hover {
    border-color: var(--csr-logo);
}

@media (hover: hover) {
    .csr-card:hover {
        transform: translateY(-3px);
        box-shadow: 0 10px 28px rgba(100, 130, 158, 0.18);
    }
}

/* lazy loading hlavni stranky (AI ukol #1363): dalsi temata se nactou samy pri posouvani, tlacitko je jen zaloha */
.csr-more {
    display: block;
    width: fit-content;
    margin: 20px auto 4px;
    padding: 10px 22px;
    border: 1px solid #2a323c;
    border-radius: 999px;
    background: linear-gradient(180deg, #14181d, var(--csr-card));
    color: var(--csr-text);
    font-size: 14px;
    text-decoration: none;
}

.csr-more:hover {
    border-color: var(--csr-logo);
}

.csr-more.is-loading {
    color: var(--csr-muted);
    pointer-events: none;
}

.csr-card:focus-visible, .csr-latest-item:focus-visible, .csr-more:focus-visible {
    outline: 2px solid var(--csr-yellow);
    outline-offset: 2px;
}

/* hlavni stranka (AI ukol #1363): posledni komentare + temata.
   mobil/tablet = komentare nahore jako vodorovny pas, pocitac (od 1024px) = lepivy sloupec vpravo */
.csr-home {
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.csr-home-main {
    min-width: 0;
}

.csr-feed-title, .csr-latest-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    margin: 0 0 12px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.csr-feed-title::before {
    content: "";
    width: 4px;
    height: 20px;
    border-radius: 2px;
    background: linear-gradient(var(--csr-yellow), var(--csr-red));
}

.csr-latest {
    min-width: 0;
}

/* pilulka "zive" s pulzujici teckou */
.csr-live {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 9px 3px 8px;
    border-radius: 999px;
    background: rgba(217, 24, 24, 0.15);
    border: 1px solid rgba(217, 24, 24, 0.45);
    color: #ff6b6b;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
}

.csr-live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--csr-red);
    box-shadow: 0 0 0 0 rgba(217, 24, 24, 0.7);
    animation: csr-pulse 1.8s infinite;
}

@keyframes csr-pulse {
    70% { box-shadow: 0 0 0 8px rgba(217, 24, 24, 0); }
    100% { box-shadow: 0 0 0 0 rgba(217, 24, 24, 0); }
}

@media (prefers-reduced-motion: reduce) {
    .csr-live-dot { animation: none; }
    .csr-card { transition: none; }
}

.csr-latest-list {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    margin: 0 -16px;
    padding: 2px 16px 10px;
    scrollbar-width: thin;
}

.csr-latest-list::-webkit-scrollbar {
    display: none;
}

/* komentar jako bublina; barva avataru a horni linky podle jmena (--av z Home.razor) */
.csr-latest-item {
    --av: var(--csr-logo);
    position: relative;
    flex: 0 0 min(82%, 300px);
    scroll-snap-align: start;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: linear-gradient(170deg, #1a2027, #111418 70%);
    border: 1px solid #262c33;
    border-radius: 16px;
    padding: 14px 14px 12px;
    text-decoration: none;
    overflow: hidden;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
    transition: border-color 0.15s, transform 0.15s;
}

.csr-latest-item::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 3px;
    background: var(--av);
}

.csr-latest-item:hover {
    border-color: var(--csr-logo);
}

@media (hover: hover) {
    .csr-latest-item:hover {
        transform: translateY(-2px);
    }
}

.csr-latest-head {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    min-width: 0;
}

.csr-avatar {
    flex: 0 0 auto;
    width: 28px;
    height: 28px;
    line-height: 28px;
    text-align: center;
    border-radius: 50%;
    background: var(--av);
    color: #fff;
    font-weight: 700;
    font-size: 14px;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.08);
}

.csr-latest-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.csr-latest-yt {
    flex: 0 0 auto;
}

.csr-latest-time {
    margin-left: auto;
    flex: 0 0 auto;
    color: var(--csr-muted);
    font-size: 12px;
}

.csr-latest-text {
    margin: 0;
    color: #eef2f6;
    font-size: 16px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
}

.csr-latest-video {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: auto;
    padding-top: 10px;
    border-top: 1px solid #262c33;
    color: var(--csr-muted);
    font-size: 12px;
    line-height: 1.3;
}

.csr-latest-video img {
    flex: 0 0 auto;
    width: 56px;
    height: 32px;
    object-fit: cover;
    border-radius: 6px;
}

.csr-latest-video span {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

@media (min-width: 1024px) {
    .csr-home {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 340px;
        align-items: start;
        gap: 28px;
    }

    .csr-latest {
        order: 2;
        position: sticky;
        top: 66px;
        max-height: calc(100vh - 80px);
        display: flex;
        flex-direction: column;
        box-sizing: border-box;
        padding: 16px 12px 12px 16px;
        background: rgba(17, 20, 24, 0.8);
        border: 1px solid #222830;
        border-radius: 20px;
    }

    .csr-latest-list {
        flex-direction: column;
        overflow-x: visible;
        overflow-y: auto;
        scroll-snap-type: none;
        margin: 0;
        padding: 0 4px 0 0;
    }

    .csr-latest-item {
        flex: 0 0 auto;
    }

    .csr-feed {
        grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    }
}

.csr-thumb {
    position: relative;
    aspect-ratio: 16 / 9;
    background: #000;
    overflow: hidden;
}

.csr-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.csr-thumb.is-short img {
    transform: scale(1.35); /* hqdefault shortu ma cerne pruhy po stranach */
}

/* prechod nahledu do karty (AI ukol #1363) */
.csr-thumb::after {
    content: "";
    position: absolute;
    inset: auto 0 0 0;
    height: 40%;
    background: linear-gradient(transparent, rgba(20, 24, 29, 0.85));
    pointer-events: none;
}

.csr-play {
    position: absolute;
    z-index: 1;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 54px;
    height: 54px;
    line-height: 54px;
    text-align: center;
    border-radius: 50%;
    background: var(--csr-red);
    color: #fff;
    font-size: 22px;
    box-shadow: 0 4px 16px rgba(217, 24, 24, 0.5);
}

.csr-badge {
    position: absolute;
    z-index: 1;
    left: 8px;
    top: 8px;
    background: var(--csr-yellow);
    color: #000;
    font-size: 12px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    text-transform: uppercase;
}

.csr-card-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 10px 14px 14px;
}

.csr-card-body .csr-meta {
    margin-top: auto;
}

.csr-meta .csr-pill {
    padding: 1px 9px;
    border-radius: 999px;
    background: rgba(100, 130, 158, 0.18);
    color: #b9c7d5;
}

.csr-card-body h2 {
    margin: 2px 0 6px;
    font-size: 18px;
    line-height: 1.25;
}

.csr-card-body p {
    margin: 0 0 8px;
    color: #c9d1d9;
    font-size: 14px;
    line-height: 1.4;
}

.csr-kicker {
    color: var(--csr-logo);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.csr-meta {
    display: flex;
    gap: 14px;
    color: var(--csr-muted);
    font-size: 13px;
}

.csr-detail {
    max-width: 760px;
    margin: 0 auto;
}

.csr-detail h1 {
    font-size: 28px;
    line-height: 1.2;
    margin: 4px 0 6px;
}

.csr-player {
    position: relative;
    margin: 14px 0 4px;
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
}

.csr-player.is-short {
    aspect-ratio: 9 / 16;
    max-width: 380px;
    max-height: 80vh;
    margin-left: auto;
    margin-right: auto;
}

.csr-player img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.csr-player iframe {
    width: 100%;
    height: 100%;
    border: 0;
}

.csr-play-btn {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 76px;
    height: 76px;
    border-radius: 50%;
    border: 0;
    background: var(--csr-red);
    color: #fff;
    font-size: 32px;
    cursor: pointer;
}

.csr-play-hint {
    text-align: center;
    font-size: 13px;
    margin: 0 0 14px;
}

.csr-text p {
    font-size: 17px;
    line-height: 1.55;
    color: #dde3ea;
}

.csr-comments {
    margin-top: 28px;
    border-top: 1px solid var(--csr-line);
    padding-top: 10px;
}

.csr-comments h2, .csr-section-title {
    font-size: 21px;
}

.csr-section-title {
    max-width: 760px;
    margin: 30px auto 12px;
}

.csr-comment {
    background: var(--csr-card);
    border: 1px solid var(--csr-line);
    border-radius: 8px;
    padding: 8px 12px;
    margin-bottom: 8px;
    scroll-margin-top: 80px; /* pod lepivou hlavickou */
}

/* proklik z "Posledni komentare" (#k{Id}, AI ukol #1363) - zvyrazni komentar, na ktery se prislo */
.csr-comment:target {
    border-color: var(--csr-yellow);
    box-shadow: 0 0 0 2px rgba(255, 212, 0, 0.25);
}

.csr-yt-icon {
    display: inline-block;
    margin-right: 4px;
    vertical-align: -1px;
    line-height: 0;
}

.csr-comment-text {
    white-space: pre-wrap;
    word-break: break-word;
    margin-top: 3px;
    line-height: 1.45;
}

.csr-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 14px;
}

.csr-form input, .csr-form textarea {
    background: #0b0b0b;
    color: var(--csr-text);
    border: 1px solid #333;
    border-radius: 8px;
    padding: 10px;
    font: inherit;
    font-size: 16px; /* min. 16px, jinak iPhone pri psani priblizi stranku */
}

.csr-form button {
    align-self: flex-start;
    background: var(--csr-red);
    color: #fff;
    border: 0;
    border-radius: 8px;
    padding: 10px 26px;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.csr-form .csr-hp {
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.csr-error {
    background: #3a0d0d;
    border: 1px solid var(--csr-red);
    border-radius: 8px;
    padding: 8px 12px;
    margin-top: 10px;
}

.csr-footer {
    text-align: center;
    color: var(--csr-muted);
    font-size: 13px;
    padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--csr-line);
}

@media (display-mode: standalone) {
    #csr-install-hint {
        display: none;
    }
}
