/* 基礎重置和根元素設定 */
        * {
            box-sizing: border-box;
        }

        html {
            font-size: 16px; /* 基準字體大小 */
            height: 100%;
        }

        body {
            box-sizing: border-box;
            margin: 0;
            padding: 0;
            font-family: 'Noto Sans TC', 'Microsoft JhengHei', sans-serif;
            background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 50%, #ffffff 100%);
            color: #333;
            overflow-x: hidden;
            min-height: 100%;
            font-size: 16px; /* 確保最小字體16px */
            line-height: 1.6;
            -webkit-user-select: none;
            -moz-user-select: none;
            -ms-user-select: none;
            user-select: none;
        }

        input,
        textarea,
        button,
        [contenteditable="true"] {
            -webkit-user-select: text;
            -moz-user-select: text;
            -ms-user-select: text;
            user-select: text;
        }

        #game,
        #game * {
            -webkit-user-select: none;
            -moz-user-select: none;
            -ms-user-select: none;
            user-select: none;
        }

        /* 小螢幕字體調整 - 寬度小於414px時最小字體14px */
        @media (max-width: 414px) {
            html {
                font-size: 14px;
            }
            
            body {
                font-size: 14px;
            }
            
            /* 小螢幕下調整標題字體 */
            .page-title {
                font-size: clamp(18px, 4vw, 24px);
            }

            .page-subtitle {
                font-size: clamp(14px, 3vw, 18px);
            }

            .homepage-title {
                font-size: clamp(24px, 5vw, 32px);
            }

            .homepage-subtitle {
                font-size: clamp(16px, 3.5vw, 20px);
            }
        }

        .container {
            width: 380px; /* 固定寬度380px */
            margin: 0 auto;
            padding: 1rem;
            box-sizing: border-box;
        }

        /* 所有頁面容器統一設定 */
        .page {
            max-width: 100%;
            width: 100%;
            margin: 0 auto;
            box-sizing: border-box;
            display: flex;
            flex-direction: column;
        }

        /* 首頁容器特殊設定 - 手機優先 */
        #homepage .container {
            max-width: 100%;
            width: 100%;
            box-shadow: none; /* 移除首頁陰影 */
        }

.nav-tabs {
            display: flex;
            justify-content: space-between;
            margin-bottom: 1.25rem;
            background: rgba(255, 255, 255, 0.95);
            border-radius: 1rem;
            padding: 0.75rem;
            gap: 0.5rem;
            position: static;
            width: 360px; /* 固定寬度360px，比容器稍小 */
            box-shadow: 0 0.25rem 1rem rgba(0, 0, 0, 0.1);
            backdrop-filter: blur(10px);
            margin: 70px auto 1.25rem auto;
        }

.language-switch {
            position: absolute;
            top: 0;
            right: 0;
            z-index: 1200;
            /* background: rgba(255, 255, 255, 0.95); */
            border-bottom-left-radius: 12px;
            padding: 8px 12px;
            /* box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1); */
            display: flex;
            align-items: center;
            gap: 8px;
            border: none;
            width: auto;
        }

        .language-option:hover {
            background: #f8f9fa;
        }

        .nav-tab {
            padding: 0.75rem 1rem;
            background: #ffffff;
            border: 2px solid #e9ecef;
            border-radius: 0.75rem;
            color: #495057;
            cursor: pointer;
            transition: all 0.3s ease;
            font-weight: 600;
            font-size: 0.9rem; /* 使用rem單位 */
            box-shadow: 0 0.125rem 0.5rem rgba(0, 0, 0, 0.1);
            flex: 1;
            white-space: nowrap;
            text-align: center;
            display: flex;
            align-items: center;
            justify-content: center;
            min-height: 2.5rem;
            min-width: 0;
        }

        .nav-tab:hover {
            background: #f8f9fa;
            border-color: #6c757d;
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
        }

        .nav-tab.active {
            background: #495057;
            color: #ffffff;
            border-color: #495057;
            transform: scale(1.05);
        }

        .page {
            display: none;
            animation: fadeIn 0.5s ease-in;
        }

        .page.active {
            display: block;
        }

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

        .page-header {
            text-align: center;
            margin-bottom: 2.5rem;
            position: relative;
            padding-top: 1rem;
        }

        .page-title {
            font-size: 1.25rem; /* 使用rem單位，固定大小 */
            font-weight: 600;
            color: #212529;
            margin-bottom: 0.75rem;
            text-align: center;
            line-height: 1.3;
        }

        .page-subtitle {
            font-size: 1rem; /* 使用rem單位，固定大小 */
            color: #6c757d;
            margin-bottom: 10px;
            font-weight: 400;
            text-align: center;
            line-height: 1.4;
        }

        .intro-text {
            font-size: 1rem;
            color: #495057;
            margin: 0 auto;
            line-height: 1.6;
            font-weight: 400;
            text-align: center;
        }

        /* 首頁樣式 */
        .home-content {
            display: grid;
            grid-template-columns: 1fr;
            gap: 2.5rem;
            margin-top: 2.5rem;
        }

        .target-selection, .tool-selection {
            background: #ffffff;
            border: 0.0625rem solid #e9ecef;
            border-radius: 1.25rem;
            padding: 1.875rem;
            box-shadow: 0 0.25rem 1.25rem rgba(0, 0, 0, 0.08);
        }

        .selection-title {
            font-size: 1.125rem; /* 使用rem單位，固定大小 */
            color: #495057;
            margin-bottom: 1.25rem;
            text-align: center;
            font-weight: 500;
        }

        .option-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(7.5rem, 1fr)); /* 120px = 7.5rem */
            gap: 0.9375rem;
        }

        .option-card {
            background: #ffffff;
            border: 2px solid #e9ecef;
            border-radius: 1rem;
            padding: 1.5rem;
            text-align: center;
            cursor: pointer;
            transition: all 0.3s ease;
            position: relative;
            overflow: hidden;
            box-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.08);
            min-height: 8rem;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
        }

        .option-card:hover {
            border-color: #6c757d;
            transform: translateY(-0.25rem);
            box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.15);
        }

        .option-card.selected {
            border-color: #495057;
            background: #f8f9fa;
            box-shadow: 0 0.5rem 1.25rem rgba(0, 0, 0, 0.2);
        }

        .option-icon {
            font-size: 2.5rem;
            margin-bottom: 0.75rem;
            display: block;
        }

        .option-name {
            font-size: 1rem;
            color: #495057;
            font-weight: 600;
            line-height: 1.3;
        }

        /* 遊戲統計資訊 (在遊戲區域內) */
        .game-stats-inline {
            display: flex;
            justify-content: center;
            gap: 1.875rem;
            margin: 0.9375rem 0;
            padding: 0.625rem;
            background: rgba(255, 255, 255, 0.9);
            border-radius: 0.625rem;
            box-shadow: 0 0.125rem 0.5rem rgba(0, 0, 0, 0.1);
        }

        .stat-item {
            text-align: center;
            flex: 1;
        }

        .stat-label {
            color: #6c757d;
            font-size: 0.75rem; /* 使用rem單位，固定大小 */
            margin-bottom: 0.3125rem;
            font-weight: 400;
        }

        .stat-value {
            font-size: 1rem; /* 使用rem單位，固定大小 */
            font-weight: 600;
            color: #495057;
        }

        /* 能量槽 (在遊戲區域底部) */
        .energy-container {
            margin-top: 1.875rem;
            width: 100%;
            max-width: min(90%, 18.75rem); /* 300px = 18.75rem */
            margin-left: auto;
            margin-right: auto;
            text-align: center;
        }

        .energy-label {
            color: #6c757d;
            font-size: 14px;
            margin-bottom: 0.5rem;
            font-weight: 400;
        }

        .energy-bar {
            width: 100%;
            height: 1rem; /* 固定高度 */
            background: #e9ecef;
            border-radius: 0.625rem;
            overflow: hidden;
            border: 0.0625rem solid #dee2e6;
            box-shadow: 0 0.125rem 0.5rem rgba(0, 0, 0, 0.1);
        }

        .energy-fill {
            height: 100%;
            background: linear-gradient(90deg, #6c757d, #495057);
            width: 75%;
            transition: width 0.3s ease;
        }

        /* 音效控制開關 */
        .sound-control {
            margin-top: 20px;
            text-align: center;
        }

        .sound-toggle {
            background: #ffffff;
            border: 2px solid #e9ecef;
            border-radius: 25px;
            padding: 10px 20px;
            cursor: pointer;
            transition: all 0.3s ease;
            display: flex;
            align-items: center;
            gap: 8px;
            font-size: 0.9em;
            font-weight: 500;
            color: #495057;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
            margin: 0 auto;
        }

        .sound-toggle:hover {
            background: #f8f9fa;
            border-color: #6c757d;
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
        }

        .sound-toggle.muted {
            background: #f8f9fa;
            border-color: #dc3545;
            color: #dc3545;
        }

        .sound-toggle.muted:hover {
            background: #fff5f5;
            border-color: #c82333;
        }

        /* 遊戲打擊區域 */
        #game {
            touch-action: manipulation;
        }

        .game-area {
            background: #ffffff;
            border: 2px solid #e9ecef;
            border-radius: 1.25rem;
            padding: 1.5rem;
            text-align: center;
            position: relative;
            height: 500px; /* 固定高度 */
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            box-shadow: 0 0.5rem 2rem rgba(0, 0, 0, 0.1);
            margin-bottom: 10px;
            width: 360px; /* 固定寬度360px */
            box-sizing: border-box;
            margin-left: auto;
            margin-right: auto;
            touch-action: manipulation;
        }

        .game-area *,
        #targetCharacter {
            touch-action: manipulation;
            -webkit-user-select: none;
        }

        .target-character {
            margin-bottom: 1.875rem;
            animation: bounce 2s infinite;
            line-height: 1;
        }

        @keyframes bounce {
            0%, 20%, 50%, 80%, 100% { transform: translateY(0) rotate(0deg); }
            40% { transform: translateY(-10px) rotate(-2deg); }
            60% { transform: translateY(-5px) rotate(2deg); }
        }

        @keyframes hitShake {
            0% { transform: translateX(0) rotate(0deg) scale(1); }
            25% { transform: translateX(-10px) rotate(-5deg) scale(0.9); }
            50% { transform: translateX(10px) rotate(5deg) scale(0.8); }
            75% { transform: translateX(-5px) rotate(-2deg) scale(0.9); }
            100% { transform: translateX(0) rotate(0deg) scale(1); }
        }

        .hit-animation {
            animation: hitShake 0.5s ease-in-out;
        }

        .hit-button {
            background: #495057;
            border: none;
            border-radius: 50%;
            width: 100px;
            height: 100px;
            font-size: 1.1em;
            color: #ffffff;
            font-weight: 500;
            cursor: pointer;
            transition: all 0.2s ease;
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
        }

        .hit-button:hover {
            background: #343a40;
            transform: scale(1.05);
            box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
        }

        .hit-button:active {
            transform: scale(0.95);
        }

        /* 整合工具選擇區域 */
        .tool-selection-integrated {
            margin-top: 1.875rem;
            text-align: center;
        }

        .tool-grid-integrated {
            display: flex;
            justify-content: center;
            gap: 0.625rem;
            margin-bottom: 1.25rem;
            flex-wrap: wrap;
        }

        .tool-button {
            background: #ffffff;
            border: 3px solid #e9ecef;
            border-radius: 50%;
            width: 44px;
            height: 44px;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition: all 0.3s ease;
            box-shadow: 0 0.25rem 1rem rgba(0, 0, 0, 0.1);
            aspect-ratio: 1;
        }

        .tool-button:hover {
            border-color: #6c757d;
            transform: translateY(-0.25rem) scale(1.05);
            box-shadow: 0 0.75rem 1.5rem rgba(0, 0, 0, 0.2);
        }

        .tool-button.selected {
            border-color: #495057;
            background: #f8f9fa;
            box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.25);
            transform: scale(1.1);
        }

        .tool-icon-integrated {
            font-size: 1.75rem;
            display: block;
        }



        /* 角色與工具展示 */
        .character-grid, .tool-grid {
            display: grid;
            grid-template-columns: 1fr;
            gap: 15px;
            margin-top: 20px;
            width: 380px;
            margin-left: auto;
            margin-right: auto;
        }

        .character-card, .tool-card {
            background: #ffffff;
            border: 1px solid #e9ecef;
            border-radius: 20px;
            padding: 25px;
            text-align: center;
            transition: all 0.3s ease;
            position: relative;
            overflow: hidden;
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
        }

        .character-card:hover, .tool-card:hover {
            transform: translateY(-10px);
            box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
        }

        .character-avatar, .tool-icon {
            font-size: 4em;
            margin-bottom: 15px;
            display: block;
        }

        .character-name, .tool-name {
            font-size: 1.3em;
            color: #495057;
            font-weight: 600;
            margin-bottom: 10px;
        }

        .character-desc, .tool-desc {
            color: #6c757d;
            font-size: 1em;
            line-height: 1.4;
            font-weight: 400;
        }

        /* 儀式感設定 */
        .ritual-settings {
            display: grid;
            grid-template-columns: 1fr;
            gap: 30px;
            margin-top: 30px;
        }

        .audio-settings, .visual-settings {
            background: #ffffff;
            border: 1px solid #e9ecef;
            border-radius: 20px;
            padding: 30px;
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
        }

        .setting-group {
            margin-bottom: 25px;
        }

        .setting-label {
            color: #495057;
            font-size: 1.1em;
            margin-bottom: 15px;
            font-weight: 600;
        }

        .audio-option, .visual-option {
            background: #f8f9fa;
            border: 2px solid #e9ecef;
            border-radius: 10px;
            padding: 15px;
            margin-bottom: 10px;
            cursor: pointer;
            transition: all 0.3s ease;
            display: flex;
            align-items: center;
            gap: 15px;
        }

        .audio-option:hover, .visual-option:hover {
            border-color: #6c757d;
            background: #ffffff;
        }

        .audio-option.selected, .visual-option.selected {
            border-color: #495057;
            background: #ffffff;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
        }

        /* AI互動頁面 */
        .ai-features {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
            gap: 30px;
            margin-top: 30px;
        }

        .ai-feature {
            background: #ffffff;
            border: 1px solid #e9ecef;
            border-radius: 20px;
            padding: 30px;
            text-align: center;
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
        }

        .ai-icon {
            font-size: 3em;
            margin-bottom: 20px;
            color: #6c757d;
        }

        .ai-title {
            font-size: 1.4em;
            color: #495057;
            margin-bottom: 15px;
            font-weight: 600;
        }

        .ai-description {
            color: #6c757d;
            line-height: 1.5;
            font-weight: 400;
        }

        /* 排行榜 */
        .leaderboard {
            background: #ffffff;
            border: 1px solid #e9ecef;
            border-radius: 20px;
            padding: 30px;
            margin-top: 30px;
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
            width: 380px;
            margin-left: auto;
            margin-right: auto;
            box-sizing: border-box;
        }

        .rank-item {
            display: flex;
            align-items: center;
            justify-content: space-between;
            background: #f8f9fa;
            border: 2px solid #e9ecef;
            border-radius: 15px;
            padding: 20px;
            margin-bottom: 15px;
            transition: all 0.3s ease;
        }

        .rank-item:hover {
            border-color: #6c757d;
            transform: translateX(10px);
            background: #ffffff;
        }

        .rank-number {
            font-size: 1.5em;
            font-weight: 600;
            color: #495057;
            width: 50px;
        }

        .rank-info {
            display: flex;
            flex-direction: column;
            gap: 6px;
            flex: 1;
            align-items: flex-end;
            text-align: right;
        }

        .rank-name {
            display: flex;
            flex-wrap: wrap;
            align-items: baseline;
            gap: 8px;
            font-weight: 700;
            color: #1f6feb;
        }

        .rank-name .villain_name {
            color: #d7263d;
            font-weight: 700;
        }

        .rank-score {
            font-size: 1.1em;
            font-weight: 700;
            color: #212529;
        }

        .player-info {
            flex: 1;
            margin-left: 20px;
        }

        .player-name {
            font-size: 1.2em;
            color: #FFA500;
            font-weight: bold;
        }

        .player-title {
            font-size: 0.9em;
            color: #111111;
            font-weight: 600;
        }

        .player-score {
            font-size: 1.3em;
            font-weight: bold;
            color: #FFD700;
        }

        .social-buttons {
            display: flex;
            justify-content: center;
            gap: 20px;
            margin-top: 30px;
        }

        .social-btn {
            background: #ffffff;
            border: 2px solid #e9ecef;
            border-radius: 15px;
            padding: 15px 30px;
            color: #495057;
            font-weight: bold;
            cursor: pointer;
            transition: all 0.3s ease;
            text-decoration: none;
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .social-btn:hover {
            background: #f8f9fa;
            color: #343a40;
            border-color: #dee2e6;
            transform: translateY(-3px);
        }

        /* 排行榜標籤樣式 */
        .rank-tab {
            background: #ffffff;
            border: 2px solid #e9ecef;
            border-radius: 10px;
            padding: 12px 20px;
            color: #495057;
            cursor: pointer;
            transition: all 0.3s ease;
            font-weight: 600;
            font-size: 1em;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
        }

        .rank-tab:hover {
            background: #f8f9fa;
            border-color: #6c757d;
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
        }

        .rank-tab.active {
            background: #495057;
            color: #ffffff;
            border-color: #495057;
            transform: scale(1.05);
            box-shadow: 0 4px 15px rgba(73, 80, 87, 0.3);
        }

        /* 遊戲首頁樣式 */
        .homepage-container {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            height: 550px;
            text-align: center;
            padding: 2.5rem 1.25rem;
            padding-top: 75px; /* 調整為75px，向下移動5px */
            padding-bottom: 10px; /* 調整為10px */
        }
        
        #homepage {
            padding-top: 0; /* 首頁特殊處理，不受container的padding-top影響 */
            margin-top: 70px;
        }
        
        #homepage .container {
            padding-top: 1rem; /* 首頁容器特殊間距 */
        }

        .logo-section {
            margin-bottom: 20px;
            position: relative;
        }

        .homepage-stickman {
            display: flex;
            justify-content: center;
            align-items: center;
            background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 50%, #ffffff 100%);
            border-radius: 1.25rem;
            padding: 1.875rem;
            box-shadow: 0 0.5rem 1.5625rem rgba(0, 0, 0, 0.15);
            transition: transform 0.3s ease;
            border: 0.125rem solid #e9ecef;
        }

        .homepage-stickman:hover {
            transform: scale(1.05);
            box-shadow: 0 0.75rem 2.1875rem rgba(0, 0, 0, 0.2);
        }

        .homepage-stickman svg {
            transition: all 0.3s ease;
            width: clamp(9rem, 25vw, 11.25rem); /* 響應式SVG */
            height: auto;
        }

        .homepage-stickman:hover svg {
            filter: drop-shadow(0.25rem 0.25rem 0.5rem rgba(0,0,0,0.4));
        }

        .homepage-title {
            font-size: 1.75rem; /* 使用rem單位，固定大小 */
            font-weight: 700;
            color: #495057;
            margin-bottom: 1rem;
            text-align: center;
            line-height: 1.2;
        }

        .homepage-subtitle {
            font-size: 1.125rem; /* 使用rem單位，固定大小 */
            color: #6c757d;
            margin-bottom: 20px;
            font-weight: 400;
            text-align: center;
            line-height: 1.3;
        }

        .homepage-buttons {
            display: flex;
            flex-direction: column;
            gap: 1.5rem;
            align-items: center;
            width: 100%;
        }

        .homepage-btn {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 1rem;
            padding: 1rem 1.5rem;
            border: none;
            border-radius: 1rem;
            font-size: 1rem; /* 使用rem單位，固定大小 */
            font-weight: 600;
            cursor: pointer;
            transition: all 0.3s ease;
            width: 100%;
            max-width: 18rem; /* 適應固定寬度 */
            min-height: 3rem;
            box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.15);
        }

        .homepage-btn.primary {
            background: #ffffff;
            color: #495057;
            border: 0.125rem solid #e9ecef;
        }

        .homepage-btn.primary:hover {
            background: #f8f9fa;
            color: #343a40;
            border-color: #dee2e6;
            transform: translateY(-0.1875rem);
            box-shadow: 0 0.625rem 1.875rem rgba(0, 0, 0, 0.15);
        }

        .homepage-btn.secondary {
            background: #f8f9fa;
            color: #6c757d;
            border: 0.125rem solid #dee2e6;
        }

        .homepage-btn.secondary:hover {
            background: #e9ecef;
            color: #495057;
            border-color: #ced4da;
            transform: translateY(-0.1875rem);
            box-shadow: 0 0.625rem 1.875rem rgba(0, 0, 0, 0.15);
        }

        .btn-icon {
            font-size: clamp(1rem, 3vw, 1.25rem); /* 響應式按鈕圖標 */
        }

        /* 動態熱度彈出訊息樣式 */
        .activity-toast {
            background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
            border: 2px solid #e9ecef;
            border-radius: 12px;
            padding: 12px 16px;
            margin-bottom: 8px;
            box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
            backdrop-filter: blur(10px);
            animation: toastSlideIn 0.5s ease-out;
            pointer-events: auto;
            cursor: pointer;
            transition: all 0.3s ease;
            max-width: 280px;
            min-width: 250px;
            font-size: 1em;
        }

        .activity-toast:hover {
            transform: translateX(-5px) scale(1.02);
            box-shadow: 0 12px 35px rgba(0, 0, 0, 0.2);
            border-color: #6c757d;
        }

        .toast-time {
            color: #6c757d;
            font-size: 0.9em;
            font-weight: 400;
            margin-bottom: 5px;
            display: flex;
            align-items: center;
            gap: 5px;
        }

        .toast-content {
            color: #495057;
            font-size: 0.9em;
            line-height: 1.4;
            font-weight: 500;
        }

        .intensity-baby {
            color: #28a745;
            font-weight: 600;
        }

        .intensity-super {
            color: #ffc107;
            font-weight: 600;
        }

        .intensity-god {
            color: #fd7e14;
            font-weight: 600;
        }

        .intensity-hell {
            color: #dc3545;
            font-weight: 600;
            text-shadow: 1px 1px 2px rgba(220, 53, 69, 0.3);
        }

        @keyframes toastSlideIn {
            from {
                opacity: 0;
                transform: translateX(100%) scale(0.8);
            }
            to {
                opacity: 1;
                transform: translateX(0) scale(1);
            }
        }

        @keyframes toastSlideOut {
            from {
                opacity: 1;
                transform: translateX(0) scale(1);
            }
            to {
                opacity: 0;
                transform: translateX(100%) scale(0.8);
            }
        }

        /* 彈窗樣式 */
        .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;
            backdrop-filter: blur(0.3125rem);
            padding: 1rem;
            box-sizing: border-box;
        }

        .modal-content {
            position: relative;
            background: #ffffff;
            border-radius: 1.25rem;
            padding: clamp(1.25rem, 5vw, 1.875rem); /* 響應式內邊距 */
            max-width: min(90vw, 31.25rem); /* 500px = 31.25rem */
            width: 100%;
            box-shadow: 0 0.9375rem 3.125rem rgba(0, 0, 0, 0.3);
            animation: modalSlideIn 0.3s ease-out;
            max-height: 90vh;
            overflow-y: auto;
        }

        @keyframes modalSlideIn {
            from {
                opacity: 0;
                transform: translateY(-50px) scale(0.9);
            }
            to {
                opacity: 1;
                transform: translateY(0) scale(1);
            }
        }

        .modal-header {
            text-align: center;
            margin-bottom: 25px;
        }

        .modal-header h3 {
            font-size: clamp(1.25rem, 4vw, 1.8rem); /* 響應式彈窗標題 */
            color: #DC143C;
            margin-bottom: 0.625rem;
            font-weight: 600;
        }

        .modal-subtitle {
            color: #6c757d;
            font-size: 1em;
            margin: 0;
            font-weight: 400;
        }

        .modal-close {
            position: absolute;
            top: 12px;
            right: 12px;
            width: 34px;
            height: 34px;
            border: none;
            border-radius: 50%;
            background: #dc3545;
            color: #fff;
            font-size: 1.1em;
            font-weight: 700;
            cursor: pointer;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
            display: flex;
            align-items: center;
            justify-content: center;
            transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
        }

        .modal-close:hover {
            transform: scale(1.05);
            background: #c82333;
            box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
        }

        .modal-close:active {
            transform: scale(0.98);
        }

        .modal-body {
            margin-bottom: 1.5625rem;
        }

        .input-label {
            display: block;
            color: #495057;
            font-size: clamp(16px, 2.5vw, 18px); /* 最小16px，最大18px */
            font-weight: 600;
            margin-bottom: 0.625rem;
        }

        .villain-input {
            width: 100%;
            padding: clamp(0.75rem, 3vw, 0.9375rem); /* 響應式內邊距 */
            border: 0.125rem solid #e9ecef;
            border-radius: 0.625rem;
            font-size: 14px; /* 固定14px字體 */
            color: #495057;
            background: #f8f9fa;
            transition: all 0.3s ease;
            box-sizing: border-box;
        }

        .villain-input:focus {
            outline: none;
            border-color: #DC143C;
            background: #ffffff;
            box-shadow: 0 0 0 0.1875rem rgba(220, 20, 60, 0.1);
        }

        .input-hint {
            margin-top: 0.625rem;
            color: #6c757d;
            font-size: clamp(14px, 2vw, 16px); /* 最小14px，最大16px */
            font-style: italic;
        }

        .modal-footer {
            display: flex;
            gap: 0.9375rem;
            justify-content: flex-end;
            flex-wrap: wrap;
        }

        .modal-btn {
            padding: clamp(0.75rem, 2.5vw, 0.75rem) clamp(1.25rem, 4vw, 1.5625rem); /* 響應式按鈕 */
            border: none;
            border-radius: 0.5rem;
            font-size: clamp(14px, 2.5vw, 16px); /* 最小14px，最大16px */
            font-weight: 600;
            cursor: pointer;
            transition: all 0.3s ease;
            min-width: 5rem;
            flex: 1;
            max-width: 8rem;
        }

        .modal-btn.cancel {
            background: #f8f9fa;
            color: #6c757d;
            border: 0.125rem solid #e9ecef;
        }

        .modal-btn.cancel:hover {
            background: #e9ecef;
            color: #495057;
            border-color: #dee2e6;
            transform: translateY(-0.125rem);
        }

        .modal-btn.confirm {
            background: #495057;
            color: #ffffff;
            border: 0.125rem solid #495057;
        }

        .modal-btn.confirm:hover {
            background: #343a40;
            border-color: #343a40;
            transform: translateY(-0.125rem);
            box-shadow: 0 0.25rem 0.9375rem rgba(73, 80, 87, 0.3);
        }

        /* 自適應偵測調節版本語法 */
        @supports (width: 100dvw) {
            .container {
                width: 100dvw;
                max-width: 414px;
            }
            .nav-tabs {
                width: calc(100dvw - 30px);
                max-width: 414px;
            }
        }

        @supports (height: 100dvh) {
            html, body {
                min-height: 100dvh;
            }
        }

        @supports (display: grid) {
            .home-content {
                display: grid;
            }
        }

        @supports (backdrop-filter: blur(10px)) {
            .nav-tabs {
                backdrop-filter: blur(15px);
            }
        }

        @supports not (backdrop-filter: blur(10px)) {
            .nav-tabs {
                background: rgba(255, 255, 255, 0.98);
            }
        }

        @supports (aspect-ratio: 1) {
            .tool-button {
                aspect-ratio: 1;
                width: 60px;
                height: auto;
            }
        }

        @supports (container-type: inline-size) {
            .container {
                container-type: inline-size;
            }
        }

        @container (max-width: 480px) {
            .tool-button {
                width: 21px;
                height: 21px;
            }
            .tool-icon-integrated {
                font-size: 0.64em;
            }
        }

        @container (min-width: 768px) {
            .tool-button {
                width: 28px;
                height: 28px;
            }
            .tool-icon-integrated {
                font-size: 0.88em;
            }
        }

        /* 固定尺寸設計 - 移除響應式字體 */
        .nav-tabs::-webkit-scrollbar {
            display: none;
        }

        .homepage-stickman svg {
            width: 140px; /* 固定SVG尺寸為140px */
            height: auto;
        }

        /* 固定尺寸設計 - 移除所有響應式媒體查詢 */

        /* 特效動畫 */
        .floating-score {
            position: absolute;
            font-size: 2em;
            font-weight: bold;
            color: #FFD700;
            pointer-events: none;
            animation: floatUp 1s ease-out forwards;
        }

        @keyframes floatUp {
            0% {
                opacity: 1;
                transform: translateY(0);
            }
            100% {
                opacity: 0;
                transform: translateY(-100px);
            }
        }

        /* 主頁小人動畫效果 */
        @keyframes wiggle {
            0%, 100% { transform: rotate(0deg); }
            25% { transform: rotate(-3deg); }
            75% { transform: rotate(3deg); }
        }

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

        @keyframes pulse {
            0%, 100% { transform: scale(1); }
            50% { transform: scale(1.1); }
        }

        @keyframes sway {
            0%, 100% { transform: translateX(0); }
            25% { transform: translateX(-10px); }
            75% { transform: translateX(10px); }
        }

        .smoke-effect {
            position: absolute;
            width: 5px;
            height: 5px;
            background: radial-gradient(circle, rgba(255, 255, 255, 0.8), transparent);
            border-radius: 50%;
            animation: smoke 2s infinite;
        }

        @keyframes smoke {
            0% {
                opacity: 0.8;
                transform: scale(0.25) translateY(0);
            }
            100% {
                opacity: 0;
                transform: scale(1) translateY(-25px);
            }
        }

        /* 打擊效果動畫 */
        @keyframes hitEffectBounce {
            0% {
                opacity: 1;
                transform: scale(0.5) translateY(0);
            }
            50% {
                transform: scale(1.2) translateY(-20px);
            }
            100% {
                opacity: 0;
                transform: scale(0.8) translateY(-50px);
            }
        }

        /* 連擊閃爍效果 */
        @keyframes comboFlash {
            0%, 100% {
                opacity: 1;
                transform: translateX(-50%) scale(1);
            }
            25% {
                opacity: 0.7;
                transform: translateX(-50%) scale(1.1);
            }
            50% {
                opacity: 1;
                transform: translateX(-50%) scale(1.2);
            }
            75% {
                opacity: 0.8;
                transform: translateX(-50%) scale(1.1);
            }
        }

        /* 草泥馬跑過動畫 - 橫向跑過小人 */
        @keyframes alpacaRun {
            0% {
                right: -40px;
                top: 15%;
                transform: scaleX(1) rotate(0deg);
            }
            50% {
                right: 50%;
                top: 15%;
                transform: scaleX(1) rotate(0deg);
            }
            100% {
                right: calc(100% + 60px);
                top: 15%;
                transform: scaleX(1) rotate(0deg);
            }
        }

        /* 蟑螂爬過動畫 */
        @keyframes cockroachCrawl {
            0% {
                right: -30px;
                bottom: -30px;
                transform: rotate(-45deg);
            }
            50% {
                right: 40%;
                bottom: 50%;
                transform: translateX(50%) translateY(50%) rotate(-45deg);
            }
            100% {
                right: 40%;
                bottom: 50%;
                transform: translateX(50%) translateY(50%) rotate(-45deg) scale(0);
                opacity: 0;
            }
        }

        .cockroach {
            position: fixed;
            font-size: 0.8em;
            z-index: 100;
            animation: cockroachCrawl 4s ease-in-out;
        }

        /* 自動打擊效果 */
        @keyframes autoHitEffect {
            0% {
                opacity: 1;
                transform: scale(0.8) rotate(0deg);
            }
            50% {
                transform: scale(1.3) rotate(10deg);
            }
            100% {
                opacity: 0;
                transform: scale(0.5) rotate(-10deg) translateY(-30px);
            }
        }

@view-transition { navigation: auto; }
.activity-toast-container {
            position: fixed;
            top: 60px;
            right: 12px;
            display: flex;
            flex-direction: column;
            gap: 10px;
        }

.share-gentle-reminder {
    margin-top: 15px;
    padding: 12px 16px;
    background: #fff7f0;
    border: 1px solid #ffe0c2;
    border-radius: 12px;
    color: #8b5e34;
    font-size: 0.9em;
    line-height: 1.5;
}

.gentle-reminder-block {
    margin-top: 10px;
    padding: 10px 14px;
    background: #fff7f0;
    border: 1px solid #ffe0c2;
    border-radius: 10px;
    color: #8b5e34;
    font-size: 0.85em;
    line-height: 1.4;
}
