/* ── Shell tokens — classic chess24 light chrome (2019–2021 colours) ── */
:root {
    color-scheme: light;

    --pds-font: "Trebuchet MS", Arial, sans-serif;
    --pds-chess-font: "Arial Narrow", Arial, "Heiti SC", SimHei, sans-serif;
    --pds-leading: 1.5;

    /* Links and active navigation stay this blue. */
    --host-accent: #004a9e;
    --host-accent-hover: #004a9e;
    --host-ink: #333333;
    --host-muted: #666666;
    --host-footer: #ffffff;

    /* Plain-blue buttons, gradient CTAs, and the one orange highlight. */
    --c24-btn: #436ab3;
    --c24-btn-hover: #3c5fa0;
    --c24-btn-gradient: linear-gradient(to bottom, #0a66ae 0%, #343f8e 100%);
    --c24-header: #436ab3;
    --c24-header-deep: #345892;
    --c24-orange: #f39200;
    --c24-orange-hover: #db8300;
    --c24-logo: #436ab3;

    /* Section accents: Play / Learn / Read. */
    --c24-play: #1068a1;
    --c24-read: #b42a52;

    --pds-canvas: #ededed;
    --pds-surface: #ffffff;
    --pds-surface-soft: #f7f7f7;
    --pds-frosted: #f3f3f3;

    --pds-text-primary: #444444;
    --pds-text-high: #333333;
    --pds-text-medium: #666666;
    --pds-text-low: #888888;
    --pds-placeholder: #bab7b7;

    --pds-border: #eeeeee;
    --pds-border-strong: #cccccc;

    --pds-focus: #9bbfe6;
    --pds-success: #528f32;
    --pds-error: #c6252c;

    --pds-motion: 0.15s ease;
    --pds-radius: 5px;
    --pds-shadow: 0 1px 1px 1px rgba(119, 119, 119, 0.3);
    --c24-header-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.1);

    /* Shell aliases */
    --bg-primary: var(--pds-canvas);
    --bg-secondary: var(--pds-surface);
    --text-primary: var(--pds-text-primary);
    --text-secondary: var(--pds-text-medium);
    --border: var(--pds-border);
    --accent: var(--host-accent);
    --accent-hover: var(--host-accent-hover);
    --success: var(--pds-success);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--pds-font);
    font-size: 16px;
    font-weight: 400;
    line-height: var(--pds-leading);
    background: var(--pds-canvas);
    color: var(--pds-text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

h1,
h2,
h3,
h4,
h5,
h6,
strong {
    color: var(--host-ink);
}

a {
    color: var(--host-accent);
}

::selection {
    background: #d3dbe9;
    color: #333333;
}

.container {
    width: min(1200px, 100%);
    margin: 0 auto;
    padding: 0 clamp(1rem, 4vw, 2rem);
}

/* ── Header ── */
.header {
    position: relative;
    z-index: 80;
    background: linear-gradient(to bottom, #4a74bf 0%, var(--c24-header) 55%, var(--c24-header-deep) 100%);
    border-bottom: 1px solid var(--c24-header-deep);
    box-shadow: var(--c24-header-shadow);
    color: #ffffff;
}

.header .container {
    width: min(1800px, 100%);
}

.header-bar {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: nowrap;
    gap: 0.85rem;
    min-height: 5.4rem;
    padding-top: 0.55rem;
    padding-bottom: 0.55rem;
}

.header-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.7rem;
    color: #ffffff;
    text-decoration: none;
    flex-shrink: 0;
}

.header-brand-mark {
    display: inline-flex;
    color: #ffffff;
    flex-shrink: 0;
}

.header-brand-glyph {
    fill: var(--c24-header-deep);
}

.header-brand-name {
    font-family: var(--pds-font);
    font-size: 1.45rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    color: #ffffff;
    text-shadow: 0 1px 0 rgba(0, 0, 0, 0.18);
}

.header-brand:hover .header-brand-name {
    color: #ffffff;
    opacity: 0.92;
}

.header-brand {
    order: 1;
}

.header-nav {
    order: 2;
}

.lang-switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
    order: 3;
    margin-left: 0.65rem;
}

.lang-switch-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.32rem;
    width: 3.35rem;
    height: 2.35rem;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.45);
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    font-family: var(--pds-font);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    line-height: 1;
    cursor: pointer;
}

.lang-switch-toggle:hover,
.lang-switch-toggle[aria-expanded='true'] {
    border-color: var(--c24-orange);
    background: rgba(255, 255, 255, 0.18);
    box-shadow: inset 0 -2px 0 var(--c24-orange);
}

.lang-switch-toggle:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: 2px;
}

.lang-switch-caret {
    width: 0.38rem;
    height: 0.38rem;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: translateY(-1px) rotate(45deg);
    transition: transform var(--pds-motion);
}

.lang-switch-toggle[aria-expanded='true'] .lang-switch-caret {
    color: var(--c24-orange);
    transform: translateY(1px) rotate(225deg);
}

.lang-switch-menu {
    position: absolute;
    top: calc(100% + 0.35rem);
    right: 0;
    z-index: 5;
    display: flex;
    flex-direction: column;
    min-width: 10.5rem;
    margin: 0;
    padding: 0.3rem;
    list-style: none;
    background: #ffffff;
    border: 1px solid #cccccc;
    border-top: 3px solid var(--c24-orange);
    border-radius: 0 0 5px 5px;
    box-shadow: var(--pds-shadow);
}

.lang-switch-menu[hidden] {
    display: none;
}

.lang-switch-menu a {
    display: flex;
    align-items: center;
    padding: 0.5rem 0.7rem;
    border-radius: 3px;
    color: #444444;
    font-size: 0.9rem;
    font-weight: 700;
    line-height: 1.2;
    text-decoration: none;
    white-space: nowrap;
}

.lang-switch-menu a:hover,
.lang-switch-menu a:focus-visible {
    background: #fff6e8;
    color: #004a9e;
}

.lang-switch-menu a:focus-visible {
    outline: 2px solid #004a9e;
    outline-offset: 1px;
}

.lang-switch-menu a.is-fallback {
    opacity: 0.45;
}

.header-menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    order: 4;
    gap: 5px;
    width: 2.5rem;
    height: 2.5rem;
    padding: 0.45rem;
    margin-left: 0;
    border: 1px solid rgba(255, 255, 255, 0.45);
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.12);
    cursor: pointer;
    flex: 0 0 auto;
}

.header-menu-toggle-bar {
    display: block;
    height: 2px;
    width: 100%;
    background: #ffffff;
    border-radius: 999px;
    transition: transform var(--pds-motion), opacity var(--pds-motion);
}

.header-menu-toggle.is-open .header-menu-toggle-bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.header-menu-toggle.is-open .header-menu-toggle-bar:nth-child(2) {
    opacity: 0;
}

.header-menu-toggle.is-open .header-menu-toggle-bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

.header-nav {
    display: flex;
    align-items: center;
    flex: 1 1 auto;
    flex-wrap: nowrap;
    justify-content: flex-end;
    gap: 0.1rem 0.15rem;
    min-width: 0;
    margin-left: auto;
}

.header-nav-link {
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
    padding: 0.45rem 0.55rem;
    font-family: var(--pds-font);
    font-size: clamp(0.88rem, 0.75rem + 0.35vw, 1.05rem);
    font-weight: 700;
    letter-spacing: 0.01em;
    white-space: nowrap;
    color: rgba(255, 255, 255, 0.92);
    text-decoration: none;
    text-shadow: 0 1px 0 rgba(0, 0, 0, 0.12);
    border-radius: 0;
    transition: color var(--pds-motion), opacity var(--pds-motion);
}

.header-nav-link:hover,
.header-nav-link.is-active {
    background: transparent;
    color: #ffffff;
}

.header-nav-link.is-active {
    box-shadow: inset 0 -2px 0 var(--c24-orange);
}

.header-nav-account {
    display: inline-flex;
    align-items: center;
    margin-left: 0.35rem;
    padding: 0.4rem 0.9rem;
    color: #ffffff;
    background: var(--c24-btn);
    border-radius: 3px;
    font-weight: 700;
}

.header-nav-account:hover,
.header-nav-account.is-active {
    background: var(--c24-btn-hover);
    color: #ffffff;
}

.header-nav-account[hidden],
.header-account-menu[hidden],
.header-account-dropdown[hidden] {
    display: none !important;
}

.header-nav-account-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.header-account-menu {
    position: relative;
    margin-left: 0.35rem;
}

.header-account-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
    color: var(--c24-logo);
    background: var(--pds-surface-soft);
    border: 1px solid #cccccc;
    border-radius: 999px;
    cursor: pointer;
    transition: background var(--pds-motion), border-color var(--pds-motion);
}

.header-account-toggle:hover,
.header-account-toggle.is-open,
.header-account-toggle.is-active {
    background: var(--c24-btn);
    border-color: var(--c24-btn);
    color: #fff;
}

.header-account-icon {
    display: block;
}

.header-account-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    z-index: 40;
    min-width: 14rem;
    padding: 0.4rem;
    background: #ffffff;
    border: 1px solid #cccccc;
    border-top: 3px solid #004a9e;
    border-radius: 0 0 5px 5px;
    box-shadow: var(--pds-shadow);
}

.header-account-email,
.header-account-signout {
    display: block;
    width: 100%;
    padding: 0.65rem 0.75rem;
    text-align: left;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--pds-text-primary);
    background: transparent;
    border: 0;
    border-radius: 8px;
    text-decoration: none;
    cursor: pointer;
}

.header-account-email:hover,
.header-account-signout:hover {
    background: var(--pds-surface-soft);
    color: var(--host-accent);
}

.page-hero {
    background: #ededed;
    border-bottom: none;
    padding: clamp(1.15rem, 2.5vw, 1.6rem) 0 0.15rem;
}

.page-hero-inner {
    text-align: left;
}

.page-hero h1 {
    font-size: clamp(1.5rem, 0.6vw + 1.25rem, 1.85rem);
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: 0;
    margin: 0;
    padding: 0;
    color: #333333;
}

.header-lead {
    margin-top: 0.85rem;
    font-size: clamp(1.05rem, 0.3vw + 1rem, 1.2rem);
    font-weight: 500;
    line-height: 1.5;
    color: var(--pds-text-medium);
    max-width: 42rem;
}

/* Diagram page: grow document with wide tree so header/footer span full scroll width */
html.layout-diagram {
    width: max-content;
    min-width: max(100%, var(--diagram-scroll-width, 100%));
}

html.layout-diagram body.layout-diagram {
    width: max-content;
    min-width: max(100%, var(--diagram-scroll-width, 100%));
    align-items: stretch;
}

html.layout-diagram .header,
html.layout-diagram .page-hero,
html.layout-diagram .footer {
    align-self: stretch;
    min-width: max(100%, var(--diagram-scroll-width, 100%));
}

html.layout-diagram .main-content {
    width: max-content;
    min-width: 100%;
    margin: 0 auto;
    padding-left: clamp(1rem, 4vw, 2rem);
    padding-right: clamp(1rem, 4vw, 2rem);
}

/* ── Main layout ── */
.main-content {
    flex: 1;
    padding-top: clamp(1.5rem, 4vw, 2.5rem);
    padding-bottom: clamp(2rem, 5vw, 3rem);
}

section {
    padding: 0;
}

/* ── Content pages ── */
.content-page {
    display: grid;
    gap: clamp(1rem, 3vw, 1.5rem);
    max-width: 52rem;
    margin: 0 auto;
}

.content-panel {
    margin-bottom: 0;
}

.content-heading {
    font-size: clamp(1.15rem, 0.3vw + 1.1rem, 1.4rem);
    font-weight: 600;
    margin-bottom: 0.85rem;
}

.content-subheading {
    font-size: 1rem;
    font-weight: 600;
    margin: 1.25rem 0 0.65rem;
}

.content-text {
    color: var(--pds-text-high);
    line-height: 1.6;
}

.content-text a {
    color: var(--host-accent);
    font-weight: 700;
}

.content-list {
    padding-left: 1.25rem;
    color: var(--pds-text-high);
    line-height: 1.6;
}

.content-list li+li {
    margin-top: 0.5rem;
}

.code-block {
    margin: 0.75rem 0 0;
    padding: 1rem 1.1rem;
    background: var(--pds-surface-soft);
    border: 1px solid var(--pds-border);
    border-radius: var(--pds-radius);
    overflow-x: auto;
    font-family: ui-monospace, 'Cascadia Code', 'Segoe UI Mono', monospace;
    font-size: 0.875rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}

.content-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.content-actions .btn {
    text-decoration: none;
    text-align: center;
}

/* ── Panel / demo controls ── */
.panel {
    background: #ffffff;
    border: 1px solid #cccccc;
    border-radius: 5px;
    padding: clamp(1.05rem, 2.4vw, 1.35rem);
    margin-bottom: clamp(1rem, 3vw, 1.5rem);
    box-shadow: var(--pds-shadow);
}

.demo-controls .panel-header {
    justify-content: center;
}

.demo-controls .panel-title {
    text-align: center;
    width: 100%;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--pds-border);
}

.panel-title {
    font-size: clamp(1.13rem, 0.21vw + 1.08rem, 1.33rem);
    font-weight: 600;
    letter-spacing: -0.01em;
}

.input-mode {
    display: inline-flex;
    gap: 0;
    border: 1px solid var(--pds-border-strong);
    border-radius: var(--pds-radius);
    overflow: hidden;
}

.mode-btn {
    padding: 0.45rem 1rem;
    background: transparent;
    border: none;
    border-right: 1px solid var(--pds-border);
    color: var(--pds-text-high);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    transition: background var(--pds-motion), color var(--pds-motion);
}

.mode-btn:last-child {
    border-right: none;
}

.mode-btn:hover {
    background: var(--pds-surface-soft);
}

.mode-btn.active {
    background: var(--c24-btn);
    color: #fff;
}

.mode-btn:focus-visible {
    outline: 2px solid var(--pds-focus);
    outline-offset: 2px;
}

.field-label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--pds-text-high);
    letter-spacing: 0.01em;
}

#pgn-input {
    width: 100%;
    padding: 0.85rem 1rem;
    background: #ffffff;
    border: 1px solid #cccccc;
    border-radius: 3px;
    color: #444444;
    font-family: ui-monospace, 'Cascadia Code', 'Segoe UI Mono', monospace;
    font-size: 0.875rem;
    line-height: 1.5;
    resize: vertical;
    min-height: 9rem;
    transition: border-color var(--pds-motion), box-shadow var(--pds-motion);
}

#pgn-input::placeholder {
    color: var(--pds-placeholder);
}

#pgn-input:hover {
    border-color: var(--pds-text-low);
}

#pgn-input:focus {
    outline: none;
    border-color: var(--pds-focus);
    box-shadow: 0 0 0 1px var(--pds-focus);
}

.field-input {
    width: 100%;
    padding: 0.75rem 0.9rem;
    background: #ffffff;
    border: 1px solid #cccccc;
    border-radius: 3px;
    color: #444444;
    font: inherit;
    transition: border-color var(--pds-motion), box-shadow var(--pds-motion);
}

.field-input:hover {
    border-color: var(--pds-text-low);
}

.field-input:focus {
    outline: none;
    border-color: var(--pds-focus);
    box-shadow: 0 0 0 1px var(--pds-focus);
}

.control-buttons {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 1.25rem;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.45rem 1rem;
    border: 1px solid transparent;
    border-radius: 3px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 700;
    letter-spacing: 0;
    text-decoration: none;
    transition: background var(--pds-motion), color var(--pds-motion), border-color var(--pds-motion), opacity var(--pds-motion);
}

.btn:focus-visible {
    outline: 2px solid #004a9e;
    outline-offset: 2px;
}

.btn.primary {
    background: var(--c24-btn);
    color: #ffffff;
    border-color: var(--c24-btn);
}

.btn.primary:hover:not(:disabled) {
    background: var(--c24-btn-hover);
    border-color: var(--c24-btn-hover);
    color: #ffffff;
}

.btn.secondary {
    background: linear-gradient(to bottom, #f1f1f1, #dfdfdf);
    color: #444444;
    border-color: #c5c5c5;
}

.btn.secondary:hover:not(:disabled) {
    background: linear-gradient(to bottom, #e7e7e7, #d4d4d4);
    color: #111111;
    border-color: #c5c5c5;
}

.btn.secondary.active {
    background: var(--c24-btn);
    color: #ffffff;
    border-color: var(--c24-btn);
}

.btn.secondary.active:hover:not(:disabled) {
    background: var(--c24-btn-hover);
    border-color: var(--c24-btn-hover);
    color: #ffffff;
}

.btn.tertiary {
    background: transparent;
    color: var(--pds-text-medium);
    border-color: transparent;
}

.btn.tertiary:hover:not(:disabled) {
    color: var(--pds-text-primary);
    background: var(--pds-surface-soft);
}

.btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* Scan, diagrams, Game analysis, and Opening explorer use the home "Read the article" button. */
body[data-page-mode="analysis"] .btn,
body[data-page-mode="openings"] .btn,
body[data-active-nav="scan"] .btn,
body[data-active-nav="diagram"] .btn {
    background: var(--c24-orange);
    color: #fcfcfc;
    border-color: transparent;
    border-radius: 3px;
    font-weight: 700;
    text-decoration: none;
}

body[data-page-mode="analysis"] .btn:hover:not(:disabled),
body[data-page-mode="openings"] .btn:hover:not(:disabled),
body[data-active-nav="scan"] .btn:hover:not(:disabled),
body[data-active-nav="diagram"] .btn:hover:not(:disabled) {
    background: var(--c24-orange-hover);
    color: #ffffff;
    border-color: transparent;
    text-decoration: none;
}

/* ── Demo section layout ── */
.demo-section {
    width: 100%;
    padding-bottom: clamp(1rem, 2vw, 2rem);
}

.demo-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
    gap: clamp(1rem, 3vw, 1.75rem);
    align-items: start;
}

/* Analysis page: left = PGN/engine, right = board + moves (full-bleed). */
.analysis-layout {
    display: grid;
    grid-template-columns: var(--analysis-left-width, calc(300px + 5rem)) minmax(0, 1fr);
    column-gap: 0.45rem;
    row-gap: 0;
    align-items: start;
    align-content: start;
    width: 100%;
    max-width: 100%;
    margin: 0;
    overflow-x: hidden;
    box-sizing: border-box;
    --chess-board-size: min(90vh, calc(100vw - 580px), 880px);
    --analysis-left-width: clamp(200px, 22vw, calc(300px + 5rem));
    --analysis-moves-width: clamp(200px, 20vw, 280px);
}

.analysis-layout__left {
    grid-column: 1;
    grid-row: 1;
}

.analysis-layout__players {
    grid-column: 2;
    grid-row: 1;
    justify-self: start;
    width: min(100%, var(--chess-board-size, 50vh));
    max-width: var(--chess-board-size, 50vh);
    margin: 0 0 0.65rem;
}

.analysis-layout__players.hidden {
    display: none;
}

.analysis-layout__center {
    grid-column: 2;
    grid-row: 1;
}

/* Player names sit above the board column; Paste stays on the same row as board+moves. */
.analysis-layout:has(.analysis-layout__players:not(.hidden)) {
    grid-template-rows: auto auto;
}

.analysis-layout:has(.analysis-layout__players:not(.hidden)) .analysis-layout__players {
    grid-row: 1;
    margin-bottom: 0;
}

.analysis-layout:has(.analysis-layout__players:not(.hidden)) .analysis-layout__left,
.analysis-layout:has(.analysis-layout__players:not(.hidden)) .analysis-layout__center {
    grid-row: 2;
}

.analysis-layout__left,
.analysis-layout__center {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.analysis-layout__center {
    align-items: stretch;
}

.analysis-layout__pgn {
    width: 100%;
    margin-bottom: 0;
    padding-top: 0.75rem;
    padding-bottom: 0.85rem;
}

.analysis-layout__pgn .panel-header {
    margin-bottom: 0.55rem;
    padding-bottom: 0.45rem;
    margin-top: -0.15rem;
}

.analysis-layout__pgn .panel-title {
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.analysis-layout__pgn #pgn-input {
    min-height: 14rem;
    padding: 0.7rem 0.85rem;
}

.analysis-layout__pgn-actions {
    flex-direction: row !important;
    flex-wrap: wrap;
    align-items: center;
    margin-top: 1.55rem;
}

.analysis-layout__pgn-actions .btn {
    width: auto !important;
    flex: 1 1 auto;
}

.analysis-layout .board-players,
.analysis-layout .viewer-hint,
.analysis-layout .viewer-status {
    max-width: 100%;
    margin-left: 0;
    margin-right: 0;
    width: 100%;
}

.analysis-layout .board-players.analysis-layout__players {
    width: min(100%, var(--chess-board-size, 50vh));
    max-width: var(--chess-board-size, 50vh);
    margin: 0;
}

.analysis-layout .viewer-container {
    width: 100%;
    max-width: 100%;
    margin: 0;
    border-radius: 0;
    padding: 0;
    border: none;
    box-shadow: none;
    background: transparent;
}

.analysis-layout .engine-panel {
    width: 100%;
    margin-top: 0;
}

/* Full-bleed analysis / openings pages (no side gutters) */
body[data-page-mode="analysis"] .main-content.container,
body[data-page-mode="openings"] .main-content.container {
    width: 100%;
    max-width: none;
    margin: 0;
    padding-left: 0;
    padding-right: 0;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
    overflow-x: hidden;
}

body[data-page-mode="analysis"] .page-hero .container,
body[data-page-mode="openings"] .page-hero .container {
    width: 100%;
    max-width: none;
    padding-left: 0.75rem;
    padding-right: 0.75rem;
}

body[data-page-mode="analysis"] .page-hero-inner,
body[data-page-mode="openings"] .page-hero-inner {
    text-align: center;
}

body[data-page-mode="analysis"] .page-hero .header-lead,
body[data-page-mode="openings"] .page-hero .header-lead {
    margin-left: auto;
    margin-right: auto;
}

body[data-page-mode="analysis"] .demo-section,
body[data-page-mode="openings"] .demo-section {
    padding-bottom: 0;
}

body[data-page-mode="analysis"] .analysis-layout,
body[data-page-mode="openings"] .analysis-layout {
    min-height: calc(100vh - 9rem);
    margin-top: 10px;
}

@media (max-width: 960px) {
    .analysis-layout {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
        row-gap: 1.25rem;
        --chess-board-size: min(92vw, 480px);
        padding: 0 0.5rem;
    }

    .analysis-layout__players {
        grid-column: 1;
        grid-row: auto;
        order: 1;
        width: 100%;
        max-width: none;
        justify-self: stretch;
    }

    .analysis-layout__center {
        grid-column: 1;
        grid-row: auto;
        order: 2;
        max-width: none;
        margin-inline: 0;
        width: 100%;
        padding-bottom: 0.25rem;
    }

    .analysis-layout__left {
        grid-column: 1;
        grid-row: auto;
        order: 3;
        margin-top: 0.25rem;
    }

    .analysis-layout__pgn {
        margin-top: 0.35rem;
    }
}

.demo-viewer-column {
    min-width: 0;
    --chess-board-size: 50vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.board-players {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem 1.25rem;
    flex-wrap: wrap;
    width: 100%;
    max-width: calc(var(--chess-board-size) + 48px);
    margin: 0 auto 0.75rem;
    padding: 0.65rem 1rem;
    background: var(--obs-bg-secondary, var(--pds-surface));
    border: 1px solid var(--obs-border, var(--pds-border));
    border-radius: var(--pds-radius);
    color: var(--obs-text-normal, var(--pds-text-primary));
    font-weight: 600;
    font-size: clamp(0.9rem, 2.5vw, 1.05rem);
    text-align: center;
    box-sizing: border-box;
}

.board-players.hidden {
    display: none;
}

/* Compact game header inside the Moves column (analysis / openings). */
.cb-workbench__moves .board-players--in-moves {
    display: block;
    width: 100%;
    max-width: none;
    margin: 0 0 0.45rem;
    padding: 0.4rem 0.55rem;
    border-radius: 4px;
    font-size: 0.98rem;
    font-weight: 600;
    text-align: left;
    background: var(--pds-surface-soft, #f3f6f7);
    border: 1px solid var(--pds-border, #d0d0d0);
    box-sizing: border-box;
    flex: 0 0 auto;
}

.cb-workbench__moves .board-players--in-moves.hidden {
    display: none;
}

.cb-workbench__moves .board-players--in-moves__line {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.35rem 0.45rem;
    min-width: 0;
}

.cb-workbench__moves .board-players--in-moves .board-player-name {
    max-width: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.cb-workbench__moves .board-players--in-moves .board-players-vs {
    display: inline;
    flex-shrink: 0;
    opacity: 0.55;
    font-weight: 500;
}

.cb-workbench__moves .board-players--in-moves .board-players-meta {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.35rem;
    margin: 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--pds-text-medium, #5a7178);
}

.cb-workbench__moves .board-players--in-moves .board-players-meta:not(.hidden)::before {
    content: '·';
    opacity: 0.7;
}

.cb-workbench__moves .board-players--in-moves .board-players-meta.hidden {
    display: none;
}

.cb-workbench__moves .board-players--in-moves .board-player-label {
    display: none;
}

.board-player {
    display: flex;
    align-items: baseline;
    gap: 0.45rem;
    min-width: 0;
}

.board-player-label {
    font-size: 0.78em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--obs-text-muted, var(--pds-text-medium));
    flex-shrink: 0;
}

.board-player-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: min(220px, 38vw);
}

.board-players-vs {
    color: var(--obs-text-muted, var(--pds-text-medium));
    font-weight: 500;
    flex-shrink: 0;
}

.board-players-meta {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    flex-shrink: 0;
    margin-left: 0.15rem;
    padding-left: 0.85rem;
    border-left: 1px solid var(--obs-border, var(--pds-border));
    color: var(--obs-text-muted, var(--pds-text-medium));
    font-weight: 600;
    font-size: 0.92em;
    letter-spacing: 0.02em;
}

.board-players-meta.hidden {
    display: none;
}

.board-players-year,
.board-players-result {
    white-space: nowrap;
}

.board-players-meta-sep {
    opacity: 0.65;
}

.demo-sidebar {
    display: flex;
    flex-direction: column;
    gap: clamp(1rem, 2vw, 1.25rem);
    min-width: 0;
}

.demo-sidebar .demo-controls {
    margin-bottom: 0;
}

.demo-sidebar .control-buttons {
    flex-direction: column;
    align-items: stretch;
}

.demo-sidebar .control-buttons .btn {
    width: 100%;
}

.viewer-container {
    background: var(--pds-surface);
    border: 1px solid var(--pds-border);
    border-radius: var(--pds-radius);
    padding: clamp(0.75rem, 2vw, 1rem);
    margin: 0 auto;
    width: 100%;
    max-width: min(calc(var(--chess-board-size, 50vh) + 80px), 100%);
    box-sizing: border-box;
    box-shadow: var(--pds-shadow);
}

.viewer-status {
    margin-top: 0.85rem;
    font-size: 0.875rem;
    text-align: center;
    color: var(--pds-text-medium);
    max-width: min(calc(var(--chess-board-size, 50vh) + 48px), 100%);
    margin-left: auto;
    margin-right: auto;
    line-height: 1.45;
    padding: 0 0.25rem;
    box-sizing: border-box;
    flex-shrink: 0;
}

.viewer-status:empty {
    display: none;
    margin: 0;
}

.viewer-hint {
    display: block;
    width: 100%;
    max-width: min(calc(var(--chess-board-size, 50vh) + 48px), 100%);
    margin: 0.75rem auto 0;
    padding: 0.55rem 0.85rem;
    font-size: 0.875rem;
    line-height: 1.45;
    text-align: center;
    color: var(--obs-text-normal, var(--pds-text-primary));
    background: var(--obs-bg-secondary, var(--pds-surface));
    border: 1px solid var(--obs-border, var(--pds-border));
    border-radius: var(--pds-radius);
    box-sizing: border-box;
    flex-shrink: 0;
}

.viewer-status.success {
    color: var(--pds-success);
}

.viewer-status.error {
    color: var(--pds-error);
}

.engine-panel {
    width: 100%;
    margin: 0;
    padding: 1rem 1.15rem;
    background: var(--pds-surface);
    border: 1px solid var(--pds-border);
    border-radius: var(--pds-radius);
    box-shadow: var(--pds-shadow);
}

.engine-panel.hidden {
    display: none;
}

.engine-panel-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.engine-panel.engine-panel--stockfish .engine-panel-header {
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--pds-border);
}

.engine-panel-title {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--pds-text-medium);
}

.engine-depth {
    font-size: 0.75rem;
    color: var(--pds-text-low);
}

.engine-opening-block {
    margin-bottom: 1rem;
}

.engine-opening-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--pds-text-medium);
    margin-bottom: 0.35rem;
}

.engine-opening {
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.35;
    color: var(--pds-text-primary);
}

.engine-opening-detail {
    margin-top: 0.35rem;
    font-size: 0.8rem;
    line-height: 1.4;
    color: var(--pds-text-low);
}

.engine-analysis-block {
    padding-top: 1rem;
    border-top: 1px solid var(--pds-border);
}

.engine-analysis-block.hidden {
    display: none;
}

.engine-eval-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem 0.75rem;
    margin-bottom: 0.5rem;
}

.engine-lines-toggle {
    display: inline-flex;
    margin-left: auto;
    border: 1px solid var(--pds-border);
    border-radius: 999px;
    overflow: hidden;
}

.engine-lines-btn {
    min-width: 1.85rem;
    padding: 0.18rem 0.5rem;
    border: 0;
    background: transparent;
    color: var(--pds-text-high);
    cursor: pointer;
    font: inherit;
    font-size: 0.75rem;
    font-weight: 750;
    line-height: 1.2;
}

.engine-lines-btn + .engine-lines-btn {
    border-left: 1px solid var(--pds-border);
}

.engine-lines-btn[aria-pressed="true"] {
    background: var(--c24-btn);
    color: #ffffff;
}

.engine-lines-btn:hover:not([aria-pressed="true"]) {
    background: var(--pds-surface);
}

.engine-eval-label {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--pds-text-medium);
}

.engine-busy {
    font-size: 0.8rem;
    color: var(--pds-text-medium);
}

.engine-lines {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.engine-line {
    margin: 0;
    font-family: ui-monospace, 'Cascadia Code', 'Segoe UI Mono', monospace;
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--pds-text-high);
    word-break: break-word;
}

.engine-line strong {
    font-size: 1.2em;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.engine-line-comment {
    font-family: var(--pds-font);
    font-size: inherit;
    font-style: italic;
    font-weight: 500;
    color: var(--pds-text-medium);
    word-break: break-word;
}

.engine-line[hidden] {
    display: none;
}

.lichess-openings-panel {
    width: 100%;
    margin: 0;
}

.analysis-layout__left .lichess-openings-panel .content-actions {
    margin-top: 0.85rem;
}

body[data-page-mode="openings"] .analysis-layout__left {
    container-type: inline-size;
    container-name: openings-sidebar;
    --openings-caption-size: clamp(0.75rem, 0.45vw + 0.62rem, 0.94rem);
    --openings-body-size: clamp(0.8125rem, 0.55vw + 0.66rem, 1rem);
    --openings-meta-size: clamp(0.8125rem, 0.5vw + 0.68rem, 0.975rem);
    --openings-score-size: clamp(0.78rem, 0.42vw + 0.66rem, 0.925rem);
    --openings-move-size: clamp(0.875rem, 0.95vw + 0.64rem, 1.125rem);
    --openings-opening-size: clamp(0.9375rem, 1.1vw + 0.68rem, 1.19rem);
    --openings-detail-size: clamp(0.8125rem, 0.65vw + 0.64rem, 1rem);
    --openings-line-size: clamp(0.8125rem, 0.6vw + 0.66rem, 1.025rem);
    --openings-eval-size: clamp(1.25rem, 2.8vw + 0.72rem, 2.19rem);
    --openings-line-height: clamp(1.45, 0.12vw + 1.38, 1.75);
    --openings-move-pad-y: clamp(0.28rem, 0.5vw + 0.12rem, 0.375rem);
    --openings-move-pad-x: clamp(0.38rem, 0.75vw + 0.14rem, 0.56rem);
    --openings-moves-gap: clamp(0.25rem, 0.35vw + 0.12rem, 0.375rem);
    --openings-moves-max-h: clamp(11rem, 12vw + 7rem, 15.625rem);
}

@supports (width: 1cqi) {
    body[data-page-mode="openings"] .analysis-layout__left {
        --openings-caption-size: clamp(0.75rem, 0.45cqi + 0.62rem, 0.94rem);
        --openings-body-size: clamp(0.8125rem, 0.55cqi + 0.66rem, 1rem);
        --openings-meta-size: clamp(0.8125rem, 0.5cqi + 0.68rem, 0.975rem);
        --openings-score-size: clamp(0.78rem, 0.42cqi + 0.66rem, 0.925rem);
        --openings-move-size: clamp(0.875rem, 0.95cqi + 0.64rem, 1.125rem);
        --openings-opening-size: clamp(0.9375rem, 1.1cqi + 0.68rem, 1.19rem);
        --openings-detail-size: clamp(0.8125rem, 0.65cqi + 0.64rem, 1rem);
        --openings-line-size: clamp(0.8125rem, 0.6cqi + 0.66rem, 1.025rem);
        --openings-eval-size: clamp(1.25rem, 2.8cqi + 0.72rem, 2.19rem);
        --openings-line-height: clamp(1.45, 0.08cqi + 1.38, 1.75);
        --openings-move-pad-y: clamp(0.28rem, 0.35cqi + 0.18rem, 0.375rem);
        --openings-move-pad-x: clamp(0.38rem, 0.55cqi + 0.2rem, 0.56rem);
        --openings-moves-gap: clamp(0.25rem, 0.25cqi + 0.18rem, 0.375rem);
        --openings-moves-max-h: clamp(11rem, 32cqi + 6rem, 15.625rem);
    }
}

.lichess-openings-panel .engine-panel-header {
    margin-bottom: 0.5rem;
}

.lichess-openings-summary {
    margin: 0 0 0.69rem;
    color: var(--pds-text-high);
    line-height: var(--openings-line-height, 1.69);
    font-size: var(--openings-body-size, 1rem);
    font-weight: 750;
}

.lichess-openings-moves {
    display: grid;
    gap: var(--openings-moves-gap, 0.375rem);
    max-height: min(var(--openings-moves-max-h, 250px), 40vh);
    overflow-y: auto;
    padding-right: 0.15rem;
}

.lichess-opening-move {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.31rem 0.625rem;
    width: 100%;
    min-height: 0;
    padding: var(--openings-move-pad-y, 0.375rem) var(--openings-move-pad-x, 0.56rem);
    border: 1px solid var(--pds-border);
    border-radius: calc(var(--pds-radius) - 2px);
    background: var(--pds-surface-soft);
    color: inherit;
    cursor: pointer;
    font: inherit;
    text-align: left;
    transition: background var(--pds-motion), border-color var(--pds-motion);
}

.lichess-opening-move:hover {
    background: var(--pds-surface);
    border-color: var(--pds-focus);
}

.lichess-opening-san {
    flex: 0 0 auto;
    min-width: 4.25rem;
    font-weight: 900;
    font-variant-numeric: tabular-nums;
    font-size: var(--openings-move-size, 1.125rem);
    line-height: var(--openings-line-height, 1.5);
    color: var(--pds-text-primary);
}

.lichess-opening-games {
    flex: 1 1 auto;
    min-width: 0;
    color: var(--pds-text-high);
    font-size: var(--openings-meta-size, 0.975rem);
    font-weight: 750;
    line-height: var(--openings-line-height, 1.5);
}

.lichess-opening-score {
    flex: 0 0 auto;
    color: var(--pds-text-high);
    font-size: var(--openings-score-size, 0.925rem);
    font-weight: 750;
    line-height: var(--openings-line-height, 1.5);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.lichess-openings-empty {
    margin: 0;
    color: var(--pds-text-high);
    font-size: var(--openings-body-size, 1.05rem);
    font-weight: 750;
    line-height: var(--openings-line-height, 1.75);
}

body[data-page-mode="openings"] .engine-panel:not(.hidden) {
    margin-bottom: 0;
}

body[data-page-mode="openings"] .engine-panel-title,
body[data-page-mode="openings"] .lichess-openings-panel .engine-panel-title {
    font-size: var(--openings-caption-size, 0.94rem);
    font-weight: 875;
    color: var(--pds-text-primary);
}

body[data-page-mode="openings"] .engine-depth,
body[data-page-mode="openings"] #lichess-openings-status {
    font-size: var(--openings-caption-size, 0.94rem);
    font-weight: 750;
    color: var(--pds-text-high);
}

body[data-page-mode="openings"] .engine-opening-label,
body[data-page-mode="openings"] .engine-eval-label {
    font-size: var(--openings-caption-size, 0.94rem);
    font-weight: 875;
    color: var(--pds-text-primary);
}

body[data-page-mode="openings"] .engine-opening-block {
    margin-bottom: 0.94rem;
}

body[data-page-mode="openings"] .engine-opening {
    font-size: var(--openings-opening-size, 1.19rem);
    font-weight: 875;
    line-height: var(--openings-line-height, 1.69);
    color: var(--pds-text-primary);
}

body[data-page-mode="openings"] .engine-opening-detail {
    font-size: var(--openings-detail-size, 1rem);
    font-weight: 750;
    line-height: var(--openings-line-height, 1.75);
    color: var(--pds-text-high);
}

body[data-page-mode="openings"] .engine-analysis-block {
    padding-top: 0.94rem;
}

body[data-page-mode="openings"] .engine-busy {
    font-size: var(--openings-body-size, 1rem);
    font-weight: 750;
    color: var(--pds-text-high);
}

body[data-page-mode="openings"] .engine-lines-btn {
    font-size: var(--openings-caption-size, 0.75rem);
    font-weight: 750;
}

body[data-page-mode="openings"] .engine-line {
    font-size: var(--openings-line-size, 1.025rem);
    font-weight: 500;
    line-height: var(--openings-line-height, 1.75);
    color: var(--pds-text-primary);
}

body[data-page-mode="openings"] .engine-line strong {
    font-weight: 800;
}

.engine-depth.error {
    color: var(--pds-error);
}

/* ── Footer ── */
.footer {
    background: #e8eef6;
    padding: clamp(1.6rem, 3.5vw, 2.25rem) 0 0;
    margin-top: auto;
    color: #444444;
    border-top: 3px solid var(--c24-header);
    box-shadow: none;
}

.footer-inner {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.footer-grid {
    display: grid;
    grid-template-columns: minmax(14rem, 1.4fr) repeat(3, minmax(8rem, 1fr));
    gap: clamp(1.5rem, 4vw, 3rem);
    padding-bottom: clamp(2rem, 4vw, 3rem);
}

.footer-logo {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    margin-bottom: 0.85rem;
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: 0;
    color: var(--c24-header-deep);
    text-decoration: none;
}

.footer-logo-mark {
    display: inline-flex;
    color: var(--c24-logo);
    flex-shrink: 0;
}

.footer-tagline {
    max-width: 22rem;
    font-size: 0.95rem;
    line-height: 1.55;
    color: #5a6a7a;
}

.footer-heading {
    margin: 0 0 0.85rem;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--c24-header);
}

.footer-list {
    list-style: none;
}

.footer-list li + li {
    margin-top: 0.55rem;
}

.footer-list a {
    color: #3a4550;
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 400;
    transition: color var(--pds-motion);
}

.footer-list a:hover {
    color: var(--c24-header-deep);
}

.footer-bottom {
    border-top: 1px solid #cdd8e6;
    padding: 1.15rem 0 1.4rem;
}

.footer-copy {
    font-size: 0.8125rem;
    font-weight: 400;
    color: #6a7a8a;
}

/* ══════════════════════════════════════════
   Chess board & PGN viewer — DO NOT restyle
   Keep original fonts for boards, controls, notation
   ══════════════════════════════════════════ */

#chess-viewer,
#chess-viewer .pgnvbutton,
#chess-viewer .buttons,
#chess-viewer .buttons > *,
#chess-viewer [class*="buttons"]:not(.cb-board-controls),
#chess-viewer coords,
#chess-viewer coords coord,
.cb-board-controls,
.cb-board-controls__btn {
    font-family: var(--pds-chess-font);
}

#chess-viewer cg-resize {
    display: none !important;
}

san {
    cursor: pointer !important;
}

move :hover {
    background-color: gray !important;
}

san.yellow {
    background-color: gray !important;
}

.ranks,
.files {
    font-weight: 900;
}

cg-board {
    border-radius: 8px;
}

#chess-viewer.analysis-active .error,
#chess-viewer.analysis-active .edit,
#chess-viewer.analysis-active .games,
#chess-viewer.analysis-active [id^="edit"] {
    display: none !important;
}

#chess-viewer {
    --chess-board-size: 50vh;
    --chess-moves-max-height: 200px;
    --obs-bg-secondary: #f7f7f7;
    --obs-bg-secondary-alt: #eeeeee;
    --obs-border: #cccccc;
    --obs-text-normal: #444444;
    --obs-text-muted: #666666;
    --obs-accent: #004a9e;
    width: 100% !important;
    max-width: calc(var(--chess-board-size) + 48px) !important;
    height: auto !important;
    padding: clamp(12px, 3vw, 24px) !important;
    box-sizing: border-box !important;
    margin-left: auto !important;
    margin-right: auto !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

/* Custom workbench shell (#chess-viewer) */
#chess-viewer:not(.pgnvjs),
#chess-viewer.cb-workbench {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
}

body[data-page-mode="analysis"] #chess-viewer.cb-workbench,
body[data-page-mode="openings"] #chess-viewer.cb-workbench {
    display: grid !important;
    flex-direction: unset !important;
    align-items: start !important;
    justify-content: start !important;
    grid-template-columns: minmax(0, var(--chess-board-size, 50vh)) minmax(0, 1fr) !important;
    grid-template-rows: auto auto !important;
    column-gap: 0.85rem !important;
    row-gap: 0.65rem !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
}

body[data-page-mode="analysis"] #chess-viewer .cb-workbench__primary,
body[data-page-mode="openings"] #chess-viewer .cb-workbench__primary {
    display: flex !important;
    flex-direction: column !important;
    gap: 0.65rem !important;
    min-width: 0 !important;
    width: 100% !important;
    max-width: var(--chess-board-size, 50vh) !important;
    grid-column: 1 !important;
    grid-row: 1 !important;
}

body[data-page-mode="analysis"] #chess-viewer .cb-workbench__moves,
body[data-page-mode="openings"] #chess-viewer .cb-workbench__moves {
    display: flex !important;
    flex-direction: column !important;
    min-width: 0 !important;
    width: 100% !important;
    max-width: none !important;
    box-sizing: border-box !important;
    visibility: visible !important;
    opacity: 1 !important;
    align-self: stretch !important;
    height: var(--chess-board-size, 50vh) !important;
    max-height: var(--chess-board-size, 50vh) !important;
    grid-column: 2 !important;
    grid-row: 1 !important;
}

body[data-page-mode="analysis"] #chess-viewer .cb-workbench__comment-wrap,
body[data-page-mode="openings"] #chess-viewer .cb-workbench__comment-wrap {
    grid-column: 1 !important;
    grid-row: 2 !important;
    align-self: start !important;
    width: 100% !important;
    max-width: var(--chess-board-size, 50vh) !important;
}

body[data-page-mode="analysis"] #chess-viewer .openings-download-pgn-bar,
body[data-page-mode="openings"] #chess-viewer .openings-download-pgn-bar {
    grid-column: 2 !important;
    grid-row: 2 !important;
    align-self: start !important;
    justify-content: center !important;
    width: 100% !important;
    max-width: none !important;
    margin-top: 0 !important;
}

body[data-page-mode="analysis"] #chess-viewer .cb-workbench__moves .cb-moves,
body[data-page-mode="analysis"] #chess-viewer .cb-workbench__moves-host .cb-moves,
body[data-page-mode="openings"] #chess-viewer .cb-workbench__moves .cb-moves,
body[data-page-mode="openings"] #chess-viewer .cb-workbench__moves-host .cb-moves {
    height: 100% !important;
    display: flex !important;
    flex-direction: column !important;
}

body[data-page-mode="analysis"] #chess-viewer .cb-workbench__moves .cb-moves__list,
body[data-page-mode="openings"] #chess-viewer .cb-workbench__moves .cb-moves__list {
    flex: 1 1 auto !important;
    min-height: 12rem !important;
    max-height: none !important;
    overflow: auto !important;
    display: block !important;
}

@media (max-width: 960px) {
    body[data-page-mode="analysis"] #chess-viewer.cb-workbench,
    body[data-page-mode="openings"] #chess-viewer.cb-workbench {
        grid-template-columns: minmax(0, 1fr) !important;
        grid-template-rows: auto !important;
        row-gap: 0.85rem !important;
        justify-items: center !important;
        width: min(100%, var(--chess-board-size, 50vh)) !important;
        max-width: 100% !important;
        margin-inline: auto !important;
        padding-bottom: 0.35rem !important;
    }

    body[data-page-mode="analysis"] #chess-viewer .cb-workbench__primary,
    body[data-page-mode="analysis"] #chess-viewer .cb-workbench__moves,
    body[data-page-mode="analysis"] #chess-viewer .cb-workbench__comment-wrap,
    body[data-page-mode="analysis"] #chess-viewer .openings-download-pgn-bar,
    body[data-page-mode="openings"] #chess-viewer .cb-workbench__primary,
    body[data-page-mode="openings"] #chess-viewer .cb-workbench__moves,
    body[data-page-mode="openings"] #chess-viewer .cb-workbench__comment-wrap,
    body[data-page-mode="openings"] #chess-viewer .openings-download-pgn-bar {
        grid-column: 1 !important;
        grid-row: auto !important;
        width: 100% !important;
    }

    body[data-page-mode="analysis"] #chess-viewer .cb-workbench__primary,
    body[data-page-mode="openings"] #chess-viewer .cb-workbench__primary {
        max-width: var(--chess-board-size, 50vh) !important;
    }

    body[data-page-mode="analysis"] #chess-viewer .cb-workbench__board,
    body[data-page-mode="analysis"] #chess-viewer .cb-workbench__board .cb-interactive-board,
    body[data-page-mode="analysis"] #chess-viewer .cb-workbench__board svg,
    body[data-page-mode="openings"] #chess-viewer .cb-workbench__board,
    body[data-page-mode="openings"] #chess-viewer .cb-workbench__board .cb-interactive-board,
    body[data-page-mode="openings"] #chess-viewer .cb-workbench__board svg {
        max-width: var(--chess-board-size, 50vh) !important;
    }

    body[data-page-mode="analysis"] #chess-viewer .cb-workbench__moves,
    body[data-page-mode="openings"] #chess-viewer .cb-workbench__moves {
        height: auto !important;
        max-height: none !important;
    }

    body[data-page-mode="analysis"] #chess-viewer .cb-workbench__comment-wrap,
    body[data-page-mode="openings"] #chess-viewer .cb-workbench__comment-wrap {
        margin-top: 0.15rem !important;
        margin-bottom: 0.25rem !important;
        max-width: var(--chess-board-size, 50vh) !important;
    }

    body[data-page-mode="analysis"] #chess-viewer .openings-download-pgn-bar,
    body[data-page-mode="openings"] #chess-viewer .openings-download-pgn-bar {
        margin-top: 0.35rem !important;
        margin-bottom: 0.5rem !important;
        align-items: center !important;
        justify-content: flex-start !important;
    }

    body[data-page-mode="analysis"] #chess-viewer .cb-workbench__moves .cb-moves__list,
    body[data-page-mode="openings"] #chess-viewer .cb-workbench__moves .cb-moves__list {
        max-height: min(40vh, 360px) !important;
    }
}

/* Legacy .pgnvjs rules kept inert (class no longer applied by the app) */
#chess-viewer.pgnvjs.layout-top {
    display: grid !important;
    align-items: stretch !important;
    width: auto !important;
}

/* Flex column so .moves grows with content (max 200px) and hint sits below */
body[data-page-mode="analysis"] #chess-viewer.pgnvjs.layout-top,
body[data-page-mode="openings"] #chess-viewer.pgnvjs.layout-top {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    grid-template-rows: unset !important;
}

body[data-page-mode="analysis"] #chess-viewer.pgnvjs.layout-top .outerBoard,
body[data-page-mode="analysis"] #chess-viewer.pgnvjs.layout-top .buttons,
body[data-page-mode="analysis"] #chess-viewer.pgnvjs.layout-top .moves,
body[data-page-mode="analysis"] #chess-viewer.pgnvjs.layout-top [class*="buttons"],
body[data-page-mode="openings"] #chess-viewer.pgnvjs.layout-top .outerBoard,
body[data-page-mode="openings"] #chess-viewer.pgnvjs.layout-top .buttons,
body[data-page-mode="openings"] #chess-viewer.pgnvjs.layout-top .moves,
body[data-page-mode="openings"] #chess-viewer.pgnvjs.layout-top .openings-download-pgn-bar,
body[data-page-mode="analysis"] #chess-viewer.pgnvjs.layout-top .openings-download-pgn-bar,
body[data-page-mode="openings"] #chess-viewer.pgnvjs.layout-top [class*="buttons"] {
    grid-row: unset !important;
    grid-column: unset !important;
}

body[data-page-mode="openings"] #chess-viewer .openings-download-pgn-bar {
    display: flex;
    justify-content: center;
    width: 100%;
    max-width: none;
    margin-top: 0;
    padding-top: 0;
}

body[data-page-mode="openings"] #chess-viewer .openings-download-pgn-bar .btn,
body[data-page-mode="analysis"] #chess-viewer .openings-download-pgn-bar .btn {
    min-width: 9.5rem;
}

body[data-page-mode="analysis"] .viewer-hint,
body[data-page-mode="openings"] .viewer-hint {
    margin-top: 0.85rem;
    width: 100%;
    max-width: 100%;
}

#chess-viewer cg-board {
    background-color: #e3dfcd;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='2' height='2'%3E%3Crect x='1' width='1' height='1' fill='%236d8150'/%3E%3Crect y='1' width='1' height='1' fill='%236d8150'/%3E%3C/svg%3E");
    background-size: 25% 25%;
}

#chess-viewer .buttons,
#chess-viewer .default.buttons,
#chess-viewer [class*="buttons"]:not(.cb-board-controls) {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    justify-content: center !important;
    align-items: stretch !important;
    gap: 8px !important;
    margin-top: 33px !important;
    margin-bottom: 2px !important;
    width: 100% !important;
    padding: 0 !important;
    box-sizing: border-box !important;
}

#chess-viewer .buttons>*,
#chess-viewer .default.buttons>*,
#chess-viewer [class*="buttons"]:not(.cb-board-controls)>*,
#chess-viewer .pgnvbutton {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 5px 4px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    background-color: var(--obs-bg-secondary) !important;
    border: 1px solid var(--obs-border) !important;
    border-radius: 4px !important;
    color: var(--obs-text-normal) !important;
    white-space: nowrap !important;
    transition: all 0.2s ease !important;
    height: 27px !important;
    margin: 0 !important;
    box-shadow: none !important;
    text-decoration: none !important;
}

#chess-viewer .buttons>*:hover,
#chess-viewer .default.buttons>*:hover,
#chess-viewer .pgnvbutton:hover {
    background-color: var(--obs-bg-secondary-alt) !important;
    border-color: var(--obs-accent) !important;
    color: var(--obs-accent) !important;
}

#chess-viewer .buttons>* i,
#chess-viewer .pgnvbutton i {
    display: inline-block !important;
    font-size: 14px !important;
    line-height: 1 !important;
    color: inherit !important;
    font-style: normal !important;
}

#chess-viewer .moves.inline {
    display: block !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: var(--chess-moves-max-height) !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    border: 1px solid var(--obs-border) !important;
    border-radius: 4px !important;
    margin-top: 16px !important;
    padding: 8px !important;
    box-sizing: border-box !important;
    text-align: left !important;
    align-self: stretch !important;
}

#chess-viewer .moves.inline * {
    cursor: pointer !important;
}

#chess-viewer .moves.inline::-webkit-scrollbar {
    width: 10px !important;
}

#chess-viewer .moves.inline::-webkit-scrollbar-thumb {
    background-color: var(--obs-text-muted) !important;
    border-radius: 10px !important;
}

#chess-viewer .moves.inline::-webkit-scrollbar-track {
    background-color: var(--obs-bg-secondary) !important;
}

#chess-viewer cg-resize {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

#chess-viewer #chess-viewerInner,
#chess-viewer cg-container {
    width: var(--chess-board-size) !important;
    height: var(--chess-board-size) !important;
    max-width: 100% !important;
}

#chess-viewer .board {
    width: var(--chess-board-size) !important;
    height: var(--chess-board-size) !important;
    max-width: 100% !important;
    margin: 0 !important;
}

#chess-viewer .cg-wrap {
    width: var(--chess-board-size) !important;
    height: var(--chess-board-size) !important;
    max-width: 100% !important;
    flex-shrink: 0;
    overflow: visible !important;
}

#chess-viewer .outerBoard {
    margin: 0 !important;
    padding: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
}

#chess-viewer .outerBoard,
#chess-viewer .buttons,
#chess-viewer .default.buttons,
#chess-viewer [class*="buttons"]:not(.cb-board-controls) {
    align-self: center !important;
}

#chess-viewer .outerBoard {
    max-width: 100% !important;
}

#chess-viewer coords.ranks {
    right: -18px !important;
    top: 0 !important;
    height: 100% !important;
    width: 20px !important;
    display: flex !important;
    flex-direction: column-reverse !important;
    justify-content: space-around !important;
    align-items: center !important;
}

#chess-viewer coords.files {
    bottom: -20px !important;
    left: 0 !important;
    width: 100% !important;
    height: 20px !important;
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-around !important;
    align-items: center !important;
}

#chess-viewer .cg-wrap.orientation-black coords.ranks {
    flex-direction: column !important;
}

#chess-viewer .cg-wrap.orientation-black coords.files {
    flex-direction: row-reverse !important;
}

#chess-viewer coords coord {
    position: static !important;
    color: var(--obs-text-normal) !important;
    font-weight: 800 !important;
    text-shadow: none !important;
    font-size: 10px !important;
}

/* ── Responsive ── */
@media (max-width: 1180px) {
    .header-bar {
        flex-wrap: wrap;
        align-items: center;
        gap: 0.45rem;
        min-height: 3.75rem;
        padding-top: 0.4rem;
        padding-bottom: 0.4rem;
    }

    .header-brand {
        order: 1;
    }

    .header-brand-name {
        font-size: 1.25rem;
    }

    .lang-switch {
        order: 2;
        margin-left: auto;
    }

    .lang-switch-toggle {
        height: 2.5rem;
    }

    .header-menu-toggle {
        display: inline-flex;
        order: 3;
        margin-left: 0.35rem;
    }

    .header-nav {
        display: none;
        order: 4;
        flex: 1 1 100%;
        flex-direction: column;
        flex-wrap: nowrap;
        align-items: stretch;
        justify-content: flex-start;
        width: 100%;
        min-width: 0;
        margin-left: 0;
        padding: 0.45rem 0.35rem 0.85rem;
        gap: 0.15rem;
        background: rgba(0, 0, 0, 0.12);
        border-radius: 0 0 5px 5px;
    }

    .header-nav.is-open {
        display: flex;
    }

    .header-nav-link {
        padding: 0.65rem 0.85rem;
        font-size: 1.05rem;
        white-space: normal;
    }

    .header-nav-account,
    .header-account-menu {
        margin-left: 0;
        width: fit-content;
    }
}

@media (max-width: 900px) {
    .footer-grid {
        grid-template-columns: 1fr 1fr;
    }

    .demo-layout {
        grid-template-columns: 1fr;
    }

    .demo-sidebar {
        order: 1;
    }

    .demo-viewer-column {
        order: 2;
    }

    .demo-sidebar .control-buttons {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
    }

    .demo-sidebar .control-buttons .btn {
        width: auto;
        flex: 1 1 auto;
    }

    .viewer-container {
        margin: 0 auto;
    }

    .viewer-status {
        max-width: min(calc(var(--chess-board-size, 50vh) + 80px), 100%);
        margin-left: auto;
        margin-right: auto;
    }
}

@media (max-width: 768px) {
    .footer-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .demo-controls .panel-header {
        align-items: center;
    }

    .control-buttons {
        flex-direction: column;
        align-items: stretch;
    }

    .control-buttons .btn {
        width: 100%;
    }
}

@media (max-width: 520px) {

    #chess-viewer .buttons,
    #chess-viewer .default.buttons,
    #chess-viewer [class*="buttons"]:not(.cb-board-controls) {
        flex-wrap: wrap !important;
        gap: 6px !important;
    }

    #chess-viewer .buttons>*,
    #chess-viewer .default.buttons>*,
    #chess-viewer [class*="buttons"]:not(.cb-board-controls)>*,
    #chess-viewer .pgnvbutton {
        flex: 1 1 calc(33.33% - 6px) !important;
        height: auto !important;
        min-height: 30px !important;
        font-size: 12px !important;
        padding: 4px 2px !important;
    }

    #chess-viewer coords.ranks {
        right: -14px !important;
        width: 16px !important;
    }

    #chess-viewer coords.files {
        bottom: -16px !important;
        height: 16px !important;
    }

    #chess-viewer coords coord {
        font-size: 9px !important;
    }
}

/* ── Home showcase ── */
.home {
    display: grid;
    gap: clamp(1.75rem, 4vw, 2.75rem);
    max-width: 72rem;
    margin: 0 auto;
}

.home-intro h1 {
    font-size: clamp(1.6rem, 1vw + 1.2rem, 2rem);
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: 0;
    color: #333333;
}

.home-intro p {
    margin-top: 0.9rem;
    font-size: clamp(1.05rem, 0.3vw + 1rem, 1.2rem);
    font-weight: 500;
    line-height: 1.5;
    color: var(--pds-text-medium);
    max-width: 40rem;
}

.home-entries {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

.home-card {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    margin-bottom: 0;
    color: inherit;
    text-decoration: none;
    transition: border-color var(--pds-motion), transform var(--pds-motion);
}

.home-card:hover {
    border-color: var(--pds-border-strong);
    transform: translateY(-2px);
}

.home-card h2,
.home-card h3 {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: 0;
    color: #333333;
}

.home-card p {
    color: var(--pds-text-medium);
    font-size: 0.98rem;
    flex: 1;
}

.home-card .btn {
    align-self: center;
    margin-top: 0.25rem;
}

@media (max-width: 800px) {
    .home-entries {
        grid-template-columns: 1fr;
    }
}

/* ── Blog ── */
.home-blog {
    display: grid;
    gap: 1rem;
}

.home-blog-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    margin-top: 0.35rem;
}

.home-blog-head h2 {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 0;
    color: #333333;
}

#latest-news-heading,
#learn-heading,
#game-of-day-heading {
    color: #333333;
}

.home-section:has(#latest-news-heading) {
    background: #d3dbe9;
    margin-inline: -0.35rem;
    padding: 0.85rem 0.85rem 1rem;
    border-radius: 5px;
}

.home-blog-head a,
.home-more,
.page-more a {
    font-weight: 700;
    color: var(--host-accent);
    text-decoration: none;
}

.home-blog-head a:hover,
.home-more:hover,
.page-more a:hover {
    color: #004a9e;
    text-decoration: underline;
}

.prose a:hover {
    color: #004a9e;
    text-decoration: underline;
}

.home-wcc {
    display: grid;
    gap: 0.45rem;
    border-top: 3px solid var(--c24-orange);
}

.home-wcc h2 {
    font-size: clamp(1.3rem, 0.6vw + 1.1rem, 1.6rem);
    font-weight: 700;
    letter-spacing: 0;
    line-height: 1.25;
    color: #333333;
}

.home-wcc h2 a {
    color: inherit;
    text-decoration: none;
}

.home-wcc h2 a:hover {
    color: var(--host-accent);
}

.home-wcc p {
    color: var(--pds-text-medium);
}

.home-wcc-live {
    display: inline-block;
    margin-right: 0.45rem;
    padding: 0.12rem 0.45rem;
    border-radius: 2px;
    background: var(--c24-orange);
    color: #ffffff;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.home-wcc-meta {
    color: var(--pds-text-medium);
    font-size: 0.9rem;
}

.home-wcc .home-more {
    display: inline-flex;
    justify-self: start;
    width: fit-content;
    margin-top: 0.35rem;
    padding: 0.4rem 0.9rem;
    background: var(--c24-orange);
    color: #fcfcfc;
    border-radius: 3px;
    font-weight: 700;
    text-decoration: none;
}

.home-wcc .home-more:hover {
    background: var(--c24-orange-hover);
    color: #ffffff;
    text-decoration: none;
}

.wcc-live {
    display: grid;
    gap: 1rem;
    max-width: 56rem;
    margin: 0 auto;
}

.wcc-live-hero {
    text-align: center;
    display: grid;
    gap: 0.85rem;
    padding: 0.35rem 0 0.25rem;
}

.wcc-live-hero h1 {
    margin: 0;
    font-size: clamp(1.5rem, 0.6vw + 1.25rem, 1.85rem);
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: 0;
    color: #333333;
}

.wcc-live-lead {
    margin: 0 auto;
    max-width: 42rem;
    text-align: center;
    font-size: clamp(1.05rem, 0.3vw + 1rem, 1.2rem);
    font-weight: 500;
    line-height: 1.5;
    color: var(--pds-text-medium);
}

.wcc-live-player {
    display: grid;
    gap: 0.85rem;
}

.wcc-live-heading {
    font-size: 1.15rem;
    font-weight: 700;
    color: #333333;
    text-align: center;
}

.wcc-live-frame {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: var(--pds-radius);
    background: #111827;
    box-shadow: inset 0 0 0 1px var(--pds-border);
}

.wcc-live-frame iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.wcc-live-details {
    margin: 0 auto;
    text-align: center;
    color: var(--pds-text-medium);
    line-height: 1.55;
    max-width: 42rem;
}

.home-top {
    display: grid;
    gap: 0.45rem;
}

.home-top h2,
.home-top h3 {
    font-size: clamp(1.3rem, 0.6vw + 1.1rem, 1.6rem);
    font-weight: 700;
    letter-spacing: 0;
    line-height: 1.25;
    color: #333333;
}

.home-top p,
.post-card p {
    color: var(--pds-text-medium);
}

.home-kicker {
    display: inline-block;
    margin-right: 0.45rem;
    padding: 0.12rem 0.45rem;
    border-radius: 2px;
    background: var(--c24-read);
    color: #ffffff;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.home-top .home-more {
    display: inline-flex;
    justify-self: start;
    width: fit-content;
    margin-top: 0.35rem;
    padding: 0.4rem 0.9rem;
    background: var(--c24-orange);
    color: #fcfcfc;
    border-radius: 3px;
    font-weight: 700;
    text-decoration: none;
}

.home-top .home-more:hover {
    background: var(--c24-orange-hover);
    color: #ffffff;
    text-decoration: none;
}

.home-game-caption {
    margin: 0;
    color: var(--pds-text-medium);
    font-weight: 650;
}

.post-list {
    list-style: none;
    display: grid;
    gap: 0.85rem;
}

.post-list--grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.post-card {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin: 0;
    padding: 1rem 1.05rem;
}

.post-card h2,
.post-card h3 {
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: 0;
    line-height: 1.3;
    color: #333333;
}

.post-card h2 a,
.post-card h3 a,
.home-top h2 a,
.home-top h3 a {
    color: #333333;
    text-decoration: none;
}

.post-card h2 a:hover,
.post-card h3 a:hover,
.home-top h2 a:hover,
.home-top h3 a:hover {
    color: var(--host-accent);
}

.home-section {
    display: grid;
    gap: 1rem;
}

.home-card-date {
    display: block;
    font-size: 0.85rem;
    font-weight: 400;
    color: #888888;
}

.home-section .post-card p {
    flex: 1;
}

.home-tools {
    display: grid;
    gap: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid #cccccc;
}

.post-card-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 0.75rem;
    font-size: 0.85rem;
    font-weight: 400;
    color: #888888;
}

.post-card-meta a {
    color: var(--host-accent);
    font-weight: 700;
    text-decoration: none;
}

.post-card-meta a[href="/news/"],
.post-kicker a[href="/news/"],
.post-card-meta a[href="/category/learn/"],
.post-kicker a[href="/category/learn/"] {
    color: #333333;
}

.post-empty,
.page-more {
    margin: 0.5rem 0 1rem;
}

/* ── chess24-style listing search ── */
.listing-toolbar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin: 0 0 1rem;
    padding: 0.55rem 0.75rem;
    background: linear-gradient(to bottom, #f0f0f0 0%, #ebebeb 100%);
    border: 1px solid #d5d5d5;
    border-radius: 5px;
}

.listing-search {
    display: inline-flex;
    margin: 0;
}

.listing-search__field {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.listing-search__input {
    width: 150px;
    height: 32px;
    padding: 7px 32px 7px 10px;
    border: 1px solid #cccccc;
    border-radius: 5px;
    background: #ffffff;
    color: #444444;
    font-family: var(--pds-font);
    font-size: 0.875rem;
    line-height: 1;
    box-shadow: inset 0 1px 5px rgba(0, 0, 0, 0.1), 0 1px 0 #ffffff;
}

.listing-search__input::placeholder {
    color: #999999;
    font-style: italic;
}

.listing-search__input:focus {
    outline: 2px solid #004a9e;
    outline-offset: 1px;
}

.listing-search__icon {
    position: absolute;
    right: 9px;
    top: 50%;
    width: 14px;
    height: 14px;
    border: 1.5px solid #888888;
    border-radius: 50%;
    transform: translateY(-58%);
    pointer-events: none;
}

.listing-search__icon::after {
    content: '';
    position: absolute;
    right: -4px;
    bottom: -3px;
    width: 6px;
    height: 1.5px;
    background: #888888;
    transform: rotate(45deg);
    transform-origin: left center;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ── chess24-style pagination ── */
.c-pagination {
    display: flex;
    justify-content: center;
    margin: 1.75rem 0 0.5rem;
}

.c-pagination__list {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.15rem 0.1rem;
    margin: 0;
    padding: 0.35rem 1.15rem;
    list-style: none;
    background: linear-gradient(to bottom, #f7f7f7 0%, #ffffff 55%, #f0f0f0 100%);
    border: 1px solid #d0d0d0;
    border-radius: 999px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.c-pagination__page,
.c-pagination__edge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0;
}

.c-pagination__page a,
.c-pagination__page span,
.c-pagination__edge a,
.c-pagination__edge span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.55rem;
    padding: 0.28rem 0.55rem;
    font-family: var(--pds-font);
    font-size: 0.8125rem;
    line-height: 1;
    text-decoration: none;
    border-radius: 3px;
}

.c-pagination__page a,
.c-pagination__edge a {
    color: #444444;
    font-style: italic;
}

.c-pagination__page a:hover,
.c-pagination__edge a:hover {
    color: #004a9e;
}

.c-pagination__page.is-active span {
    color: #004a9e;
    font-style: normal;
    font-weight: 700;
    background: #e7eef8;
}

.c-pagination__edge.is-inactive span {
    color: #b0b0b0;
    font-style: italic;
    cursor: default;
}

.page-intro {
    max-width: 46rem;
    margin-bottom: 1.25rem;
}

.post {
    max-width: 52rem;
    margin: 0 auto;
    background: #ffffff;
    border: 1px solid #cccccc;
    border-radius: 5px;
    box-shadow: var(--pds-shadow);
    padding: clamp(1.05rem, 2.4vw, 1.6rem) clamp(1rem, 2.6vw, 1.7rem) 1.4rem;
}

.post-kicker {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.75rem;
    color: #888888;
    font-size: 0.85rem;
    font-weight: 400;
}

.post-kicker a {
    color: var(--host-accent);
    font-weight: 700;
    text-decoration: none;
}

.post-title {
    margin: 0.35rem 0 0.85rem;
    font-size: clamp(1.35rem, 0.5vw + 1.15rem, 1.7rem);
    font-weight: 700;
    letter-spacing: 0;
    line-height: 1.25;
    color: #333333;
}

.prose p,
.page-intro p {
    margin: 0.85rem 0;
}

.prose {
    color: #444444;
    font-size: 15px;
    line-height: 1.55;
}

.prose h2,
.prose h3,
.archive-heading {
    margin: 1.45rem 0 0.45rem;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 0;
    color: #333333;
}

.prose h3 {
    font-size: 1.125rem;
}

.prose strong {
    color: #333333;
    font-weight: 700;
}

.prose blockquote {
    margin: 1rem 0;
    padding: 0.85rem 1.1rem;
    background: #f7f7f7;
    border: 1px solid #eeeeee;
    border-radius: 5px;
    color: #444444;
}

.prose ul,
.page-intro ul {
    margin: 0.4rem 0 1rem 1.25rem;
}

.prose li,
.page-intro li {
    margin: 0.3rem 0;
}

.prose a,
.lesson-index a,
.game-index a {
    color: #004a9e;
    font-weight: 700;
}

.prose a {
    text-decoration: underline;
    text-underline-offset: 0.12em;
}

.game-index a.game-row {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    color: inherit;
    font-weight: 500;
    text-decoration: none;
}

.game-row__players {
    font-weight: 800;
}

.game-row__meta {
    color: var(--pds-text-medium);
    font-size: 0.92rem;
    font-weight: 500;
}

.game-index a.game-row:hover .game-row__players {
    color: var(--host-accent);
}

.game-group {
    display: grid;
    gap: 0.65rem;
    margin-bottom: 1.75rem;
}

.game-group h2 {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: 0;
    color: #333333;
}

.game-group h2 a {
    color: #333333;
    text-decoration: none;
}

.game-group h2 a:hover {
    color: var(--host-accent);
}

.game-group .home-blog-head time {
    color: var(--pds-text-medium);
    font-size: 0.85rem;
    font-weight: 650;
}

.lesson-index,
.game-index {
    list-style: none;
    display: grid;
    gap: 0.65rem;
}

.lesson-index li,
.game-index li {
    padding: 0.85rem 1rem;
    border: 1px solid #cccccc;
    border-radius: 5px;
    background: #ffffff;
    box-shadow: var(--pds-shadow);
}

.archive-game h3 {
    margin: 1.4rem 0 0.35rem;
    font-size: 1.1rem;
}

.pgn-embed {
    display: grid;
    grid-template-columns: minmax(16rem, 22.5rem) minmax(0, 1fr);
    gap: 0.85rem 1rem;
    margin: 1rem 0 1.5rem;
    padding: 0.9rem;
    background: #ffffff;
    border: 1px solid #cccccc;
    border-radius: 5px;
    box-shadow: var(--pds-shadow);
    color: #333333;
}

.post .pgn-embed {
    background: #f7f7f7;
    border-color: #e6e6e6;
    box-shadow: inset 0 0 0 1px #ffffff;
}

.pgn-embed__frame {
    position: relative;
    width: 100%;
}

.pgn-embed__board {
    width: 100%;
}

.pgn-embed__board svg {
    width: 100%;
    height: auto;
    display: block;
}

/* Shared by embedded PGN boards, Game analysis, and Opening explorer. */
.chess-eval-bar-frame {
    fill: var(--host-accent);
}

.chess-eval-bar-white {
    fill: var(--c24-orange);
}

.pgn-embed__controls {
    margin-top: 0.45rem;
}

.pgn-embed__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    width: 100%;
    gap: 0.65rem 0.9rem;
    margin-top: 0.55rem;
}

a.pgn-embed__analyze {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.4rem 0.85rem;
    background: var(--c24-orange);
    color: #fcfcfc;
    border: 1px solid transparent;
    border-radius: 3px;
    font-size: 0.85rem;
    font-weight: 700;
    line-height: 1.2;
    text-decoration: none;
}

a.pgn-embed__analyze:hover {
    background: var(--c24-orange-hover);
    color: #ffffff;
    text-decoration: none;
}

a.pgn-embed__analyze:focus-visible {
    outline: 2px solid var(--c24-play);
    outline-offset: 2px;
}

.prose a.pgn-embed__analyze,
.prose a.pgn-embed__analyze:hover {
    color: #fcfcfc;
    text-decoration: none;
}

.prose a.pgn-embed__analyze:hover {
    background: var(--c24-orange-hover);
    color: #ffffff;
}

.pgn-embed__moves {
    min-width: 0;
}

.pgn-embed__moves .cb-moves__list {
    max-height: min(28rem, 70vh);
}

.pgn-embed__source {
    display: none;
}

@media (max-width: 900px) {
    .post-list--grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 720px) {
    .header-bar {
        gap: 0.35rem;
    }

    .post-list--grid,
    .pgn-embed {
        grid-template-columns: 1fr;
    }

    /* Bleed the embed out of the article/container padding so the board
       uses the viewport width. Desktop keeps the side-by-side column. */
    .pgn-embed {
        width: 100vw;
        max-width: 100vw;
        margin-left: calc(50% - 50vw);
        margin-right: calc(50% - 50vw);
        padding: 0.55rem 0.35rem 0.7rem;
        border-radius: 0;
        box-sizing: border-box;
    }

    .pgn-embed__stage,
    .pgn-embed__frame,
    .pgn-embed__board,
    .pgn-embed__controls,
    .pgn-embed__moves,
    .pgn-embed__board .cb-interactive-board,
    .pgn-embed__board svg {
        width: 100%;
        max-width: none;
    }

    .pgn-embed__board svg {
        height: auto;
    }
}
