/* 🎯 除法配對遊戲 - 太空主題 */

:root {
    --space-dark: #0f0c29;
    --space-mid: #302b63;
    --space-light: #24243e;
    --star-gold: #ffd700;
    --star-glow: #fff7b2;
    --accent-cyan: #00d4ff;
    --accent-pink: #ff6b9d;
    --accent-purple: #a855f7;
    --card-bg: rgba(255, 255, 255, 0.95);
    --success: #10b981;
    --error: #ef4444;
}

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

body {
    font-family: 'Fredoka', 'Microsoft JhengHei', sans-serif;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--space-dark) 0%, var(--space-mid) 50%, var(--space-light) 100%);
    overflow-x: hidden;
}

/* 星空背景 */
.stars-bg {
    position: fixed;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}

.star {
    position: absolute;
    width: 4px;
    height: 4px;
    background: white;
    border-radius: 50%;
    animation: twinkle 2s ease-in-out infinite;
}

.star-1 { top: 10%; left: 20%; animation-delay: 0s; }
.star-2 { top: 30%; left: 70%; animation-delay: 0.5s; }
.star-3 { top: 50%; left: 40%; animation-delay: 1s; }
.star-4 { top: 70%; left: 80%; animation-delay: 1.5s; }
.star-5 { top: 85%; left: 15%; animation-delay: 0.8s; }

@keyframes twinkle {
    0%, 100% { opacity: 0.3; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.5); }
}

.shooting-star {
    position: absolute;
    top: 20%;
    left: -100px;
    width: 100px;
    height: 2px;
    background: linear-gradient(90deg, transparent, white);
    animation: shoot 8s linear infinite;
}

@keyframes shoot {
    0% { left: -100px; top: 20%; opacity: 1; }
    30% { left: 110%; top: 50%; opacity: 0; }
    100% { left: 110%; top: 50%; opacity: 0; }
}

/* 主容器 */
.game-container {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.screen {
    display: none;
    width: 100%;
    max-width: 900px;
    animation: fadeSlide 0.5s ease-out;
}

.screen.active {
    display: block;
}

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

/* ==================== 登入畫面 ==================== */

.login-card {
    background: var(--card-bg);
    border-radius: 30px;
    padding: 40px;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.5), 0 0 100px rgba(168, 85, 247, 0.2);
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.title-icon {
    font-size: 70px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0) rotate(-5deg); }
    50% { transform: translateY(-15px) rotate(5deg); }
}

.game-title {
    font-size: 42px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-purple) 0%, var(--accent-pink) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 15px 0 10px;
}

.game-subtitle {
    color: #666;
    font-size: 18px;
}

/* 吉祥物選擇 */
.mascot-section {
    text-align: center;
    margin-bottom: 25px;
}

.mascot-preview {
    font-size: 80px;
    animation: bounce 2s ease-in-out infinite;
}

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

.section-label {
    font-size: 16px;
    font-weight: 600;
    color: #555;
    margin: 15px 0;
}

.mascot-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 10px;
    padding: 15px;
    background: linear-gradient(135deg, #f3e8ff 0%, #fce7f3 100%);
    border-radius: 20px;
}

.mascot-btn {
    font-size: 32px;
    padding: 12px;
    background: white;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s;
    border: 3px solid transparent;
    text-align: center;
}

.mascot-btn:hover {
    transform: scale(1.15);
    border-color: var(--accent-purple);
    box-shadow: 0 8px 25px rgba(168, 85, 247, 0.3);
}

.mascot-btn.selected {
    background: linear-gradient(135deg, var(--accent-purple) 0%, var(--accent-pink) 100%);
    border-color: var(--accent-purple);
    box-shadow: 0 8px 25px rgba(168, 85, 247, 0.4);
}

/* 表單 */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 25px;
}

.form-field label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #555;
    margin-bottom: 8px;
}

.form-field select {
    width: 100%;
    padding: 15px;
    font-size: 16px;
    font-family: inherit;
    border: 3px solid #e5e7eb;
    border-radius: 15px;
    background: white;
    cursor: pointer;
    transition: all 0.3s;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

.form-field select:focus {
    outline: none;
    border-color: var(--accent-purple);
    box-shadow: 0 0 0 4px rgba(168, 85, 247, 0.2);
}

/* 開始按鈕 */
.start-btn {
    width: 100%;
    padding: 20px;
    font-size: 22px;
    font-weight: 700;
    font-family: inherit;
    background: linear-gradient(135deg, var(--accent-purple) 0%, var(--accent-pink) 100%);
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    transition: all 0.3s;
    box-shadow: 0 10px 40px rgba(168, 85, 247, 0.4);
}

.start-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 50px rgba(168, 85, 247, 0.5);
}

.rocket {
    font-size: 28px;
    animation: rocketShake 0.5s ease-in-out infinite;
}

@keyframes rocketShake {
    0%, 100% { transform: translateX(0) rotate(-5deg); }
    50% { transform: translateX(3px) rotate(5deg); }
}

.login-links {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-top: 25px;
}

.link-item {
    color: var(--accent-purple);
    text-decoration: none;
    font-weight: 600;
    font-size: 16px;
    padding: 10px 20px;
    border-radius: 10px;
    transition: all 0.3s;
}

.link-item:hover {
    background: rgba(168, 85, 247, 0.1);
}

/* ==================== 遊戲畫面 ==================== */

.game-panel {
    background: var(--card-bg);
    border-radius: 30px;
    padding: 30px;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.5);
}

.game-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 3px dashed #e5e7eb;
}

.player-badge {
    display: flex;
    align-items: center;
    gap: 10px;
}

.player-mascot {
    font-size: 36px;
}

.player-info {
    font-size: 16px;
    font-weight: 600;
    color: #555;
}

.round-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%);
    padding: 10px 25px;
    border-radius: 15px;
}

.round-label {
    font-size: 12px;
    color: #6366f1;
    font-weight: 600;
}

.round-num {
    font-size: 20px;
    font-weight: 700;
    color: #4f46e5;
}

.score-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    padding: 12px 25px;
    border-radius: 50px;
    box-shadow: 0 5px 20px rgba(251, 191, 36, 0.3);
}

.score-star {
    font-size: 28px;
}

.score-num {
    font-size: 28px;
    font-weight: 700;
    color: #b45309;
}

.game-hint {
    text-align: center;
    padding: 15px;
    background: linear-gradient(135deg, #f3e8ff 0%, #fce7f3 100%);
    border-radius: 15px;
    margin-bottom: 25px;
    font-size: 16px;
    font-weight: 600;
    color: #7c3aed;
}

/* 配對區域 */
.matching-zone {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 20px;
    margin-bottom: 25px;
}

.divider {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.divider-line {
    width: 3px;
    flex: 1;
    background: linear-gradient(180deg, transparent, #e5e7eb, transparent);
    border-radius: 2px;
}

.divider-icon {
    font-size: 24px;
}

.questions-col,
.answers-col {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* 題目卡片 */
.question-card {
    background: linear-gradient(135deg, #fef3c7 0%, #fed7aa 100%);
    border: 4px solid #f59e0b;
    border-radius: 20px;
    padding: 20px;
    min-height: 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s;
    position: relative;
}

.question-card .question-text {
    font-size: 22px;
    font-weight: 700;
    color: #92400e;
}

.question-card.drag-over {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    border-color: #3b82f6;
    transform: scale(1.03);
}

.question-card.has-answer {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    border-color: var(--success);
}

.answer-in-question {
    background: white;
    border: 3px solid var(--accent-purple);
    border-radius: 12px;
    padding: 8px 20px;
    font-size: 24px;
    font-weight: 700;
    color: var(--accent-purple);
    cursor: grab;
}

/* 答案卡片 */
.answer-card {
    background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%);
    border: 4px solid #6366f1;
    border-radius: 20px;
    padding: 20px;
    font-size: 28px;
    font-weight: 700;
    color: #4338ca;
    text-align: center;
    cursor: grab;
    transition: all 0.3s;
    animation: cardAppear 0.4s ease-out both;
}

.answer-card:nth-child(1) { animation-delay: 0.1s; }
.answer-card:nth-child(2) { animation-delay: 0.15s; }
.answer-card:nth-child(3) { animation-delay: 0.2s; }
.answer-card:nth-child(4) { animation-delay: 0.25s; }
.answer-card:nth-child(5) { animation-delay: 0.3s; }

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

.answer-card:hover {
    transform: scale(1.05);
    box-shadow: 0 10px 30px rgba(99, 102, 241, 0.3);
}

.answer-card:active {
    cursor: grabbing;
}

.answer-card.dragging {
    opacity: 0.5;
    transform: rotate(5deg);
}

/* 遊戲按鈕 */
.game-buttons {
    display: flex;
    gap: 15px;
}

.game-btn {
    flex: 1;
    padding: 18px;
    font-size: 18px;
    font-weight: 700;
    font-family: inherit;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s;
}

.check-btn {
    background: linear-gradient(135deg, var(--success) 0%, #059669 100%);
    color: white;
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.4);
}

.check-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 35px rgba(16, 185, 129, 0.5);
}

.next-btn {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    color: white;
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.4);
}

.next-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 35px rgba(99, 102, 241, 0.5);
}

/* ==================== 結果畫面 ==================== */

.result-card {
    background: var(--card-bg);
    border-radius: 30px;
    padding: 40px;
    text-align: center;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.5);
}

.result-header {
    margin-bottom: 25px;
}

.trophy-icon {
    font-size: 80px;
    animation: trophySpin 1s ease-out;
}

@keyframes trophySpin {
    0% { transform: scale(0) rotate(-180deg); }
    60% { transform: scale(1.2) rotate(10deg); }
    100% { transform: scale(1) rotate(0); }
}

.result-header h2 {
    font-size: 36px;
    color: #374151;
    margin-top: 15px;
}

.result-player {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 25px;
}

.result-mascot {
    font-size: 50px;
}

.result-name {
    font-size: 22px;
    font-weight: 600;
    color: #6b7280;
}

.stats-row {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 25px;
}

.stat-box {
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
    border-radius: 20px;
    padding: 25px 40px;
}

.stat-icon {
    font-size: 36px;
    margin-bottom: 10px;
}

.stat-val {
    font-size: 40px;
    font-weight: 700;
    color: var(--accent-purple);
}

.stat-label {
    font-size: 14px;
    color: #6b7280;
    font-weight: 600;
}

.result-msg {
    background: linear-gradient(135deg, #f3e8ff 0%, #fce7f3 100%);
    padding: 15px 25px;
    border-radius: 15px;
    font-size: 18px;
    color: #7c3aed;
    margin-bottom: 25px;
}

/* 排行榜 */
.ranking-box {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border: 3px solid #f59e0b;
    border-radius: 20px;
    padding: 20px;
    margin-bottom: 25px;
    text-align: left;
}

.ranking-box h3 {
    text-align: center;
    font-size: 20px;
    color: #92400e;
    margin-bottom: 15px;
}

.ranking-list {
    max-height: 200px;
    overflow-y: auto;
}

.ranking-loading {
    text-align: center;
    color: #92400e;
    padding: 20px;
}

.ranking-item {
    display: flex;
    align-items: center;
    background: white;
    border-radius: 12px;
    padding: 12px 15px;
    margin-bottom: 8px;
}

.ranking-item.current-user {
    background: linear-gradient(135deg, var(--star-gold) 0%, var(--star-glow) 100%);
    border: 2px solid #f59e0b;
}

.ranking-rank {
    font-size: 16px;
    font-weight: 700;
    min-width: 40px;
    color: #6b7280;
}

.ranking-rank.rank-1::before { content: '🥇 '; }
.ranking-rank.rank-2::before { content: '🥈 '; }
.ranking-rank.rank-3::before { content: '🥉 '; }

.ranking-mascot {
    font-size: 28px;
    margin: 0 10px;
}

.ranking-info {
    flex: 1;
}

.ranking-student {
    font-size: 14px;
    font-weight: 600;
    color: #374151;
}

.ranking-details {
    font-size: 12px;
    color: #9ca3af;
}

.ranking-score {
    font-size: 22px;
    font-weight: 700;
    color: var(--accent-purple);
}

/* 結果按鈕 */
.result-buttons {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.result-btn {
    flex: 1;
    min-width: 120px;
    padding: 15px 20px;
    font-size: 16px;
    font-weight: 700;
    font-family: inherit;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s;
}

.result-btn.primary {
    background: linear-gradient(135deg, var(--accent-purple) 0%, var(--accent-pink) 100%);
    color: white;
}

.result-btn.secondary {
    background: linear-gradient(135deg, var(--success) 0%, #059669 100%);
    color: white;
}

.result-btn.tertiary {
    background: linear-gradient(135deg, #9ca3af 0%, #6b7280 100%);
    color: white;
}

.result-btn:hover {
    transform: translateY(-3px);
}

/* ==================== 反饋彈窗 ==================== */

.feedback-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.feedback-overlay.show {
    display: flex;
}

.feedback-modal {
    background: white;
    border-radius: 25px;
    padding: 40px 60px;
    text-align: center;
    animation: popIn 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.3);
}

@keyframes popIn {
    0% { transform: scale(0); }
    100% { transform: scale(1); }
}

.feedback-icon {
    font-size: 70px;
    margin-bottom: 15px;
}

.feedback-text {
    font-size: 22px;
    font-weight: 700;
    color: #374151;
}

.feedback-modal.correct {
    border: 5px solid var(--success);
}

.feedback-modal.correct .feedback-text {
    color: var(--success);
}

.feedback-modal.incorrect {
    border: 5px solid var(--error);
}

.feedback-modal.incorrect .feedback-text {
    color: var(--error);
}

/* ==================== iPad 適配 (768px - 1024px) ==================== */

@media (min-width: 768px) and (max-width: 1024px) {
    .game-container {
        padding: 25px;
    }

    .login-card,
    .game-panel,
    .result-card {
        padding: 35px;
        max-width: 850px;
    }

    .game-title {
        font-size: 38px;
    }

    .title-icon {
        font-size: 65px;
    }

    .mascot-preview {
        font-size: 70px;
    }

    .mascot-grid {
        grid-template-columns: repeat(6, 1fr);
        gap: 12px;
    }

    .mascot-btn {
        font-size: 30px;
        padding: 14px;
    }

    .form-row {
        gap: 25px;
    }

    .form-field select {
        padding: 16px;
        font-size: 17px;
    }

    .start-btn {
        padding: 22px;
        font-size: 24px;
    }

    .game-topbar {
        gap: 20px;
    }

    .player-mascot {
        font-size: 40px;
    }

    .player-info {
        font-size: 18px;
    }

    .round-badge {
        padding: 12px 30px;
    }

    .round-num {
        font-size: 22px;
    }

    .score-badge {
        padding: 14px 30px;
    }

    .score-num {
        font-size: 30px;
    }

    .game-hint {
        font-size: 18px;
        padding: 18px;
    }

    .matching-zone {
        gap: 25px;
    }

    .question-card {
        padding: 22px;
        min-height: 90px;
    }

    .question-card .question-text {
        font-size: 24px;
    }

    .answer-card {
        padding: 22px;
        font-size: 30px;
    }

    .answer-in-question {
        font-size: 26px;
        padding: 10px 24px;
    }

    .game-btn {
        padding: 20px;
        font-size: 20px;
    }

    .stat-box {
        padding: 28px 45px;
    }

    .stat-val {
        font-size: 44px;
    }

    /* iPad 橫向 */
    @media (orientation: landscape) {
        .matching-zone {
            grid-template-columns: 1fr auto 1fr;
        }

        .divider {
            flex-direction: column;
        }

        .divider-line {
            width: 3px;
            height: auto;
        }
    }
}

/* ==================== 手機適配 (< 768px) ==================== */

@media (max-width: 767px) {
    .game-container {
        padding: 12px;
        align-items: flex-start;
        padding-top: 20px;
    }

    .login-card,
    .game-panel,
    .result-card {
        padding: 25px 18px;
        border-radius: 22px;
    }

    .title-icon {
        font-size: 55px;
    }

    .game-title {
        font-size: 28px;
        margin: 12px 0 8px;
    }

    .game-subtitle {
        font-size: 15px;
    }

    .mascot-preview {
        font-size: 65px;
    }

    .section-label {
        font-size: 14px;
        margin: 12px 0;
    }

    .mascot-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 8px;
        padding: 12px;
        border-radius: 15px;
    }

    .mascot-btn {
        font-size: 28px;
        padding: 10px;
        border-radius: 12px;
    }

    .form-row {
        grid-template-columns: 1fr;
        gap: 15px;
        margin-bottom: 20px;
    }

    .form-field label {
        font-size: 13px;
        margin-bottom: 6px;
    }

    .form-field select {
        padding: 14px;
        font-size: 16px;
        border-radius: 12px;
    }

    .start-btn {
        padding: 18px;
        font-size: 20px;
        border-radius: 16px;
    }

    .rocket {
        font-size: 24px;
    }

    .login-links {
        gap: 15px;
        margin-top: 20px;
        flex-wrap: wrap;
        justify-content: center;
    }

    .link-item {
        font-size: 14px;
        padding: 8px 15px;
    }

    /* 遊戲畫面 */
    .game-topbar {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        margin-bottom: 15px;
        padding-bottom: 15px;
    }

    .player-badge {
        justify-content: center;
    }

    .player-mascot {
        font-size: 32px;
    }

    .player-info {
        font-size: 15px;
    }

    .round-badge {
        padding: 10px 20px;
        align-self: center;
    }

    .round-label {
        font-size: 11px;
    }

    .round-num {
        font-size: 18px;
    }

    .score-badge {
        padding: 10px 22px;
        align-self: center;
    }

    .score-star {
        font-size: 24px;
    }

    .score-num {
        font-size: 24px;
    }

    .game-hint {
        padding: 12px;
        margin-bottom: 18px;
        font-size: 14px;
        border-radius: 12px;
    }

    .matching-zone {
        grid-template-columns: 1fr;
        gap: 15px;
        margin-bottom: 18px;
    }

    .divider {
        flex-direction: row;
        padding: 8px 0;
    }

    .divider-line {
        height: 3px;
        width: auto;
        flex: 1;
    }

    .divider-icon {
        font-size: 20px;
    }

    .questions-col,
    .answers-col {
        gap: 10px;
    }

    .question-card {
        padding: 15px;
        min-height: 70px;
        border-radius: 15px;
        border-width: 3px;
    }

    .question-card .question-text {
        font-size: 18px;
    }

    .answer-card {
        padding: 15px;
        font-size: 24px;
        border-radius: 15px;
        border-width: 3px;
    }

    .answer-in-question {
        font-size: 20px;
        padding: 6px 16px;
        border-radius: 10px;
    }

    .game-buttons {
        flex-direction: column;
        gap: 10px;
    }

    .game-btn {
        padding: 16px;
        font-size: 17px;
        border-radius: 12px;
    }

    /* 結果畫面 */
    .trophy-icon {
        font-size: 60px;
    }

    .result-header h2 {
        font-size: 28px;
        margin-top: 12px;
    }

    .result-player {
        gap: 12px;
        margin-bottom: 20px;
    }

    .result-mascot {
        font-size: 40px;
    }

    .result-name {
        font-size: 18px;
    }

    .stats-row {
        gap: 15px;
        margin-bottom: 20px;
    }

    .stat-box {
        padding: 18px 25px;
        border-radius: 15px;
    }

    .stat-icon {
        font-size: 30px;
        margin-bottom: 8px;
    }

    .stat-val {
        font-size: 32px;
    }

    .stat-label {
        font-size: 12px;
    }

    .result-msg {
        padding: 12px 18px;
        font-size: 15px;
        margin-bottom: 18px;
        border-radius: 12px;
    }

    .ranking-box {
        padding: 15px;
        margin-bottom: 18px;
        border-radius: 15px;
    }

    .ranking-box h3 {
        font-size: 17px;
        margin-bottom: 12px;
    }

    .ranking-list {
        max-height: 180px;
    }

    .ranking-item {
        padding: 10px 12px;
        border-radius: 10px;
        margin-bottom: 6px;
    }

    .ranking-rank {
        font-size: 14px;
        min-width: 35px;
    }

    .ranking-mascot {
        font-size: 24px;
        margin: 0 8px;
    }

    .ranking-student {
        font-size: 13px;
    }

    .ranking-details {
        font-size: 11px;
    }

    .ranking-score {
        font-size: 18px;
    }

    .result-buttons {
        flex-direction: column;
        gap: 10px;
    }

    .result-btn {
        padding: 14px 18px;
        font-size: 15px;
        border-radius: 12px;
    }

    /* 反饋彈窗 */
    .feedback-modal {
        padding: 30px 40px;
        border-radius: 20px;
        margin: 0 15px;
    }

    .feedback-icon {
        font-size: 55px;
        margin-bottom: 12px;
    }

    .feedback-text {
        font-size: 18px;
    }
}

/* ==================== 小手機適配 (< 400px) ==================== */

@media (max-width: 400px) {
    .game-container {
        padding: 10px;
    }

    .login-card,
    .game-panel,
    .result-card {
        padding: 20px 15px;
    }

    .title-icon {
        font-size: 48px;
    }

    .game-title {
        font-size: 24px;
    }

    .mascot-preview {
        font-size: 55px;
    }

    .mascot-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .mascot-btn {
        font-size: 26px;
        padding: 8px;
    }

    .question-card .question-text {
        font-size: 16px;
    }

    .answer-card {
        font-size: 20px;
        padding: 12px;
    }

    .stat-box {
        padding: 15px 20px;
    }

    .stat-val {
        font-size: 28px;
    }
}

/* ==================== 觸控優化 ==================== */

@media (hover: none) and (pointer: coarse) {
    .mascot-btn:hover {
        transform: none;
        box-shadow: none;
    }

    .mascot-btn:active {
        transform: scale(1.1);
    }

    .answer-card:hover {
        transform: none;
        box-shadow: none;
    }

    .answer-card:active {
        transform: scale(1.05);
    }

    .game-btn:hover,
    .start-btn:hover,
    .result-btn:hover {
        transform: none;
    }

    .game-btn:active,
    .start-btn:active,
    .result-btn:active {
        transform: scale(0.98);
    }

    /* 增大觸控目標 */
    .answer-card {
        min-height: 60px;
    }

    .question-card {
        min-height: 75px;
    }

    .mascot-btn {
        min-width: 50px;
        min-height: 50px;
    }
}

