/* WoodChess Live — broadcast index, tournament grid and their cards. Every colour is a theme token, so
   dark theme needs no rules of its own here. */

.live {
    max-width: 1180px;
    margin: 0 auto;
    padding: 1.25rem 1rem 3rem;
    color: var(--text);
}

.live-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.6rem;
    margin: 0 0 0.75rem;
    color: var(--text);
    overflow-wrap: anywhere;
}

.live-title__mark {
    color: var(--accent);
    flex: none;
}

.live-lede {
    max-width: 46rem;
    color: var(--muted);
    line-height: 1.55;
}

.live-empty {
    color: var(--muted);
    margin: 1.5rem 0;
}

.live-crumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    align-items: center;
    font-size: 0.85rem;
    color: var(--muted);
    margin-bottom: 0.75rem;
}

.live-crumbs a {
    color: var(--muted);
    text-decoration: none;
}

.live-crumbs a:hover {
    color: var(--text);
    text-decoration: underline;
}

.live-crumbs__sep {
    opacity: 0.6;
}

/* The on-air mark: a small steady dot that breathes, never a flashing badge. */
.live-dot {
    display: inline-block;
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: var(--good);
    margin-right: 0.35rem;
    vertical-align: middle;
    animation: live-breathe 2.4s ease-in-out infinite;
}

@keyframes live-breathe {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.45; }
}

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

/* Index */

.live-section {
    margin-top: 2rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--rowline);
}

.live-section__title {
    font-size: 1.15rem;
    margin: 0 0 0.85rem;
    color: var(--text);
}

.live-tours {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr));
    gap: 0.85rem;
}

.live-tour {
    display: flex;
    flex-direction: column;
    height: 100%;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    background: var(--surface);
    color: var(--text);
    text-decoration: none;
    overflow: hidden;
    transition: border-color 0.15s ease;
}

.live-tour:hover,
.live-tour:focus-visible {
    border-color: var(--border-strong);
    color: var(--text);
}

.live-tour__image {
    width: 100%;
    aspect-ratio: 2 / 1;
    object-fit: cover;
    background: var(--raise);
}

.live-tour__body {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    padding: 0.75rem 0.85rem 0.85rem;
}

.live-tour__name {
    font-weight: 600;
    overflow-wrap: anywhere;
}

.live-tour__round {
    font-size: 0.9rem;
}

.live-tour--group:hover {
    border-color: var(--border);
}

.live-tour__image-link {
    display: block;
    line-height: 0;
}

.live-tour__sections {
    list-style: none;
    margin: 0.15rem 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.live-tour__section {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.15rem 0.6rem;
    padding: 0.4rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    color: var(--text);
    text-decoration: none;
    transition: border-color 0.15s ease;
}

.live-tour__section:hover,
.live-tour__section:focus-visible {
    border-color: var(--border-strong);
    color: var(--text);
}

.live-tour__section-name {
    font-weight: 600;
}

.live-tour__meta,
.live-head__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 0.75rem;
    font-size: 0.85rem;
    color: var(--muted);
}

/* Tournament */

.live-head {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.live-head__image {
    width: min(100%, 280px);
    aspect-ratio: 2 / 1;
    object-fit: cover;
    border-radius: 0.5rem;
    background: var(--raise);
}

.live-head__body {
    flex: 1 1 280px;
    min-width: 0;
}

.live-head__meta {
    margin: 0 0 0.5rem;
}

.live-head__links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin: 0;
    font-size: 0.9rem;
}

.live-rounds {
    display: flex;
    gap: 0.35rem;
    overflow-x: auto;
    padding-bottom: 0.35rem;
    margin-bottom: 0.75rem;
    border-bottom: 1px solid var(--rowline);
    scrollbar-width: thin;
}

.live-rounds__tab {
    flex: none;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    color: var(--muted);
    text-decoration: none;
    font-size: 0.9rem;
    white-space: nowrap;
}

.live-rounds__tab:hover {
    color: var(--text);
    border-color: var(--border-strong);
}

.live-rounds__tab.is-active {
    color: var(--text);
    border-color: var(--accent);
    background: var(--accent-soft);
}

.live-round-status {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1rem;
    color: var(--muted);
    font-size: 0.9rem;
}

.live-round-status__delay {
    font-style: italic;
}

.live-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr));
    gap: 1rem 0.85rem;
}

/* Board card */

.live-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    background: var(--surface);
    min-width: 0;
}

.live-card:hover,
.live-card:focus-within {
    border-color: var(--border-strong);
}

.live-card__link {
    position: absolute;
    inset: 0;
    z-index: 1;
    border-radius: inherit;
}

.live-card__link:focus-visible {
    outline: 2px solid var(--outline);
    outline-offset: 2px;
}

.live-card__board {
    position: relative;
    display: flex;
    justify-content: center;
}

.live-card.is-finished .live-card__board .mini-board {
    opacity: 0.82;
}

.live-card__result {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    padding: 0.2rem 0.6rem;
    border-radius: 0.35rem;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    font-weight: 700;
    font-size: 1rem;
    font-variant-numeric: tabular-nums;
}

.live-player {
    display: flex;
    align-items: baseline;
    gap: 0.35rem;
    min-width: 0;
    font-size: 0.85rem;
    line-height: 1.3;
}

.live-player__title {
    flex: none;
    font-weight: 700;
    color: var(--accent-text);
    font-size: 0.75rem;
}

.live-player__name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text);
    text-decoration: none;
}

/* Above the stretched game link, so the name opens the profile and the rest of the card the game. */
a.live-player__name {
    position: relative;
    z-index: 2;
}

a.live-player__name:hover {
    text-decoration: underline;
}

.live-player__elo,
.live-player__fed {
    flex: none;
    color: var(--muted);
    font-size: 0.78rem;
}

.live-player__end {
    margin-left: auto;
    flex: none;
}

.live-player__score {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.live-clock {
    display: inline-block;
    min-width: 3.4rem;
    padding: 0.05rem 0.4rem;
    border-radius: 0.3rem;
    border: 1px solid var(--clock-bd);
    background: var(--clock-bg);
    color: var(--text);
    font-variant-numeric: tabular-nums;
    text-align: right;
    font-size: 0.8rem;
}

.live-clock.is-running {
    border-color: var(--clock-active-bd);
    background: var(--clock-active-bg);
    font-weight: 600;
}

.live-clock.is-low {
    border-color: var(--clock-warn-bd);
    background: var(--clock-warn-bg);
    color: var(--clock-warn-text);
}

.live-attribution {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 2.5rem;
    padding-top: 0.85rem;
    border-top: 1px solid var(--rowline);
    font-size: 0.8rem;
    color: var(--muted);
}

.live-attribution a {
    color: var(--muted);
}

.live-attribution a:hover {
    color: var(--text);
}

/* ---- Game page ---- */

.live-game {
    padding: 0.5rem 0 2rem;
    color: var(--text);
}

.live-game__head {
    margin-bottom: 0.35rem;
}

.live-game__head .live-crumbs {
    margin-bottom: 0.25rem;
}

.live-game__title {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.75rem;
    margin: 0;
    font-size: 1.15rem;
    color: var(--text);
    overflow-wrap: anywhere;
}

.live-game__state {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--muted);
}

/* The row is the board's width, so its type follows the board down the same way the library game's
   player rows do. */
.live-game__player {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    min-width: 0;
    width: 100%;
    font-size: clamp(0.78rem, calc(var(--board-size-px, 640px) * 0.0238), 0.95rem);
}

.live-game__photo {
    flex: none;
    width: 1.75em;
    height: 1.75em;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--border);
    background: var(--surface-2);
}

.live-game__name {
    min-width: 0;
    color: var(--text);
    font-weight: 600;
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

a.live-game__name:hover {
    color: var(--accent);
    text-decoration: underline;
}

.live-game__clock {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    flex: none;
}

.live-game__below {
    max-width: 960px;
    margin: 1rem auto 0;
    padding: 0 1rem;
}

.live-game__note,
.live-game__credits {
    font-size: 0.85rem;
    color: var(--muted);
    margin: 0.5rem 0;
    overflow-wrap: anywhere;
}

.live-game__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0.75rem 0;
}

.pgn-viewer-live-return {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    padding: 0.45rem 0.75rem;
    background: var(--accent-soft);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.pgn-viewer-live-return__label {
    font-size: 0.88rem;
    color: var(--muted);
}

/* ---- Player page ---- */

.live-profile {
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem;
    align-items: flex-start;
    margin-bottom: 1.5rem;
}

.live-profile__photo {
    flex: none;
    margin: 0;
    width: 180px;
}

.live-profile__photo img {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 5;
    object-fit: cover;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface-2);
}

.live-profile__photo--empty {
    display: grid;
    place-items: center;
    aspect-ratio: 4 / 5;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--muted);
    font-size: 2.5rem;
    font-weight: 600;
    letter-spacing: 0.04em;
}

.live-profile__photo figcaption {
    margin-top: 0.35rem;
    font-size: 0.72rem;
    color: var(--muted);
    overflow-wrap: anywhere;
}

.live-profile__body {
    flex: 1 1 18rem;
    min-width: 0;
}

.live-profile__title {
    font-size: 1rem;
}

.live-ratings {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin: 0.75rem 0 0;
}

.live-ratings__item {
    min-width: 6.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.live-ratings__item dt {
    font-size: 0.75rem;
    color: var(--muted);
}

.live-ratings__item dd {
    margin: 0.15rem 0 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.live-games-table {
    width: 100%;
    margin-top: 1rem;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.live-games-table th {
    text-align: left;
    font-weight: 600;
    font-size: 0.78rem;
    color: var(--muted);
    padding: 0.35rem 0.5rem;
    border-bottom: 1px solid var(--border-strong);
}

.live-games-table td {
    padding: 0.4rem 0.5rem;
    border-bottom: 1px solid var(--rowline);
    color: var(--text);
}

.live-games-table a {
    color: var(--text);
}

.live-games-table a:hover {
    color: var(--accent);
}

/* ---- Rating chart ---- */

.live-chart {
    --live-chart-line: light-dark(#a0522d, #c4863a);
    position: relative;
    margin-top: 0.75rem;
    padding-top: 2rem;
}

.live-chart__svg {
    display: block;
    width: 100%;
    height: auto;
    overflow: visible;
}

.live-chart__grid {
    stroke: var(--rowline);
    stroke-width: 1;
}

.live-chart__tick {
    fill: var(--muted);
    font-size: 11px;
    font-variant-numeric: tabular-nums;
}

.live-chart__line {
    fill: none;
    stroke: var(--live-chart-line);
    stroke-width: 2;
    stroke-linejoin: round;
    stroke-linecap: round;
    vector-effect: non-scaling-stroke;
}

.live-chart__crosshair {
    stroke: var(--border-strong);
    stroke-width: 1;
    vector-effect: non-scaling-stroke;
}

.live-chart__dot {
    fill: var(--live-chart-line);
    stroke: var(--bg);
    stroke-width: 2;
}

.live-chart__hit {
    fill: transparent;
}

.live-chart__tip {
    position: absolute;
    top: 0;
    transform: translateX(-50%);
    display: flex;
    gap: 0.4rem;
    align-items: baseline;
    padding: 0.2rem 0.5rem;
    white-space: nowrap;
    font-size: 0.82rem;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    pointer-events: none;
    font-variant-numeric: tabular-nums;
}

.live-chart__tip-date {
    color: var(--muted);
}

.live-chart__table {
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: var(--muted);
}

.live-chart__table summary {
    cursor: pointer;
}

.live-chart__table table {
    margin-top: 0.5rem;
    border-collapse: collapse;
}

.live-chart__table td,
.live-chart__table th {
    padding: 0.2rem 0.75rem 0.2rem 0;
    text-align: left;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

/* ---- Home page featured card ---- */

.live-featured {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-top: 1.5rem;
    max-width: 280px;
    color: var(--text);
}

.live-featured--guest {
    margin-top: 2rem;
}

.live-featured__head {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.live-featured__title {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0;
    font-size: 1.05rem;
    color: var(--text);
}

.live-featured__title .wood-icon {
    color: var(--accent);
}

.live-featured__tour {
    font-size: 0.85rem;
    color: var(--muted);
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.live-featured__tour:hover {
    color: var(--text);
    text-decoration: underline;
}

.live-featured__more {
    font-size: 0.85rem;
    color: var(--accent-text);
}
