/* ---------- Board touch scrolling (see site-extras.js) ---------- */

:root body.board-idle #chessBoard,
:root body.board-idle #chessboard,
:root body.board-idle #puzzleBoard,
:root body.board-idle #multiplayer-board,
:root body.board-idle .board-b72b1,
:root body.board-idle .board-b72b1 .piece-417db,
:root body.board-idle #multiplayer-board .piece-417db {
    touch-action: manipulation;
}

:root body.board-idle.board-drag-pieces .board-b72b1 .piece-417db {
    touch-action: none;
}

/* ---------- Puzzle Ladder notice ---------- */

.ladder-notice {
    --ln-bg: #1b1a18;
    --ln-text: #f4efe8;
    --ln-muted: rgba(244, 239, 232, 0.68);
    position: fixed;
    left: 20px;
    bottom: 20px;
    z-index: 1300;
    display: grid;
    grid-template-columns: 76px minmax(0, 1fr);
    gap: 14px;
    width: min(380px, calc(100vw - 24px));
    padding: 14px 16px 14px 14px;
    box-sizing: border-box;
    border-radius: 14px;
    background:
        radial-gradient(140% 120% at 0% 100%, rgba(236, 106, 53, 0.28), transparent 55%),
        radial-gradient(90% 90% at 100% 0%, rgba(226, 180, 60, 0.16), transparent 60%),
        var(--ln-bg);
    color: var(--ln-text);
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.38), 0 0 0 1px rgba(255, 255, 255, 0.07);
    font-family: inherit;
    opacity: 0;
    transform: translateY(24px) scale(0.96);
    transition: opacity 0.35s ease, transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
    pointer-events: none;
}

.ladder-notice::before {
    content: "";
    position: absolute;
    inset: 0;
    padding: 1px;
    border-radius: inherit;
    background: conic-gradient(from var(--ln-angle, 0deg), transparent 0 70%, #ec6a35 80%, #e2b43c 88%, transparent 96%);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    animation: lnBorder 4s linear infinite;
    pointer-events: none;
}

@property --ln-angle {
    syntax: "<angle>";
    inherits: false;
    initial-value: 0deg;
}

@keyframes lnBorder {
    to { --ln-angle: 360deg; }
}

.ladder-notice.is-in {
    opacity: 1;
    transform: none;
    pointer-events: auto;
}

.ladder-notice.is-in.is-tucked {
    opacity: 0;
    transform: translateY(24px) scale(0.96);
    pointer-events: none;
}

.ladder-notice.is-out {
    opacity: 0;
    transform: translateY(16px) scale(0.94);
    transition-duration: 0.25s;
}

.ladder-notice-art {
    position: relative;
    align-self: stretch;
    min-height: 96px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    overflow: hidden;
}

.ladder-notice-rungs {
    position: absolute;
    inset: 8px 12px;
    display: flex;
    flex-direction: column-reverse;
    justify-content: space-between;
}

.ladder-notice-rungs span {
    display: block;
    height: 4px;
    border-radius: 3px;
    background: var(--c);
    opacity: 0.25;
    animation: lnRung 3.2s ease-in-out infinite;
    animation-delay: calc(var(--i) * 0.16s);
}

@keyframes lnRung {
    0%, 8% { opacity: 0.22; transform: scaleX(0.7); }
    22%, 70% { opacity: 1; transform: scaleX(1); box-shadow: 0 0 8px var(--c); }
    100% { opacity: 0.22; transform: scaleX(0.7); }
}

.ladder-notice-knight {
    position: absolute;
    left: 50%;
    bottom: 6px;
    width: 34px;
    height: 34px;
    margin-left: -17px;
    border-radius: 50%;
    background: #ec6a35;
    color: #fff;
    font-size: 22px;
    line-height: 34px;
    text-align: center;
    box-shadow: 0 4px 14px rgba(236, 106, 53, 0.55);
    animation: lnClimb 3.2s cubic-bezier(0.5, 0, 0.3, 1) infinite;
}

@keyframes lnClimb {
    0% { transform: translateY(0); }
    60% { transform: translateY(-52px); }
    70% { transform: translateY(-52px) scale(1.12); }
    80%, 100% { transform: translateY(-52px); opacity: 0; }
}

.ladder-notice-copy {
    min-width: 0;
    padding-right: 18px;
}

.ladder-notice-kicker {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0 0 3px;
    color: var(--ln-muted);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.ladder-notice-kicker span {
    padding: 2px 6px;
    border-radius: 4px;
    background: #ec6a35;
    color: #fff;
    letter-spacing: 0.06em;
}

.ladder-notice-title {
    margin: 0 0 3px;
    font-size: 1.02rem;
    font-weight: 900;
    line-height: 1.2;
}

.ladder-notice-text {
    margin: 0 0 10px;
    color: var(--ln-muted);
    font-size: 0.82rem;
    line-height: 1.4;
}

.ladder-notice-cta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 8px;
    background: #ec6a35;
    color: #fff;
    font-size: 0.86rem;
    font-weight: 800;
    text-decoration: none;
    box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.18);
    transition: background 0.15s ease;
}

.ladder-notice-cta:hover {
    background: #f27d4c;
    color: #fff;
}

.ladder-notice-cta svg {
    width: 16px;
    height: 16px;
    transition: transform 0.15s ease;
}

.ladder-notice-cta:hover svg {
    transform: translateX(3px);
}

.ladder-notice-close {
    position: absolute;
    top: 8px;
    right: 8px;
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    color: var(--ln-muted);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.ladder-notice-close:hover {
    background: rgba(255, 255, 255, 0.14);
    color: var(--ln-text);
}

.ladder-notice-close svg {
    width: 15px;
    height: 15px;
}

@media (max-width: 1024px) {
    .ladder-notice {
        left: 12px;
        right: 12px;
        bottom: calc(56px + env(safe-area-inset-bottom, 0px) + 10px);
        width: auto;
        max-width: 480px;
        margin: 0 auto;
        grid-template-columns: 64px minmax(0, 1fr);
        gap: 12px;
        padding: 12px 14px 12px 12px;
    }
    .ladder-notice-art {
        min-height: 84px;
    }
    .ladder-notice-text {
        font-size: 0.78rem;
    }
}

/* ---------- Footer About + About modal ---------- */

:root .footer {
    padding: 1rem 1.25rem 1.15rem;
}

:root .footer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

:root .footer .gtranslate_wrapper {
    margin-top: 0;
}

:root .footer-about {
    appearance: none;
    -webkit-appearance: none;
    border: 1px solid var(--ch-line);
    background: var(--ch-surface-2);
    color: var(--ch-text);
    font: inherit;
    font-size: 0.9rem;
    font-weight: 750;
    line-height: 1;
    padding: 0.5rem 1.05rem;
    border-radius: 999px;
    cursor: pointer;
}

:root .footer-about:hover {
    border-color: var(--ch-orange);
    color: var(--ch-orange);
}

.about-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1400;
    display: none;
    align-items: flex-end;
    justify-content: center;
    padding: 12px;
    background: rgba(18, 16, 14, 0.55);
}

.about-modal-overlay.open {
    display: flex;
}

.about-modal {
    width: min(480px, 100%);
    max-height: min(86dvh, 640px);
    overflow: auto;
    box-sizing: border-box;
    border-radius: 18px 18px 14px 14px;
    background: var(--ch-surface, #fffdf9);
    color: var(--ch-text, #1c1916);
    border: 1px solid var(--ch-line, rgba(28, 25, 22, 0.08));
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}

.about-modal-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 16px 0;
}

.about-modal-kicker {
    margin: 0;
    color: var(--ch-muted, #8a8176);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.about-modal-head h2 {
    margin: 2px 0 0;
    font-size: 1.35rem;
    font-weight: 850;
    line-height: 1.15;
}

.about-modal-close {
    flex: none;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 50%;
    background: var(--ch-surface-2, rgba(28, 25, 22, 0.06));
    color: var(--ch-text, #1c1916);
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
}

.about-modal-body {
    padding: 12px 16px 16px;
}

.about-modal-lead {
    margin: 0 0 6px;
    font-size: 0.98rem;
    line-height: 1.4;
}

.about-modal-credits {
    margin: 0 0 14px;
    color: var(--ch-muted, #8a8176);
    font-size: 0.8rem;
    line-height: 1.45;
}

.about-modal-credits a {
    color: var(--ch-orange, #ec6a35);
}

.about-modal-links {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px 14px;
    margin: 0 0 14px;
    padding-top: 12px;
    border-top: 1px solid var(--ch-line, rgba(28, 25, 22, 0.08));
}

.about-modal-links a {
    padding: 7px 0;
    color: var(--ch-text, #1c1916);
    font-size: 0.9rem;
    font-weight: 650;
    text-decoration: none;
}

.about-modal-links a:hover {
    color: var(--ch-orange, #ec6a35);
}

.about-contact {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 46px;
    border: 0;
    border-radius: 10px;
    background: var(--ch-orange, #ec6a35);
    color: #fff;
    font: inherit;
    font-size: 0.98rem;
    font-weight: 800;
    cursor: pointer;
    box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.16);
}

.about-contact:hover {
    background: var(--ch-orange-hi, #f27d4c);
}

@media (min-width: 700px) {
    .about-modal-overlay {
        align-items: center;
        padding: 24px;
    }

    .about-modal {
        border-radius: 18px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ladder-notice,
    .ladder-notice::before,
    .ladder-notice-rungs span,
    .ladder-notice-knight {
        animation: none;
        transition: opacity 0.2s ease;
    }
    .ladder-notice-rungs span {
        opacity: 1;
    }
}
