/**
 * Playable Bao page (/esports/competitions/bao)
 */

.bao-page {
    --bao-wood: #7a3f1f;
    --bao-wood-dark: #3b1b0c;
    --bao-gold: #f3c969;
    --bao-ink: #2a160c;
    --bao-cream: #fff3c8;
}

.bao-eyebrow {
    margin: 0 0 8px;
    color: var(--esports-primary, #7c3aed);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.bao-game-shell,
.bao-about,
.bao-reference,
.bao-faq {
    border: 1px solid rgba(124, 58, 237, 0.14);
    border-radius: 22px;
    background: linear-gradient(145deg, rgba(255, 248, 222, 0.92), rgba(255, 255, 255, 0.96));
    box-shadow: 0 14px 38px rgba(42, 22, 12, 0.08);
}

.bao-game-shell {
    margin: 0 0 28px;
    padding: 16px 18px 22px;
}

.bao-game-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px 16px;
    margin-bottom: 14px;
}

.bao-game-bar__brand {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 10px 14px;
    min-width: 0;
}

.bao-game-bar__brand h1 {
    margin: 0;
    color: var(--bao-ink);
    font-size: 28px;
    font-weight: 900;
    letter-spacing: -0.02em;
}

.bao-back,
.bao-full-rules,
.bao-sources a {
    color: #7c2d12;
    font-size: 13px;
    font-weight: 800;
    text-decoration: none;
    white-space: nowrap;
}

.bao-back:hover,
.bao-full-rules:hover,
.bao-sources a:hover {
    text-decoration: underline;
}

.bao-menu {
    display: flex;
    flex-wrap: nowrap;
    align-items: end;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 2px;
    -webkit-overflow-scrolling: touch;
}

.bao-menu__field {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.bao-menu__label {
    color: rgba(42, 22, 12, 0.48);
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    white-space: nowrap;
}

.bao-menu select,
.bao-menu__action {
    appearance: none;
    border: 1px solid rgba(122, 63, 31, 0.18);
    border-radius: 10px;
    padding: 8px 28px 8px 11px;
    background-color: rgba(255, 255, 255, 0.9);
    background-image:
        linear-gradient(45deg, transparent 50%, #7c2d12 50%),
        linear-gradient(135deg, #7c2d12 50%, transparent 50%);
    background-position:
        calc(100% - 14px) calc(50% - 2px),
        calc(100% - 9px) calc(50% - 2px);
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
    color: var(--bao-ink);
    font-size: 13px;
    font-weight: 800;
    line-height: 1.2;
    cursor: pointer;
    max-width: 148px;
}

.bao-menu select:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.bao-menu__action {
    padding: 8px 12px;
    background-image: none;
    background: linear-gradient(135deg, #a13c10, #7c2d12);
    color: #fff;
    border-color: transparent;
    white-space: nowrap;
}

.bao-menu__action:hover {
    filter: brightness(1.05);
}

.bao-menu__action--ghost {
    background: rgba(255, 255, 255, 0.9);
    color: var(--bao-ink);
    border-color: rgba(122, 63, 31, 0.18);
}

.bao-guide {
    margin: 0 0 12px;
    padding: 16px;
    border: 1px solid rgba(122, 63, 31, 0.16);
    border-radius: 16px;
    background: linear-gradient(145deg, rgba(255, 248, 222, 0.98), rgba(255, 255, 255, 0.96));
    color: var(--bao-ink);
}

.bao-guide[hidden] {
    display: none !important;
}

.bao-guide__top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.bao-guide__meta {
    margin: 0;
    color: rgba(42, 22, 12, 0.55);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.bao-guide__exit,
.bao-guide__nav-btn {
    border: 1px solid rgba(122, 63, 31, 0.18);
    border-radius: 10px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.9);
    color: var(--bao-ink);
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
}

.bao-guide__exit:hover,
.bao-guide__nav-btn:hover:not(:disabled) {
    border-color: rgba(124, 58, 237, 0.34);
}

.bao-guide__nav-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.bao-guide__nav-btn--next {
    background: linear-gradient(135deg, #a13c10, #7c2d12);
    color: #fff;
    border-color: transparent;
}

.bao-guide__title {
    margin: 0 0 10px;
    color: var(--bao-ink);
    font-size: clamp(22px, 4vw, 30px);
    font-weight: 900;
    letter-spacing: -0.02em;
}

.bao-guide__body p {
    margin: 0 0 10px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.bao-guide__body ul {
    margin: 0 0 10px;
    padding-left: 18px;
    color: var(--text-secondary);
    line-height: 1.55;
}

.bao-guide__note {
    margin: 0 0 14px;
    color: rgba(42, 22, 12, 0.55);
    font-size: 13px;
    font-weight: 700;
}

.bao-guide__nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.bao-guide__dots {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
}

.bao-guide__dot {
    width: 8px;
    height: 8px;
    border: 0;
    border-radius: 999px;
    background: #f0d39a;
    cursor: pointer;
    padding: 0;
}

.bao-guide__dot.is-active {
    background: #0284c7;
    transform: scale(1.25);
}

.bao-example-badge {
    display: inline-flex;
    margin: 0 auto 8px;
    padding: 5px 12px;
    border-radius: 999px;
    background: rgba(42, 22, 12, 0.82);
    color: #fff3c8;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.bao-example-badge[hidden] {
    display: none !important;
}

.bao-pit.is-guide-focus {
    outline: 3px solid rgba(251, 191, 36, 0.98) !important;
    box-shadow: inset 0 12px 22px rgba(0, 0, 0, 0.75), 0 0 0 8px rgba(251, 191, 36, 0.22) !important;
}

.bao-pit.is-guide-landing {
    outline: 3px solid rgba(56, 189, 248, 0.95) !important;
    box-shadow: inset 0 12px 22px rgba(0, 0, 0, 0.75), 0 0 0 8px rgba(56, 189, 248, 0.2) !important;
}

.bao-pit.is-guide-capture {
    outline: 3px solid rgba(248, 113, 113, 0.95) !important;
    box-shadow: inset 0 12px 22px rgba(0, 0, 0, 0.75), 0 0 0 8px rgba(248, 113, 113, 0.22) !important;
}

.bao-pit.is-guide-info {
    outline: 3px solid rgba(167, 139, 250, 0.95) !important;
    box-shadow: inset 0 12px 22px rgba(0, 0, 0, 0.75), 0 0 0 8px rgba(167, 139, 250, 0.2) !important;
}

.bao-guide-marker {
    position: absolute;
    left: 50%;
    bottom: -16px;
    z-index: 6;
    transform: translateX(-50%);
    max-width: 110px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 2px 7px;
    border-radius: 999px;
    background: #facc15;
    color: #2a160c;
    font-size: clamp(8px, 2.2vw, 9px);
    font-weight: 900;
    line-height: 1.2;
    pointer-events: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.bao-page.is-guide-open .bao-board-wrap {
    padding-bottom: 28px;
}

.bao-guide-marker--landing {
    background: #38bdf8;
    color: #082f49;
}

.bao-guide-marker--capture {
    background: #f87171;
    color: #450a0a;
}

.bao-guide-marker--info {
    background: #c4b5fd;
    color: #2e1065;
}

.bao-page.is-guide-open .bao-status-card,
.bao-page.is-guide-open .bao-teach {
    opacity: 0.55;
}

.bao-page.is-guide-open .bao-menu select,
.bao-page.is-guide-open .bao-menu [data-bao-new] {
    opacity: 0.55;
    pointer-events: none;
}

.bao-board-wrap {
    position: relative;
    overflow: visible;
    padding: 8px 0 18px;
    width: 100%;
    text-align: center;
}

.bao-board {
    position: relative;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    display: grid;
    grid-template-columns: repeat(8, minmax(0, 1fr));
    gap: clamp(4px, 1.4vw, 14px);
    padding: clamp(12px, 3vw, 38px) clamp(8px, 2.2vw, 24px);
    border: 4px solid #2b1208;
    border-radius: clamp(10px, 2vw, 18px);
    box-sizing: border-box;
    background:
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px) 0 0 / 42px 42px,
        linear-gradient(0deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px) 0 0 / 42px 42px,
        radial-gradient(circle at 35% 20%, rgba(244, 172, 84, 0.18), transparent 28%),
        linear-gradient(135deg, #8a4a28, #5b2b16 55%, #351507);
    box-shadow: inset 0 0 28px rgba(0, 0, 0, 0.35), 0 18px 38px rgba(42, 22, 12, 0.22);
}

.bao-pit {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    min-height: 0;
    border: 0;
    border-radius: 999px;
    background:
        radial-gradient(circle at 40% 35%, rgba(255, 255, 255, 0.08), transparent 17%),
        radial-gradient(circle at 50% 52%, #2b130b 0%, #130704 62%, #050201 100%);
    box-shadow: inset 0 12px 22px rgba(0, 0, 0, 0.75), inset 0 -5px 18px rgba(255, 214, 148, 0.08), 0 2px 0 rgba(255, 255, 255, 0.08);
    cursor: default;
    overflow: visible;
}

.bao-pit--house {
    border-radius: 7px;
    outline: 2px solid rgba(243, 201, 105, 0.36);
}

.bao-pit.is-legal {
    cursor: pointer;
    outline: 3px solid rgba(34, 211, 238, 0.75);
    box-shadow: inset 0 12px 22px rgba(0, 0, 0, 0.75), 0 0 0 6px rgba(34, 211, 238, 0.16);
}

.bao-pit.is-selected {
    z-index: 3;
    outline: 3px solid var(--bao-gold);
    box-shadow: inset 0 12px 22px rgba(0, 0, 0, 0.75), 0 0 0 7px rgba(243, 201, 105, 0.18);
}

.bao-pit.is-last {
    animation: baoPulse 0.9s ease-out;
}

.bao-pit.is-anim {
    z-index: 4;
}

.bao-pit.is-anim-pickup,
.bao-pit.is-anim-relay {
    outline: 3px solid rgba(251, 191, 36, 0.95);
    box-shadow: inset 0 12px 22px rgba(0, 0, 0, 0.75), 0 0 0 8px rgba(251, 191, 36, 0.22);
    transform: scale(1.04);
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.bao-pit.is-anim-drop {
    outline: 3px solid rgba(110, 231, 183, 0.95);
    box-shadow: inset 0 12px 22px rgba(0, 0, 0, 0.75), 0 0 0 8px rgba(110, 231, 183, 0.2);
    animation: baoDropPulse 0.18s ease-out;
}

.bao-pit.is-anim-capture {
    outline: 3px solid rgba(248, 113, 113, 0.95);
    box-shadow: inset 0 12px 22px rgba(0, 0, 0, 0.75), 0 0 0 10px rgba(248, 113, 113, 0.24);
    animation: baoCaptureFlash 0.35s ease-out;
}

.bao-flying-seed {
    position: absolute;
    z-index: 20;
    width: 16px;
    height: 16px;
    border-radius: 999px;
    pointer-events: none;
    background: radial-gradient(circle at 35% 30%, #fff, #d9d1c3 48%, #6f655b 100%);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.45);
    transition-property: transform, opacity;
    transition-timing-function: cubic-bezier(0.22, 0.9, 0.28, 1);
    will-change: transform;
}

.bao-flying-seed.is-flying {
    opacity: 1;
}

.bao-flying-seed.is-landed {
    opacity: 0;
    transition-duration: 80ms !important;
}

.bao-pit__label,
.bao-pit__count {
    position: absolute;
    z-index: 2;
    color: rgba(255, 243, 200, 0.9);
    font-size: clamp(7px, 1.8vw, 10px);
    font-weight: 900;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.bao-pit__label {
    top: clamp(3px, 1vw, 8px);
    left: clamp(4px, 1vw, 9px);
    color: rgba(255, 243, 200, 0.28);
}

.bao-pit__count {
    right: clamp(4px, 1vw, 10px);
    bottom: clamp(3px, 1vw, 8px);
}

.bao-seeds {
    position: absolute;
    inset: clamp(8px, 2.2vw, 17px) clamp(6px, 2vw, 16px) clamp(8px, 2.2vw, 18px);
    display: flex;
    flex-wrap: wrap;
    gap: clamp(2px, 0.7vw, 4px);
    align-items: center;
    justify-content: center;
}

.bao-seed {
    width: clamp(6px, 2.2vw, 13px);
    height: clamp(6px, 2.2vw, 13px);
    border-radius: 999px;
    background: radial-gradient(circle at 35% 30%, #fff, #cfc9bd 48%, #776d63 100%);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.bao-seed--more {
    width: auto;
    min-width: clamp(16px, 4vw, 24px);
    padding: 1px 4px;
    border-radius: 999px;
    color: #2a160c;
    background: #fff3c8;
    font-size: clamp(7px, 1.8vw, 10px);
    font-weight: 900;
}

.bao-dir-overlay {
    position: absolute;
    inset: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
    padding: 0 4px;
    border-radius: inherit;
    background: rgba(18, 8, 3, 0.42);
    pointer-events: none;
}

.bao-dir-btn {
    pointer-events: auto;
    flex: 0 0 auto;
    width: clamp(22px, 7vw, 34px);
    height: clamp(22px, 7vw, 34px);
    border: 0;
    border-radius: 999px;
    background: linear-gradient(145deg, #f6d27a, #c9852a);
    color: #2a160c;
    font-size: clamp(12px, 4vw, 18px);
    font-weight: 900;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45);
}

.bao-dir-btn:hover,
.bao-dir-btn:focus-visible {
    transform: scale(1.08);
    outline: 2px solid #fff3c8;
}

.bao-player-label {
    color: rgba(42, 22, 12, 0.54);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.35em;
    text-align: center;
}

.bao-player-label span {
    letter-spacing: normal;
    opacity: 0.72;
}

.bao-player-label--north {
    margin-bottom: 6px;
}

.bao-player-label--south {
    margin-top: 6px;
}

.bao-status-card {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: center;
    max-width: 760px;
    margin: 18px auto 0;
    padding: 18px;
    border: 1px solid rgba(122, 63, 31, 0.12);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.78);
    color: var(--bao-ink);
}

.bao-status-card__label {
    margin: 0 0 5px;
    color: rgba(42, 22, 12, 0.48);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.08em;
}

.bao-status-card strong,
.bao-status-card span {
    display: block;
}

.bao-status-card span {
    margin-top: 3px;
    color: var(--text-secondary);
    font-size: 13px;
}

.bao-status-card p:last-child {
    max-width: 460px;
    margin: 0;
    color: var(--text-secondary);
    text-align: right;
    line-height: 1.5;
}

.bao-teach {
    max-width: 760px;
    margin: 12px auto 0;
    padding: 14px 16px;
    border: 1px solid rgba(16, 185, 129, 0.28);
    border-radius: 14px;
    background: linear-gradient(145deg, rgba(16, 185, 129, 0.12), rgba(255, 255, 255, 0.88));
    color: var(--bao-ink);
}

.bao-teach[hidden] {
    display: none !important;
}

.bao-teach__badge {
    margin: 0 0 6px;
    color: #047857;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.bao-teach strong {
    display: block;
    margin-bottom: 6px;
    font-size: 16px;
}

.bao-teach p {
    margin: 0;
    color: var(--text-secondary);
    line-height: 1.5;
}

.bao-teach__explain {
    margin-top: 8px !important;
    padding-top: 8px;
    border-top: 1px solid rgba(16, 185, 129, 0.18);
    font-size: 13px;
}

.bao-pit.is-teach-hint {
    outline: 3px solid rgba(16, 185, 129, 0.95) !important;
    box-shadow: inset 0 12px 22px rgba(0, 0, 0, 0.75), 0 0 0 8px rgba(16, 185, 129, 0.22) !important;
    animation: baoTeachPulse 1.2s ease-in-out infinite;
}

.bao-dir-btn.is-teach-dir {
    background: linear-gradient(145deg, #6ee7b7, #059669);
    color: #052e1c;
    outline: 2px solid #ecfdf5;
    transform: scale(1.12);
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.28), 0 4px 12px rgba(0, 0, 0, 0.45);
}

.bao-about {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 18px;
    padding: 22px;
    margin-bottom: 26px;
}

.bao-about h3 {
    margin: 0 0 10px;
    color: var(--bao-ink);
    font-size: 22px;
}

.bao-about p,
.bao-about li {
    color: var(--text-secondary);
    line-height: 1.65;
}

.bao-about ul {
    margin: 14px 0 0;
    padding-left: 18px;
}

.bao-reference,
.bao-faq {
    padding: 22px;
    margin-bottom: 26px;
}

.bao-reference-grid,
.bao-faq-list {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.bao-reference-card,
.bao-faq-item {
    padding: 16px;
    border: 1px solid rgba(124, 58, 237, 0.12);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.72);
}

.bao-reference-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    color: var(--text-primary);
    text-decoration: none;
}

.bao-reference-card strong {
    color: #7c2d12;
}

.bao-reference-card span,
.bao-faq-item p {
    color: var(--text-secondary);
    line-height: 1.55;
}

.bao-faq-item h4 {
    margin: 0 0 8px;
    color: var(--bao-ink);
}

.bao-faq-item p {
    margin: 0;
}

.bao-sources {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 16px;
}

@keyframes baoPulse {
    from {
        transform: scale(1.05);
    }
    to {
        transform: scale(1);
    }
}

@keyframes baoDropPulse {
    0% {
        transform: scale(1.08);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes baoCaptureFlash {
    0% {
        transform: scale(1.1);
        filter: brightness(1.35);
    }
    100% {
        transform: scale(1);
        filter: brightness(1);
    }
}

@keyframes baoTeachPulse {
    0%,
    100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.03);
    }
}

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

    .bao-status-card {
        align-items: flex-start;
        flex-direction: column;
    }

    .bao-status-card p:last-child {
        text-align: left;
    }

    .bao-page.esports-view,
    .esports-view.bao-page {
        padding-left: 10px;
        padding-right: 10px;
    }
}

@media (max-width: 720px) {
    .bao-game-shell {
        margin-bottom: 18px;
        padding: 10px;
        border-radius: 14px;
    }

    .bao-game-bar {
        gap: 8px;
        margin-bottom: 8px;
    }

    .bao-game-bar__brand {
        width: 100%;
        justify-content: space-between;
        gap: 8px;
    }

    .bao-game-bar__brand h1 {
        font-size: 22px;
    }

    .bao-menu {
        width: 100%;
        gap: 6px;
    }

    .bao-menu__field {
        flex: 1 1 0;
        min-width: 64px;
    }

    .bao-menu select,
    .bao-menu__action {
        width: 100%;
        max-width: none;
        font-size: 11px;
        padding: 7px 22px 7px 8px;
    }

    .bao-menu__action {
        flex: 0 0 auto;
        width: auto;
        padding-right: 10px;
        padding-left: 10px;
    }

    .bao-player-label {
        letter-spacing: 0.12em;
        font-size: 10px;
    }

    .bao-board {
        border-width: 3px;
    }

    .bao-pit.is-legal,
    .bao-pit.is-selected {
        outline-width: 2px;
        box-shadow: inset 0 8px 14px rgba(0, 0, 0, 0.75), 0 0 0 3px rgba(34, 211, 238, 0.18);
    }

    .bao-pit.is-selected {
        box-shadow: inset 0 8px 14px rgba(0, 0, 0, 0.75), 0 0 0 3px rgba(243, 201, 105, 0.22);
    }

    .bao-flying-seed {
        width: 11px;
        height: 11px;
    }

    .bao-status-card {
        margin-top: 12px;
        padding: 12px;
    }
}

@media (max-width: 420px) {
    .bao-pit__label {
        display: none;
    }

    .bao-menu__label {
        font-size: 9px;
    }

    .bao-dir-overlay {
        padding: 0 1px;
    }
}
