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

:root {
    --bg: #0f0f23;
    --card: #1a1a35;
    --card-border: #2a2a4a;
    --accent: #e94560;
    --gold: #ffd93d;
    --green: #6bcb77;
    --blue: #4d96ff;
    --text: #f1f1f1;
    --text-muted: #8888aa;
    --radius: 16px;
}

body {
    font-family: 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    background: linear-gradient(180deg, #0f0f23 0%, #1a1a35 100%);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.game-container {
    width: 100%;
    max-width: 650px;
    padding: 1.5rem;
    text-align: center;
    position: relative;
}

.hidden { display: none !important; }

/* Title */
.title {
    font-size: 2.2rem;
    font-weight: 800;
    margin-bottom: 1.5rem;
    background: linear-gradient(135deg, var(--accent), var(--gold));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* === Setup Screen === */
.setup-card {
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: 2rem;
}

.setup-card h2 {
    font-size: 1.4rem;
    margin-bottom: 1.25rem;
}

/* Presets */
.preset-row {
    display: flex;
    gap: 0.6rem;
    justify-content: center;
    margin-bottom: 1rem;
}

.preset-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg);
    border: 2px solid var(--card-border);
    border-radius: 10px;
    padding: 0.6rem 1rem;
    color: var(--text);
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    transition: all 0.2s;
}

.preset-btn:hover {
    border-color: var(--gold);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 217, 61, 0.15);
}

.diff-icon { font-size: 1.1rem; }

.setup-divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 1.25rem 0;
    color: var(--text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.setup-divider::before,
.setup-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--card-border);
}

.setup-section {
    margin-bottom: 1.25rem;
    text-align: left;
}

.setup-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.6rem;
}

.setup-label strong {
    color: var(--gold);
    font-size: 1.1rem;
}

/* Operation toggles */
.op-toggles {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.op-toggle input { display: none; }

.op-btn {
    display: inline-block;
    padding: 0.6rem 1rem;
    border: 2px solid var(--card-border);
    border-radius: 10px;
    background: var(--bg);
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    user-select: none;
}

.op-btn:hover {
    border-color: var(--text-muted);
}

.op-toggle input:checked + .op-btn {
    border-color: var(--blue);
    background: rgba(77, 150, 255, 0.12);
    color: var(--blue);
    box-shadow: 0 0 10px rgba(77, 150, 255, 0.15);
}

/* Learning mode */
.learning-btn {
    min-width: 200px;
    text-align: center;
}

.learning-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.4rem;
}

/* Number picker */
.num-picker {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.num-picker-btn {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    border: 2px solid var(--card-border);
    background: var(--bg);
    color: var(--text);
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.num-picker-btn:hover {
    border-color: var(--gold);
    transform: scale(1.1);
}

.num-picker-btn:active {
    transform: scale(1.05);
}

.num-picker-value {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--gold);
    min-width: 60px;
    text-align: center;
}

/* Slider */
.setup-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: var(--bg);
    border: 1px solid var(--card-border);
    outline: none;
    cursor: pointer;
}

.setup-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--gold);
    border: 3px solid #c9a520;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(255, 217, 61, 0.3);
    transition: transform 0.15s;
}

.setup-slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

.setup-slider::-moz-range-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--gold);
    border: 3px solid #c9a520;
    cursor: pointer;
}

.setup-slider::-moz-range-track {
    height: 8px;
    border-radius: 4px;
    background: var(--bg);
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.35rem;
}

/* Mode toggles */
.mode-toggles {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}

.mode-btn {
    min-width: 120px;
    text-align: center;
}

.op-toggle input[type="radio"] { display: none; }
.op-toggle input[type="radio"]:checked + .op-btn {
    border-color: var(--blue);
    background: rgba(77, 150, 255, 0.12);
    color: var(--blue);
    box-shadow: 0 0 10px rgba(77, 150, 255, 0.15);
}

/* Handoff screen */
.handoff-card {
    text-align: center;
    padding: 2rem;
}

.handoff-emoji {
    font-size: 4rem;
    margin-bottom: 0.75rem;
    animation: handoff-bounce 1s ease infinite;
}

@keyframes handoff-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.handoff-text {
    font-size: 1.5rem;
    font-weight: 700;
}

/* Start button */
.start-btn {
    background: linear-gradient(135deg, var(--green), #4aa85a);
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 1.2rem;
    font-weight: 700;
    padding: 1rem 2.5rem;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    width: 100%;
    margin-top: 0.5rem;
}

.start-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(107, 203, 119, 0.3);
}

/* === Battle Screen === */

/* HP Bars */
.hp-section {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.hp-bar-container {
    flex: 1;
    text-align: left;
}

.hp-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 0.35rem;
    color: var(--text-muted);
}

.hp-bar {
    height: 14px;
    background: #222244;
    border-radius: 7px;
    overflow: hidden;
    border: 1px solid var(--card-border);
}

.hp-fill {
    height: 100%;
    border-radius: 7px;
    transition: width 0.5s ease, background 0.3s;
}

.hp-fill-player { background: linear-gradient(90deg, var(--blue), #7cb8ff); }
.hp-fill-computer { background: linear-gradient(90deg, var(--accent), #ff7b8e); }
.hp-fill.hp-warn { background: linear-gradient(90deg, #f59e0b, #fbbf24) !important; }
.hp-fill.hp-danger { background: linear-gradient(90deg, #ef4444, #f87171) !important; animation: hp-pulse 0.8s ease infinite alternate; }

@keyframes hp-pulse {
    from { opacity: 1; }
    to { opacity: 0.6; }
}

/* Arena */
.arena {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1rem;
    min-height: 160px;
    position: relative;
}

.robot {
    background: var(--card);
    border: 2px solid var(--card-border);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem 1rem;
    min-width: 140px;
    transition: transform 0.2s;
}

/* === 3D Robot === */
.robot-3d {
    width: 100px;
    margin: 0 auto;
    position: relative;
    perspective: 400px;
    transform-style: preserve-3d;
}

/* Antenna */
.r-antenna {
    width: 4px;
    height: 18px;
    margin: 0 auto;
    border-radius: 2px;
    position: relative;
}

.hero .r-antenna { background: linear-gradient(180deg, #7cb8ff, #4d96ff); }
.villain .r-antenna { background: linear-gradient(180deg, #ff7b8e, #e94560); }

.r-antenna-ball {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    animation: antenna-glow 1.5s ease infinite alternate;
}

.hero .r-antenna-ball {
    background: radial-gradient(circle, #7cb8ff, #4d96ff);
    box-shadow: 0 0 8px #4d96ff, 0 0 16px rgba(77, 150, 255, 0.4);
}

.villain .r-antenna-ball {
    background: radial-gradient(circle, #ff7b8e, #e94560);
    box-shadow: 0 0 8px #e94560, 0 0 16px rgba(233, 69, 96, 0.4);
}

@keyframes antenna-glow {
    from { box-shadow: 0 0 6px currentColor; opacity: 0.7; }
    to { box-shadow: 0 0 14px currentColor; opacity: 1; }
}

/* Head */
.r-head {
    width: 70px;
    height: 52px;
    margin: 0 auto;
    border-radius: 14px 14px 10px 10px;
    position: relative;
    transform: rotateX(5deg);
}

.hero .r-head {
    background: linear-gradient(180deg, #5a7fbf, #3a5a8f);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3), inset 0 2px 4px rgba(255,255,255,0.1);
    border: 1px solid #6a8fcf;
}

.villain .r-head {
    background: linear-gradient(180deg, #8b3a4a, #5a2030);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3), inset 0 2px 4px rgba(255,255,255,0.1);
    border: 1px solid #9b4a5a;
}

/* Eyes */
.r-eye {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    position: absolute;
    top: 14px;
    background: #111;
    border: 2px solid #333;
    box-shadow: inset 0 0 4px rgba(0,0,0,0.5);
}

.r-eye::after {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    position: absolute;
    top: 2px;
    left: 2px;
    animation: eye-blink 3s ease infinite;
}

.hero .r-eye::after {
    background: radial-gradient(circle, #fff, #7cb8ff);
    box-shadow: 0 0 6px #7cb8ff;
}

.villain .r-eye::after {
    background: radial-gradient(circle, #fff, #ff4444);
    box-shadow: 0 0 6px #ff4444;
}

@keyframes eye-blink {
    0%, 95%, 100% { transform: scaleY(1); }
    97% { transform: scaleY(0.1); }
}

.r-eye-l { left: 12px; }
.r-eye-r { right: 12px; }

/* Mouth */
.r-mouth {
    width: 22px;
    height: 6px;
    border-radius: 0 0 6px 6px;
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: #222;
    border: 1px solid #444;
}

.r-mouth-evil {
    width: 28px;
    height: 8px;
    border-radius: 0 0 4px 4px;
    clip-path: polygon(0 0, 15% 80%, 30% 0, 45% 80%, 60% 0, 75% 80%, 100% 0, 100% 100%, 0 100%);
    background: #ff4444;
    border: none;
}

/* Neck */
.r-neck {
    width: 20px;
    height: 8px;
    margin: 0 auto;
    border-radius: 2px;
}

.hero .r-neck { background: linear-gradient(180deg, #4a6a9f, #3a5a8f); }
.villain .r-neck { background: linear-gradient(180deg, #6a2a3a, #5a2030); }

/* Torso */
.r-torso {
    width: 80px;
    height: 60px;
    margin: 0 auto;
    border-radius: 8px 8px 12px 12px;
    position: relative;
    transform: rotateX(3deg);
}

.hero .r-torso {
    background: linear-gradient(180deg, #4a6a9f, #2a4a7f);
    box-shadow: 0 6px 16px rgba(0,0,0,0.3), inset 0 2px 6px rgba(255,255,255,0.08);
    border: 1px solid #5a7aaf;
}

.villain .r-torso {
    background: linear-gradient(180deg, #7a2a3a, #4a1020);
    box-shadow: 0 6px 16px rgba(0,0,0,0.3), inset 0 2px 6px rgba(255,255,255,0.08);
    border: 1px solid #8a3a4a;
}

.r-chest-light {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    animation: chest-pulse 2s ease infinite alternate;
}

.hero .r-chest-light {
    background: radial-gradient(circle, #7cb8ff, #4d96ff);
    box-shadow: 0 0 10px #4d96ff, 0 0 20px rgba(77, 150, 255, 0.3);
}

.villain .r-chest-light {
    background: radial-gradient(circle, #ff7b8e, #e94560);
    box-shadow: 0 0 10px #e94560, 0 0 20px rgba(233, 69, 96, 0.3);
}

@keyframes chest-pulse {
    from { box-shadow: 0 0 6px currentColor; }
    to { box-shadow: 0 0 16px currentColor, 0 0 30px currentColor; }
}

.r-chest-panel {
    width: 40px;
    height: 16px;
    border-radius: 3px;
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: #111;
    border: 1px solid #333;
    box-shadow: inset 0 0 4px rgba(0,0,0,0.5);
}

.r-chest-panel::after {
    content: '';
    display: block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    position: absolute;
    top: 4px;
    left: 6px;
    background: #6bcb77;
    box-shadow: 12px 0 0 #ffd93d, 24px 0 0 #e94560;
}

/* Arms */
.r-arms {
    position: absolute;
    top: 90px;
    width: 100%;
}

.r-arm {
    width: 16px;
    height: 50px;
    border-radius: 6px 6px 8px 8px;
    position: absolute;
}

.hero .r-arm {
    background: linear-gradient(180deg, #4a6a9f, #3a5a8f);
    box-shadow: 2px 4px 8px rgba(0,0,0,0.3);
    border: 1px solid #5a7aaf;
}

.villain .r-arm {
    background: linear-gradient(180deg, #7a2a3a, #5a1a2a);
    box-shadow: 2px 4px 8px rgba(0,0,0,0.3);
    border: 1px solid #8a3a4a;
}

.r-arm-l {
    left: -6px;
    transform: rotate(8deg);
    transform-origin: top center;
    animation: arm-idle-l 3s ease infinite alternate;
}

.r-arm-r {
    right: -6px;
    transform: rotate(-8deg);
    transform-origin: top center;
    animation: arm-idle-r 3s ease infinite alternate;
}

@keyframes arm-idle-l {
    from { transform: rotate(6deg); }
    to { transform: rotate(10deg); }
}

@keyframes arm-idle-r {
    from { transform: rotate(-6deg); }
    to { transform: rotate(-10deg); }
}

/* Arm fists */
.r-arm::after {
    content: '';
    width: 18px;
    height: 14px;
    border-radius: 6px;
    position: absolute;
    bottom: -2px;
    left: -1px;
}

.hero .r-arm::after { background: #5a7aaf; }
.villain .r-arm::after { background: #8a3a4a; }

/* Legs */
.r-legs {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 2px;
}

.r-leg {
    width: 22px;
    height: 30px;
    border-radius: 4px 4px 8px 8px;
}

.hero .r-leg {
    background: linear-gradient(180deg, #3a5a8f, #2a4a7f);
    box-shadow: 0 4px 8px rgba(0,0,0,0.4);
    border: 1px solid #4a6a9f;
}

.villain .r-leg {
    background: linear-gradient(180deg, #5a1a2a, #4a1020);
    box-shadow: 0 4px 8px rgba(0,0,0,0.4);
    border: 1px solid #6a2a3a;
}

/* Feet */
.r-leg::after {
    content: '';
    display: block;
    width: 28px;
    height: 10px;
    border-radius: 6px;
    position: relative;
    top: 24px;
    left: -3px;
}

.hero .r-leg::after { background: #4a6a9f; box-shadow: 0 2px 4px rgba(0,0,0,0.3); }
.villain .r-leg::after { background: #6a2a3a; box-shadow: 0 2px 4px rgba(0,0,0,0.3); }

/* Shadow */
.r-shadow {
    width: 70px;
    height: 10px;
    border-radius: 50%;
    background: rgba(0,0,0,0.3);
    margin: 14px auto 0;
    filter: blur(4px);
}

/* Idle bob */
.robot-3d {
    animation: robot-idle 3s ease infinite;
}

@keyframes robot-idle {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

.robot-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-top: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.player-robot { border-color: rgba(77, 150, 255, 0.3); }
.computer-robot { border-color: rgba(233, 69, 96, 0.3); }

.hit-shake {
    animation: hit-shake 0.5s ease;
}

@keyframes hit-shake {
    0%, 100% { transform: translateX(0); }
    15% { transform: translateX(-10px) rotate(-2deg); }
    30% { transform: translateX(8px) rotate(2deg); }
    45% { transform: translateX(-6px) rotate(-1deg); }
    60% { transform: translateX(4px); }
}

.battle-fx {
    font-size: 3rem;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    opacity: 0;
    z-index: 10;
}

.battle-fx.fx-pop {
    animation: fx-pop 0.6s ease forwards;
}

@keyframes fx-pop {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.3); }
    30% { opacity: 1; transform: translate(-50%, -50%) scale(1.4); }
    100% { opacity: 0; transform: translate(-50%, -70%) scale(1); }
}

/* Battle Log */
.battle-log {
    margin-bottom: 1rem;
    min-height: 2rem;
}

.log-entry {
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.3rem 0;
    animation: log-fade-in 0.3s ease;
}

.log-entry:not(:first-child) {
    opacity: 0.4;
    font-size: 0.8rem;
}

@keyframes log-fade-in {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.log-hit { color: var(--green); }
.log-miss { color: var(--gold); }
.log-enemy-hit { color: var(--accent); }
.log-enemy-miss { color: var(--blue); }
.log-info { color: var(--text-muted); }

/* Question Card */
.turn-section {
    margin-top: 0.5rem;
}

.question-card {
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: 1.5rem;
}

.question-prompt {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
}

.question-math {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 1.25rem;
    color: var(--gold);
}

.answer-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    max-width: 350px;
    margin: 0 auto;
}

.answer-btn {
    background: var(--bg);
    border: 2px solid var(--card-border);
    border-radius: 12px;
    color: var(--text);
    font-size: 1.5rem;
    font-weight: 700;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.15s;
}

.answer-btn:hover:not(:disabled) {
    border-color: var(--gold);
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(255, 217, 61, 0.15);
}

.answer-btn:active:not(:disabled) {
    transform: scale(1.02);
}

.answer-btn:disabled {
    cursor: default;
    opacity: 0.6;
}

.answer-btn.correct {
    border-color: var(--green) !important;
    background: rgba(107, 203, 119, 0.15) !important;
    opacity: 1 !important;
    color: var(--green);
}

.answer-btn.wrong {
    border-color: var(--accent) !important;
    background: rgba(233, 69, 96, 0.15) !important;
    opacity: 1 !important;
    color: var(--accent);
}

/* Explanation box */
.explain-box {
    margin-top: 1.25rem;
    padding: 1rem 1.25rem;
    background: rgba(255, 217, 61, 0.08);
    border: 2px solid rgba(255, 217, 61, 0.3);
    border-radius: 12px;
    animation: explain-slide-in 0.3s ease;
}

@keyframes explain-slide-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.explain-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--gold);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.5rem;
}

.explain-math {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.75rem;
}

.explain-btn {
    background: var(--gold);
    color: #1a1a2e;
    border: none;
    border-radius: 10px;
    padding: 0.6rem 1.5rem;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.15s;
}

.explain-btn:hover {
    transform: scale(1.05);
}

.computer-turn-card {
    border-color: rgba(233, 69, 96, 0.3);
    animation: enemy-pulse 1s ease infinite alternate;
}

@keyframes enemy-pulse {
    from { box-shadow: 0 0 0 rgba(233, 69, 96, 0); }
    to { box-shadow: 0 0 25px rgba(233, 69, 96, 0.2); }
}

/* === Game Over === */
.gameover-card {
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: 2rem;
}

.gameover-emoji {
    font-size: 5rem;
    margin-bottom: 1rem;
}

.gameover-card h2 {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
}

.gameover-msg {
    color: var(--text-muted);
    font-size: 1rem;
    margin-bottom: 1.5rem;
}

.gameover-stats {
    background: var(--bg);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    text-align: left;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    padding: 0.4rem 0;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--card-border);
}

.stat-row:last-child { border-bottom: none; }
.stat-row span:first-child { color: var(--text-muted); }
.stat-row span:last-child { font-weight: 700; }

.play-again-btn {
    background: linear-gradient(135deg, var(--accent), #ff6b8a);
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 1.1rem;
    font-weight: 700;
    padding: 0.9rem 2.5rem;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.play-again-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(233, 69, 96, 0.3);
}

/* Confetti */
.confetti {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    top: 20%;
    animation: confetti-fall linear forwards;
    pointer-events: none;
}

@keyframes confetti-fall {
    0% { transform: translateY(0) rotate(0deg) scale(1); opacity: 1; }
    100% { transform: translateY(500px) rotate(720deg) scale(0); opacity: 0; }
}

/* Tablet */
@media (max-width: 500px) {
    .title { font-size: 1.6rem; }
    .robot-3d { transform: scale(0.8); }
    .robot { min-width: 110px; padding: 0.75rem 1rem; }
    .question-math { font-size: 2rem; }
    .answer-btn { font-size: 1.2rem; padding: 0.75rem; }
    .diff-desc { display: none; }
}

/* Mobile */
@media (max-width: 430px) {
    .game-container { padding: 1rem 0.75rem; }
    .title { font-size: 1.4rem; margin-bottom: 1rem; }

    /* Setup */
    .setup-card { padding: 1.25rem 1rem; }
    .setup-card h2 { font-size: 1.15rem; margin-bottom: 1rem; }
    .preset-row { flex-wrap: wrap; gap: 0.4rem; }
    .preset-btn { flex: 1; min-width: 80px; padding: 0.5rem 0.6rem; font-size: 0.85rem; justify-content: center; }
    .setup-divider { margin: 0.75rem 0; }
    .setup-section { margin-bottom: 0.75rem; }
    .op-toggles { gap: 0.35rem; }
    .op-btn { padding: 0.5rem 0.7rem; font-size: 0.85rem; }
    .mode-btn { min-width: 100px; }
    .num-picker { gap: 0.35rem; }
    .num-picker-btn { width: 38px; height: 38px; font-size: 0.95rem; }
    .num-picker-value { font-size: 1.8rem; min-width: 50px; }
    .start-btn { font-size: 1.05rem; padding: 0.8rem 2rem; }
    .learning-btn { min-width: 170px; }

    /* Battle */
    .hp-section { gap: 0.5rem; margin-bottom: 1rem; }
    .hp-label { font-size: 0.7rem; }
    .hp-bar { height: 10px; }

    .arena { gap: 0.5rem; margin-bottom: 0.75rem; min-height: 120px; }
    .robot { min-width: 100px; padding: 0.5rem 0.75rem; }
    .robot-3d { transform: scale(0.65); }
    .robot-name { font-size: 0.7rem; }

    .battle-log { margin-bottom: 0.5rem; }
    .log-entry { font-size: 0.75rem; }

    .question-card { padding: 1rem; }
    .question-prompt { font-size: 0.8rem; margin-bottom: 0.5rem; }
    .question-math { font-size: 1.8rem; margin-bottom: 1rem; }
    .answer-grid { gap: 0.5rem; max-width: 280px; }
    .answer-btn { font-size: 1.1rem; padding: 0.7rem; }

    .explain-box { padding: 0.75rem 1rem; }
    .explain-math { font-size: 1.2rem; }

    /* Handoff */
    .handoff-emoji { font-size: 3rem; }
    .handoff-text { font-size: 1.2rem; }

    /* Game Over */
    .gameover-card { padding: 1.25rem; }
    .gameover-emoji { font-size: 3.5rem; }
    .gameover-card h2 { font-size: 1.5rem; }
    .gameover-msg { font-size: 0.9rem; }
    .stat-row { font-size: 0.8rem; }
    .play-again-btn { font-size: 1rem; padding: 0.75rem 2rem; }
}
