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

:root {
    /* 背景色 - 深色主題 */
    --bg-primary: #333;
    --bg-secondary: #222;
    --bg-tertiary: #191919;
    --bg-card: #282828;
    --bg-card-hover: #363636;

    /* 文字顏色 */
    --text-primary: #eee;
    --text-secondary: #ccc;
    --text-muted: #888;

    /* 強調色 */
    --accent: #5C6E8E;
    --accent-hover: #6d7f9f;
    --accent-gold: #917D54;

    /* 狀態顏色 */
    --success: #5a9c69;
    --warning: #917D54;
    --error: #dc3545;

    /* 邊框與陰影 */
    --border: #191919;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4);

    /* 隊伍類型顏色 */
    --party-8: #917D54;
    --party-1: #5C6E8E;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Microsoft JhengHei', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 1.5rem 2rem;
}

header {
    text-align: center;
    padding: 1rem 2rem;
    background: var(--bg-tertiary);
    margin-bottom: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.3);
}

header h1 {
    font-size: 2rem;
    margin-bottom: 5px;
    color: var(--text-primary);
}

/* Header 按鈕區 */
.header-buttons {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 15px;
    flex-wrap: wrap;
}

.btn-header {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.btn-header svg {
    flex-shrink: 0;
}

.btn-discord {
    background: #5865F2;
    color: white;
}

.btn-discord:hover {
    background: #4752C4;
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.btn-coffee {
    background: var(--accent-gold);
    color: white;
}

.btn-coffee:hover {
    background: #7a6a48;
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.hidden {
    display: none !important;
}

/* Step Sections */
.step-section {
    margin-bottom: 30px;
}

.step-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

.step-title {
    font-size: 1.3rem;
    color: var(--text-primary);
    margin-bottom: 15px;
}

.step-header .step-title {
    margin-bottom: 0;
}

/* Back Button */
.btn-back {
    padding: 8px 16px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.btn-back:hover {
    background: var(--border);
    border-color: var(--accent);
}

/* Grade Grid */
.grade-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}

.grade-btn {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}

.grade-btn:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
    background: var(--bg-card-hover);
}

.grade-btn.party-8 {
    border-left: 4px solid var(--party-8);
}

.grade-btn.party-1 {
    border-left: 4px solid var(--party-1);
}

.grade-btn.special {
    background: var(--bg-card);
    border-color: var(--success);
}

.grade-label {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--accent-gold);
}

.grade-btn.special .grade-label {
    color: var(--success);
}

.grade-name {
    font-size: 0.9rem;
    color: var(--text-primary);
    margin: 5px 0;
}

.grade-meta {
    display: flex;
    gap: 8px;
    margin-top: 5px;
}

.party-badge, .expansion-badge {
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 4px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.party-badge {
    background: var(--bg-tertiary);
}

.grade-btn.party-8 .party-badge {
    color: var(--party-8);
}

.grade-btn.party-1 .party-badge {
    color: var(--party-1);
}

/* 採集地點資訊 */
.gathering-info {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 8px;
    margin-top: 6px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.gathering-level {
    color: var(--accent-gold);
    font-weight: 500;
}

.gathering-zones {
    opacity: 0.85;
}

/* Map Grid */
.map-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.map-btn {
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border: 1px solid transparent;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s;
}

.map-btn:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
    background: var(--bg-card-hover);
}

.map-btn-image {
    width: 100%;
    aspect-ratio: 1;
    overflow: hidden;
}

.map-btn-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.map-btn:hover .map-btn-image img {
    transform: scale(1.05);
}

.map-btn-info {
    padding: 12px;
    text-align: center;
}

.map-btn-name {
    display: block;
    font-weight: bold;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.map-letter {
    display: inline-block;
    background: var(--accent);
    color: white;
    width: 22px;
    height: 22px;
    line-height: 22px;
    text-align: center;
    border-radius: 4px;
    font-size: 0.85rem;
    margin-right: 6px;
}

.map-btn-count {
    font-size: 0.85rem;
    color: var(--accent-gold);
}

/* ============================================
   Teamcraft 風格藏寶圖布局
   ============================================ */

/* 主要布局：藏寶圖卡片為主，側邊小地圖 */
.treasure-layout {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

/* 藏寶圖卡片網格區域 */
.treasure-grid-wrapper {
    flex: 1;
    min-width: 0;
}

/* Teamcraft 風格網格：使用 flex wrap */
.treasure-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

/* ============================================
   Teamcraft 風格藏寶圖卡片 (218x189 像素)
   ============================================ */
.treasure-map {
    position: relative;
    width: 218px;
    height: 189px;
    overflow: hidden;
    cursor: pointer;
    border-radius: 4px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.treasure-map:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.treasure-map.active {
    box-shadow: 0 0 0 3px var(--accent-gold), var(--shadow-lg);
}

/* 地圖背景容器 - Teamcraft 原版樣式 */
.map-background-container {
    position: absolute;
    top: 0;
    left: 0;
    overflow: hidden;
    height: 90%;
    width: 90%;
    transform: translateX(5%) translateY(5%);
    border-radius: 3px;
}

/* 地圖背景圖片 */
.map-background {
    position: absolute;
    width: 2048px;
    height: 2048px;
}

/* 藏寶圖前景框架 */
.map-foreground {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    background-image: url('../assets/icons/treasure_map.png');
    background-size: 100% 100%;
    pointer-events: none;
}

/* 藏寶點標記 (中心 X) */
.treasure-marker-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translateX(-50%) translateY(-50%);
    z-index: 3;
    width: 24px;
    height: 24px;
}

.treasure-marker-icon img {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.8));
}

/* 卡片編號 - 左上角 */
.card-number {
    position: absolute;
    z-index: 5;
    top: 8px;
    left: 12px;
    font-size: 24px;
    font-weight: bold;
    color: white;
}

/* 座標顯示 - 右上角 */
.position {
    position: absolute;
    z-index: 5;
    top: 12px;
    right: 16px;
    font-size: 14px;
    font-weight: bold;
    color: white;
}

.shadow-text {
    text-shadow: 0 0 5px black, 0 0 3px black;
}

/* 隊伍人數顯示 - 左下角 */
.player-count {
    position: absolute;
    z-index: 5;
    bottom: 12px;
    left: 16px;
    height: 32px;
    width: 80px;
    border-radius: 4px;
    background: linear-gradient(90deg, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0) 100%);
    display: flex;
    align-items: center;
    padding-left: 8px;
    gap: 6px;
}

/* 複製座標按鈕 - 右下角 */
.copy-pos-btn {
    position: absolute;
    z-index: 5;
    bottom: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.7);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.copy-pos-btn:hover {
    background: var(--accent);
    transform: scale(1.1);
}

.copy-pos-btn.copied {
    background: var(--success);
}

.copy-pos-btn.copied::after {
    content: '✓';
    position: absolute;
    font-size: 12px;
}

.player-icon {
    width: 20px;
    height: 20px;
}

.player-icon img {
    width: 100%;
    height: 100%;
}

.party-size {
    font-size: 14px;
    font-weight: bold;
    color: white;
}

/* ============================================
   側邊小地圖面板
   ============================================ */
.side-map-panel {
    width: 280px;
    flex-shrink: 0;
    position: sticky;
    top: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
}

.side-map-container {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    border-radius: 6px;
    overflow: hidden;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
}

.side-map-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.map-markers {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* 側邊地圖上的標記點 */
.map-marker {
    position: absolute;
    width: 20px;
    height: 20px;
    transform: translate(-50%, -50%);
    cursor: pointer;
    pointer-events: auto;
    transition: transform 0.2s;
    z-index: 10;
    background: var(--accent);
    border: 2px solid white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: bold;
    color: white;
}

.map-marker:hover {
    transform: translate(-50%, -50%) scale(1.3);
    z-index: 15;
    background: var(--accent-hover);
}

.map-marker.active {
    transform: translate(-50%, -50%) scale(1.4);
    background: var(--accent-gold);
    z-index: 20;
}

/* 選中標記動畫 */
.selected-marker {
    position: absolute;
    width: 32px;
    height: 32px;
    transform: translate(-50%, -50%);
    z-index: 25;
    pointer-events: none;
    animation: pulse 1.5s infinite;
}

.selected-marker img {
    width: 100%;
    height: 100%;
}

@keyframes pulse {
    0%, 100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 0.8;
    }
}

/* 側邊地圖資訊 */
.side-map-info {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.side-map-info p {
    font-size: 0.9rem;
    margin-bottom: 6px;
    color: var(--text-primary);
}

.side-map-info strong {
    color: var(--text-secondary);
}

/* ============================================
   響應式設計
   ============================================ */
@media (max-width: 900px) {
    .treasure-layout {
        flex-direction: column-reverse;
    }

    .side-map-panel {
        width: 100%;
        position: static;
    }

    .side-map-container {
        max-width: 300px;
        margin: 0 auto;
    }

    .treasure-grid {
        justify-content: center;
    }
}

@media (max-width: 500px) {
    .treasure-map {
        width: 100%;
        max-width: 218px;
        height: auto;
        aspect-ratio: 218 / 189;
    }

    .map-background {
        width: 2048px;
        height: 2048px;
    }
}

/* Footer */
footer {
    margin-top: 2rem;
    padding: 1rem;
    text-align: center;
    background: var(--bg-card);
    border-radius: 8px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.footer-links {
    margin-bottom: 0.75rem;
}

.footer-links p {
    margin: 0;
    font-size: 0.9rem;
}

.footer-credits p {
    margin-bottom: 4px;
}

.copyright {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
    font-size: 0.75rem;
    color: var(--text-muted);
}

footer a {
    color: var(--accent-gold);
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
    color: var(--accent-hover);
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* ============================================
   隊伍功能樣式
   ============================================ */

/* 隊伍按鈕 */
.btn-party {
    background: var(--accent);
    color: white;
}

.btn-party:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.btn-party-join {
    background: var(--success);
}

.btn-party-join:hover {
    background: #4a8c59;
}

.btn-party-leave {
    background: var(--error);
}

.btn-party-leave:hover {
    background: #c82333;
}

/* 連線狀態指示器 */
.connection-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    background: var(--bg-tertiary);
}

.connection-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
}

.connection-status.connected .connection-dot {
    background: var(--success);
    animation: pulse-dot 2s infinite;
}

.connection-status.disconnected .connection-dot {
    background: var(--error);
}

.connection-status.syncing .connection-dot {
    background: var(--warning);
    animation: pulse-dot 0.5s infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Modal 樣式 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 24px;
    max-width: 420px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    transform: translateY(-20px);
    transition: transform 0.3s;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
}

.modal-overlay.active .modal {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.modal-title {
    font-size: 1.3rem;
    font-weight: bold;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    font-size: 1.5rem;
    line-height: 1;
    transition: color 0.2s;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    margin-bottom: 20px;
}

.modal-footer {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* 表單輸入 */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.form-input {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 1rem;
    transition: border-color 0.2s;
}

.form-input:focus {
    outline: none;
    border-color: var(--accent);
}

.form-input::placeholder {
    color: var(--text-muted);
}

.form-input.code-input {
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 1.3rem;
    text-align: center;
    letter-spacing: 3px;
    text-transform: uppercase;
}

.form-hint {
    margin-top: 6px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.form-error {
    color: var(--error);
}

/* 隊伍代碼顯示 */
.party-code-display {
    background: var(--bg-tertiary);
    border: 2px dashed var(--accent);
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    margin: 16px 0;
}

.party-code {
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 2rem;
    font-weight: bold;
    color: var(--accent-gold);
    letter-spacing: 4px;
    margin-bottom: 12px;
}

.copy-code-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.copy-code-btn:hover {
    background: var(--accent-hover);
}

.copy-code-btn.copied {
    background: var(--success);
}

/* 邀請連結按鈕 */
.btn-invite-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
    margin-left: 8px;
}

.btn-invite-link:hover {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

.btn-invite-link.copied {
    background: var(--success);
    color: white;
    border-color: var(--success);
}

/* 邀請代碼輸入框 (從連結加入時鎖定) */
.invite-code {
    background: var(--bg-tertiary) !important;
    color: var(--accent-gold) !important;
    font-weight: bold;
    cursor: not-allowed;
}

/* 邀請連結區塊 (建立隊伍後顯示) */
.invite-link-section {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    text-align: center;
}

.btn-invite-link-lg {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    background: linear-gradient(135deg, var(--accent) 0%, #6366f1 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.2s;
    width: 100%;
}

.btn-invite-link-lg:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.btn-invite-link-lg.copied {
    background: linear-gradient(135deg, var(--success) 0%, #4ade80 100%);
}

.invite-hint {
    margin-top: 8px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* 按鈕樣式 */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-primary:hover {
    background: var(--accent-hover);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: #4a8c59;
}

.btn-danger {
    background: var(--error);
    color: white;
}

.btn-danger:hover {
    background: #c82333;
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--border);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.85rem;
}

.btn-block {
    width: 100%;
}

/* 隊伍面板 */
.party-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 20px;
}

.party-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.party-panel-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1rem;
    font-weight: bold;
    color: var(--text-primary);
}

.party-panel-code {
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.9rem;
    color: var(--accent-gold);
    background: var(--bg-tertiary);
    padding: 2px 8px;
    border-radius: 4px;
}

/* 成員列表 */
.members-section {
    margin-bottom: 16px;
}

.section-title {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.members-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.member-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: var(--bg-tertiary);
    border-radius: 16px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.member-tag.is-self {
    background: var(--accent);
    color: white;
}

.member-tag.is-leader::after {
    content: '★';
    color: var(--accent-gold);
    margin-left: 2px;
}

/* 修改暱稱按鈕 */
.btn-edit-nickname {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    padding: 0;
    margin-left: 4px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    color: inherit;
    cursor: pointer;
    opacity: 0.7;
    transition: all 0.2s;
}

.btn-edit-nickname:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.btn-edit-nickname svg {
    width: 10px;
    height: 10px;
}

/* 隊伍藏寶圖列表 */
.party-treasures-section {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.party-treasures-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 200px;
    overflow-y: auto;
}

.party-treasure-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: var(--bg-tertiary);
    border-radius: 6px;
    transition: background 0.2s;
}

.party-treasure-item:hover {
    background: var(--bg-secondary);
}

.party-treasure-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.party-treasure-name {
    font-size: 0.9rem;
    color: var(--text-primary);
}

.party-treasure-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.party-treasure-coords {
    color: var(--accent-gold);
}

.party-treasure-remove {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    transition: color 0.2s;
}

.party-treasure-remove:hover {
    color: var(--error);
}

/* 空狀態 */
.empty-state {
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* 藏寶圖卡片上的隊伍按鈕 */
.add-to-party-btn {
    position: absolute;
    z-index: 5;
    bottom: 12px;
    right: 50px;
    width: 32px;
    height: 32px;
    border-radius: 4px;
    background: rgba(90, 156, 105, 0.85);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.add-to-party-btn:hover {
    background: var(--success);
    transform: scale(1.1);
}

/* Firebase 未設定警告 */
.firebase-warning {
    background: var(--warning);
    color: white;
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 0.9rem;
}

.firebase-warning a {
    color: white;
    text-decoration: underline;
}

/* ============================================
   隊伍模式面板 - 完整版
   ============================================ */

.party-mode-panel {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    border: 2px solid var(--accent);
}

.party-mode-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    gap: 12px;
}

.party-mode-info {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.party-mode-title {
    font-size: 1.4rem;
    color: var(--accent-gold);
    margin: 0;
}

/* 隊伍過期倒數計時 */
.party-expiry {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: var(--bg-tertiary);
    border-radius: 6px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.party-expiry::before {
    content: '剩餘時間:';
    color: var(--text-muted);
}

.expiry-time {
    font-family: 'Consolas', 'Monaco', monospace;
    font-weight: bold;
    color: var(--text-primary);
}

.expiry-time.expiry-warning {
    color: var(--warning);
    animation: pulse-expiry 1s infinite;
}

.expiry-expired {
    color: var(--error);
    font-weight: bold;
}

@keyframes pulse-expiry {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.party-code-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-tertiary);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.9rem;
}

.party-code-badge code {
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 1rem;
    color: var(--accent-gold);
    letter-spacing: 1px;
}

.party-mode-actions {
    display: flex;
    gap: 10px;
}

.btn-icon {
    background: var(--bg-tertiary);
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: var(--accent);
    color: white;
}

.btn-icon:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-icon:disabled:hover {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.btn-text {
    background: var(--bg-tertiary);
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.8rem;
    transition: all 0.2s;
}

.btn-text:hover {
    background: var(--success);
    color: white;
}

.btn-text:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-text:disabled:hover {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

/* 成員列 */
.party-members-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    padding: 10px 14px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    flex-wrap: wrap;
}

.members-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    white-space: nowrap;
}

/* 主要內容區 */
.party-mode-content {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 20px;
    min-height: 400px;
}

/* 路線列表 */
.party-route-list {
    background: var(--bg-secondary);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.route-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border);
}

.route-list-header h3 {
    font-size: 1rem;
    margin: 0;
    color: var(--text-primary);
}

.route-actions {
    display: flex;
    gap: 8px;
}

.route-items {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.route-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    text-align: center;
    padding: 40px;
}

.route-empty .hint {
    font-size: 0.85rem;
    margin-top: 8px;
}

/* 路線項目卡片 */
.route-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-card);
    border-radius: 8px;
    border: 2px solid transparent;
    transition: all 0.2s;
    cursor: pointer;
}

.route-item:hover {
    border-color: var(--accent);
}

.route-item.active {
    border-color: var(--accent-gold);
    background: var(--bg-card-hover);
}

.route-item.completed {
    opacity: 0.5;
}

.route-item.completed .route-item-info {
    text-decoration: line-through;
}

.route-item-order {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.route-item-number {
    width: 28px;
    height: 28px;
    background: var(--accent);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.9rem;
}

.route-item.active .route-item-number {
    background: var(--accent-gold);
}

.route-item.completed .route-item-number {
    background: var(--success);
}

.route-item.completed .route-item-number::after {
    content: '✓';
}

.route-item.completed .route-item-number span {
    display: none;
}

.route-order-btns {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.route-order-btns button {
    background: var(--bg-tertiary);
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 6px;
    line-height: 1;
    font-size: 10px;
    border-radius: 3px;
    transition: all 0.2s;
}

.route-order-btns button:hover {
    background: var(--accent);
    color: white;
}

.route-item-info {
    flex: 1;
    min-width: 0;
}

.route-item-map {
    font-weight: bold;
    color: var(--text-primary);
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.route-item-details {
    display: flex;
    gap: 12px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.route-item-coords {
    color: var(--accent-gold);
    font-family: 'Consolas', 'Monaco', monospace;
}

.route-item-aetheryte {
    color: #e2e8f0;
}

.route-item-aetheryte .aetheryte-icon {
    color: #38bdf8;
}

.route-item-actions {
    display: flex;
    gap: 6px;
}

.route-item-actions button {
    background: var(--bg-tertiary);
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px;
    border-radius: 4px;
    transition: all 0.2s;
}

.route-item-actions button:hover {
    background: var(--accent);
    color: white;
}

.route-item-actions button.btn-complete:hover {
    background: var(--success);
}

.route-item-actions button.btn-remove:hover {
    background: var(--error);
}

.route-item-actions button.btn-copy-coords-party.copied {
    background: var(--success);
    color: white;
}

/* 地圖預覽 */
.party-map-preview {
    background: var(--bg-secondary);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.map-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border);
}

.map-preview-header h3 {
    font-size: 1rem;
    margin: 0;
    color: var(--text-primary);
}

.map-select {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.85rem;
}

.map-preview-container {
    position: relative;
    aspect-ratio: 1;
    background: var(--bg-tertiary);
    overflow: hidden;
}

.preview-map-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.preview-map-markers {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.preview-marker {
    position: absolute;
    transform: translate(-50%, -50%);
    width: 24px;
    height: 24px;
    background: var(--accent);
    border: 2px solid white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: bold;
    color: white;
    pointer-events: auto;
    cursor: pointer;
    transition: all 0.2s;
    z-index: 10;
}

.preview-marker:hover {
    transform: translate(-50%, -50%) scale(1.2);
    z-index: 15;
}

.preview-marker.active {
    background: var(--accent-gold);
    transform: translate(-50%, -50%) scale(1.3);
    z-index: 20;
}

.preview-marker.completed {
    background: var(--success);
    opacity: 0.6;
}

.map-preview-info {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-align: center;
}

/* ============================================
   藏寶點放大預覽 (隊伍模式)
   ============================================ */
.treasure-zoom-preview {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
}

.treasure-zoom-header {
    margin-bottom: 10px;
}

.treasure-zoom-title {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.treasure-zoom-card {
    position: relative;
    width: 100%;
    max-width: 320px;
    height: 277px;
    margin: 0 auto;
    overflow: hidden;
    border-radius: 4px;
    box-shadow: 0 0 0 3px var(--accent-gold), var(--shadow-lg);
}

/* 放大圖地圖背景容器 */
.zoom-map-background-container {
    position: absolute;
    top: 0;
    left: 0;
    overflow: hidden;
    height: 90%;
    width: 90%;
    transform: translateX(5%) translateY(5%);
    border-radius: 3px;
}

/* 放大圖地圖背景 */
.zoom-map-background {
    position: absolute;
    width: 2048px;
    height: 2048px;
}

/* 放大圖前景框架 */
.zoom-map-foreground {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    background-image: url('../assets/icons/treasure_map.png');
    background-size: 100% 100%;
    pointer-events: none;
}

/* 放大圖藏寶點標記 */
.zoom-treasure-marker-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translateX(-50%) translateY(-50%);
    z-index: 3;
    width: 36px;
    height: 36px;
    animation: zoom-pulse 1.5s infinite;
}

.zoom-treasure-marker-icon img {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 0 4px rgba(0, 0, 0, 0.8));
}

@keyframes zoom-pulse {
    0%, 100% {
        transform: translateX(-50%) translateY(-50%) scale(1);
    }
    50% {
        transform: translateX(-50%) translateY(-50%) scale(1.15);
    }
}

/* 放大圖編號 */
.zoom-card-number {
    position: absolute;
    z-index: 5;
    top: 12px;
    left: 18px;
    font-size: 32px;
    font-weight: bold;
    color: white;
}

/* 放大圖座標 */
.zoom-position {
    position: absolute;
    z-index: 5;
    top: 16px;
    right: 22px;
    font-size: 18px;
    font-weight: bold;
    color: white;
}

/* 放大圖傳送點 */
.zoom-aetheryte {
    position: absolute;
    z-index: 5;
    top: 44px;
    right: 22px;
    font-size: 0.85rem;
    color: #e2e8f0;
    background: rgba(0, 0, 0, 0.6);
    padding: 3px 8px;
    border-radius: 3px;
}

/* 響應式 - 放大圖 */
@media (max-width: 900px) {
    .treasure-zoom-card {
        max-width: 280px;
        height: 243px;
    }

    .zoom-card-number {
        font-size: 28px;
    }

    .zoom-position {
        font-size: 16px;
    }
}

/* 響應式 - 隊伍模式 */
@media (max-width: 900px) {
    .party-mode-content {
        grid-template-columns: 1fr;
    }

    .party-map-preview {
        order: -1;
    }

    .map-preview-container {
        max-height: 300px;
    }
}

@media (max-width: 600px) {
    .party-mode-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .party-mode-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .party-mode-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
}

/* 響應式調整 */
@media (max-width: 600px) {
    .modal {
        padding: 16px;
        width: 95%;
    }

    .party-code {
        font-size: 1.5rem;
        letter-spacing: 2px;
    }

    .party-panel {
        padding: 12px;
    }

    .header-buttons {
        flex-direction: column;
        align-items: center;
    }

    .btn-header {
        width: 100%;
        max-width: 250px;
        justify-content: center;
    }
}

/* ============================================
   重連按鈕樣式
   ============================================ */

#btn-reconnect-party {
    background: var(--warning);
    color: white;
    animation: pulse-reconnect 2s infinite;
}

#btn-reconnect-party:hover {
    background: #7a6a48;
}

#btn-reconnect-party:disabled {
    animation: none;
    opacity: 0.8;
}

#btn-cancel-reconnect {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

#btn-cancel-reconnect:hover {
    background: var(--border);
}

@keyframes pulse-reconnect {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(145, 125, 84, 0.4);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(145, 125, 84, 0);
    }
}

/* 旋轉動畫 */
.spin {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* ============================================
   採集點功能樣式
   ============================================ */

/* 採集點按鈕 */
.btn-gathering-nodes {
    margin-top: 8px;
    padding: 4px 12px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-gathering-nodes:hover {
    background: var(--accent-hover);
    transform: scale(1.05);
}

/* Modal - 大尺寸 */
.modal-lg {
    max-width: 600px;
}

/* 職業區塊 */
.gathering-job-section {
    margin-bottom: 20px;
}

.gathering-job-section:last-child {
    margin-bottom: 0;
}

.gathering-job-title {
    font-size: 1rem;
    color: var(--accent-gold);
    margin-bottom: 12px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
}

/* 節點卡片 */
.gathering-node-card {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: 6px;
    margin-bottom: 8px;
}

.gathering-node-card:last-child {
    margin-bottom: 0;
}

.node-type {
    min-width: 80px;
    font-weight: bold;
    color: var(--text-primary);
}

.node-location {
    flex: 1;
    min-width: 150px;
    color: var(--text-primary);
}

.node-details {
    display: flex;
    align-items: center;
    gap: 10px;
}

.node-coords {
    font-family: 'Consolas', 'Monaco', monospace;
    color: var(--accent-gold);
    font-size: 0.9rem;
}


/* 地圖按鈕 */
.btn-show-map {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: var(--accent);
    border: 1px solid var(--accent);
    border-radius: 4px;
    color: white;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s;
}

.btn-show-map:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    transform: scale(1.05);
}

.btn-show-map svg {
    flex-shrink: 0;
}

/* 響應式 - 採集點 */
@media (max-width: 500px) {
    .gathering-node-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .node-details {
        width: 100%;
        justify-content: space-between;
    }
}

/* ============================================
   最近傳送點樣式
   ============================================ */

.nearest-aetheryte {
    position: absolute;
    z-index: 5;
    top: 32px;
    right: 16px;
    font-size: 0.7rem;
    color: #e2e8f0;
    background: rgba(0, 0, 0, 0.6);
    padding: 2px 6px;
    border-radius: 3px;
    cursor: default;
}

.nearest-aetheryte:hover {
    color: #7dd3fc;
}

.aetheryte-icon {
    color: #38bdf8;
}

/* 暫時隱藏複製座標按鈕 (藏寶圖卡片上的) */
.treasure-map .copy-pos-btn {
    display: none !important;
}


/* ============================================
   採集點大地圖 Modal 樣式
   ============================================ */

.gathering-map-container {
    position: relative;
    width: 100%;
    max-width: 500px;
    aspect-ratio: 1;
    margin: 0 auto;
    overflow: hidden;
    border-radius: 8px;
    background: var(--bg-tertiary);
}

.gathering-map-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gathering-map-marker {
    position: absolute;
    width: 40px;
    height: 40px;
    transform: translate(-50%, -50%);
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gathering-marker-icon {
    width: 40px;
    height: 40px;
}

.gathering-range-indicator {
    position: absolute;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(92, 200, 220, 0.15);
    border: 3px solid rgba(92, 200, 220, 0.6);
    transform: translate(-50%, -50%);
    z-index: 2;
    animation: pulse-range 2s ease-in-out infinite;
}

@keyframes pulse-range {
    0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
    50% { transform: translate(-50%, -50%) scale(1.08); opacity: 0.7; }
}

.gathering-map-info {
    margin-top: 16px;
    padding: 16px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    text-align: center;
}

.gathering-map-info-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
}

.gathering-map-info-content p {
    margin: 0;
    color: var(--text-secondary);
}

.gathering-map-info-content strong {
    color: var(--text-primary);
}

/* 響應式 - 採集點地圖 */
@media (max-width: 600px) {
    .gathering-map-container {
        max-width: 100%;
    }
}
