/* LGS live games: the homepage block, the /live/ list and the viewer. Loaded after designs/home.css. */
.live-block {
    background: #fbf4e6;
    border: 1px solid #c9ab7c;
    border-left: 4px solid #8d2e28;
    border-radius: 8px;
    padding: 12px 16px 10px;
    margin: 0 0 22px;
}
.news .live-block h2 { margin: 0 0 6px; font-size: 1.45rem; }
.live-block h3 {
    margin: 8px 0 2px;
    font-size: 0.95rem;
    font-weight: 700;
    color: #5a4030;
    letter-spacing: 0.02em;
}
.live-block .live-list { list-style: none; margin: 0; padding: 0; }
.news .live-block .live-list { padding-left: 0; }
.live-block .live-item { margin: 0.3em 0; overflow-wrap: anywhere; }
.live-block .live-item a { color: #8d2e28; font-weight: 600; text-decoration: none; }
.live-block .live-item a:hover .live-players,
.live-block .live-item a:hover .live-event { text-decoration: underline; }
.live-block .live-event { color: #2a1c12; }
.live-block .live-meta { color: #5a4030; font-size: 0.88rem; white-space: nowrap; }
.live-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    margin: 0 6px 1px 0;
    border-radius: 50%;
    background: #c0392b;
    box-shadow: 0 0 0 2px rgba(192, 57, 43, 0.2);
    vertical-align: middle;
}
.live-block .live-empty { margin: 4px 0; color: #5a4030; font-size: 0.95rem; }
.live-block [hidden] { display: none !important; }
.live-block-page { font-size: 1.05rem; }

/* The viewer: board on the left, players and status on the right; one column on phones. */
.live-page h2 {
    font-family: "Songti TC", "Noto Serif CJK TC", "PMingLiU", "Microsoft JhengHei", serif;
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1.35;
    margin: 4px 0 10px;
    overflow-wrap: anywhere;
}
.live-page .live-lead { color: #5a4030; margin: 0 0 12px; }
.live-viewer {
    display: flex;
    flex-wrap: wrap;
    gap: 16px 24px;
    align-items: flex-start;
}
.live-viewer[hidden], .live-ended[hidden] { display: none; }
.live-board-wrap { flex: 1 1 480px; max-width: 760px; min-width: 0; }
.live-board { width: 100%; aspect-ratio: 1 / 1; position: relative; }
/* Hollow red ring for a reviewed (earlier) move; goboard's CR marks are black/white, not red. */
.live-move-ring { position: absolute; left: 0; top: 0; z-index: 20; pointer-events: none; }
.live-side { flex: 1 1 260px; min-width: 0; }
.live-player {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #fbf4e6;
    border: 1px solid #c9ab7c;
    border-radius: 8px;
    padding: 8px 12px;
    margin: 0 0 8px;
}
.live-player.is-turn { border-color: #8d2e28; box-shadow: 0 0 0 2px rgba(141, 46, 40, 0.25); }
.live-stone,
.live-avatar {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid #2a1c12;
}
.live-avatar { object-fit: cover; background: #efe4cc; }
.live-stone-b { background: radial-gradient(circle at 35% 35%, #555, #000 70%); }
.live-stone-w { background: radial-gradient(circle at 35% 35%, #fff, #ddd 70%); }
.live-player-name { font-weight: 700; overflow-wrap: anywhere; }
.live-player-rank { color: #5a4030; margin-left: 4px; font-weight: 400; }
.live-player-info { margin-left: auto; text-align: right; font-size: 0.9rem; color: #5a4030; white-space: nowrap; }
.live-clock { font-variant-numeric: tabular-nums; font-size: 1.05rem; color: #2a1c12; font-weight: 600; }
.live-status { margin: 10px 0; font-size: 0.95rem; color: #5a4030; }
.live-status .live-dot { animation: live-pulse 2s infinite; }
.live-status.is-off .live-dot { background: #999; box-shadow: none; animation: none; }
.live-desc { margin: 6px 0; overflow-wrap: anywhere; }
.live-links { margin: 14px 0 0; padding-left: 1.2em; }
.live-links li { margin: 0.35em 0; }
.live-page > p > a, .live-links a, .live-ended a { color: #8d2e28; font-weight: 600; }
.live-ended {
    background: #fbf4e6;
    border: 1px solid #c9ab7c;
    border-left: 4px solid #8d2e28;
    border-radius: 8px;
    padding: 18px 20px;
    margin: 12px 0 24px;
    font-size: 1.1rem;
}
.live-board-wrap > .live-ended { margin: 8px 0 12px; }
.live-board[hidden] { display: none; }
.live-ended p { margin: 0.3em 0; }
@keyframes live-pulse { 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .live-status .live-dot { animation: none; } }
@media screen and (max-width: 640px) {
    .live-page h2 { font-size: 1.25rem; }
    .live-board-wrap { flex-basis: 100%; }
    .live-player { padding: 6px 10px; }
}


/* The move control bar, above the board. Look, icons and layout follow lgs.tw's record viewer
 * (web/record.php, public/css/style.css .board-toolbar); colours are the LGS homepage's wood and ink. */
.board-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 3px;
    margin: 0 0 10px;
}
.board-toolbar .tool-group {
    display: flex;
    align-items: center;
    gap: 3px;
}
.board-toolbar button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    min-width: 26px;
    min-height: 26px;
    padding: 0;
    font: inherit;
    font-size: 12px;
    color: #2a1c12;
    background: #fbf4e6;
    border: 1px solid #c9ab7c;
    border-radius: 4px;
    cursor: pointer;
}
.board-toolbar button svg {
    width: 14px;
    height: 14px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.board-toolbar button:hover:not(:disabled) {
    border-color: #8d2e28;
    color: #8d2e28;
}
.board-toolbar button:disabled {
    opacity: 0.38;
    cursor: default;
}
.board-toolbar #move-count {
    min-width: 56px;
    margin: 0 1px;
    text-align: center;
    white-space: nowrap;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    color: #5a4030;
}
.board-toolbar #move-live {
    margin: 0 4px 0 0;
    font-size: 12px;
    font-weight: 700;
    color: #8d2e28;
    white-space: nowrap;
}
.board-toolbar #move-live[hidden] { display: none; }
.board-toolbar.is-live #move-last { /* at the latest move: the "live" state is the count + 直播 label */ }
@media screen and (max-width: 640px) {
    /* Keep the bar on one row: nav, count/DES, and the 手數 toggle. */
    .board-toolbar { gap: 2px; flex-wrap: nowrap; }
    .board-toolbar .tool-group {
        gap: 2px;
        flex-wrap: nowrap;
        width: auto;
        min-width: 0;
        justify-content: flex-start;
    }
    .board-toolbar .tool-group.last { margin-left: 2px; flex: 0 0 auto; }
    .board-toolbar .move-info { flex: 1 1 auto; min-width: 0; }
    .board-toolbar button {
        width: 32px;
        height: 32px;
        min-width: 32px;
        min-height: 32px;
        flex: 0 0 32px;
    }
    .board-toolbar button svg { width: 16px; height: 16px; }
    .board-toolbar #move-count { min-width: 0; flex: 0 1 auto; font-size: 12px; }
    .board-toolbar #move-live { margin: 0; flex: 0 0 auto; }
}


/* 手數 toggle, as on lgs.tw: the chosen state stays chosen. */
.board-toolbar #move-numbers.on {
    background: #8d2e28;
    border-color: #8d2e28;
    color: #fbf4e6;
}
.board-toolbar .tool-group.last { margin-left: 4px; }
.board-toolbar .move-info {
    display: inline-flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0 8px;
    min-width: 0;
    max-width: 100%;
    margin: 0 2px;
}
.board-toolbar #move-des,
.board-toolbar #move-result {
    font-size: 13px;
    max-width: 22em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #2a1c12;
}
.board-toolbar #move-des[hidden],
.board-toolbar #move-result[hidden] { display: none; }
.board-toolbar #move-result {
    font-weight: 700;
    color: #8d2e28;
}

/* 分享: Facebook, LINE, 取得鏈結 — layout follows lgs.tw's .share-row. */
.live-page .share-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: 0 0 12px;
}
.live-side .share-row { margin: 14px 0 8px; }
.live-side .live-play { margin: 0 0 14px; }
.live-side .live-others { margin: 0 0 8px; }
.live-side .live-others h2 { margin: 0 0 8px; font-size: 1.25rem; }
.live-page .share-row .share-label {
    color: #5a4030;
    font-size: 13px;
}
.live-page .share-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.live-page .share-buttons .share {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    padding: 4px 10px;
    color: #2a1c12;
    background: #fbf4e6;
    border: 1px solid #c9ab7c;
    border-radius: 4px;
    text-decoration: none;
    cursor: pointer;
    font: inherit;
}
.live-page .share-buttons .share:hover {
    border-color: #8d2e28;
}
.live-page .share-buttons .share-icon {
    width: 15px;
    height: 15px;
    flex: none;
}
.live-page .share-row .hint {
    flex-basis: 100%;
    margin: 2px 0 0;
    font-size: 13px;
    color: #5a4030;
}
.live-page .share-row .hint[hidden] { display: none; }

.live-ended-result { font-weight: 700; color: #8d2e28; }
.live-ended-des { color: #5a4030; }

.live-others { margin: 24px 0 8px; }
.live-others h2 {
    font-family: "Songti TC", "Noto Serif CJK TC", "PMingLiU", "Microsoft JhengHei", serif;
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0 0 10px;
}
.live-others .live-list { list-style: none; margin: 0; padding: 0; }
.live-others .live-item { margin: 0.4em 0; }

@media screen and (max-width: 640px) {
    .board-toolbar #move-des { max-width: 7em; font-size: 12px; }
    .board-toolbar #move-result { font-size: 13px; }
    /* When a result is in the bar, give DES + result a full-width row so "結果：W+R" is not clipped. */
    .board-toolbar.has-result { align-items: flex-start; }
    .board-toolbar.has-result #move-group { flex-wrap: wrap; }
    .board-toolbar.has-result .move-info {
        flex: 1 0 100%;
        order: 20;
        justify-content: center;
        max-width: none;
        margin-top: 2px;
        gap: 0 8px;
    }
    .board-toolbar.has-result #move-des,
    .board-toolbar.has-result #move-result {
        max-width: none;
        overflow: visible;
        text-overflow: unset;
        white-space: nowrap;
    }
    .live-stone, .live-avatar { width: 36px; height: 36px; }
}
