:root {
    --bg-dark: #07090f;
    --primary-cyan: #00f0ff;
    --primary-pink: #ff003c;
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.08);
    --text-main: #e2e8f0;
}

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

body {
    font-family: 'Inter', 'Outfit', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    overflow-y: auto;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px 0;
}

#star-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: radial-gradient(ellipse at bottom, #1b2735 0%, #090a0f 100%);
}

.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 40px;
    width: 90%;
    max-width: 1000px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    animation: fadeIn 0.5s ease-out;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 20px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-shrink: 0;
}

.avatar {
    width: 64px;
    height: 64px;
    flex-shrink: 0;
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.resources {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-left: auto;
    justify-content: flex-end;
}

.resources button,
.resources .resource {
    white-space: nowrap;
    flex-shrink: 0;
}

.avatar:hover {
    transform: scale(1.05);
}

.avatar.avatar-cyan-pink {
    background: linear-gradient(135deg, var(--primary-cyan), var(--primary-pink));
    box-shadow: 0 0 15px rgba(0, 240, 255, 0.5);
}

.avatar.avatar-orange-red {
    background: linear-gradient(135deg, #ff8c00, #ff003c);
    box-shadow: 0 0 15px rgba(255, 0, 60, 0.5);
}

.avatar.avatar-green-blue {
    background: linear-gradient(135deg, #00ff66, #00f0ff);
    box-shadow: 0 0 15px rgba(0, 255, 102, 0.5);
}

.avatar.avatar-purple-indigo {
    background: linear-gradient(135deg, #8a2be2, #4169e1);
    box-shadow: 0 0 15px rgba(138, 43, 226, 0.5);
}

.avatar.avatar-gold-yellow {
    background: linear-gradient(135deg, #ffd700, #ffa500);
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.5);
}

/* 2026 賽季冠軍尊爵動態頭像框 (2026 Sovereign Champion Frame) */
.avatar.avatar-frame-2026-gold {
    position: relative;
    border: 3px solid #ffd700 !important;
    box-shadow: 0 0 20px #ffd700, 0 0 35px #ff007f, inset 0 0 10px #ffd700 !important;
    animation: goldFramePulse 2s infinite ease-in-out;
}

.avatar.avatar-frame-2026-gold::after {
    content: "";
    position: absolute;
    top: -12px;
    right: -12px;
    width: 28px;
    height: 28px;
    background-image: url('../img/badge_2026_champion.png');
    background-size: contain;
    background-repeat: no-repeat;
    animation: bounce 1.5s infinite ease-in-out;
}

/* 2026 賽季亞軍銀月頭像框 */
.avatar.badge-2026-silver {
    position: relative;
    border: 3px solid #c0c0c0 !important;
    box-shadow: 0 0 15px #e0e0e0, 0 0 25px #00f0ff !important;
}

/* 2026 賽季季軍銅輝頭像框 */
.avatar.badge-2026-bronze {
    position: relative;
    border: 3px solid #cd7f32 !important;
    box-shadow: 0 0 15px #cd7f32, 0 0 25px #ff8c00 !important;
}

/* 2026 賽季百強領主頭像框 */
.avatar.badge-2026-top100 {
    position: relative;
    border: 2px dashed #00f3ff !important;
    box-shadow: 0 0 10px #00f3ff !important;
}

@keyframes goldFramePulse {

    0%,
    100% {
        box-shadow: 0 0 15px #ffd700, 0 0 30px #ff007f;
    }

    50% {
        box-shadow: 0 0 30px #ffd700, 0 0 50px #ffea00;
    }
}

/* 大頭照預設面板樣式 */
.avatar-preset {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid transparent;
    transition: transform 0.2s;
}

.avatar-preset:hover {
    transform: scale(1.1);
}

.avatar-preset.avatar-cyan-pink {
    background: linear-gradient(135deg, var(--primary-cyan), var(--primary-pink));
}

.avatar-preset.avatar-orange-red {
    background: linear-gradient(135deg, #ff8c00, #ff003c);
}

.avatar-preset.avatar-green-blue {
    background: linear-gradient(135deg, #00ff66, #00f0ff);
}

.avatar-preset.avatar-purple-indigo {
    background: linear-gradient(135deg, #8a2be2, #4169e1);
}

.avatar-preset.avatar-gold-yellow {
    background: linear-gradient(135deg, #ffd700, #ffa500);
}

.avatar-preset.active {
    border-color: var(--primary-cyan);
    box-shadow: 0 0 12px var(--primary-cyan);
}

h1 {
    font-family: 'Outfit', sans-serif;
    font-weight: 900;
    font-size: 1.5rem;
    margin-bottom: 5px;
}

.badge {
    background: rgba(255, 215, 0, 0.2);
    color: #ffd700;
    padding: 4px 8px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    border: 1px solid rgba(255, 215, 0, 0.5);
}

.mmr {
    margin-left: 10px;
    font-size: 0.9rem;
    color: #94a3b8;
}

button {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    border: none;
    border-radius: 12px;
    padding: 16px 32px;
    cursor: pointer;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    text-transform: uppercase;
}

.btn-primary {
    background: linear-gradient(45deg, var(--primary-cyan), #0066ff);
    color: white;
    box-shadow: 0 0 20px rgba(0, 240, 255, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 30px rgba(0, 240, 255, 0.5);
}

.btn-danger {
    background: linear-gradient(45deg, var(--primary-pink), #990000);
    color: white;
    box-shadow: 0 0 15px rgba(255, 0, 60, 0.4);
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: bold;
}

.btn-danger:hover {
    transform: scale(1.05);
}

.btn-text {
    background: transparent;
    border: none;
    color: var(--text-main);
    font-size: 1rem;
    padding: 10px;
}

.btn-text:hover {
    color: var(--primary-cyan);
}

.btn-text.warning:hover {
    color: var(--primary-pink);
    text-shadow: 0 0 10px var(--primary-pink);
}

.mt-20 {
    margin-top: 20px;
}

.text-center {
    text-align: center;
}

/* SLG Map - 20x20 Grid System */
.map-container {
    position: relative;
    width: 100%;
    height: 450px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 20px;
    box-shadow: inset 0 0 50px rgba(0, 0, 0, 0.8);
}

.sector-info {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    background: rgba(0, 240, 255, 0.1);
    color: var(--primary-cyan);
    padding: 10px 20px;
    font-size: 0.9rem;
    font-weight: bold;
    border-bottom: 1px solid var(--glass-border);
    z-index: 10;
    backdrop-filter: blur(5px);
    pointer-events: none;
}

.map-controls {
    position: absolute;
    top: 50px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 20;
}

.btn-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid var(--primary-cyan);
    color: var(--primary-cyan);
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    transition: 0.2s;
    backdrop-filter: blur(5px);
    padding: 0;
}

.btn-icon:hover {
    background: var(--primary-cyan);
    color: black;
}

.world-map-viewport {
    width: 100%;
    height: 100%;
    overflow: hidden;
    cursor: grab;
}

.world-map-viewport:active {
    cursor: grabbing;
}

/* Fixed 2400x2400px map for 40x40 60px grid */
.world-map-inner {
    position: relative;
    width: 2400px;
    height: 2400px;
    background-color: rgba(0, 20, 40, 0.5);
    background-image: linear-gradient(rgba(0, 240, 255, 0.2) 1px, transparent 1px), linear-gradient(90deg, rgba(0, 240, 255, 0.2) 1px, transparent 1px);
    background-size: 60px 60px;
    transform-origin: 0 0;
    border: 1px solid rgba(0, 240, 255, 0.5);
}

.map-node {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: filter 0.2s;
    transform: translate(-50%, -50%);
}

.map-node:hover {
    z-index: 5;
    filter: brightness(1.3);
}

.map-tower {
    width: 35px;
    height: 55px;
    transition: all 0.3s ease;
    background-size: 100% 100%;
    background-repeat: no-repeat;
    background-position: center bottom;
    filter: drop-shadow(0 0 4px rgba(0, 0, 0, 0.6));
}

.map-tower.skin-cyber {
    background-image: url('../img/map_tower_cyber.png');
}

.map-tower.skin-stone {
    background-image: url('../img/map_tower_stone.png');
}

.map-tower.skin-crystal {
    background-image: url('../img/map_tower_crystal.png');
}

.map-tower.skin-cute {
    background-image: url('../img/map_tower_cute.png');
}

/* 塔高度多階梯視覺進化特效 (Stage Visual Evolution - 修仙高難度門檻) */
.tower-stage-2 {
    filter: drop-shadow(0 0 12px rgba(0, 240, 255, 0.7)) !important;
}

.tower-stage-3 {
    filter: drop-shadow(0 0 18px #ffd700) !important;
}

.tower-stage-3::before {
    content: "🔮";
    position: absolute;
    top: -18px;
    font-size: 1.1rem;
    animation: bounce 1.2s infinite ease-in-out;
}

.tower-stage-4 {
    filter: drop-shadow(0 0 25px #ff0055) brightness(1.2) !important;
}

.tower-stage-4::before {
    content: "👑";
    position: absolute;
    top: -24px;
    font-size: 1.4rem;
    animation: popIn 0.8s infinite alternate;
}

.tower-stage-5 {
    filter: drop-shadow(0 0 35px #ffd700) brightness(1.4) !important;
    animation: divineGlow 1.5s infinite ease-in-out;
}

.tower-stage-5::before {
    content: "⚡";
    position: absolute;
    top: -30px;
    font-size: 1.8rem;
    animation: bounce 0.6s infinite alternate;
}

@keyframes divineGlow {

    0%,
    100% {
        filter: drop-shadow(0 0 25px #ffd700) brightness(1.3);
    }

    50% {
        filter: drop-shadow(0 0 45px #ff007f) brightness(1.6);
    }
}

.map-node.player .map-tower {
    filter: drop-shadow(0 0 10px #00ff66) !important;
}

.map-node.nemesis .map-tower {
    filter: drop-shadow(0 0 10px var(--primary-pink)) !important;
}

.nemesis-mark {
    position: absolute;
    top: -30px;
    color: var(--primary-pink);
    font-size: 1.5rem;
    animation: bounce 1s infinite;
    text-shadow: 0 0 10px rgba(255, 0, 60, 0.8);
}

/* 微型輕量高質感膠囊地圖標籤 (Compact Glass Pill Label) */
.map-label {
    font-size: 0.72rem;
    margin-top: 2px;
    background: rgba(10, 15, 25, 0.65);
    backdrop-filter: blur(6px);
    color: #e2e8f0;
    padding: 2px 8px;
    border-radius: 12px;
    white-space: nowrap;
    border: 1px solid rgba(0, 240, 255, 0.25);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
    pointer-events: none;
    transition: all 0.2s ease;
    z-index: 2;
    transform: scale(0.92);
}

.map-node:hover .map-label {
    background: rgba(0, 240, 255, 0.2);
    border-color: var(--primary-cyan);
    color: #fff;
    box-shadow: 0 0 15px rgba(0, 240, 255, 0.5);
    transform: scale(1.05);
    z-index: 99;
}

.target-panel {
    position: absolute;
    bottom: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.85);
    border: 1px solid var(--primary-cyan);
    padding: 20px;
    border-radius: 12px;
    backdrop-filter: blur(5px);
    box-shadow: 0 0 20px rgba(0, 240, 255, 0.2);
    z-index: 10;
    animation: fadeIn 0.3s;
}

.bonus-text {
    color: var(--primary-pink);
    font-weight: bold;
    text-shadow: 0 0 10px rgba(255, 0, 60, 0.5);
}

/* Builder */
.tower-builder-layout {
    display: flex;
    gap: 30px;
}

.tower-status {
    flex: 1;
}

.build-action {
    flex: 1.5;
    background: rgba(0, 0, 0, 0.4);
    padding: 30px;
    border-radius: 16px;
    border: 1px solid var(--glass-border);
}

.tower-preview {
    display: flex;
    flex-direction: column-reverse;
    align-items: center;
    justify-content: flex-start;
    padding: 15px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--glass-border);
    width: 180px;
    margin: 20px auto 0 auto;
    transition: height 0.3s ease;
    box-sizing: border-box;
}

.tower-brick {
    background: rgba(0, 240, 255, 0.1);
    border: 1px solid var(--primary-cyan);
    width: 100%;
    border-radius: 4px;
    color: var(--primary-cyan);
    font-weight: bold;
    letter-spacing: 1px;
    text-align: center;
    box-shadow: 0 0 10px rgba(0, 240, 255, 0.2);
    animation: dropIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-sizing: border-box;
}

.tower-brick.gold {
    background: linear-gradient(45deg, #ffd700, #ff8c00);
    border-color: #ffd700;
    color: #fff;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.8);
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    font-weight: 900;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    backdrop-filter: blur(5px);
}

.modal-content {
    width: 90%;
    max-width: 500px;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
    padding: 30px 25px;
    border-color: var(--primary-cyan);
    box-shadow: 0 0 50px rgba(0, 240, 255, 0.2);
}

.glitch-text {
    font-size: 3.5rem;
    font-weight: 900;
    color: var(--primary-cyan);
    text-shadow: 3px 3px 0px var(--primary-pink), -3px -3px 0px blue;
    margin-bottom: 10px;
    animation: glitch 1.5s infinite;
}

.mmr-change {
    font-size: 2.5rem;
    font-weight: bold;
    color: #00ff66;
    margin: 20px 0;
    text-shadow: 0 0 15px rgba(0, 255, 102, 0.5);
}

.mmr-change.negative {
    color: var(--primary-pink);
    text-shadow: 0 0 15px rgba(255, 0, 60, 0.5);
}

.hidden {
    display: none !important;
}

#battle-scene {
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 40px;
    background: radial-gradient(circle at 50% 30%, rgba(255, 0, 60, 0.1) 0%, transparent 50%);
}

.battle-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.hp-bars {
    display: flex;
    gap: 30px;
    font-size: 1.2rem;
    font-weight: bold;
}

#enemy-shield {
    color: var(--primary-pink);
}

#player-shield {
    color: var(--primary-cyan);
}

.tower-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.tower {
    display: flex;
    flex-direction: column-reverse;
    align-items: center;
    justify-content: flex-start;
    width: 180px;
    max-height: 440px;
    overflow-y: auto;
    scroll-behavior: smooth;
    transition: all 0.3s ease;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--glass-border);
    padding: 15px;
    border-radius: 12px;
    box-sizing: border-box;
}

.tower-status {
    position: relative;
    max-height: 500px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.tower-preview {
    max-height: 420px;
    overflow-y: auto;
    scroll-behavior: smooth;
    padding: 10px;
    box-sizing: border-box;
}

/* 霓虹特效滾動條 */
.tower-preview::-webkit-scrollbar,
.tower::-webkit-scrollbar {
    width: 6px;
}

.tower-preview::-webkit-scrollbar-track,
.tower::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 3px;
}

.tower-preview::-webkit-scrollbar-thumb,
.tower::-webkit-scrollbar-thumb {
    background: var(--primary-cyan);
    border-radius: 3px;
    box-shadow: 0 0 10px var(--primary-cyan);
}

/* 折疊層磚塊樣式 (Accordion Fold Brick) */
.tower-brick-fold {
    background: linear-gradient(45deg, rgba(138, 43, 226, 0.4), rgba(0, 240, 255, 0.4));
    border: 1px dashed var(--primary-cyan);
    color: #ffffff;
    font-size: 0.85rem;
    font-weight: bold;
    padding: 8px 12px;
    margin: 6px 0;
    border-radius: 8px;
    cursor: pointer;
    text-align: center;
    box-shadow: 0 0 12px rgba(0, 240, 255, 0.3);
    transition: all 0.25s ease;
    user-select: none;
}

.tower-brick-fold:hover {
    background: linear-gradient(45deg, rgba(138, 43, 226, 0.7), rgba(0, 240, 255, 0.7));
    transform: scale(1.02);
    box-shadow: 0 0 20px rgba(0, 240, 255, 0.6);
}

.tower.hit {
    animation: shake 0.4s;
    filter: brightness(1.5);
}

.combat-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
}

.question-box {
    background: rgba(0, 0, 0, 0.6);
    padding: 20px 40px;
    border-radius: 16px;
    border: 1px solid var(--primary-cyan);
    font-size: 1.5rem;
    font-weight: bold;
    box-shadow: 0 0 20px rgba(0, 240, 255, 0.2);
}

.input-area {
    display: flex;
    gap: 10px;
    width: 100%;
    max-width: 600px;
}

input[type="text"] {
    flex: 1;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 15px 20px;
    color: white;
    font-size: 1.2rem;
    outline: none;
    transition: 0.3s;
}

input[type="text"]:focus {
    border-color: var(--primary-cyan);
    box-shadow: 0 0 15px rgba(0, 240, 255, 0.2);
}

.btn-fire {
    background: var(--primary-pink);
    color: white;
    box-shadow: 0 0 20px rgba(255, 0, 60, 0.4);
}

.laser {
    position: absolute;
    width: 4px;
    height: 100px;
    background: var(--primary-cyan);
    box-shadow: 0 0 10px var(--primary-cyan), 0 0 20px white;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    animation: shoot 0.3s linear forwards;
}

.status-msg {
    margin-top: 15px;
    padding: 10px;
    background: rgba(0, 255, 102, 0.1);
    border: 1px solid #00ff66;
    color: #00ff66;
    border-radius: 8px;
    font-weight: bold;
    text-align: center;
}

.status-msg.negative {
    background: rgba(255, 0, 60, 0.2);
    border-color: #ff4d6d;
    color: #ffffff;
    text-shadow: 0 0 5px rgba(255, 77, 109, 0.8);
}

.revealed-answer {
    color: #ffd700;
    font-size: 1.4rem;
    font-weight: 900;
    display: inline-block;
    margin: 0 10px;
    text-shadow: 0 0 15px rgba(255, 215, 0, 0.8);
    letter-spacing: 2px;
    font-family: 'Outfit', sans-serif;
}

.combo-text {
    color: #ff8c00;
    font-size: 1.5rem;
    font-weight: 900;
    text-shadow: 0 0 10px #ffd700;
    margin-top: 10px;
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    text-align: center;
}

@keyframes dropIn {
    from {
        transform: translateY(-30px) scale(1.1);
        opacity: 0;
    }

    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

@keyframes glitch {
    0% {
        transform: translate(0)
    }

    20% {
        transform: translate(-2px, 2px)
    }

    40% {
        transform: translate(-2px, -2px)
    }

    60% {
        transform: translate(2px, 2px)
    }

    80% {
        transform: translate(2px, -2px)
    }

    100% {
        transform: translate(0)
    }
}

@keyframes shoot {
    0% {
        bottom: 0;
        opacity: 1;
        height: 50px;
    }

    100% {
        bottom: 100%;
        opacity: 0;
        height: 150px;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25%,
    75% {
        transform: translateX(-10px);
    }

    50% {
        transform: translateX(10px);
    }
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-8px);
    }
}

@keyframes popIn {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* --- 三大風格專屬攻擊特效與打擊動畫 --- */

/* 1. 科技霓虹：脈衝雷射光束 (Cyber Neon Attack) */
.attack-effect.skin-cyber {
    position: absolute;
    width: 6px;
    height: 120px;
    background: linear-gradient(to top, var(--primary-cyan), #ffffff, var(--primary-pink));
    box-shadow: 0 0 15px var(--primary-cyan), 0 0 30px var(--primary-pink);
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    animation: cyberShoot 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
    border-radius: 3px;
    z-index: 50;
}

@keyframes cyberShoot {
    0% {
        bottom: 0;
        opacity: 1;
        height: 40px;
        filter: drop-shadow(0 0 5px var(--primary-cyan));
    }

    100% {
        bottom: 85%;
        opacity: 0;
        height: 180px;
        filter: drop-shadow(0 0 25px var(--primary-pink));
    }
}

/* 2. 中古石堡：投石巨木火焰隕石 (Ancient Stone Catapult Boulder) */
.attack-effect.skin-stone {
    position: absolute;
    width: 32px;
    height: 32px;
    background: radial-gradient(circle, #ffea00 10%, #ff4500 50%, #333 90%);
    border-radius: 50%;
    box-shadow: 0 0 20px #ff4500, 0 0 40px #ffaa00;
    bottom: 0;
    left: 45%;
    animation: stoneCatapult 0.45s ease-in forwards;
    z-index: 50;
}

@keyframes stoneCatapult {
    0% {
        bottom: 0;
        left: 20%;
        transform: scale(0.6) rotate(0deg);
        opacity: 1;
    }

    50% {
        bottom: 50%;
        left: 55%;
        transform: scale(1.3) rotate(180deg);
    }

    100% {
        bottom: 85%;
        left: 50%;
        transform: scale(1.6) rotate(360deg);
        opacity: 0.2;
    }
}

/* 3. 水晶能量：奧術紫光極光波 (Crystal Arcane Blast) */
.attack-effect.skin-crystal {
    position: absolute;
    width: 24px;
    height: 80px;
    background: linear-gradient(0deg, #ba55d3, #da70d6, #ffffff);
    box-shadow: 0 0 25px #da70d6, 0 0 50px #8a2be2;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 12px;
    animation: crystalNova 0.4s ease-out forwards;
    z-index: 50;
}

@keyframes crystalNova {
    0% {
        bottom: 0;
        opacity: 1;
        width: 10px;
        height: 40px;
        transform: translateX(-50%) scale(1);
    }

    60% {
        width: 50px;
        height: 100px;
        opacity: 0.9;
    }

    100% {
        bottom: 85%;
        opacity: 0;
        width: 80px;
        height: 140px;
        transform: translateX(-50%) scale(1.5);
    }
}

/* 專屬打擊爆破特效 */
.tower.hit-cyber {
    animation: cyberShake 0.4s ease-in-out;
    filter: brightness(2) drop-shadow(0 0 20px var(--primary-cyan));
}

.tower.hit-stone {
    animation: earthQuake 0.5s ease-in-out;
    filter: brightness(1.6) sepia(0.8) hue-rotate(-30deg);
}

.tower.hit-crystal {
    animation: crystalFlash 0.4s ease-in-out;
    filter: brightness(2.2) drop-shadow(0 0 25px #da70d6);
}

@keyframes cyberShake {

    0%,
    100% {
        transform: translateX(0);
    }

    20% {
        transform: translate(-12px, 6px);
    }

    60% {
        transform: translate(12px, -6px);
    }
}

@keyframes earthQuake {

    0%,
    100% {
        transform: translate(0, 0);
    }

    20% {
        transform: translate(-8px, 10px);
    }

    40% {
        transform: translate(8px, -10px);
    }

    60% {
        transform: translate(-5px, 5px);
    }
}

@keyframes crystalFlash {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.08);
    }
}

/* --- 塔基與三大 Skins 外貌 --- */
.tower-base {
    width: 100%;
    height: 12px;
    margin-top: 5px;
    border-radius: 4px;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

/* 1. 科技霓虹 (Cyber Neon) */
.skin-cyber {
    border-color: rgba(0, 240, 255, 0.4) !important;
    box-shadow: 0 0 25px rgba(0, 240, 255, 0.15) !important;
}

.skin-cyber .tower-base {
    background: linear-gradient(90deg, #111, var(--primary-cyan), #111);
    box-shadow: 0 0 15px var(--primary-cyan);
    border: 1px solid var(--primary-cyan);
}

.skin-cyber .tower-brick {
    background: rgba(0, 240, 255, 0.08);
    border: 1px solid var(--primary-cyan);
    color: var(--primary-cyan);
    box-shadow: 0 0 8px rgba(0, 240, 255, 0.3);
}

.skin-cyber .tower-brick.gold {
    background: linear-gradient(45deg, #ffd700, #ff8c00);
    border-color: #ffd700;
    color: white;
    box-shadow: 0 0 15px #ffd700;
}

.tower-brick.trap {
    background: linear-gradient(45deg, #ff003c, #800020) !important;
    border-color: #ff0055 !important;
    color: #ffffff !important;
    box-shadow: 0 0 15px #ff003c, inset 0 0 8px #ff0055 !important;
    animation: trapPulse 1.5s infinite ease-in-out;
}

@keyframes trapPulse {

    0%,
    100% {
        box-shadow: 0 0 10px #ff003c;
    }

    50% {
        box-shadow: 0 0 25px #ff0055, 0 0 35px #ff003c;
    }
}

/* 2. 中古石堡 (Ancient Stone) */
.skin-stone {
    border-color: #8b5a2b !important;
    box-shadow: 0 0 25px rgba(139, 90, 43, 0.15) !important;
}

.skin-stone .tower-base {
    background: linear-gradient(90deg, #424242, #757575, #424242);
    border: 1px solid #616161;
    border-radius: 2px;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.5);
}

.skin-stone .tower-brick {
    background: linear-gradient(to bottom, #5d5d5d, #424242);
    border: 1.5px solid #8d8d8d;
    color: #e0e0e0;
    border-radius: 2px;
    box-shadow: inset 0 2px 2px rgba(255, 255, 255, 0.1), 0 2px 4px rgba(0, 0, 0, 0.4);
}

.skin-stone .tower-brick.gold {
    background: linear-gradient(135deg, #b8860b, #daa520);
    border-color: #ffd700;
    color: #fff;
    box-shadow: inset 0 2px 2px rgba(255, 255, 255, 0.3), 0 3px 8px rgba(0, 0, 0, 0.5);
}

/* 3. 水晶能量 (Crystal Spire) */
.skin-crystal {
    border-color: rgba(186, 85, 211, 0.4) !important;
    box-shadow: 0 0 25px rgba(186, 85, 211, 0.15) !important;
}

.skin-crystal .tower-base {
    background: linear-gradient(90deg, #1d003b, #8a2be2, #1d003b);
    box-shadow: 0 0 20px #8a2be2;
    border: 1px solid #ba55d3;
}

.skin-crystal .tower-brick {
    background: rgba(186, 85, 211, 0.15);
    border: 1px solid #da70d6;
    color: #e6a8d7;
    backdrop-filter: blur(4px);
    box-shadow: 0 0 10px rgba(218, 112, 214, 0.4);
    border-radius: 6px;
}

.skin-crystal .tower-brick.gold {
    background: linear-gradient(45deg, #da70d6, #ff007f);
    border-color: #ff007f;
    color: white;
    box-shadow: 0 0 20px rgba(255, 0, 127, 0.7);
}

/* 4. 夢幻櫻花/可愛粉彩 (Pastel Kawaii) */
.skin-cute {
    border-color: rgba(255, 182, 193, 0.6) !important;
    box-shadow: 0 0 25px rgba(255, 182, 193, 0.3) !important;
}

.skin-cute .tower-base {
    background: linear-gradient(90deg, #ff9a9e, #fecfef, #a1c4fd);
    box-shadow: 0 0 15px #ff9a9e;
    border: 1px solid #ffb6c1;
}

.skin-cute .tower-brick {
    background: rgba(255, 182, 193, 0.2);
    border: 1px solid #ffb6c1;
    color: #ff3377;
    backdrop-filter: blur(4px);
    box-shadow: 0 0 8px rgba(255, 182, 193, 0.5);
    border-radius: 8px;
}

.skin-cute .tower-brick.gold {
    background: linear-gradient(45deg, #ff9a9e, #fecfef);
    border-color: #ff69b4;
    color: #8b0046;
    box-shadow: 0 0 18px #ff69b4;
}

/* 可愛版專屬攻擊特效 (Candy Star Blast) */
.attack-effect.skin-cute {
    position: absolute;
    width: 28px;
    height: 28px;
    background: radial-gradient(circle, #ffffff 20%, #ff69b4 60%, #ff1493 90%);
    border-radius: 50%;
    box-shadow: 0 0 20px #ff69b4, 0 0 35px #ff1493;
    bottom: 0;
    left: 46%;
    animation: cuteStarShoot 0.4s ease-out forwards;
    z-index: 50;
}

@keyframes cuteStarShoot {
    0% {
        bottom: 0;
        opacity: 1;
        transform: scale(0.5) rotate(0deg);
    }

    50% {
        opacity: 1;
        transform: scale(1.4) rotate(180deg);
    }

    100% {
        bottom: 85%;
        opacity: 0;
        transform: scale(1.8) rotate(360deg);
    }
}

.tower.hit-cute {
    animation: cutePop 0.4s ease-in-out;
    filter: brightness(1.8) drop-shadow(0 0 25px #ff69b4);
}

@keyframes cutePop {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.12) rotate(3deg);
    }
}

/* --- 廢墟前哨塔樣式 (冒煙廢墟感) --- */
.ruined-node {
    filter: grayscale(80%) brightness(0.6) contrast(0.9);
    opacity: 0.75;
    animation: ruinSmoke 2s infinite ease-in-out;
}

.ruined-node .map-tower {
    filter: drop-shadow(0 0 10px rgba(255, 68, 68, 0.4)) saturate(0.5) !important;
}

.ruined-node .map-label {
    color: var(--primary-pink) !important;
    text-shadow: 0 0 5px rgba(255, 68, 68, 0.8) !important;
}

@keyframes ruinSmoke {

    0%,
    100% {
        opacity: 0.7;
        transform: translate(0, 0);
    }

    50% {
        opacity: 0.85;
        transform: translate(1px, -2px);
    }
}

/* --- 手機版響應式設計 (max-width: 767px) --- */
@media (max-width: 767px) {
    body {
        padding: 10px 0;
    }

    .glass-panel {
        padding: 20px 15px;
        border-radius: 16px;
        width: 95%;
    }

    header {
        flex-direction: column;
        gap: 15px;
        align-items: center;
        text-align: center;
        padding-bottom: 15px;
    }

    .user-info {
        flex-direction: column;
        gap: 10px;
        align-items: center;
    }

    .badge {
        display: inline-block;
        margin-top: 5px;
    }

    /* 塔防擴建垂直堆疊 */
    .tower-builder-layout {
        flex-direction: column;
        gap: 20px;
    }

    .build-action {
        padding: 20px 15px;
        border-radius: 12px;
    }

    /* 戰略地圖按鈕與浮動面板調整 */
    .map-container {
        height: 380px;
    }

    .map-controls {
        top: 15px;
        right: 15px;
    }

    .target-panel {
        position: fixed;
        bottom: 15px;
        left: 15px;
        right: 15px;
        width: auto;
        padding: 15px;
        box-sizing: border-box;
    }

    .target-panel .mt-20 {
        flex-direction: column;
        gap: 10px;
    }

    .target-panel button {
        width: 100%;
    }

    /* 戰鬥畫面調整 */
    #battle-scene {
        padding: 15px;
        height: auto;
        min-height: 100vh;
        justify-content: flex-start;
        gap: 15px;
    }

    .battle-header {
        flex-direction: column;
        gap: 10px;
        align-items: center;
    }

    .hp-bars {
        font-size: 1rem;
        gap: 15px;
    }

    .tower-container {
        padding: 20px 0;
    }

    .question-box {
        padding: 15px;
        font-size: 1.25rem;
        width: 100%;
        text-align: center;
    }

    .input-area {
        flex-direction: column;
        gap: 10px;
        width: 100%;
    }

    input[type="text"] {
        padding: 12px;
        font-size: 1.1rem;
        text-align: center;
    }

    /* 字型與彈窗微調 */
    .glitch-text {
        font-size: 2.2rem;
    }
}

/* 收稅提醒紅點動畫 */
.tax-red-dot {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 10px;
    height: 10px;
    background-color: #ff0055;
    border-radius: 50%;
    box-shadow: 0 0 8px #ff0055;
    animation: taxDotPulse 1.2s infinite ease-in-out;
}

@keyframes taxDotPulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.3);
        opacity: 0.7;
    }
}

/* --- 平板版響應式設計 (768px 至 1024px) --- */
@media (min-width: 768px) and (max-width: 1024px) {
    .glass-panel {
        padding: 30px;
        width: 92%;
    }

    .tower-builder-layout {
        flex-direction: column;
        gap: 25px;
    }

    .target-panel {
        max-width: 320px;
    }
}

/* 關鍵 UI 微型幫助 ? 提示圖示樣式 */
.help-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: rgba(0, 240, 255, 0.15);
    border: 1px solid var(--primary-cyan);
    color: var(--primary-cyan);
    font-size: 0.75rem;
    font-weight: bold;
    cursor: pointer;
    margin-left: 6px;
    position: relative;
    user-select: none;
    transition: all 0.2s ease;
}

.help-icon:hover {
    background: var(--primary-cyan);
    color: #000;
    box-shadow: 0 0 10px var(--primary-cyan);
}

.help-tooltip {
    display: none;
    position: absolute;
    bottom: 26px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(10, 15, 30, 0.98);
    border: 1px solid var(--primary-cyan);
    color: #fff;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 0.8rem;
    font-weight: normal;
    white-space: normal;
    width: 240px;
    text-align: left;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.9), 0 0 15px rgba(0, 240, 255, 0.3);
    z-index: 99999;
    line-height: 1.5;
}

.help-icon:hover .help-tooltip,
.help-icon:focus .help-tooltip {
    display: block !important;
}

/* 置頂全寬星際廣播跑馬燈 */
.top-announcement-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 42px;
    background: rgba(10, 15, 30, 0.96);
    border-bottom: 1px solid rgba(0, 240, 255, 0.4);
    box-shadow: 0 4px 15px rgba(0, 240, 255, 0.25);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    font-size: 0.85rem;
    color: var(--primary-cyan);
    backdrop-filter: blur(10px);
}

body {
    padding-top: 50px !important;
}

/* 全域Modal視窗與遮罩 (Modal Overlay & Top Z-Index) */
.modal {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(5, 10, 20, 0.75) !important;
    backdrop-filter: blur(8px) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 100000 !important;
}

.modal.hidden {
    display: none !important;
}

.modal-content {
    position: relative !important;
    z-index: 100001 !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8), 0 0 25px rgba(0, 240, 255, 0.3) !important;
}

/* --- 魔戒巴拉多塔 3 大傳奇階梯外觀 Skins --- */
.map-tower.skin-baraddur-10k {
    background-image: url('../img/baraddur_10k.png');
    filter: drop-shadow(0 0 10px #ff3300);
}
.map-tower.skin-baraddur-100k {
    background-image: url('../img/baraddur_100k.png');
    filter: drop-shadow(0 0 15px #ff0055) brightness(1.1);
    animation: baraddurLavaPulse 2s infinite alternate;
}
.map-tower.skin-baraddur-1000k {
    background-image: url('../img/baraddur_1000k.png');
    filter: drop-shadow(0 0 25px #ffd700) brightness(1.3);
    animation: divineSauronEye 1.5s infinite ease-in-out;
}

@keyframes baraddurLavaPulse {
    0% { filter: drop-shadow(0 0 10px #ff003c) brightness(1); }
    100% { filter: drop-shadow(0 0 22px #ff8c00) brightness(1.35); }
}

@keyframes divineSauronEye {
    0%, 100% { filter: drop-shadow(0 0 20px #ffd700) drop-shadow(0 0 35px #ff007f) brightness(1.2); }
    50% { filter: drop-shadow(0 0 35px #ffd700) drop-shadow(0 0 55px #ffea00) brightness(1.5); }
}

/* --- 後台自訂上架商品之通用無 CSS 依賴動態渲染器 (Generic Custom Skin Engine) --- */
/* 戰略地圖主城與前哨站外觀 — 5 階段 30%~100% 視覺放大與光暈進化 */
.map-tower.tower-stage-1 { width: 48px !important; height: 48px !important; filter: drop-shadow(0 0 8px #00f3ff); }
.map-tower.tower-stage-2 { width: 60px !important; height: 60px !important; filter: drop-shadow(0 0 14px #00f3ff); }
.map-tower.tower-stage-3 { width: 72px !important; height: 72px !important; filter: drop-shadow(0 0 20px #a855f7); }
.map-tower.tower-stage-4 { width: 84px !important; height: 84px !important; filter: drop-shadow(0 0 26px #eab308); }
.map-tower.tower-stage-5 { width: 96px !important; height: 96px !important; filter: drop-shadow(0 0 35px #ff0055); animation: sauronHolyGlow 2s infinite alternate; }

.map-node.outpost-node .map-tower.tower-stage-1 { width: 36px !important; height: 36px !important; }
.map-node.outpost-node .map-tower.tower-stage-2 { width: 46px !important; height: 46px !important; }
.map-node.outpost-node .map-tower.tower-stage-3 { width: 56px !important; height: 56px !important; }
.map-node.outpost-node .map-tower.tower-stage-4 { width: 66px !important; height: 66px !important; }
.map-node.outpost-node .map-tower.tower-stage-5 { width: 76px !important; height: 76px !important; }

@keyframes sauronHolyGlow {
    0% { filter: drop-shadow(0 0 20px #ff0055) brightness(1); }
    100% { filter: drop-shadow(0 0 45px #ffd700) brightness(1.3); }
}

/* 戰術建設與攻防射程高亮光圈 */
.cell-valid-build {
    background: rgba(0, 240, 255, 0.18) !important;
    border: 2px dashed rgba(0, 240, 255, 0.8) !important;
    box-shadow: inset 0 0 15px rgba(0, 240, 255, 0.3) !important;
}
.cell-attack-range {
    background: rgba(255, 0, 85, 0.18) !important;
    border: 2px dashed rgba(255, 0, 85, 0.8) !important;
    box-shadow: inset 0 0 15px rgba(255, 0, 85, 0.3) !important;
}
.ghost-preview-tower {
    opacity: 0.65;
    filter: drop-shadow(0 0 12px #00f3ff) brightness(1.2);
    animation: ghostPulse 1.5s infinite alternate;
}
@keyframes ghostPulse {
    0% { opacity: 0.4; }
    100% { opacity: 0.85; }
}

.map-tower.custom-skin {
    background-size: contain !important;
    background-repeat: no-repeat !important;
    background-position: bottom center !important;
    filter: drop-shadow(0 0 10px var(--primary-cyan));
    transition: filter 0.3s ease, transform 0.2s ease;
}
.map-tower.custom-skin:hover {
    filter: drop-shadow(0 0 20px var(--primary-cyan)) brightness(1.2);
    transform: scale(1.1);
}

/* --- 晶體商城商品三大分類 Tab 標籤 --- */
.shop-tab-btn {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(0, 240, 255, 0.3);
    color: #94a3b8;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
}

.shop-tab-btn:hover {
    color: #fff;
    border-color: var(--primary-cyan);
    box-shadow: 0 0 10px rgba(0, 240, 255, 0.3);
}

.shop-tab-btn.active {
    background: linear-gradient(135deg, rgba(0, 240, 255, 0.3), rgba(255, 0, 85, 0.3));
    border-color: var(--primary-cyan);
    color: #fff;
    box-shadow: 0 0 10px rgba(0, 240, 255, 0.4);
}

/* 🏆 賽季尊榮頭像框實體 PNG & 幾何特效掛載引擎 */
.avatar.avatar-frame-2026-gold,
.avatar.badge-2026-silver,
.avatar.badge-2026-bronze,
.avatar.badge-2026-top100 {
    position: relative !important;
    overflow: visible !important;
}

/* 🥇 冠軍金冠框 */
.avatar.avatar-frame-2026-gold::after {
    content: '';
    position: absolute;
    top: -14%;
    left: -14%;
    width: 128%;
    height: 128%;
    background-image: url('../img/avatar-frame-2026-gold.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    pointer-events: none;
    filter: drop-shadow(0 0 10px #ffd700);
    z-index: 10;
}

/* 🥈 亞軍銀輝框 */
.avatar.badge-2026-silver::after {
    content: '';
    position: absolute;
    top: -14%;
    left: -14%;
    width: 128%;
    height: 128%;
    background-image: url('../img/badge-2026-silver.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    pointer-events: none;
    filter: drop-shadow(0 0 10px #c0c0c0);
    z-index: 10;
}

/* 🥉 季軍銅彩框 */
.avatar.badge-2026-bronze::after {
    content: '';
    position: absolute;
    top: -14%;
    left: -14%;
    width: 128%;
    height: 128%;
    background-image: url('../img/badge-2026-bronze.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    pointer-events: none;
    filter: drop-shadow(0 0 10px #cd7f32);
    z-index: 10;
}

/* 🎖️ 全球百強閃耀框 */
.avatar.badge-2026-top100::after {
    content: '';
    position: absolute;
    top: -14%;
    left: -14%;
    width: 128%;
    height: 128%;
    background-image: url('../img/badge-2026-top100.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    pointer-events: none;
    filter: drop-shadow(0 0 10px var(--primary-cyan));
    animation: rotateFrame 15s linear infinite;
    z-index: 10;
}

@keyframes rotateFrame {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}