.tool-content {
    box-shadow: var(--card-shadow);
    border: 1px solid var(--border-color);
    padding: 1.2em;
    border-radius: .6em;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 1.2em;
}

@media (max-width: 768px) {
    .tool-content {
        padding: .8em;
        box-shadow: unset;
        gap: 0.8em;
    }
}

/* ===== 中国象棋 / chess- 前缀，样式仅作用于 .chess-app 内部 ===== */
.chess-app {
    --chess-brand: rgba(93, 79, 248, .92);
    --chess-brand-lite: #6C5CE8;
    --chess-brand-faint: rgba(93, 79, 248, .09);
    --chess-grad-a: #8C7CFF;
    --chess-grad-b: #4635DC;
    --chess-brand-glow: rgba(93, 79, 248, .28);
    --chess-surface: #FFFFFF;
    --chess-surface-2: #FFFFFF;
    --chess-stroke: rgba(60, 64, 110, .10);
    --chess-stroke-hi: rgba(60, 64, 110, .17);
    --chess-ink: #23263E;
    --chess-muted: #6A6F8C;
    --chess-faint: #9AA0B8;
    --chess-gold: #E8C27A;
    --chess-modal-bg: linear-gradient(165deg, #FFFFFF, #F6F5FE);
    --chess-modal-stroke: rgba(93, 79, 248, .22);
    --chess-overlay-bg: rgba(38, 40, 70, .38);
    --chess-pr2: #C8102E;
    --chess-pr-ink: #FFF6F0;
    --chess-pb2: #1D1D1F;
    --chess-pb-ink: #F5F5F7;
    display: grid;
    grid-template-columns:minmax(0, 1fr) minmax(270px, 340px);
    gap: 18px;
    align-items: start;
    color: var(--chess-ink);
    font-family: "Inter", "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", system-ui, sans-serif;
    -webkit-font-smoothing: antialiased;
}

.chess-app * {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent
}

.chess-app .chess-side {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0
}

.chess-app #chess-board {
    display: block;
    width: 100%;
    max-width: 800px;
    height: auto;
    margin: 0;
    justify-self: center;
    border-radius: 0;
    touch-action: manipulation;
    cursor: pointer
}

.chess-app .chess-card {
    background: var(--chess-surface);
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 1em;
    box-shadow: none;
}

.chess-app .chess-card h2 {
    font-size: 11px;
    letter-spacing: 2.6px;
    color: var(--chess-muted);
    font-weight: 700;
    margin: 0 0 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    text-transform: uppercase
}

.chess-app .chess-card h2::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--chess-brand-lite);
    box-shadow: 0 0 0 4px var(--chess-brand-faint);
    flex: none
}

.chess-app .chess-status {
    display: flex;
    align-items: center;
    gap: 11px;
    height: 42px;
    min-height: 42px;
    flex-wrap: nowrap;
    overflow: hidden
}

.chess-app .chess-turn-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    flex: none;
    border: 2px solid rgba(255, 255, 255, .65)
}

.chess-app .chess-turn-dot.chess-r {
    background: #C8102E;
    box-shadow: 0 0 10px rgba(200, 16, 46, .35)
}

.chess-app .chess-turn-dot.chess-b {
    background: #1D1D1F;
    box-shadow: 0 0 10px rgba(29, 29, 31, .3)
}

.chess-app .chess-turn-text {
    font-size: 17px;
    font-weight: 650;
    letter-spacing: .5px;
    flex: 0 0 auto;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis
}

.chess-app .chess-turn-text.chess-busy {
    color: var(--chess-brand-lite);
    animation: chess-pulse 1.1s infinite
}

.chess-app .chess-tag {
    font-size: 10.5px;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--chess-brand-faint);
    color: var(--chess-brand-lite);
    letter-spacing: .6px;
    border: 1px solid rgba(93, 79, 248, .24);
    white-space: nowrap;
    flex: 0 1 auto;
    min-width: 0;
    max-width: 170px;
    overflow: hidden;
    text-overflow: ellipsis
}

.chess-app .chess-tag:empty {
    display: none
}

.chess-app .chess-tag.chess-danger {
    background: rgba(244, 103, 94, .14);
    color: #FF9A92;
    border-color: rgba(244, 103, 94, .34);
    font-weight: 600;
    animation: chess-pulse 1.1s infinite
}

.chess-app .chess-tag.chess-warn {
    background: rgba(232, 194, 122, .13);
    color: var(--chess-gold);
    border-color: rgba(232, 194, 122, .3);
    font-weight: 600
}

@keyframes chess-pulse {
    50% {
        opacity: .5
    }
}

.chess-app .chess-meta {
    font-size: 11.5px;
    color: var(--chess-muted);
    margin-top: 12px;
    padding-top: 11px;
    border-top: 1px solid var(--chess-stroke);
    letter-spacing: .3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis
}

.chess-app .chess-hint-text {
    font-size: 11px;
    color: var(--chess-faint);
    line-height: 1.6;
    margin: -1px 0 2px;
    text-align: right;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis
}

.chess-app kbd {
    display: inline-block;
    border: 1px solid var(--chess-stroke-hi);
    border-radius: 5px;
    padding: 0 4px;
    background: rgba(255, 255, 255, .9);
    font: inherit;
    font-size: 9.5px;
    line-height: 1.5;
    color: var(--chess-ink);
    margin: 0 1px
}

.chess-app .chess-row {
    display: flex;
    gap: 9px;
    flex-wrap: wrap
}

.chess-app .chess-field {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 10px 0;
    font-size: 13px
}

.chess-app .chess-field label {
    color: var(--chess-muted);
    white-space: nowrap
}

.chess-app select {
    appearance: none;
    border: 1px solid var(--chess-stroke-hi);
    background: #FFFFFF;
    color: var(--chess-ink);
    border-radius: 8px;
    padding: 9px 30px 9px 12px;
    font-size: 12.5px;
    font-family: inherit;
    cursor: pointer;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6'><path d='M1 1l4 4 4-4' stroke='%239A99B8' stroke-width='1.4' fill='none'/></svg>");
    background-repeat: no-repeat;
    background-position: right 11px center;
    transition: .18s;
}

.chess-app select:hover {
    border-color: rgba(93, 79, 248, .5)
}

.chess-app select:focus {
    outline: none;
    border-color: var(--chess-brand);
    box-shadow: 0 0 0 3px var(--chess-brand-faint)
}

.chess-app select option {
    background: #fff;
    color: #23263E
}

.chess-app .chess-btn {
    flex: 1 1 auto;
    min-width: 76px;
    border: 1px solid var(--chess-stroke-hi);
    background: var(--chess-surface-2);
    color: var(--chess-ink);
    border-radius: 8px;
    padding: 10px 11px;
    font-size: 12.5px;
    font-weight: 550;
    font-family: inherit;
    cursor: pointer;
    transition: background .15s, border-color .15s, color .15s;
    white-space: nowrap;
    letter-spacing: .3px;
}

.chess-app .chess-btn:hover:not(:disabled) {
    background: var(--chess-brand-faint);
    border-color: rgba(93, 79, 248, .45)
}

.chess-app .chess-btn:active:not(:disabled) {
    background: rgba(93, 79, 248, .16)
}

.chess-app .chess-btn:disabled {
    opacity: .36;
    cursor: not-allowed
}

.chess-app .chess-btn.chess-primary {
    background: var(--chess-brand);
    border-color: transparent;
    color: #fff;
    font-weight: 650
}

.chess-app .chess-btn.chess-primary:hover:not(:disabled) {
    background: rgba(108, 92, 232, .95)
}

.chess-app .chess-btn.chess-on {
    background: rgba(38, 180, 128, .1);
    border-color: rgba(38, 180, 128, .4);
    color: #12805E
}

.chess-app .chess-empty-note {
    color: var(--chess-faint);
    font-size: 11.5px;
    padding-top: 4px
}

.chess-app .chess-captured {
    display: flex;
    flex-direction: column;
    gap: 9px;
    min-height: 34px;
    font-size: 11px;
    color: var(--chess-muted)
}

.chess-app .chess-captured > div {
    display: flex;
    gap: 9px;
    align-items: flex-start
}

.chess-app .chess-cap-group {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    align-items: center
}

.chess-app .chess-cap-label {
    white-space: nowrap;
    padding-top: 6px;
    width: 58px;
    flex: none;
    text-align: right
}

.chess-app .chess-mini {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 13px;
    font-weight: 700;
    font-family: "STKaiti", "KaiTi", serif;
    color: var(--chess-pr-ink);
    border: 1px solid rgba(0, 0, 0, .18);
    background: var(--chess-pr2);
    box-shadow: 0 2px 5px rgba(0, 0, 0, .18)
}

.chess-app .chess-mini.chess-b {
    color: var(--chess-pb-ink);
    background: var(--chess-pb2)
}

.chess-app .chess-moves {
    max-height: 186px;
    overflow-y: auto;
    border-top: 1px solid var(--chess-stroke);
    padding-top: 9px;
    font-size: 13px;
    line-height: 1.95
}

.chess-app .chess-moves::-webkit-scrollbar {
    width: 6px
}

.chess-app .chess-moves::-webkit-scrollbar-thumb {
    background: rgba(93, 79, 248, .25);
    border-radius: 4px
}

.chess-app .chess-mv-row {
    display: grid;
    grid-template-columns:36px 1fr 1fr;
    gap: 6px;
    padding: 2px 6px;
    border-radius: 7px;
    transition: .15s
}

.chess-app .chess-mv-row:nth-child(odd) {
    background: rgba(60, 64, 110, .045)
}

.chess-app .chess-mv-row:hover {
    background: var(--chess-brand-faint)
}

.chess-app .chess-mv-no {
    color: var(--chess-brand-lite);
    font-size: 11px;
    text-align: center;
    font-variant-numeric: tabular-nums;
    opacity: .8
}

.chess-app .chess-mv-r {
    color: #C8102E
}

.chess-app .chess-mv-b {
    color: #333333
}

.chess-app .chess-mv-empty {
    color: var(--chess-faint)
}

.chess-app .chess-rules {
    font-size: 12.5px;
    color: var(--chess-muted);
    line-height: 1.85
}

.chess-app .chess-rules summary {
    cursor: pointer;
    font-size: 12px;
    letter-spacing: 2px;
    font-weight: 700;
    color: var(--chess-ink);
    list-style: none
}

.chess-app .chess-rules summary::-webkit-details-marker {
    display: none
}

.chess-app .chess-rules summary::before {
    content: "\25B8 ";
    color: var(--chess-brand-lite)
}

.chess-app details[open].chess-rules summary::before {
    content: "\25BE "
}

.chess-app .chess-rules ul {
    padding-left: 18px;
    margin: 12px 0 0
}

.chess-app .chess-rules li {
    margin-bottom: 3px
}

.chess-app .chess-rules b {
    color: var(--chess-ink);
    font-weight: 650
}

.chess-app .chess-overlay {
    position: fixed;
    inset: 0;
    background: var(--chess-overlay-bg);
    display: none;
    place-items: center;
    z-index: 30;
    padding: 20px
}

.chess-app .chess-overlay.chess-show {
    display: grid
}

.chess-app .chess-modal {
    background: var(--chess-modal-bg);
    border: 1px solid var(--chess-modal-stroke);
    border-radius: 22px;
    padding: 34px 34px 30px;
    text-align: center;
    box-shadow: 0 30px 80px rgba(0, 0, 0, .24), 0 0 60px var(--chess-brand-faint);
    max-width: 340px;
    width: 100%;
    animation: chess-pop .28s cubic-bezier(.2, .9, .3, 1.2)
}

@keyframes chess-pop {
    from {
        transform: scale(.86) translateY(12px);
        opacity: 0
    }
    to {
        transform: scale(1) translateY(0);
        opacity: 1
    }
}

.chess-app .chess-modal .chess-icon {
    width: 68px;
    height: 68px;
    margin: 0 auto 12px;
    border-radius: 22px;
    display: grid;
    place-items: center;
    font-size: 36px;
    font-family: "STKaiti", serif;
    color: #fff;
    background: linear-gradient(140deg, var(--chess-grad-a), var(--chess-brand) 55%, var(--chess-grad-b));
    box-shadow: 0 12px 28px var(--chess-brand-glow), inset 0 1px 0 rgba(255, 255, 255, .4)
}

.chess-app .chess-modal h3 {
    font-size: 25px;
    letter-spacing: 2px;
    margin: 10px 0;
    font-weight: 700
}

.chess-app .chess-modal p {
    font-size: 12.5px;
    color: var(--chess-muted);
    margin: 0 0 24px;
    line-height: 1.75
}

.chess-app .chess-modal .chess-btn {
    width: 100%;
    padding: 12px
}

@media (max-width: 1180px) {
    .chess-app {
        grid-template-columns:1fr;
        gap: 14px
    }

    .chess-app .chess-moves {
        max-height: 150px
    }

    .chess-app .chess-card {
        padding: 14px
    }
}

@media (max-width: 520px) {
    .chess-app .chess-btn {
        min-width: 0;
        font-size: 12px;
        padding: 9px 7px
    }
}

/* ===== 全屏：最大化显示棋盘（等同 F11 的元素全屏） ===== */
.chess-app:fullscreen,
.chess-app.chess-fs-fallback {
    position: fixed;
    inset: 0;
    z-index: 9998;
    width: 100vw;
    height: 100vh;
    max-width: none;
    margin: 0;
    box-sizing: border-box;
    background: #FFFFFF;
    overflow: hidden;
    grid-template-columns:minmax(0, 1fr) 300px;
    gap: 16px;
    align-items: center;
}

.chess-app:fullscreen .chess-side,
.chess-app.chess-fs-fallback .chess-side {
    max-height: 100%;
    overflow-y: auto;
    padding-right: 4px
}

.chess-app:fullscreen #chess-board,
.chess-app.chess-fs-fallback #chess-board {
    max-width: none;
    height: auto;
    margin: 0;
    align-self: center;
    justify-self: center
}

@media (max-width: 900px) {
    .chess-app:fullscreen,
    .chess-app.chess-fs-fallback {
        grid-template-columns:minmax(0, 1fr) 230px
    }
}
