* { box-sizing: border-box; margin: 0; padding: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
body { background-color: #0E1117; color: #FFFFFF; display: flex; height: 100vh; overflow: hidden; font-size: 14px; position: relative; }

/* 🌟 電競級震撼 Splash 開場動畫 */
#octopus-splash {
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    background: radial-gradient(circle at center, #161B22 0%, #090C10 100%);
    z-index: 99999;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: opacity 0.8s ease, visibility 0.8s ease;
}

.splash-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    max-width: 600px;
}

.splash-slogan {
    font-size: 28px;
    font-weight: 900;
    letter-spacing: 4px;
    text-transform: uppercase;
    background: linear-gradient(90deg, #FFD700, #00E5FF, #FFD700);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: shine-text 3s linear infinite;
}

@keyframes shine-text { 0% { background-position: 0% center; } 100% { background-position: 200% center; } }

.splash-card-showcase {
    position: relative;
    width: 320px;
    height: 160px;
    display: flex;
    justify-content: center;
    align-items: center;
    perspective: 1000px;
    margin: 10px 0;
}

.splash-feat-card {
    position: absolute;
    width: 120px;
    height: 168px;
    border-radius: 8px;
    border: 2px solid #00E5FF;
    box-shadow: 0 10px 30px rgba(0, 229, 255, 0.4);
    transition: all 1s cubic-bezier(0.2, 0.8, 0.2, 1);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.feat-1 {
    transform: translateX(-80px) rotate(-15deg) scale(0.85);
    border-color: #E91E63;
    box-shadow: 0 0 20px rgba(233, 30, 99, 0.5);
    background: linear-gradient(135deg, #B71C1C, #880E4F);
}

.feat-2 {
    transform: translateX(80px) rotate(15deg) scale(0.85);
    border-color: #FFD700;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
    background: linear-gradient(135deg, #0D47A1, #01579B);
}

.cardback-octo-logo {
    font-size: 36px;
    filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.8));
}

.cardback-pattern {
    width: 80%;
    height: 80%;
    border: 1px dashed rgba(255,255,255,0.3);
    border-radius: 6px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.feat-main {
    z-index: 5;
    transform: scale(1.05);
    border-color: #00E5FF;
    background: #161B22;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 10px;
    box-shadow: 0 0 35px rgba(0, 229, 255, 0.8);
    animation: pulse-main 2s infinite ease-in-out;
}

@keyframes pulse-main {
    0%, 100% { transform: scale(1.05); }
    50% { transform: scale(1.12); box-shadow: 0 0 45px rgba(0, 229, 255, 1); }
}

.splash-counter-box {
    background: rgba(0, 229, 255, 0.08);
    border: 1px solid #00E5FF;
    padding: 10px 24px;
    border-radius: 30px;
    font-size: 20px;
    font-weight: 900;
    color: #FFD700;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.splash-progress-bar {
    width: 240px;
    height: 4px;
    background: #21262D;
    border-radius: 2px;
    overflow: hidden;
    margin-top: 5px;
}

.splash-progress-inner {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #00E5FF, #FFD700);
    transition: width 0.03s linear;
}

/* 🐙 獨立懸浮 3D 可拖曳小章魚吉祥物 */
#octo-mascot-wrapper {
    position: fixed;
    bottom: 25px;
    left: 20px;
    z-index: 8000;
    user-select: none;
    cursor: grab;
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: auto;
}

#octo-mascot-wrapper:active {
    cursor: grabbing;
}

#octo-speech-bubble {
    background: #161B22;
    border: 2px solid #00E5FF;
    color: #FFF;
    padding: 8px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
    white-space: nowrap;
    box-shadow: 0 5px 15px rgba(0, 229, 255, 0.3);
    margin-bottom: 8px;
    opacity: 0;
    transform: translateY(10px) scale(0.9);
    transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    pointer-events: none;
    position: relative;
}

#octo-speech-bubble::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 6px 6px 0;
    border-style: solid;
    border-color: #00E5FF transparent;
    display: block;
    width: 0;
}

#octo-speech-bubble.active {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.octo-3d-body {
    width: 70px;
    height: 70px;
    background: radial-gradient(circle at 35% 30%, #FF80AB 0%, #E91E63 60%, #880E4F 100%);
    border-radius: 50%;
    box-shadow: 0 10px 25px rgba(233, 30, 99, 0.5), inset 0 3px 8px rgba(255,255,255,0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 36px;
    animation: float-mascot 3s ease-in-out infinite;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 2px solid rgba(255, 255, 255, 0.3);
}

@keyframes float-mascot {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-8px) rotate(3deg); }
}

.octo-3d-body.jump {
    animation: bounce-jump 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes bounce-jump {
    0% { transform: scale(1) translateY(0); }
    40% { transform: scale(1.25) translateY(-25px) rotate(-10deg); }
    70% { transform: scale(0.9) translateY(5px); }
    100% { transform: scale(1) translateY(0); }
}

#sidebar-wrapper { display: flex; height: 100%; position: relative; z-index: 50; }
#sidebar { width: 360px; background-color: #161B22; border-right: 1px solid #30363D; display: flex; flex-direction: column; overflow: hidden; flex-shrink: 0; transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1); }
.sidebar-content { padding: 15px; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; flex: 1; min-width: 360px; }

#sidebar-toggle-btn { width: 24px; height: 40px; background: #21262D; border: 1px solid #30363D; border-left: none; color: #58A6FF; font-weight: bold; cursor: pointer; display: flex; align-items: center; justify-content: center; position: absolute; top: 15px; right: -24px; border-radius: 0 6px 6px 0; z-index: 100; box-shadow: 2px 0 5px rgba(0,0,0,0.5); }
#sidebar-toggle-btn:hover { background: #30363D; color: #FFF; }

.tab-group { display: flex; border-bottom: 1px solid #30363D; }
.tab-btn { flex: 1; background: transparent; color: #888; border: none; padding: 8px 0; cursor: pointer; font-weight: bold; border-bottom: 2px solid transparent; font-size: 14px; }
.tab-btn.active { color: #58A6FF; border-bottom: 2px solid #58A6FF; }
.tab-content { display: none; margin-top: 10px; }
.tab-content.active { display: block; }

.local-progress-container { display: none; margin-top: 10px; padding: 8px; background: rgba(255, 215, 0, 0.1); border: 1px solid #FFD700; border-radius: 6px; text-align: center; }
.local-progress-bar { height: 4px; width: 0%; background: #FFD700; transition: width 0.3s ease; border-radius: 2px; margin-top: 6px; }

input, textarea, select { width: 100%; background: #0D1117; border: 1px solid #30363D; color: white; padding: 8px; border-radius: 6px; outline: none; font-size: 14px; }
.btn { background: #238636; color: white; border: none; padding: 10px; border-radius: 6px; cursor: pointer; font-weight: bold; width: 100%; transition: 0.2s; font-size: 14px; }
.btn:hover { background: #2ea043; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-secondary { background: #21262D; border: 1px solid #30363D; color: #C9D1D9; }

@keyframes tour-pulse { 
    0% { box-shadow: 0 0 0 0 rgba(0, 229, 255, 0.9); border-color: #00E5FF; } 
    70% { box-shadow: 0 0 0 15px rgba(0, 229, 255, 0); border-color: #FFD700; } 
    100% { box-shadow: 0 0 0 0 rgba(0, 229, 255, 0); } 
}
.tour-active-target { 
    animation: tour-pulse 1.5s infinite !important; 
    border: 2px solid #00E5FF !important; 
    z-index: 10001 !important; 
    position: relative !important;
    background: rgba(0, 229, 255, 0.1) !important;
}

#tour-tooltip-box {
    position: fixed;
    background: #161B22;
    border: 2px solid #FFD700;
    border-radius: 12px;
    padding: 15px 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.8);
    z-index: 10002;
    display: none;
    width: 320px;
    transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

#deck-list-container { flex: 1; overflow-y: auto; border: 1px solid #30363D; border-radius: 6px; padding: 8px; background: #0D1117; min-height: 120px; }
.deck-item { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; font-size: 14px; border-bottom: 1px solid #21262D; padding-bottom: 4px; }

.search-wrapper { position: relative; }
#search-results { position: absolute; top: 100%; left: 0; width: 100%; background: #161B22; border: 1px solid #30363D; border-radius: 6px; max-height: 250px; overflow-y: auto; z-index: 2000; display: none; box-shadow: 0 5px 15px rgba(0,0,0,0.5); }
.search-result-item { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-bottom: 1px solid #21262D; cursor: pointer; }
.search-result-item:hover { background: #30363D; }
.search-result-item img { width: 35px; height: 50px; object-fit: contain; border-radius: 3px; }

.marquee-container { width: 100%; overflow: hidden; white-space: nowrap; background: rgba(255, 152, 0, 0.08); border: 1px solid #FF9800; border-radius: 6px; padding: 8px; margin-top: 10px; color: #FFB74D; font-size: 13px; }
.marquee-content { display: inline-block; padding-left: 100%; animation-name: marquee-anim; animation-timing-function: linear; animation-iteration-count: infinite; } 
@keyframes marquee-anim { 0% { transform: translate(0, 0); } 100% { transform: translate(-100%, 0); } }
.disclaimer-box { margin-top: 5px; padding: 8px; background-color: rgba(0, 0, 0, 0.4); border-left: 3px solid #E53935; border-radius: 4px; font-size: 11px; color: #999; line-height: 1.4; }

#main-view { flex: 1; display: flex; flex-direction: column; overflow-y: auto; overflow-x: auto; padding: 20px; gap: 20px; background: #0D1117; position: relative; min-width: 900px; }

details#prob-panel { background: #161B22; border: 1px solid #30363D; border-radius: 8px; padding: 15px; transition: 0.3s ease; }
details#prob-panel summary { color: #00E5FF; font-weight: bold; font-size: 18px; cursor: pointer; outline: none; list-style: none; display: flex; align-items: center; justify-content: space-between; }
details#prob-panel summary::-webkit-details-marker { display: none; }
.arrow-badge { margin-left: 12px; background: #21262D; border: 1px solid #30363D; color: #00E5FF; padding: 4px 12px; border-radius: 20px; font-size: 13px; display: inline-flex; align-items: center; gap: 6px; transition: 0.2s; }
details#prob-panel summary:hover .arrow-badge { background: #30363D; color: #FFF; }
.arrow-symbol { display: inline-block; transition: transform 0.3s ease; font-size: 12px; }
details#prob-panel[open] .arrow-symbol { transform: rotate(180deg); }

.prob-grid { display: grid; grid-template-columns: 1.2fr 1.5fr 1fr; gap: 20px; margin-top: 15px; }
.prob-card { background: #0D1117; border: 1px solid #30363D; border-radius: 6px; padding: 15px; }

input[type="radio"] { width: 18px; height: 18px; cursor: pointer; accent-color: #00E5FF; }
.target-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; background: #21262D; padding: 8px; border-radius: 6px; border-left: 3px solid #00E5FF; }

#ab-board { display: flex; gap: 10px; margin-top: 15px; overflow-x: auto; padding-bottom: 10px; }
.ab-item { min-width: 180px; background: #21262D; border-top: 4px solid #444; border-radius: 6px; padding: 12px; flex-shrink: 0; position: relative; cursor: pointer; transition: 0.2s; }
.ab-item:hover { background: #30363D; transform: translateY(-2px); }

.battle-container { display: flex; gap: 30px; flex: 1; min-height: 600px; overflow-x: auto; }
.col-left { width: 280px; flex-shrink: 0; }
.col-center { flex: 1; display: flex; flex-direction: column; gap: 20px; min-width: 820px; padding: 0 10px; } 
.col-right { width: 280px; flex-shrink: 0; }

/* 💡 緊湊標題樣式 (修復括號被 Flex 推開的問題) */
.zone-title { font-weight: bold; color: #58A6FF; margin-bottom: 10px; font-size: 16px; display: flex; justify-content: space-between; align-items: center; }
.zone-title-compact { display: flex; align-items: center; gap: 6px; font-weight: bold; color: #58A6FF; font-size: 16px; margin-bottom: 10px; }

.drop-zone { border: 2px dashed #30363D; border-radius: 8px; background: rgba(255,255,255,0.02); display: flex; flex-wrap: wrap; gap: 10px; padding: 12px; min-height: 195px; }
.drop-zone.dragover { border-color: #00E5FF; background: rgba(0, 229, 255, 0.05); }

.drop-zone-stacked { position: relative; display: flex; justify-content: center; align-items: center; overflow: visible; min-height: 195px; }
.prize-grid { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: repeat(3, 1fr); gap: 12px; border: none; padding: 0; }
.prize-slot { border: 2px dashed #30363D; border-radius: 6px; height: 183px; display: flex; align-items: center; justify-content: center; }

.field-row { display: flex; justify-content: center; gap: 30px; }
.stadium-zone { width: 150px; border: 2px dashed #FF9800; border-radius: 8px; display: flex; justify-content: center; align-items: center; position: relative; background: rgba(255, 152, 0, 0.05); }
.active-zone { width: 150px; border: 2px dashed #E53935; border-radius: 8px; display: flex; justify-content: center; align-items: center; position: relative; background: rgba(229, 57, 53, 0.05); }

#bench-container { display: grid; grid-template-columns: repeat(5, 150px); gap: 12px; justify-content: center; margin-top: 10px; min-height: 195px; }

.card-wrapper { width: 128px; height: 178px; border-radius: 6px; cursor: grab; position: relative; transition: transform 0.1s; flex-shrink: 0; }
.card-wrapper:hover { transform: translateY(-5px) scale(1.05); z-index: 900 !important; }
.card-wrapper img { width: 100%; height: 100%; object-fit: contain; border-radius: 6px; box-shadow: 2px 2px 8px rgba(0,0,0,0.6); pointer-events: none; }
.card-name-overlay { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 90%; color: #FFF; text-shadow: 1px 1px 3px #000, -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000; font-weight: bold; font-size: 14px; text-align: center; pointer-events: none; }

.card-action-menu { display: none; position: absolute; top: -35px; left: 50%; transform: translateX(-50%); background: #161B22; border: 1px solid #58A6FF; border-radius: 6px; padding: 4px; z-index: 950; white-space: nowrap; gap: 4px; }
.card-wrapper:hover .card-action-menu { display: flex; }
.card-btn { background: #30363D; color: white; border: none; padding: 4px 8px; font-size: 12px; cursor: pointer; border-radius: 4px; font-weight: bold; }
.card-btn:hover { background: #58A6FF; }

.hand-badge { position: absolute; top: -8px; left: -8px; background: #FFD700; color: #000; border-radius: 12px; padding: 4px 8px; font-weight: bold; font-size: 15px; z-index: 20; box-shadow: 0 2px 4px rgba(0,0,0,0.5); pointer-events: none; }

#zone-hand { display: flex; flex-wrap: nowrap; justify-content: center; align-items: center; padding: 40px 20px 20px 20px; min-height: 250px; border: 2px dashed #30363D; border-radius: 8px; background: rgba(255,255,255,0.02); overflow: visible; }
#zone-hand .card-wrapper { margin-left: -60px; transform-origin: bottom center; transform: translateY(var(--fan-y, 0)) rotate(var(--fan-rot, 0)); transition: 0.2s cubic-bezier(0.2, 0.8, 0.2, 1); box-shadow: -4px 0 10px rgba(0,0,0,0.6); }
#zone-hand .card-wrapper:first-child { margin-left: 0; box-shadow: 2px 2px 8px rgba(0,0,0,0.6); }
#zone-hand .card-wrapper:hover { transform: translateY(calc(var(--fan-y, 0) - 40px)) scale(1.2) rotate(0deg); z-index: 1000 !important; box-shadow: 0 15px 30px rgba(0,0,0,0.8); }

.modal-overlay { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(0,0,0,0.85); z-index: 9999; display: none; justify-content: center; align-items: center; }
.modal-card { background: #161B22; padding: 25px; border-radius: 12px; border: 1px solid #30363D; width: 90vw; max-width: 950px; max-height: 92vh; display: flex; flex-direction: column; }
.modal-card.tutorial-card { max-width: 1100px !important; width: 95vw; height: 82vh; max-height: 760px; } 
.modal-header { flex-shrink: 0; margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center; }
.modal-body { flex: 1; overflow-y: auto; padding-right: 5px; }
.modal-footer { flex-shrink: 0; padding-top: 15px; margin-top: 15px; border-top: 1px solid #30363D; display: flex; justify-content: flex-end; gap: 10px; }

.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 15px; margin: 5px 0; }
.gallery-item { text-align: center; cursor: pointer; transition: 0.2s; position: relative; border-radius: 6px; padding: 2px; }
.gallery-item:hover { transform: scale(1.05); }
.gallery-item.selected { border: 3px solid #00E5FF; background: rgba(0, 229, 255, 0.2); transform: scale(1.05); }
.gallery-item img { width: 128px; height: 178px; border-radius: 6px; object-fit: contain; }

.qty-control { position: absolute; bottom: 0; left: 0; width: 100%; display: flex; justify-content: space-between; align-items: center; background: rgba(0,0,0,0.8); padding: 4px; border-radius: 0 0 6px 6px; z-index: 10; }
.qty-btn { background: #444; color: white; border: none; width: 22px; height: 22px; border-radius: 50%; font-weight: bold; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.qty-btn:hover { background: #58A6FF; }

.badge { position: absolute; top: -8px; right: -8px; background: #E91E63; color: white; border-radius: 12px; padding: 4px 8px; font-weight: bold; font-size:12px; z-index: 5; }
.check-badge { position: absolute; bottom: 30px; right: 5px; background: #00E5FF; color: black; border-radius: 50%; width: 28px; height: 28px; font-size: 18px; font-weight: bold; display: none; align-items: center; justify-content: center; z-index: 5;}
.gallery-item.selected .check-badge { display: flex; }

#history-controls { position: fixed; bottom: 20px; right: 20px; display: flex; gap: 10px; z-index: 9000; }
.history-btn { background: #21262D; border: 1px solid #30363D; color: #FFF; padding: 8px 12px; border-radius: 30px; cursor: pointer; font-weight: bold; box-shadow: 0 4px 10px rgba(0,0,0,0.5); transition: 0.2s; display:flex; align-items:center; gap:5px;}
.history-btn:hover { background: #30363D; transform: translateY(-2px); }
.history-btn:disabled { opacity: 0.3; cursor: not-allowed; transform: none; }

.color-dot { width: 16px; height: 16px; border-radius: 50%; cursor: pointer; border: 1px solid #000; transition: 0.2s; }
.color-dot:hover { transform: scale(1.3); border-color: #FFF; }

.tut-content { height: 100%; display: flex; flex-direction: column; }
.tut-img { max-width: 100%; max-height: 48vh; width: auto; height: auto; object-fit: contain; display: block; margin: 0 auto 15px auto; border-radius: 8px; border: 1px solid #444; background-color: #0D1117; }

.login-btn { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; padding: 12px; border-radius: 8px; font-weight: bold; cursor: pointer; transition: 0.2s; border: 1px solid #00E5FF; margin-top: 8px; background: #0D1117; color: #00E5FF; }
.login-btn:hover:not(:disabled) { background: #00E5FF; color: #000; }
.login-btn:disabled { border-color: #444 !important; color: #666 !important; cursor: not-allowed !important; background: #161B22 !important; }

.legal-link { color: #58A6FF; text-decoration: underline; cursor: pointer; font-weight: bold; }
.legal-link:hover { color: #79C0FF; }

.status-badge { display: inline-block; width: 85px; font-weight: bold; }

@media (max-width: 768px) {
    body { flex-direction: column; overflow-y: auto; }
    #sidebar { width: 100% !important; height: auto; border-right: none; border-bottom: 1px solid #30363D; }
    #main-view { min-width: 100%; zoom: 0.85; padding: 10px; }
    .battle-container { min-height: 500px; }
}
