:root {
    --bg: #0e0e10;
    --panel: #17171b;
    --text: #e8e8ea;
    --muted: #8a8a92;
    --accent: #e0a04d;
    --border: #26262c;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    padding: 0 2rem 2rem;
    font-family: system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
}

/* Visible focus ring for keyboard users (mouse clicks stay ring-free). */
:where(a, button, summary):focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 4px;
}

.lb-link { color: var(--muted); text-decoration: none; font-size: 0.85rem; }
.lb-link:hover { color: var(--accent); text-decoration: underline; }

/* ── Overview hero: totals + mascot ── */
.hero {
    display: flex;
    align-items: flex-end;                /* mascot rests on the block's floor */
    justify-content: space-between;
    gap: 1.5rem;
    padding: 1.5rem 2rem 0;               /* no bottom padding: mascot bleeds to the edge */
    /* Faint warm glow near the mascot, over a soft dark gradient. */
    background:
        radial-gradient(circle at 85% 65%, rgba(224, 160, 77, 0.13), transparent 55%),
        linear-gradient(135deg, var(--panel) 0%, var(--bg) 70%);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
}
.hero__mascot { flex-shrink: 0; align-self: flex-end; display: block; height: 180px; width: auto; }

/* Left column fills the block height: tagline at the top, totals at the bottom. */
.hero__text {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: flex-start;
    align-self: stretch;
    gap: 1rem;
    padding-bottom: 1.5rem;
}
.hero__tagline { margin: 0; color: var(--muted); font-size: 1rem; }

/* Totals read as one grounded stat bar: thin dividers, no floaty gaps. */
.hero .totals { margin: 0; gap: 0; }
.hero .stat { padding: 0 1.5rem; }
.hero .stat:first-child { padding-left: 0; }
.hero .stat + .stat { border-left: 1px solid var(--border); }
.hero .stat__num {
    background: linear-gradient(180deg, #f2d3a0 0%, var(--accent) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.totals { display: flex; flex-wrap: wrap; gap: 1.5rem; margin: 2rem 0; }
.stat { display: flex; flex-direction: column; }
.stat__num { font-size: 2.5rem; font-weight: 700; }
.stat__label { color: var(--muted); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.05em; }

.cards { display: flex; flex-wrap: wrap; gap: 1rem; margin-bottom: 0; }
.card { flex: 1; min-width: 200px; padding: 1.25rem 1.5rem; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; }
.card__label { margin: 0 0 0.5rem; color: var(--muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; }
.card__title { margin: 0 0 0.5rem; font-size: 1.2rem; }
.card__avg { font-size: 2rem; font-weight: 700; color: var(--accent); }
.card__meta { color: var(--muted); font-size: 0.85rem; }
.card__empty { color: var(--muted); font-style: italic; }
.card__films { display: flex; flex-wrap: wrap; gap: 0.9rem 2rem; }
.card__body { display: flex; gap: 0.9rem; align-items: flex-start; }
.card__info { display: flex; flex-direction: column; min-width: 0; }
.card__stats { margin: 0; display: flex; flex-direction: column; gap: 0.15rem; }
.error { color: #ff6b6b; }

.nav { position: sticky; top: 0; z-index: 10; display: flex; align-items: baseline; gap: 1.5rem; margin: 0 -2rem 2.5rem; padding: 1.25rem 2rem; background: rgba(14, 14, 16, 0.72); backdrop-filter: blur(12px) saturate(140%); -webkit-backdrop-filter: blur(12px) saturate(140%); border-bottom: 1px solid var(--border); }
.nav::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px; background: linear-gradient(90deg, transparent 0%, var(--accent) 50%, transparent 100%); }
.nav__brand { font-weight: 700; letter-spacing: 0.02em; margin-right: auto; }
.nav__link { color: var(--muted); text-decoration: none; font-size: 0.95rem; }
.nav__link:hover { color: var(--text); }
.nav__link--active { color: var(--accent); }

.placeholder { color: var(--muted); font-style: italic; }

.member-group { margin-bottom: 2.5rem; }
.member-group__title { font-size: 1rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 1rem; }
.member-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.member { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.member__row { display: flex; align-items: center; gap: 1rem; padding: 0.9rem 1.25rem; }
.member__row--toggle { cursor: pointer; list-style: none; user-select: none; }
.member__row--toggle::-webkit-details-marker { display: none; }
.member__row--toggle::before { content: '▸'; color: var(--muted); transition: transform 0.15s; }
.member[open] .member__row--toggle::before { transform: rotate(90deg); }
.member__row--toggle:hover { background: #1d1d22; }
.member__avatar { flex-shrink: 0; width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--border); color: var(--text); font-weight: 600; font-size: 1.1rem; }
.member__id { display: flex; flex-direction: column; gap: 0.2rem; }
.member__name { font-weight: 600; }
.member__stats { display: flex; align-items: flex-start; gap: 2rem; margin-left: auto; }

.member__body { padding: 0.35rem 1.25rem 1.1rem; border-top: 1px solid var(--border); }
.member-block { margin-top: 1rem; }
.member-block__title { margin: 0 0 0.6rem; color: var(--muted); font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.member-block__avg { color: var(--accent); }
.member-block__empty { margin: 0; color: var(--muted); font-style: italic; font-size: 0.9rem; }

/* Two content-width columns packed left, so the score sits right by its title. */
.pick-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, max-content) max-content; column-gap: 1.25rem; row-gap: 0.4rem; align-items: baseline; }
.pick { display: contents; }
.pick__title { color: var(--text); text-decoration: none; font-size: 0.9rem; }
.pick__title:hover { color: var(--accent); }
.pick__avg { color: var(--accent); font-weight: 700; font-size: 0.9rem; }

.missed-round { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 0.6rem 0.85rem; margin-bottom: 0.5rem; }
.missed-round:last-child { margin-bottom: 0; }
.missed-round--current { box-shadow: inset 3px 0 0 var(--accent); }
.missed-round__head { display: flex; align-items: baseline; gap: 0.5rem; margin-bottom: 0.4rem; }
.missed-round__num { font-weight: 600; font-size: 0.85rem; }
.missed-round__badge { color: var(--accent); font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.05em; }
.missed-round__count { margin-left: auto; color: var(--muted); font-size: 0.8rem; }
.missed-round__films { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.2rem; }
.missed__link { color: var(--text); text-decoration: none; font-size: 0.9rem; }
.missed__link:hover { color: var(--accent); }
/* Older rounds sit quieter; the current round stays full-strength. */
.missed-round:not(.missed-round--current) .missed-round__num,
.missed-round:not(.missed-round--current) .missed__link { color: var(--muted); }

/* Compact "number over label" stat — both member stats share it, so they align. */
.stat-mini { display: flex; flex-direction: column; align-items: flex-end; gap: 0.15rem; }
.stat-mini__num { font-size: 1.35rem; font-weight: 700; line-height: 1; }
.stat-mini__label { color: var(--muted); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em; }
.stat-mini--accent .stat-mini__num { color: var(--accent); }

.film-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.film { display: flex; align-items: center; gap: 1rem; padding: 0.9rem 1.25rem; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; }
.film__main { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.film__stats { margin-left: auto; display: flex; align-items: flex-start; gap: 1.5rem; }
.film__sub { color: var(--muted); font-size: 0.85rem; overflow-wrap: anywhere; }
.film__badge { font-size: 0.85rem; }
.film__title { font-weight: 600; color: inherit; text-decoration: none; }
.film__title:hover { color: var(--accent); }
.back-link { color: var(--muted); text-decoration: none; font-size: 0.9rem; }
.back-link:hover { color: var(--accent); }

.poster { display: block; border-radius: 6px; background: #26262c; }
.poster--sm { width: 46px; height: auto; }
.poster--card { width: 64px; height: auto; }

.film-detail__head { display: flex; gap: 1.5rem; align-items: flex-start; margin-bottom: 2.5rem; }
.poster--lg { width: 140px; height: auto; }
.film-detail__meta { display: flex; flex-direction: column; }
.film-detail__title { margin: 0 0 0.4rem; font-size: 2rem; }
.film-detail__sub { margin: 0 0 1rem; color: var(--muted); }
.film-detail__score { display: flex; align-items: baseline; gap: 1rem; }
.film-detail__avg { font-size: 2.5rem; font-weight: 700; color: var(--accent); }
.film-detail__spread { color: var(--muted); font-size: 0.9rem; }

.section-title { font-size: 1rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; margin: 2.5rem 0 1rem; }

.rating-list { list-style: none; margin: 0 0 2.5rem; padding: 0; display: flex; flex-direction: column; gap: 0.6rem; }
.rating { display: flex; align-items: center; gap: 1rem; }
.rating__who { display: flex; flex-direction: column; min-width: 140px; }
.rating__name { font-weight: 600; }
.rating__bar { flex: 1; height: 8px; background: var(--panel); border-radius: 4px; overflow: hidden; }
.rating__fill { display: block; height: 100%; background: var(--accent); }
.rating__score { min-width: 2rem; text-align: right; font-weight: 700; font-size: 1.1rem; }

.review-list { list-style: none; margin: 0 0 2.5rem; padding: 0; display: flex; flex-direction: column; gap: 0.6rem; }
.review { display: flex; gap: 1.25rem; padding: 0.9rem 1.25rem; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; }
.review__who { flex-shrink: 0; width: 140px; display: flex; flex-direction: column; gap: 0.15rem; }
.review__name { font-weight: 600; }
.review__score { color: var(--accent); font-weight: 700; font-size: 1.1rem; }
.review__body { flex: 1; min-width: 0; margin: 0; color: var(--text); line-height: 1.6; white-space: pre-line; }

.not-watched__names { color: var(--muted); line-height: 1.8; }

.rounds-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; margin-bottom: 1rem; }
.rounds-toolbar__label { color: var(--muted); font-size: 0.85rem; }
.sort-group { display: flex; flex-wrap: wrap; gap: 0.25rem; }
.sort-btn { padding: 0.35rem 0.75rem; font: inherit; font-size: 0.85rem; color: var(--muted); background: var(--panel); border: none; border-radius: 6px; cursor: pointer; }
.sort-btn:hover { color: var(--text); }
.sort-btn--active { color: var(--bg); background: var(--accent); font-weight: 600; }

.rounds-list { display: flex; flex-direction: column; gap: 0.75rem; }
.round { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.round__head { display: flex; align-items: baseline; gap: 1rem; padding: 1rem 1.25rem; cursor: pointer; list-style: none; user-select: none; }
.round__head::-webkit-details-marker { display: none; }
.round__head::before { content: '▸'; color: var(--muted); transition: transform 0.15s; }
.round[open] .round__head::before { transform: rotate(90deg); }
.round__head:hover { background: #1d1d22; }
.round__num { font-size: 1.1rem; font-weight: 700; }
.round__dates { color: var(--muted); font-size: 0.85rem; }
.round__count { color: var(--muted); font-size: 0.85rem; margin-left: auto; }
.round__avg { color: var(--accent); font-weight: 600; font-size: 0.95rem; min-width: 4rem; text-align: right; }
.round__films { list-style: none; margin: 0; padding: 0 0.75rem 0.75rem; display: flex; flex-direction: column; gap: 0.4rem; }
.round__films .film { background: var(--bg); }

.film--winner { box-shadow: inset 3px 0 0 var(--accent); }
.badge-winner { color: var(--accent); font-weight: 600; }
.film--worst { box-shadow: inset 3px 0 0 #6b6b73; }
.badge-worst { color: #9a9aa2; font-weight: 600; }

.chart-mini { display: block; margin-bottom: 2rem; padding: 0.75rem 1rem; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; }
.chart-mini__label { display: block; margin-bottom: 0.5rem; color: var(--muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; }
.chart-mini__wrap { position: relative; height: 100px; }

.card__link { color: inherit; text-decoration: none; }
.card__link:hover { color: var(--accent); }
.card--member { display: flex; flex-direction: column; align-items: flex-start; gap: 0.2rem; }
.card--member .card__title { margin: 0; }
.card--member .card__stats { margin-top: 0.6rem; }
.card__members { display: flex; flex-wrap: wrap; gap: 1.25rem 2rem; }
.card__member { display: flex; flex-direction: column; align-items: flex-start; }

#view { transition: opacity 0.15s; overflow-x: clip; }
.view--loading { opacity: 0.4; cursor: progress; }

.hint { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 1.1em; height: 1.1em; border: 1px solid var(--muted); border-radius: 50%; font-size: 0.7rem; color: var(--muted); cursor: help; margin-left: 0.25rem; }
.hint::after { content: attr(data-tip); position: absolute; bottom: 150%; left: 50%; transform: translateX(-50%); width: max-content; max-width: 240px; padding: 0.5rem 0.7rem; background: #000; color: var(--text); font-size: 0.8rem; line-height: 1.4; text-align: left; border-radius: 6px; opacity: 0; pointer-events: none; transition: opacity 0.15s; z-index: 10; }
.hint:hover::after { opacity: 1; }

/* ── Mobile (phones & small tablets) ── */
@media (max-width: 640px) {
    /* Less side padding so blocks don't crowd the screen edges. */
    body { padding: 0 1rem 1rem; }

    /* Nav: brand takes the first line, links wrap onto the line below. */
    .nav { flex-wrap: wrap; gap: 0.5rem 1.25rem; margin: 0 -1rem 1.75rem; padding: 1rem 1.25rem; }
    .nav__brand { width: 100%; margin-right: 0; }

    /* Hero: tagline + totals on top, mascot resting on the bottom edge. */
    .hero { flex-direction: column; align-items: center; gap: 1rem; padding: 1.5rem 1.5rem 0; }
    .hero__text { align-items: stretch; text-align: center; padding-bottom: 0; }
    .hero__mascot { height: 160px; }
    /* On mobile the grid spaces the stats; drop the desktop divider treatment. */
    .hero .totals { gap: 0.75rem; }
    .hero .stat { padding: 0; }
    .hero .stat + .stat { border-left: none; }

    /* Totals: four columns in one row, smaller so they always fit. */
    .totals { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.75rem; margin: 1.5rem 0; }
    .stat__num { font-size: 1.6rem; }
    .stat__label { font-size: 0.68rem; }

    /* Overview cards stack full width instead of squeezing side by side. */
    .card { min-width: 100%; }

    /* List rows: tighter padding and gaps. */
    .film, .member__row { padding: 0.75rem 0.9rem; gap: 0.75rem; }
    .film__stats { gap: 0.75rem; }
    .member__stats { gap: 1rem; }
    /* Правые подписи компактнее — правая колонка уже, нику слева просторнее. */
    .stat-mini__label { font-size: 0.6rem; }

    /* Round summary can wrap when the date range is long. */
    .round__head { flex-wrap: wrap; row-gap: 0.2rem; padding: 0.85rem 1rem; }
    .round__films { padding: 0 0.5rem 0.5rem; }

    /* Rating rows: narrower name column so the bar keeps room. */
    .rating { gap: 0.6rem; }
    .rating__who { min-width: 90px; }

    /* Reviews stack vertically so the text keeps full width. */
    .review { flex-direction: column; gap: 0.5rem; }
    .review__who { width: auto; flex-direction: row; align-items: baseline; gap: 0.5rem; }

    /* Film detail header: smaller poster and title. */
    .film-detail__head { gap: 1rem; margin-bottom: 1.75rem; }
    .poster--lg { width: 110px; }
    .film-detail__title { font-size: 1.5rem; }
    .film-detail__avg { font-size: 2rem; }

    .section-title { margin: 2rem 0 0.75rem; }
}
