/* --- style.css --- */
/* --- 基礎設定 --- */
@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;500;700;900&family=Noto+Sans+TC:wght@300;400;500;700&display=swap');

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; outline: none; }

/* 自定義 Scrollbar */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.2); }
::-webkit-scrollbar-thumb { background: #555; border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: #d4af37; }

body, html { 
    margin: 0; padding: 0; width: 100%; height: 100%; overflow: hidden; 
    background-color: #050507; font-family: 'Noto Sans TC', sans-serif;
    color: #e0e0e0; touch-action: none; user-select: none; -webkit-user-select: none; 
}
canvas { display: block; }

/* --- UI 通用元件 --- */
.glass-panel { 
    background: rgba(18, 18, 22, 0.96);
    border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 16px; 
    box-shadow: 0 0 60px rgba(0, 0, 0, 0.95), inset 0 0 40px rgba(0,0,0,0.5); 
    color: #ccc; padding: 0; display:flex; flex-direction:column;
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
}

.neon-text {
    font-family: 'Orbitron'; font-weight: 900; color: #d4af37; font-size: 36px; letter-spacing: 4px;
    text-shadow: 0 0 10px rgba(212,175,55,0.6), 0 0 20px rgba(212,175,55,0.4);
}

.btn { 
    background: linear-gradient(180deg, #3a3a3a 0%, #1f1f1f 100%);
    border: 1px solid #555; padding: 10px 16px; color: #ddd; 
    font-family: 'Noto Sans TC', sans-serif; font-weight: 500; font-size: 13px; border-radius: 6px; 
    cursor: pointer; letter-spacing: 0.5px;
    transition: all 0.2s ease; white-space: nowrap; position: relative; overflow: hidden;
    text-shadow: 0 1px 2px rgba(0,0,0,0.8);
    box-shadow: 0 2px 5px rgba(0,0,0,0.4);
}
.btn:active { transform: scale(0.96); filter: brightness(1.2); }
.btn:disabled { opacity: 0.4; filter: grayscale(100%); cursor: not-allowed; transform:none; border-color:#333; box-shadow:none;}

.btn-gold { 
    background: linear-gradient(180deg, #e6c256 0%, #b38800 100%); 
    color: #111; border-color: #ffe066; font-weight: 700; 
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.3); 
    text-shadow: none;
}
.btn-gold:hover { box-shadow: 0 0 25px rgba(212, 175, 55, 0.6); filter: brightness(1.1); }
.btn-danger { background: linear-gradient(180deg, #aa0000 0%, #660000 100%); color: #ffdddd; border-color: #f44; }
.btn-success { background: linear-gradient(180deg, #00aa00 0%, #006600 100%); color: #fff; border-color: #4f4; }

/* --- HUD --- */
#ui-layer { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 50;}
#hud { position: absolute; top: 0; left: 0; width: 100%; height:100%; padding: 15px; pointer-events: none; z-index: 50; display: flex; flex-direction: column; justify-content: space-between;}

.top-info { display: flex; justify-content: space-between; align-items: flex-start; width: 100%; pointer-events: auto;}

.stat-box { 
    font-family: 'Orbitron'; font-weight: 700; font-size: 14px; color: #fff; background: rgba(0,0,0,0.85);
    padding: 8px 12px; border-radius: 8px; border: 1px solid rgba(255,255,255,0.15); 
    box-shadow: 0 4px 10px rgba(0,0,0,0.6); letter-spacing: 1px;
}

.bar-group { width: 240px; display: flex; flex-direction: column; pointer-events: auto; box-shadow: 0 4px 12px rgba(0,0,0,0.7); }
#hp-container { width: 100%; height: 20px; background: #2a0a0a; border: 1px solid #555; border-radius: 6px 6px 0 0; position: relative; overflow: hidden; }
#hp-fill { height: 100%; width: 100%; background: linear-gradient(90deg, #ff5555, #cc0000); transition: width 0.2s; box-shadow: inset 0 0 10px rgba(0,0,0,0.5); }
#hp-text { position: absolute; top: 0; left: 0; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: bold; color: #fff; text-shadow: 1px 1px 2px #000; font-family: 'Orbitron'; letter-spacing: 1px; }
#xp-container { width: 100%; height: 6px; background: #111; border: 1px solid #555; border-top: none; border-radius: 0 0 6px 6px; overflow: hidden; }
#xp-fill { height: 100%; width: 0%; background: #d4af37; box-shadow: 0 0 10px #d4af37; transition: width 0.2s; }

#btn-pause { pointer-events: auto; width: 40px; height: 40px; background: #222; border: 1px solid #666; color:#fff; border-radius:8px; display:flex; align-items:center; justify-content:center; cursor:pointer; z-index: 60; transition:0.2s; box-shadow: 0 4px 8px rgba(0,0,0,0.5); font-size: 18px;}
#btn-pause:active { background: #444; transform: scale(0.95); }

#combat-bar { 
    position: absolute; bottom: 30px; left: 0; width: 100%; 
    display: flex; justify-content: center; gap: 12px; 
    pointer-events: auto; padding-bottom: 20px; z-index: 3100; 
}
.skill-slot { 
    width: 56px; height: 56px; background: radial-gradient(circle, #2a2a2a 0%, #0a0a0a 100%); 
    border: 1px solid #666; border-radius: 50%; 
    display: flex; align-items: center; justify-content: center; position: relative; cursor: pointer; transition: 0.15s; 
    box-shadow: 0 0 20px rgba(0,0,0,0.8); 
}
.skill-slot:active { transform: scale(0.92); border-color: #d4af37; }
.skill-slot .icon { font-size: 26px; filter: drop-shadow(0 0 5px rgba(255,255,255,0.4)); }
.skill-slot .lvl-badge { 
    position: absolute; bottom: -6px; right: -6px; background: #111; color: #d4af37; 
    font-size: 11px; padding: 2px 6px; border-radius: 10px; border: 1px solid #555; 
    font-family: 'Orbitron'; font-weight: bold; box-shadow: 0 0 5px rgba(0,0,0,0.8);
}

#pause-overlay { position: absolute; top:0; left:0; width:100%; height:100%; background:rgba(0,0,0,0.92); 
    z-index: 3000; display:none; align-items:center; justify-content:center; flex-direction:column; gap: 15px;
    pointer-events: auto; backdrop-filter: blur(10px);
}

/* --- Modals --- */
.modal { 
    pointer-events: auto; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); 
    width: 96%; height: 96vh; 
    display: none; z-index: 4000; overflow: hidden; 
    flex-direction: column;
}

.level-modal {
    pointer-events: auto; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    width: 85%; height: 75%;
    display: none; z-index: 5000; overflow: hidden;
    flex-direction: column;
    border: 1px solid #d4af37;
    box-shadow: 0 0 80px rgba(212, 175, 55, 0.15), 0 0 0 1000px rgba(0,0,0,0.8); 
}

.lvl-header {
    height: 60px; flex-shrink: 0; background: linear-gradient(90deg, #222, #080808);
    border-bottom: 1px solid rgba(212,175,55,0.3); display: flex; align-items: center; justify-content: space-between; padding: 0 25px;
}
.lvl-title { font-family: 'Orbitron'; font-weight: 900; color: #d4af37; font-size: 20px; letter-spacing: 3px; text-shadow: 0 0 15px rgba(212,175,55,0.5); }
.lvl-gold-tag { font-family: 'Orbitron'; font-weight: 700; color: #fff; font-size: 15px; background: rgba(0,0,0,0.6); padding: 5px 12px; border-radius: 6px; border: 1px solid #444; }

.lvl-body-layout { display: flex; flex: 1; overflow: hidden; }

.lvl-left-panel {
    flex: 1; background: rgba(0,0,0,0.3); border-right: 1px solid rgba(255,255,255,0.08);
    padding: 25px; display: flex; flex-direction: column;
}

.lvl-right-panel {
    flex: 1.4; display: flex; flex-direction: column; padding: 25px; background: radial-gradient(circle at center, #1a1a1a 0%, #050505 100%);
}

.lvl-rewards-box {
    flex: 1; border: 1px solid rgba(255,255,255,0.1); background: rgba(0,0,0,0.2); border-radius: 12px;
    padding: 15px; margin-bottom: 15px; position: relative; overflow-y: auto;
    box-shadow: inset 0 0 30px rgba(0,0,0,0.6);
}
/* [Fix] Increase min-width slightly to ensure consistent width */
.lvl-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(105px, 1fr)); gap: 12px; width: 100%;
}
.lvl-controls { display: flex; gap: 12px; height: 50px; }

/* -------------------- */

.modal-header { 
    padding: 0 20px; border-bottom: 1px solid rgba(255,255,255,0.1); display: flex; 
    justify-content: space-between; align-items: center; 
    background: linear-gradient(90deg, rgba(20,20,25,0.98), rgba(30,30,35,0.98)); 
    flex-shrink: 0; height: 55px;
}
.modal-title { color: #d4af37; font-weight: 700; font-family: 'Noto Sans TC'; font-size: 16px; letter-spacing: 1px; text-shadow: 0 0 5px rgba(212,175,55,0.3);}
.currency-badge { font-size:13px; background:#111; padding:4px 12px; border-radius:6px; border:1px solid #333; color:#d4af37; font-family:'Orbitron'; font-weight:700; letter-spacing:1px;}

/* --- Dashboard Layout --- */
#shop-modal > .modal-body {
    padding: 0 !important; overflow: hidden !important; display: flex; flex-direction: column; height: 100%;
    background: radial-gradient(circle at center, #151515 0%, #050505 120%);
}

.dashboard-row {
    display: flex; height: 60%; width: 100%;
    border-bottom: 1px solid rgba(212, 175, 55, 0.2);
    overflow: hidden;
}

.col { 
    display: flex; flex-direction: column; 
    padding: 12px; border-right: 1px solid rgba(255,255,255,0.06); 
    position: relative; overflow: hidden;
}
.col:last-child { border-right: none; }

.col-header { 
    font-size: 12px; color: #777; letter-spacing: 2px;
    margin-bottom: 10px; flex-shrink: 0; text-align: center; border-bottom: 1px solid #333; padding-bottom: 8px;
    font-family: 'Noto Sans TC'; font-weight: 700; text-transform: uppercase;
}

/* 重新調整比例：讓融合區變窄，裝備區變寬 */
.col-info { flex: 1.4; background: rgba(0,0,0,0.2); }
.col-shop { flex: 1.4; }
.col-forge { flex: 1.6; background: rgba(0,0,0,0.2); } 
/* 增大裝備欄比例，背景加深 */
.col-equipment { flex: 0.9; background: #0c0c0c; align-items: center; overflow-y: auto; border-left: 1px solid #222; box-shadow: inset 0 0 30px #000;}
/* 縮小融合區比例 */
.col-fusion { flex: 0.4; background:rgba(0,0,0,0.3); padding: 5px; } 

/* --- Info Panel --- */
.info-content { flex: 1; overflow-y: auto; text-align: left; padding-right: 4px; display: flex; flex-direction: column;}
.info-title { color: #d4af37; font-weight: 700; font-size: 20px; margin-bottom: 10px; font-family:'Noto Sans TC'; text-shadow: 0 0 15px rgba(212,175,55,0.4);}

.meta-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 15px; }
.type-badge { font-size: 11px; padding: 3px 10px; border-radius: 4px; font-family:'Noto Sans TC'; font-weight:700; border: 1px solid transparent; letter-spacing: 1px;}
.type-badge.active-type { background: rgba(0, 255, 0, 0.08); color: #4f4; border-color: rgba(0, 255, 0, 0.3); box-shadow: 0 0 8px rgba(0,255,0,0.15);}
.type-badge.support-type { background: rgba(0, 204, 255, 0.08); color: #4cf; border-color: rgba(0, 204, 255, 0.3); box-shadow: 0 0 8px rgba(0,204,255,0.15);}
.type-badge.weapon-type { background: rgba(180, 0, 255, 0.08); color: #d0f; border-color: rgba(180, 0, 255, 0.3); box-shadow: 0 0 8px rgba(180,0,255,0.15);}
.tag-pill { font-size: 10px; color: #bbb; background: #252525; padding: 3px 8px; border-radius: 4px; border: 1px solid #444; }
.tag-pill.tiny { font-size: 9px; padding: 2px 5px; background: rgba(255,255,255,0.1); border-color:rgba(255,255,255,0.2); }

.info-desc { font-size: 14px; color: #ccc; line-height: 1.6; margin-bottom: 20px; font-weight: 300; }
.info-effect { 
    color: #8ce; font-size: 13px; line-height: 1.6; 
    border-top: 1px dashed #444; padding-top: 15px; margin-top: auto;
    background: linear-gradient(90deg, rgba(0,50,60,0.25) 0%, transparent 100%);
    padding: 12px; border-radius: 6px; border-left: 3px solid #00ccff;
}

/* Shop Grid */
.shop-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; overflow-y: auto; flex:1; padding-bottom:10px;}
.forge-controls { display: flex; flex-direction:column; gap: 4px; margin-top: auto; justify-content: center; width: 100%; align-items:center;}
.forge-controls .btn { flex: 1; font-size: 11px; padding: 6px 0; border-radius: 4px; }

/* 狀態標題 */
.forge-status-header {
    width: 100%; text-align: center; font-size: 10px; color: #888;
    background: #111; padding: 4px; border-radius: 4px; margin-bottom: 8px;
    font-family: 'Noto Sans TC'; border: 1px solid #333;
}

/* Equipment Grid Layout (2欄 x 3列) - 修改部分 */
.e-v-list { 
    display: grid; 
    grid-template-columns: 1fr 1fr; 
    gap: 8px; 
    width: 100%; 
    padding: 10px 5px; 
    align-content: start;
}

.e-icon-box { 
    /* 移除固定寬高，改用長寬比或自動填充 */
    width: 100%; 
    aspect-ratio: 1; /* 保持正方形 */
    border: 1px solid #333; background: linear-gradient(135deg, #1a1a1a 0%, #0d0d0d 100%); 
    display: flex; flex-direction: column; align-items: center; justify-content: center; 
    border-radius: 8px; font-size: 20px; color: #555; cursor:pointer; 
    transition: 0.2s; position: relative; 
    box-shadow: 0 4px 8px rgba(0,0,0,0.3); overflow: hidden;
}
.e-icon-box:hover { border-color: #666; color:#ccc; transform: translateY(-1px);}
.e-icon-box.selected { border-color: #d4af37; background: #2a2210; color: #fff; box-shadow: 0 0 15px rgba(212,175,55,0.4); z-index:2;}
.e-icon-box.locked { opacity: 0.3; pointer-events: none; border-style: dashed; }
.e-icon-box .slot-label { 
    position: absolute; bottom: 0; left: 0; width: 100%; font-size: 8px; color: #888; 
    font-family:'Orbitron'; text-transform:uppercase; background:rgba(0,0,0,0.8); 
    padding:2px 0; text-align: center; border-top: 1px solid rgba(255,255,255,0.05);
}

/* 裝備待確認狀態與勾勾按鈕 */
.e-icon-box.pending-state, .socket.pending-state {
    border-color: #00ff66 !important;
    box-shadow: 0 0 15px rgba(0, 255, 102, 0.3);
    animation: pulseBorder 1.5s infinite;
}

@keyframes pulseBorder {
    0% { box-shadow: 0 0 10px rgba(0, 255, 102, 0.3); }
    50% { box-shadow: 0 0 25px rgba(0, 255, 102, 0.6); }
    100% { box-shadow: 0 0 10px rgba(0, 255, 102, 0.3); }
}

.action-check-btn {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    width: 40px; height: 40px; border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #aaffcc, #00aa44);
    box-shadow: 0 0 15px #00ff66; border: 2px solid #fff;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 22px; cursor: pointer; z-index: 10;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
    transition: transform 0.2s;
}
.action-check-btn:active { transform: translate(-50%, -50%) scale(0.9); }
.action-check-btn.small { width: 28px; height: 28px; font-size: 16px; }

/* Fusion Vertical Layout - 窄版設計 */
.fusion-box { display: flex; flex-direction: column; align-items: center; gap: 4px; flex: 1; justify-content: center; width: 100%; }
.fusion-slots { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 100%; }
.f-slot { 
    width: 48px; height: 48px; 
    border: 1px dashed #555; border-radius: 10px; 
    display: flex; flex-direction: column; align-items: center; justify-content: center; 
    background: #111; cursor: pointer; transition: 0.2s; position: relative;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.5);
}
.f-slot:hover { border-color: #888; background: #1a1a1a; }
.f-slot.filled { border-style: solid; border-color: #d4af37; background: #1a1810; box-shadow: 0 0 10px rgba(0,0,0,0.5); }
.f-slot.destroy { animation: shake 0.4s ease-in-out; border-color: #f33; }
.f-slot:active { transform: scale(0.95); }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(3px); } 75% { transform: translateX(-3px); } }

/* Socket Area */
#socket-area { 
    position: relative; 
    width: 170px; height: 170px; 
    margin: auto; 
    background: radial-gradient(circle, #2a2a2a 0%, #080808 70%); 
    border-radius: 50%; border: 1px solid #444; flex-shrink: 0;
    box-shadow: 0 0 40px rgba(0,0,0,0.8), inset 0 0 60px #000;
}
#socket-area::before {
    content:''; position:absolute; top:-5px; left:-5px; right:-5px; bottom:-5px;
    border-radius: 50%; border: 1px dashed rgba(255,255,255,0.08); pointer-events:none;
}

.socket { width: 34px; height: 34px; border-radius: 50%; position: absolute; border: 1px solid #666; background: #000; display: flex; align-items: center; justify-content: center; z-index: 2; cursor: pointer; transition: 0.2s; box-shadow: 0 0 10px rgba(0,0,0,0.8);}
.socket.selected { border-color: #0f0; box-shadow: 0 0 20px rgba(0,255,0,0.5); transform: scale(1.15); z-index: 10; background:#051505;}
.socket.has-item { border-color: #bbb; }
.gem { width: 28px; height: 28px; border-radius: 50%; background: #333; color: #aaa; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: bold; pointer-events: none; position: relative;}
.gem.active { background: radial-gradient(circle at 30% 30%, #ff8800, #aa3300); color:#fff; box-shadow: 0 0 10px #ff4400; text-shadow: 0 0 2px #000; border:1px solid #ffaa00;}
.gem.support { background: radial-gradient(circle at 30% 30%, #00f0ff, #0055aa); color:#fff; box-shadow: 0 0 10px #00ccff; text-shadow: 0 0 2px #000; border:1px solid #00ffff;}
.gem-lvl { position: absolute; bottom: -6px; right: -6px; background: #000; color: #fff; font-size: 8px; padding: 0 4px; border-radius: 6px; border: 1px solid #555; font-family:'Orbitron'; font-weight:700;}
.link-line { position: absolute; height: 4px; background: #888; transform-origin: 0 50%; z-index: 1; opacity: 0.5; border-radius:2px;}
.link-line.active { background: #d4af37; height: 4px; box-shadow: 0 0 12px #d4af37; opacity: 1; }

/* --- Inventory (Tri-Split Layout) --- */
#inventory-container { 
    height: 42% !important; flex: none !important;
    background: #080808; padding: 12px; box-sizing: border-box; z-index: 50; 
    border-top: 1px solid #333; display: flex; gap: 8px; overflow: hidden; 
}
.inv-panel { flex: 1; min-width: 0; display: flex; flex-direction: column; background: rgba(30, 30, 35, 0.5); border: 1px solid #333; border-radius: 12px; overflow: hidden; }

.inv-header { 
    flex-shrink: 0; font-size: 10px; color: #bbb; 
    background: rgba(0,0,0,0.7); padding: 6px 8px; border-bottom: 1px solid rgba(255,255,255,0.08); 
    font-family: 'Noto Sans TC'; font-weight:700;
    display: flex; justify-content: space-between; align-items: center; white-space: nowrap;
}

.sort-toolbar { display: flex; gap: 4px; }
.sort-btn {
    background: #222; border: 1px solid #444; color: #888;
    font-size: 8px; padding: 2px 5px; border-radius: 4px; cursor: pointer;
    font-family: 'Orbitron'; font-weight: bold; transition: 0.2s; min-width: 30px;
}
.sort-btn:hover { color: #d4af37; border-color: #666; }
.sort-btn:active { background: #444; }

.inv-list { 
    flex: 1; overflow-y: auto !important; -webkit-overflow-scrolling: touch; touch-action: pan-y !important; pointer-events: auto;
    display: flex; flex-wrap: wrap; gap: 6px; padding: 8px; align-content: flex-start; justify-content: flex-start; padding-bottom: 40px;
}
.inv-item { 
    width: 44px; height: 44px; border-radius: 8px; background: #1a1a1a; border: 1px solid #444; 
    display: flex; flex-direction: column; align-items: center; justify-content: center; 
    cursor: pointer; position: relative; flex-shrink: 0; transition: 0.15s;
}
.inv-item:hover { background: #2a2a2a; border-color:#666;}
.inv-item.selected { border-color: #d4af37 !important; background: #332a1a; box-shadow: 0 0 15px rgba(212,175,55,0.5); transform: scale(1.05); z-index: 5;}
.inv-item.equipment { background: linear-gradient(135deg, #222 0%, #111 100%); }
.inv-item.equipment .inv-icon { font-size: 18px; filter: drop-shadow(0 0 2px rgba(255,255,255,0.2)); }
.socket-indicator {
    position: absolute; top: -3px; right: -3px; width: 8px; height: 8px;
    background: #0ff; border-radius: 50%; box-shadow: 0 0 5px #0ff; border: 1px solid #fff;
    z-index: 6;
}

/* --- Cards --- */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(85px, 1fr)); gap: 10px; width: 100%; align-content: start; overflow-y: auto; padding:4px;}
.card { 
    background: linear-gradient(160deg, #222 0%, #121212 100%); border: 1px solid #444; 
    padding: 10px; border-radius: 10px; cursor: pointer; position: relative;
    display: flex; flex-direction: column; align-items: center; justify-content: center; 
    min-height: 100px; transition: 0.15s; box-shadow: 0 4px 8px rgba(0,0,0,0.4);
    overflow: hidden; /* Prevent spillover */
}
.card:active { transform: scale(0.96); }
.card.selected { border-color: #d4af37 !important; background: linear-gradient(160deg, #3a301a 0%, #1f1805 100%); box-shadow: 0 0 20px rgba(212,175,55,0.4); }
.card.sold-out { opacity: 0.2; filter: grayscale(100%); border-style: dashed; pointer-events: none; }
.card.weapon-card { background: linear-gradient(160deg, #1a1a1e 0%, #050508 100%); }

/* [Fix] Level Up Grid Card Consistency & Layout Fix */
.lvl-grid .card {
    height: 135px; /* 強制統一高度 */
    /* Remove global justify-content: center to avoid weapon layout break */
}

/* 元素卡片設定: 保持置中與大間距 */
.lvl-grid .card:not(.weapon-card) {
    justify-content: center;
    gap: 15px;
}

/* 武器卡片設定: 內容均分排列，縮小間距防止跑版 */
.lvl-grid .card.weapon-card {
    justify-content: space-evenly;
    gap: 2px;
    padding-top: 12px;
    padding-bottom: 12px;
}

/* Start Menu Specific Cards (New Style) */
.start-card {
    min-height: 140px;
    align-items: flex-start; text-align: left;
    background: linear-gradient(160deg, #2a2a2e 0%, #151518 100%);
    border: 1px solid rgba(255,255,255,0.1);
}
.start-card:hover { border-color: #00ccff; box-shadow: 0 0 15px rgba(0, 204, 255, 0.2); transform: translateY(-2px);}
.start-card-header { display: flex; align-items: center; width: 100%; border-bottom: 1px solid rgba(255,255,255,0.05); padding-bottom: 8px; margin-bottom: 8px; }
.start-card-title { margin-left: 10px; }
.start-card-body { width: 100%; }

/* Rarity Glows */
.card.tier-common { border: 1px solid #777; } 
.card.tier-rare { border: 1px solid #00ccff; box-shadow: 0 0 8px rgba(0,204,255,0.25); } 
.card.tier-legendary { border: 1px solid #ffd700; box-shadow: 0 0 12px rgba(255,215,0,0.4); } 

.el-symbol { font-size: 24px; font-weight: 700; color: #fff; font-family: serif; text-shadow: 0 2px 6px rgba(0,0,0,0.8); margin-bottom:6px;}
.el-symbol.large { font-size: 32px; margin-bottom: 0; color: #d4af37; }
.el-cn { font-size: 13px; color: #d4af37; font-weight: 500; font-family:'Noto Sans TC'; text-align:center;}
.el-lvl { position: absolute; top: 5px; right: 5px; font-size: 10px; color: #bbb; background:rgba(0,0,0,0.7); padding:2px 6px; border-radius:4px; font-family:'Orbitron'; border:1px solid #444;}
.el-equip { position: absolute; top: 5px; left: 5px; font-size: 10px; color: #000; background: #d4af37; padding:2px 6px; border-radius:4px; font-weight:800; font-family:'Orbitron'; box-shadow: 0 0 5px rgba(212,175,55,0.5);}

.price-tag { 
    font-size: 10px; color: #ccc; margin-top: 8px; 
    background: rgba(255,255,255,0.06); padding: 4px 10px; border-radius: 4px; 
    border: 1px solid rgba(255,255,255,0.1); font-family:'Orbitron'; text-align:center; min-width: 65px;
}
.tier-label { font-size: 10px; margin-top: 3px; color: #888; font-family: 'Noto Sans TC'; text-align: center; }

/* --- Toast --- */
#toast-container { 
    position: absolute; top: 100px; left: 50%; transform: translateX(-50%); z-index: 7000; 
    pointer-events: none; display: flex; flex-direction: column; gap: 10px; align-items: center;
}
.toast { 
    background: rgba(15, 15, 20, 0.95); border: 1px solid #d4af37; 
    color: #fff; padding: 12px 25px; border-radius: 8px; 
    font-size: 14px; animation: fadeUp 1.2s forwards; backdrop-filter: blur(10px);
    box-shadow: 0 5px 25px rgba(0,0,0,0.9); font-family:'Noto Sans TC';
    display:flex; align-items:center;
}
@keyframes fadeUp { 
    0% { opacity: 0; transform: translateY(20px) scale(0.9); } 
    15% { opacity: 1; transform: translateY(0) scale(1); } 
    80% { opacity: 1; } 
    100% { opacity: 0; transform: translateY(-25px); } 
}

/* --- Joystick --- */
#joystick-area { position: absolute; top:0; left:0; width:50%; height:100%; z-index: 10; }
#joy-base { position: absolute; width: 110px; height: 110px; border: 2px solid rgba(255,255,255,0.08); border-radius: 50%; display: none; pointer-events: none; background:rgba(255,255,255,0.03);}
#joy-stick { position: absolute; width: 45px; height: 45px; background: rgba(255,255,255,0.2); border-radius: 50%; top: 50%; left: 50%; transform: translate(-50%, -50%); backdrop-filter: blur(5px); box-shadow: 0 0 15px rgba(255,255,255,0.1); border:1px solid rgba(255,255,255,0.2);}

/* --- Control Buttons (Dash, etc) --- */
.control-btn {
    position: absolute; bottom: 100px; right: 40px;
    width: 70px; height: 70px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(50, 50, 60, 0.6) 0%, rgba(20, 20, 30, 0.8) 100%);
    border: 2px solid rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(8px);
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.5), inset 0 0 10px rgba(255, 255, 255, 0.05);
    z-index: 200; pointer-events: auto;
    display: flex; align-items: center; justify-content: center;
    transition: transform 0.1s, box-shadow 0.1s;
    cursor: pointer;
}
.control-btn:active {
    transform: scale(0.92);
    box-shadow: 0 0 8px rgba(0,0,0,0.8), inset 0 0 15px rgba(0,0,0,0.5);
    background: rgba(60, 60, 70, 0.8);
}
.control-btn .btn-icon {
    font-size: 28px; color: #00ccff;
    text-shadow: 0 0 8px rgba(0, 204, 255, 0.6);
    user-select: none;
}
.control-btn .cd-overlay {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    clip-path: polygon(50% 50%, 50% 0%, 100% 0%, 100% 100%, 0% 100%, 0% 0%, 50% 0%); /* 簡單的全覆蓋，動態修改由JS處理 */
    display: none;
}

/* --- Skill Popup --- */
#skill-detail-popup { position: absolute; bottom: 100px; left: 50%; transform: translateX(-50%); width: 300px; background: rgba(18,18,22,0.98); border: 1px solid #d4af37; border-radius: 12px; padding: 15px; display: none; z-index: 4000; pointer-events: auto; box-shadow: 0 15px 50px rgba(0,0,0,0.95); backdrop-filter: blur(15px); }
.sd-header { display:flex; align-items:center; border-bottom:1px solid #444; padding-bottom:12px; margin-bottom:12px; }
.sd-icon { width:42px; height:42px; background:#111; border-radius:50%; display:flex; align-items:center; justify-content:center; margin-right:15px; border:1px solid #d4af37; color:#fff; font-weight:bold; font-size:18px; box-shadow:0 0 12px rgba(212,175,55,0.25);}
.sd-title { color: #d4af37; font-weight: 700; font-size: 16px;}
.sd-list { display:flex; flex-direction:column; gap:8px; }
.sd-item { display:flex; align-items:center; font-size:13px; color:#ccc; background:rgba(255,255,255,0.06); padding:8px; border-radius:6px;}
.sd-item .dot { width:8px; height:8px; background:#00ccff; border-radius:50%; margin-right:12px; box-shadow:0 0 8px #00ccff;}

/* --- [新增] Gear Viewer Styles (請貼在 style.css 最下方) --- */

#gear-viewer-modal {
    display: none; /* 預設隱藏 */
    padding: 20px;
    width: 90%;
    height: 90%;
    border: 1px solid #00aaff;
    box-shadow: 0 0 50px rgba(0, 170, 255, 0.15), 0 0 0 1000px rgba(0,0,0,0.8);
}

.gv-header {
    display: flex; justify-content: space-between; align-items: center;
    border-bottom: 1px solid rgba(0, 170, 255, 0.3);
    padding-bottom: 15px; margin-bottom: 20px; flex-shrink: 0;
}

.gv-icon-box {
    width: 40px; height: 40px; background: rgba(0, 170, 255, 0.1);
    border: 1px solid #00aaff; border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; box-shadow: 0 0 10px rgba(0, 170, 255, 0.3);
}

.gv-body {
    display: flex; gap: 20px; flex: 1; overflow: hidden;
}

/* 左側區塊 */
.gv-slots-section {
    flex: 1.2; display: flex; flex-direction: column;
    background: rgba(0,0,0,0.3); border-radius: 12px; padding: 10px; border: 1px solid rgba(255,255,255,0.05);
}

.gv-grid {
    display: grid; grid-template-columns: repeat(2, 1fr); /* 2欄排列 */
    gap: 12px; overflow-y: auto; padding: 5px; flex: 1;
}

/* 裝備卡片 */
.gv-card {
    background: linear-gradient(135deg, #1a1a1a 0%, #0a0a0a 100%);
    border: 1px solid #444; border-radius: 8px;
    padding: 10px; display: flex; flex-direction: column; gap: 8px;
    cursor: pointer; transition: 0.2s; position: relative; overflow: hidden;
}
.gv-card:hover { border-color: #00aaff; transform: translateY(-2px); box-shadow: 0 5px 15px rgba(0,0,0,0.5); }
.gv-card.selected { border-color: #d4af37; background: #221e10; box-shadow: 0 0 15px rgba(212,175,55,0.3); }

.gv-card-header {
    display: flex; align-items: center; gap: 10px; border-bottom: 1px solid rgba(255,255,255,0.1); padding-bottom: 6px;
}
.gv-card-icon { font-size: 24px; filter: drop-shadow(0 0 5px rgba(255,255,255,0.2)); }

/* 鑲孔容器 */
.gv-socket-row { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; margin-top: auto; padding-top: 5px;}
.gv-socket {
    width: 30px; height: 30px; border-radius: 50%;
    background: #000; border: 1px solid #555;
    display: flex; align-items: center; justify-content: center;
    position: relative; transition: 0.2s; cursor: pointer;
}
.gv-socket:hover { transform: scale(1.15); border-color: #fff; z-index: 5; }
.gv-socket.active { border-color: #d4af37; box-shadow: 0 0 8px #d4af37; }
.gv-socket.support { border-color: #00ccff; box-shadow: 0 0 8px #00ccff; }

/* 右側區塊 */
.gv-info-section {
    flex: 1; display: flex; flex-direction: column;
    background: rgba(0,0,0,0.3); border-radius: 12px; padding: 10px; border: 1px solid rgba(255,255,255,0.05);
}

.gv-info-panel {
    flex: 1; background: rgba(10, 10, 12, 0.8); border: 1px solid #333;
    border-radius: 8px; padding: 20px; display: flex; flex-direction: column;
    overflow-y: auto; position: relative;
}

#gv-info-placeholder {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    height: 100%; color: #555; text-align: center; font-family: 'Orbitron'; font-size: 12px; letter-spacing: 1px;
}

.gv-title-row { border-bottom: 1px solid #333; padding-bottom: 10px; margin-bottom: 10px; }
.gv-info-title { font-size: 22px; font-weight: 700; color: #d4af37; font-family: 'Noto Sans TC'; margin-bottom: 5px; text-shadow: 0 0 10px rgba(0,0,0,0.5); }
.gv-info-type { font-size: 12px; color: #888; margin-bottom: 15px; font-family: 'Noto Sans TC'; display: flex; gap: 5px; }

.gv-info-desc {
    background: rgba(255,255,255,0.03); padding: 12px; border: 0; box-shadow: none;
    font-size: 14px; color: #ccc; line-height: 1.6; margin-bottom: 20px;
    font-weight: 300; border-left: 2px solid #555; border-radius: 0 4px 4px 0;
}

.gv-info-stats {
    background: linear-gradient(90deg, rgba(0, 50, 60, 0.3) 0%, transparent 100%);
    padding: 15px; border-radius: 6px; border-left: 3px solid #00aaff;
    color: #aaddff; font-size: 13px; line-height: 1.8;
}

/* RWD for mobile */
@media (max-width: 768px) {
    .gv-body { flex-direction: column; }
    .gv-grid { grid-template-columns: repeat(3, 1fr); max-height: 200px; }
}

/* --- [Updated] Gear & Inventory Viewer Styles --- */

/* 分頁按鈕容器 */
.gv-tabs {
    display: flex; gap: 10px; background: rgba(0,0,0,0.5);
    padding: 5px; border-radius: 8px; border: 1px solid #333;
}

/* 分頁按鈕樣式 */
.gv-tab {
    background: transparent; border: none; color: #666;
    padding: 8px 20px; font-family: 'Orbitron'; font-size: 12px;
    cursor: pointer; transition: 0.3s; border-radius: 4px;
    letter-spacing: 1px;
}
.gv-tab:hover { color: #fff; background: rgba(255,255,255,0.05); }
.gv-tab.active {
    background: #00aaff; color: #000; font-weight: bold;
    box-shadow: 0 0 10px rgba(0, 170, 255, 0.4);
}
/* 背包專屬激活顏色 */
#tab-btn-inventory.active {
    background: #00ffaa; box-shadow: 0 0 10px rgba(0, 255, 170, 0.4);
}

/* 視圖容器 */
.gv-view-container {
    display: flex; flex-direction: column; height: 100%; overflow: hidden;
}

/* 背包網格 (比裝備網格更密集) */
.gv-inventory-grid {
    display: grid; 
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); 
    gap: 8px; overflow-y: auto; padding: 5px; flex: 1;
    align-content: start;
}

/* 背包物品卡片 */
.gv-inv-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid #444; border-radius: 6px;
    padding: 8px; display: flex; flex-direction: column; align-items: center;
    cursor: pointer; transition: 0.2s; position: relative;
    height: 100px; justify-content: space-between;
}
.gv-inv-item:hover { border-color: #fff; background: rgba(255,255,255,0.08); }
.gv-inv-item.selected { border-color: #ffd700; background: rgba(255, 215, 0, 0.1); }

/* 背包物品內容 */
.gv-inv-icon { font-size: 24px; margin-bottom: 5px; }
.gv-inv-name { font-size: 10px; color: #ccc; text-align: center; line-height: 1.2; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.gv-inv-lvl { 
    font-size: 9px; background: #000; color: #fff; padding: 1px 4px; border-radius: 3px; margin-top: 2px; border: 1px solid #333;
}

/* 詳細數值強調 */
.stat-highlight { color: #00ffaa; font-weight: bold; margin-left: 5px; }
.stat-label { color: #aaddff; }
.stat-row { display: flex; justify-content: space-between; border-bottom: 1px solid rgba(255,255,255,0.05); padding: 4px 0; }

/* 寶石等級標籤 */
.gem-lvl-badge {
    position: absolute; top: -5px; right: -5px;
    background: #000; border: 1px solid #ffd700; color: #ffd700;
    font-size: 10px; padding: 0 4px; border-radius: 4px; z-index: 10;
    font-family: 'Orbitron';
}

/* RWD 調整 */
@media (max-width: 768px) {
    .gv-header { flex-direction: column; align-items: stretch; gap: 10px; }
    .gv-tabs { justify-content: center; }
    .gv-inventory-grid { grid-template-columns: repeat(4, 1fr); }
}