.wjj_td-page {
    --wjj-td-bg: #d9f2ff;
    --wjj-td-panel: #fff4c7;
    --wjj-td-panel-2: #ffe39a;
    --wjj-td-ink: #172033;
    --wjj-td-muted: #59627a;
    --wjj-td-line: #172033;
    --wjj-td-green: #3fa85b;
    --wjj-td-blue: #3183d8;
    --wjj-td-amber: #f2a42b;
    --wjj-td-red: #d9473f;
    --wjj-td-shadow: 6px 6px 0 #172033;
    max-width: 1480px;
    margin: 0 auto;
    padding: 26px 18px 42px;
    color: var(--wjj-td-ink);
    box-sizing: border-box;
    font-family: "Arial Rounded MT Bold", "Trebuchet MS", "Microsoft YaHei", sans-serif;
    image-rendering: pixelated;
}

.wjj_td-page * {
    box-sizing: border-box;
}

.wjj_td-shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 18px;
    align-items: start;
}

.wjj_td-game,
.wjj_td-card {
    background: var(--wjj-td-panel);
    border: 3px solid var(--wjj-td-line);
    border-radius: 6px;
    box-shadow: var(--wjj-td-shadow);
}

.wjj_td-header {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: center;
    padding: 24px;
    border-bottom: 3px solid var(--wjj-td-line);
    background:
        linear-gradient(135deg, rgba(63, 168, 91, 0.18), rgba(49, 131, 216, 0.16)),
        var(--wjj-td-panel);
}

.wjj_td-eyebrow {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 10px;
    border: 2px solid var(--wjj-td-line);
    border-radius: 4px;
    background: #ffffff;
    color: var(--wjj-td-blue);
    font-size: 12px;
    font-weight: 700;
}

.wjj_td-header h1 {
    margin: 10px 0 8px;
    font-size: 36px;
    line-height: 1.12;
    letter-spacing: 0;
}

.wjj_td-header p {
    max-width: 680px;
    margin: 0;
    color: var(--wjj-td-muted);
    line-height: 1.75;
}

.wjj_td-user {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 240px;
    padding: 12px;
    border: 1px solid rgba(47, 123, 85, 0.16);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.66);
}

.wjj_td-user img {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    object-fit: cover;
}

.wjj_td-user strong,
.wjj_td-user span {
    display: block;
}

.wjj_td-user strong {
    font-size: 17px;
}

.wjj_td-user span {
    margin-top: 3px;
    color: var(--wjj-td-muted);
    font-size: 13px;
}

.wjj_td-board-section {
    padding: 18px;
}

.wjj_td-topbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.wjj_td-topbar label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--wjj-td-muted);
    font-size: 13px;
}

.wjj_td-topbar select {
    height: 38px;
    min-width: 96px;
    padding: 0 10px;
    border: 1px solid var(--wjj-td-line);
    border-radius: 8px;
    background: #fff;
    color: var(--wjj-td-ink);
}

.wjj_td-primary-btn,
.wjj_td-ghost-btn,
.wjj_td-text-btn,
.wjj_td-tower-btn,
.wjj_td-cell {
    font: inherit;
}

.wjj_td-primary-btn,
.wjj_td-ghost-btn,
.wjj_td-text-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    border-radius: 5px;
    cursor: pointer;
    box-shadow: 3px 3px 0 var(--wjj-td-line);
    transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}

.wjj_td-primary-btn {
    padding: 0 16px;
    border: 3px solid var(--wjj-td-line);
    background: var(--wjj-td-green);
    color: #fff;
    font-weight: 700;
}

.wjj_td-ghost-btn {
    padding: 0 14px;
    border: 3px solid var(--wjj-td-line);
    background: #fff;
    color: var(--wjj-td-ink);
}

.wjj_td-text-btn {
    min-height: 30px;
    padding: 0 8px;
    border: 2px solid var(--wjj-td-line);
    background: #fff;
    color: var(--wjj-td-green);
    font-weight: 700;
}

.wjj_td-primary-btn:hover,
.wjj_td-ghost-btn:hover,
.wjj_td-text-btn:hover,
.wjj_td-tower-btn:hover,
.wjj_td-cell.can-build:hover {
    transform: translateY(-1px);
    box-shadow: 4px 4px 0 var(--wjj-td-line);
}

.wjj_td-primary-btn:disabled,
.wjj_td-ghost-btn:disabled {
    cursor: not-allowed;
    opacity: 0.52;
    transform: none;
}

.wjj_td-arena {
    position: relative;
    overflow: hidden;
    width: 100%;
    aspect-ratio: 12 / 7;
    min-height: 430px;
    border: 4px solid var(--wjj-td-line);
    border-radius: 6px;
    background:
        linear-gradient(90deg, rgba(23, 32, 51, 0.12) 2px, transparent 2px),
        linear-gradient(0deg, rgba(23, 32, 51, 0.12) 2px, transparent 2px),
        linear-gradient(135deg, #83d45e, #4fb46f 54%, #91dc67);
    background-size: calc(100% / 12) calc(100% / 7), calc(100% / 12) calc(100% / 7), auto;
}

.wjj_td-grid,
.wjj_td-layer,
.wjj_td-mask {
    position: absolute;
    inset: 0;
}

.wjj_td-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    grid-template-rows: repeat(7, 1fr);
    z-index: 1;
}

.wjj_td-cell {
    position: relative;
    min-width: 0;
    min-height: 0;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: transparent;
    cursor: pointer;
}

.wjj_td-cell.is-path {
    cursor: default;
    background:
        linear-gradient(135deg, rgba(128, 95, 60, 0.9), rgba(181, 139, 86, 0.92)),
        repeating-linear-gradient(45deg, transparent 0, transparent 8px, rgba(255, 255, 255, 0.1) 8px, rgba(255, 255, 255, 0.1) 13px);
    box-shadow: inset 0 0 0 1px rgba(76, 47, 28, 0.16);
}

.wjj_td-cell.is-start::after,
.wjj_td-cell.is-end::after {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    min-width: 38px;
    padding: 4px 7px;
    border-radius: 999px;
    color: #fff;
    font-size: 12px;
    font-weight: 800;
    text-align: center;
}

.wjj_td-cell.is-start::after {
    content: "入口";
    background: rgba(179, 58, 51, 0.92);
}

.wjj_td-cell.is-end::after {
    content: "基地";
    background: rgba(46, 111, 159, 0.92);
}

.wjj_td-cell.can-build {
    background: rgba(255, 255, 255, 0.08);
}

.wjj_td-cell.can-build:hover {
    background: rgba(255, 255, 255, 0.28);
    box-shadow: inset 0 0 0 2px rgba(47, 123, 85, 0.5);
}

.wjj_td-cell.is-selected-tower {
    box-shadow: inset 0 0 0 3px rgba(247, 241, 213, 0.95), inset 0 0 0 6px rgba(46, 111, 159, 0.82);
}

.wjj_td-tower {
    position: absolute;
    left: 50%;
    top: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: min(46px, 70%);
    height: min(46px, 70%);
    transform: translate(-50%, -50%);
    border: 2px solid rgba(255, 255, 255, 0.82);
    border-radius: 50%;
    color: #fff;
    font-size: 16px;
    font-weight: 900;
    box-shadow: 0 8px 18px rgba(21, 28, 23, 0.22);
}

.wjj_td-tower.is-arrow {
    background: var(--wjj-td-green);
}

.wjj_td-tower.is-cannon {
    background: var(--wjj-td-amber);
}

.wjj_td-tower.is-frost {
    background: var(--wjj-td-blue);
}

.wjj_td-layer {
    z-index: 3;
    pointer-events: none;
}

.wjj_td-enemy {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    transform: translate(-50%, -50%);
    border: 3px solid var(--wjj-td-line);
    border-radius: 6px;
    background: #ff735d;
    box-shadow: 3px 3px 0 rgba(23, 32, 51, 0.65);
    color: #fff;
    font-size: 12px;
    font-weight: 900;
}

.wjj_td-enemy::before {
    content: "";
    position: absolute;
    left: 6px;
    top: 7px;
    width: 5px;
    height: 5px;
    background: #fff;
    box-shadow: 14px 0 0 #fff;
}

.wjj_td-enemy b {
    position: relative;
    z-index: 1;
    margin-top: 10px;
    text-shadow: 1px 1px 0 #172033;
}

.wjj_td-enemy.is-normal {
    background: #ff735d;
}

.wjj_td-enemy.is-swift {
    width: 28px;
    height: 28px;
    border-radius: 4px;
    clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
    background: #43c6ff;
}

.wjj_td-enemy.is-armored {
    width: 38px;
    height: 34px;
    border-radius: 8px 8px 14px 14px;
    background: linear-gradient(180deg, #b7a4ff 0 42%, #6653c9 42% 100%);
}

.wjj_td-enemy.is-boss {
    width: 52px;
    height: 50px;
    border-width: 4px;
    border-radius: 10px;
    background: linear-gradient(180deg, #ff6aa2 0 35%, #db3c77 35% 100%);
    font-size: 14px;
    box-shadow: 5px 5px 0 rgba(23, 32, 51, 0.72);
}

.wjj_td-enemy.is-boss::after {
    content: "";
    position: absolute;
    left: 8px;
    right: 8px;
    top: -12px;
    height: 12px;
    background:
        linear-gradient(135deg, transparent 0 35%, #ffd84b 35% 65%, transparent 65%),
        linear-gradient(45deg, transparent 0 35%, #ffd84b 35% 65%, transparent 65%);
    background-size: 16px 12px;
    background-repeat: repeat-x;
}


.wjj_td-enemy.is-slowed {
    filter: hue-rotate(145deg) saturate(1.25);
}

.wjj_td-enemy span {
    position: absolute;
    left: -2px;
    right: auto;
    bottom: -10px;
    height: 5px;
    border: 1px solid var(--wjj-td-line);
    border-radius: 2px;
    background: #69f075;
    box-shadow: none;
}

.wjj_td-shot {
    position: absolute;
    display: block;
    height: 3px;
    transform-origin: left center;
    border-radius: 999px;
    background: #f7f1d1;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.7);
}

.wjj_td-shot.is-cannon {
    height: 5px;
    background: #ffb13c;
}

.wjj_td-shot.is-frost {
    background: #9edbff;
}

.wjj_td-mask {
    z-index: 4;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(31, 42, 36, 0.28);
    pointer-events: none;
}

.wjj_td-mask.is-hidden {
    display: none;
}

.wjj_td-mask > div {
    max-width: 360px;
    padding: 18px 20px;
    border-radius: 8px;
    background: rgba(255, 253, 246, 0.94);
    box-shadow: 0 16px 34px rgba(31, 42, 36, 0.2);
    text-align: center;
}

.wjj_td-mask strong,
.wjj_td-mask span {
    display: block;
}

.wjj_td-mask strong {
    font-size: 22px;
}

.wjj_td-mask span {
    margin-top: 8px;
    color: var(--wjj-td-muted);
    line-height: 1.65;
}

.wjj_td-panel {
    display: grid;
    gap: 14px;
}

.wjj_td-card {
    padding: 16px;
}

.wjj_td-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}

.wjj_td-card-head h2 {
    margin: 0;
    font-size: 18px;
}

.wjj_td-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    background: rgba(47, 123, 85, 0.12);
    color: var(--wjj-td-green);
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

.wjj_td-chip.is-soft {
    background: rgba(182, 121, 36, 0.12);
    color: var(--wjj-td-amber);
}

.wjj_td-chip.is-danger {
    background: rgba(179, 58, 51, 0.12);
    color: var(--wjj-td-red);
}

.wjj_td-chip.is-win {
    background: rgba(47, 123, 85, 0.12);
    color: var(--wjj-td-green);
}

.wjj_td-tower-list {
    display: grid;
    gap: 9px;
}

.wjj_td-tower-btn {
    width: 100%;
    min-height: 64px;
    padding: 10px 12px;
    border: 3px solid var(--wjj-td-line);
    border-radius: 5px;
    background: #fff;
    color: var(--wjj-td-ink);
    cursor: pointer;
    box-shadow: 3px 3px 0 rgba(23, 32, 51, 0.72);
    text-align: left;
    transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.wjj_td-tower-btn strong,
.wjj_td-tower-btn span {
    display: block;
}

.wjj_td-tower-btn strong {
    font-size: 15px;
}

.wjj_td-tower-btn span {
    margin-top: 4px;
    color: var(--wjj-td-muted);
    font-size: 13px;
}

.wjj_td-tower-btn.is-active {
    border-color: var(--wjj-td-line);
    background: #c9ff9d;
}

.wjj_td-sell-box {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    margin-top: 12px;
    padding: 10px;
    border: 3px solid var(--wjj-td-line);
    border-radius: 5px;
    background: rgba(46, 111, 159, 0.08);
}

.wjj_td-sell-box span {
    color: var(--wjj-td-muted);
    font-size: 13px;
    line-height: 1.45;
}

.wjj_td-enemy-legend {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: 12px;
}

.wjj_td-enemy-legend span {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 34px;
    color: var(--wjj-td-ink);
    font-size: 13px;
    font-weight: 800;
}

.wjj_td-enemy-legend i {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: 3px solid var(--wjj-td-line);
    border-radius: 5px;
    color: #fff;
    font-style: normal;
    text-shadow: 1px 1px 0 var(--wjj-td-line);
    box-shadow: 2px 2px 0 rgba(23, 32, 51, 0.6);
}

.wjj_td-enemy-legend .is-normal { background: #ff735d; }
.wjj_td-enemy-legend .is-swift { background: #43c6ff; }
.wjj_td-enemy-legend .is-armored { background: #8a75ff; }
.wjj_td-enemy-legend .is-boss { background: #db3c77; }

.wjj_td-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
}

.wjj_td-stats div {
    min-height: 64px;
    padding: 11px;
    border: 3px solid var(--wjj-td-line);
    border-radius: 5px;
    background: var(--wjj-td-panel-2);
    box-shadow: 3px 3px 0 rgba(23, 32, 51, 0.55);
}

.wjj_td-stats span,
.wjj_td-stats strong {
    display: block;
}

.wjj_td-stats span {
    color: var(--wjj-td-muted);
    font-size: 12px;
}

.wjj_td-stats strong {
    margin-top: 5px;
    font-size: 20px;
}

.wjj_td-message {
    margin-top: 12px;
    padding: 12px;
    border: 3px solid var(--wjj-td-line);
    border-left-width: 8px;
    border-radius: 5px;
    background: #dfffbf;
    color: #415044;
    font-size: 13px;
    line-height: 1.65;
}

.wjj_td-record-list {
    display: grid;
    gap: 9px;
}

.wjj_td-record {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    padding: 10px;
    border: 3px solid var(--wjj-td-line);
    border-radius: 5px;
    background: #fff;
}

.wjj_td-record strong,
.wjj_td-record span {
    display: block;
}

.wjj_td-record strong {
    font-size: 14px;
}

.wjj_td-record span {
    margin-top: 3px;
    color: var(--wjj-td-muted);
    font-size: 12px;
    line-height: 1.45;
}

.wjj_td-empty {
    padding: 16px;
    border: 1px dashed rgba(51, 67, 55, 0.24);
    border-radius: 8px;
    color: var(--wjj-td-muted);
    text-align: center;
}

@media (max-width: 1180px) {
    .wjj_td-shell {
        grid-template-columns: 1fr;
    }

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

@media (max-width: 860px) {
    .wjj_td-page {
        padding: 14px 10px 28px;
    }

    .wjj_td-header {
        align-items: stretch;
        flex-direction: column;
        padding: 18px;
    }

    .wjj_td-user {
        min-width: 0;
    }

    .wjj_td-header h1 {
        font-size: 30px;
    }

    .wjj_td-board-section {
        padding: 12px;
    }

    .wjj_td-arena {
        min-height: 320px;
    }

    .wjj_td-panel {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 560px) {
    .wjj_td-topbar {
        align-items: stretch;
        flex-direction: column;
    }

    .wjj_td-topbar label,
    .wjj_td-topbar select,
    .wjj_td-primary-btn,
    .wjj_td-ghost-btn {
        width: 100%;
    }

    .wjj_td-arena {
        min-height: 250px;
    }

    .wjj_td-stats {
        grid-template-columns: 1fr;
    }

    .wjj_td-record {
        grid-template-columns: 1fr;
    }

    .wjj_td-sell-box {
        grid-template-columns: 1fr;
    }
}
