/* Radio ChessBase's GAME STORIES (2026-11-30): the story page (RadioStory.cshtml, StoryPlayer.js,
 * StoryBoard.js) and the index (RadioStories.cshtml, StoriesBrowse.js), over radio.css's tokens.
 * The board is a DOM board of whole-pixel squares (StoryBoard sets the size); the stage is the
 * board on the left, the voices, the caption and the notation on the right — stacked on a phone. */

.story-page { padding-bottom: 40px; }
.story-hook { font: italic 400 17px/1.5 var(--serif); color: #e5e7eb; margin: 0 0 16px; max-width: 760px; }
.story-staff { font: 600 12px var(--ui); color: #fbbf24; margin: 0 0 12px; }

.story-stage { display: grid; grid-template-columns: minmax(0, 520px) minmax(0, 1fr); gap: 24px; align-items: start; margin-top: 10px; }
.story-left { min-width: 0; }
.story-board-wrap { position: relative; }

/* ── the board ── */
.story-board { width: 100%; }
/* The board and the players' rows above and below it, as wide as the board (2026-12-01). */
.sb-col { display: flex; flex-direction: column; width: fit-content; margin: 0 auto; }
.sb-col .sb-frame { order: 1; margin: 0; }
.sb-player { order: 0; display: flex; align-items: center; gap: 7px; min-height: 24px; padding: 2px 1px; font: 600 12px/1.2 var(--ui); color: #d1d5db; }
.sb-player[data-side="w"] { order: 2; }
.story-board[data-flipped="1"] .sb-player[data-side="w"] { order: 0; }
.story-board[data-flipped="1"] .sb-player[data-side="b"] { order: 2; }
.sb-disc { flex: none; width: 10px; height: 10px; border-radius: 50%; }
.sb-player[data-side="w"] .sb-disc { background: #f3f4f6; box-shadow: 0 0 0 1px rgba(0, 0, 0, .5); }
.sb-player[data-side="b"] .sb-disc { background: #111318; box-shadow: 0 0 0 1px rgba(255, 255, 255, .45); }
.sb-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* The game's events over the board are board-fx.css's; a "?" / "??" flashes the board's edge red. */
.sb-frame::after { content: ""; position: absolute; inset: 0; z-index: 6; pointer-events: none; opacity: 0;
    box-shadow: 0 0 0 3px #ff3b3b inset, 0 0 30px 4px rgba(255, 40, 40, .5) inset; }
.story-board.is-blunder .sb-frame::after { animation: sb-blunder .9s ease-out; }
@keyframes sb-blunder { 0% { opacity: 0; } 15% { opacity: 1; } 100% { opacity: 0; } }
.sb-frame { position: relative; width: fit-content; margin: 0 auto; border: 3px solid #6b4a2e; border-radius: 4px; }
.sb-squares { position: relative; width: 320px; height: 320px; user-select: none; -webkit-user-select: none; touch-action: manipulation; cursor: pointer; }
.sb-sq { position: absolute; width: 12.5%; height: 12.5%; }
.sb-sq.is-light { background-color: #e9d4b2; background-image: url("/Common/Media/Chess/LightSquaresCoolerBrighterSofter.jpg"); }
.sb-sq.is-dark { background-color: #b47a4f; background-image: url("/Common/Media/Chess/DarkSquaresLessSatur.png"); }
/* The last move: the framework's amber arrow over the pieces (StoryBoard #drawLast), fading in as the piece lands. */
.sb-arrows { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 2; pointer-events: none; overflow: visible; }
.sb-last { animation: sb-last-in .22s ease-out .12s both; }
@keyframes sb-last-in { 0% { opacity: 0; } 100% { opacity: 1; } }
.sb-sq.is-sel { box-shadow: inset 0 0 0 3px #f3d29b; }
/* A square the voice names (yellow) or an attack's target (red), under the pieces (BoardFx.decor). */
.sb-sq { transition: box-shadow .25s ease; }
.sb-sq.is-said { box-shadow: inset 0 0 0 200px rgba(255, 226, 60, .55); }
.sb-sq.is-hit { box-shadow: inset 0 0 0 200px rgba(240, 105, 85, .5); }
.sb-sq.is-target::before { content: ""; position: absolute; z-index: 2; left: 36%; top: 36%; width: 28%; height: 28%; border-radius: 50%; background: rgba(17, 24, 39, .34); }
.sb-sq.is-target.is-capture::before { left: 6%; top: 6%; width: 88%; height: 88%; background: none; box-shadow: inset 0 0 0 4px rgba(17, 24, 39, .34); }
.sb-piece {
    position: absolute; left: 0; top: 0; z-index: 1; width: 12.5%; height: 12.5%; pointer-events: none;
    background-image: var(--sb-strip); background-size: 1200% 100%; background-repeat: no-repeat;
    transition: transform .26s ease;
}
.sb-squares.no-anim .sb-piece, .sb-piece.is-dragging { transition: none; }
.sb-piece.is-dragging { z-index: 3; }
.story-board.is-var .sb-frame { outline: 2px dashed #8fbdf2; outline-offset: 3px; }
.story-board.is-var .sb-sq { filter: saturate(.5); }
.story-board.is-own .sb-frame { outline: 2px dashed #f3d29b; outline-offset: 3px; }
.story-board.is-armed .sb-frame { outline: 3px solid #f59e0b; outline-offset: 3px; animation: sb-pulse 1.2s ease-in-out infinite; }
@keyframes sb-pulse { 50% { outline-color: rgba(245, 158, 11, .35); } }
.sb-chip { display: none; position: absolute; z-index: 4; left: 8px; top: -11px; padding: 2px 8px; border-radius: 3px; font: 700 10px/1.5 var(--ui); letter-spacing: .5px; text-transform: uppercase; color: #111827; white-space: nowrap; }
.story-board.is-var .sb-chip-var { display: block; background: #8fbdf2; }
.story-board.is-own .sb-chip-own { display: block; background: #f3d29b; }

/* The act's title over the board as it begins; the big ▶ before the first play. */
.story-act-card {
    position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%); z-index: 5; pointer-events: none;
    padding: 10px 22px; border-radius: 8px; background: rgba(17, 17, 17, .82); color: #fff;
    font: 700 22px/1.25 var(--serif); text-align: center; max-width: 80%; opacity: 0;
}
.story-act-card.is-on { animation: story-card 2.6s ease forwards; }
@keyframes story-card { 0% { opacity: 0; } 15% { opacity: 1; } 75% { opacity: 1; } 100% { opacity: 0; } }
.story-start {
    position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 6;
    display: flex; align-items: center; gap: 10px; padding: 14px 24px; border: 0; border-radius: 40px;
    background: var(--cb-red); color: #fff; font: 700 17px var(--ui); cursor: pointer; box-shadow: 0 8px 30px rgba(0, 0, 0, .45);
    white-space: nowrap;
}
.story-start span { font-size: 20px; }
.story-start small { font-weight: 500; opacity: .8; }
.story-start[hidden] { display: none; }

.story-find, .story-own {
    display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 14px auto 0; padding: 10px 14px;
    border-radius: 8px; background: #1f2937; font: 600 14px var(--ui); color: #f9fafb; max-width: 520px;
}
.story-find[hidden], .story-own[hidden] { display: none; }
.story-find { border: 2px solid #f59e0b; }
.story-find.is-right { border-color: #22c55e; }
.story-find.is-wrong { border-color: #ef4444; }
.story-find button, .story-own button { margin-left: auto; font: 600 13px var(--ui); padding: 6px 12px; border-radius: 6px; border: 1px solid #4b5563; background: #111827; color: #e5e7eb; cursor: pointer; }
.story-own button + button { margin-left: 0; }
.story-own button.primary { background: var(--cb-red); border-color: var(--cb-red); color: #fff; }
.story-own-line { color: #f3d29b; font-variant-numeric: tabular-nums; }

/* ── the voices, the caption, the notation ── */
.story-voices { display: flex; gap: 14px; flex-wrap: wrap; }
.story-voice { display: flex; align-items: center; gap: 10px; padding: 6px 12px 6px 6px; border-radius: 40px; background: #1a1a1a; opacity: .55; transition: opacity .2s, box-shadow .2s; }
.story-voice img { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; background: #374151; }
.story-voice span { display: flex; flex-direction: column; font: 600 14px var(--ui); color: #fff; }
.story-voice small { font-weight: 500; font-size: 11px; color: #9ca3af; letter-spacing: .3px; }
.story-voice.is-speaking { opacity: 1; box-shadow: 0 0 0 2px var(--cb-red), 0 0 18px rgba(181, 22, 52, .55); }
.story-act { margin: 16px 0 6px; font: 700 12px var(--ui); letter-spacing: .8px; text-transform: uppercase; color: #9ca3af; min-height: 1.3em; }
.story-caption { min-height: 7.5em; padding: 12px 16px; border-radius: 8px; background: #161616; }
.story-caption-who { font: 700 11px var(--ui); letter-spacing: .8px; text-transform: uppercase; color: var(--cb-red); }
.story-caption p { margin: 4px 0 0; font: 400 18px/1.5 var(--serif); color: #f3f4f6; }
.story-caption b { color: #fcd34d; font-weight: 700; }
.story-moves { position: relative; margin-top: 14px; max-height: 200px; overflow-y: auto; font: 500 14px/1.9 var(--ui); font-variant-numeric: tabular-nums; color: #d1d5db; }
.sm-move { color: inherit; text-decoration: none; padding: 1px 3px; border-radius: 3px; }
.sm-move:hover { background: #374151; }
.sm-move.is-on { background: #fcd34d; color: #111827; }
.sm-move[hidden], .sm-var[hidden] { display: none; }
.sm-var { display: block; margin: 2px 0 2px 14px; color: #8fbdf2; }
.sm-var::before { content: "("; } .sm-var::after { content: ")"; }

/* ── the transport ── */
.story-transport { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 18px; padding: 10px 14px; border-radius: 10px; background: #161616; }
.story-transport button { flex: none; width: 38px; height: 38px; border-radius: 50%; border: 1px solid #374151; background: #111827; color: #e5e7eb; font: 600 15px/1 var(--ui); cursor: pointer; }
.story-transport button.story-play { width: 46px; height: 46px; background: var(--cb-red); border-color: var(--cb-red); color: #fff; font-size: 17px; }
.story-seek-wrap { position: relative; flex: 1 1 220px; min-width: 160px; }
.story-seek-wrap input { width: 100%; accent-color: var(--cb-red); }
.story-marks { position: absolute; left: 0; right: 0; top: 50%; height: 0; pointer-events: none; }
.story-mark { position: absolute; top: -7px; width: 2px; height: 14px; background: #9ca3af; }
.story-time { font: 600 13px var(--ui); font-variant-numeric: tabular-nums; color: #9ca3af; min-width: 88px; }
.story-transport select { background: #111827; color: #e5e7eb; border: 1px solid #374151; border-radius: 6px; padding: 6px; font: 600 13px var(--ui); }
.story-find-on { display: flex; align-items: center; gap: 6px; font: 600 12px var(--ui); color: #9ca3af; cursor: pointer; }

/* ── the transcript ── */
.story-transcript { margin-top: 36px; max-width: 820px; }
.story-transcript-act { font: 700 17px var(--serif); color: #fff; margin: 26px 0 8px; }
.story-transcript-act a { color: inherit; text-decoration: none; }
.story-line { font: 400 16px/1.6 var(--serif); color: #d1d5db; margin: 0 0 10px; }
.story-line-who { font: 700 12px var(--ui); letter-spacing: .6px; text-transform: uppercase; text-decoration: none; color: var(--cb-red); margin-right: 6px; }
.story-line.is-analyst .story-line-who { color: #60a5fa; }
.story-about { margin-top: 28px; font: 500 13px/1.6 var(--ui); color: #9ca3af; }
.story-about a { color: #e5e7eb; }

@media (max-width: 860px) {
    .story-stage { grid-template-columns: minmax(0, 1fr); }
    .story-caption { min-height: 6em; }
    .story-caption p { font-size: 16px; }
    .story-voice img { width: 40px; height: 40px; }
}

/* ── the index ── */
.stories-filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 6px 0 20px; }
.stories-filters input[type="search"] { flex: 1 1 240px; padding: 9px 12px; border-radius: 8px; border: 1px solid #374151; background: #111827; color: #f3f4f6; font: 500 14px var(--ui); }
.stories-filters select { padding: 8px; border-radius: 8px; border: 1px solid #374151; background: #111827; color: #e5e7eb; font: 600 13px var(--ui); }
.stories-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.stories-chip { padding: 6px 12px; border-radius: 20px; border: 1px solid #374151; background: #111827; color: #d1d5db; font: 600 12px var(--ui); cursor: pointer; }
.stories-chip.is-on { background: var(--cb-red); border-color: var(--cb-red); color: #fff; }
.stories-count { font: 600 12px var(--ui); color: #9ca3af; }
.stories-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
.stories-grid li[hidden] { display: none; }
.stories-tile { display: flex; gap: 14px; padding: 12px; border-radius: 10px; background: #161616; text-decoration: none; color: inherit; height: 100%; box-sizing: border-box; }
.stories-tile:hover { outline: 2px solid var(--cb-red); outline-offset: 2px; }
.stories-diagram { flex: none; width: 146px; height: 146px; border-radius: 3px; background: #2a2a2a; }
.stories-diagram canvas { display: block; }
.stories-tile-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.stories-tile-title { font: 700 17px/1.3 var(--serif); color: #fff; }
.stories-tile-sub { font: 600 12px var(--ui); color: #9ca3af; }
.stories-tile-hook { font: italic 400 13px/1.45 var(--serif); color: #d1d5db; margin-top: 4px; }
@media (max-width: 420px) { .stories-diagram { width: 110px; height: 110px; } }
