/* ============================================
   Chinese Stroke Order Training - Styles
   ============================================ */

/* CSS Variables */
:root {
    /* Colors - Ink & Paper Theme */
    --bg-primary: #1a1a2e;
    --bg-secondary: #16213e;
    --bg-card: #0f3460;
    --text-primary: #eee;
    --text-secondary: #a0a0a0;
    --accent-gold: #f4d03f;
    --accent-red: #e74c3c;
    --accent-green: #2ecc71;
    --accent-blue: #3498db;
    --accent-ink: #2c3e50;
    --paper: #f5f0e1;
    --ink-black: #1a1a1a;
    
    /* Shadows */
    --shadow-soft: 0 4px 20px rgba(0, 0, 0, 0.3);
    --shadow-glow: 0 0 20px rgba(244, 208, 63, 0.3);
    
    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
    
    /* Spacing */
    --header-height: 60px;
    --stats-height: 50px;
    --controls-height: 60px;
}

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: 'PingFang SC', 'Microsoft YaHei', 'Noto Sans SC', sans-serif;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* ============================================
   Loading Screen
   ============================================ */
#loading-screen {
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, var(--bg-primary), var(--bg-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-content {
    text-align: center;
    padding: 2rem;
}

.brush-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    animation: brush-wiggle 1s ease-in-out infinite;
}

@keyframes brush-wiggle {
    0%, 100% { transform: rotate(-10deg); }
    50% { transform: rotate(10deg); }
}

.loading-title {
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-gold), #fff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

.loading-subtitle {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.loading-bar {
    width: 200px;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    margin: 0 auto 1rem;
    overflow: hidden;
}

.loading-progress {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent-gold), var(--accent-red));
    border-radius: 2px;
    transition: width 0.3s ease;
}

.loading-status {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* ============================================
   Permission Screen
   ============================================ */
#permission-screen {
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, var(--bg-primary), var(--bg-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
    padding: 1rem;
}

.permission-content {
    text-align: center;
    max-width: 400px;
    padding: 2rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    backdrop-filter: blur(10px);
}

.camera-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.permission-content h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.permission-content p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.permission-list {
    list-style: none;
    text-align: left;
    margin-bottom: 2rem;
}

.permission-list li {
    padding: 0.5rem 0;
    color: var(--accent-green);
    font-size: 0.9rem;
}

/* Buttons */
.btn-primary, .btn-secondary {
    display: block;
    width: 100%;
    padding: 1rem 2rem;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-normal);
    margin-bottom: 0.75rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-gold), #e6c02e);
    color: var(--ink-black);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

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

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* ============================================
   Calibration Screen
   ============================================ */
#calibration-screen {
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, var(--bg-primary), var(--bg-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 998;
    padding: 1rem;
}

.calibration-content {
    text-align: center;
    max-width: 500px;
    width: 100%;
}

.calibration-content h2 {
    margin-bottom: 0.5rem;
}

.calibration-content > p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.calibration-preview {
    position: relative;
    width: 100%;
    max-width: 400px;
    aspect-ratio: 4/3;
    margin: 0 auto 1.5rem;
    border-radius: 16px;
    overflow: hidden;
    background: #000;
}

#calib-video, #calib-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#calib-canvas {
    pointer-events: none;
}

.calibration-target {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 80px;
    border: 3px dashed var(--accent-gold);
    border-radius: 50%;
    animation: pulse-ring 2s ease-in-out infinite;
}

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

.calibration-status {
    margin-bottom: 1.5rem;
}

.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
}

.indicator-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent-red);
    transition: var(--transition-normal);
}

.status-indicator.detected .indicator-dot {
    background: var(--accent-green);
    animation: pulse-dot 1s ease-in-out infinite;
}

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

/* ============================================
   Tutorial Screen (Stroke Training)
   ============================================ */
#tutorial-screen {
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, var(--bg-primary), var(--bg-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 997;
    padding: 1rem;
}

.tutorial-content {
    max-width: 800px;
    width: 100%;
    text-align: center;
}

.tutorial-header h2 {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
    color: var(--accent-gold);
}

.tutorial-header p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.tutorial-progress {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    border: 2px solid transparent;
    transition: var(--transition-normal);
    min-width: 70px;
}

.progress-step.active {
    border-color: var(--accent-gold);
    background: rgba(244, 208, 63, 0.1);
}

.progress-step.completed {
    border-color: var(--accent-green);
    background: rgba(46, 204, 113, 0.1);
}

.progress-step.completed .step-status {
    color: var(--accent-green);
}

.step-icon {
    font-size: 2rem;
    font-family: 'KaiTi', 'STKaiti', serif;
    color: var(--text-primary);
    line-height: 1;
}

.step-name {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.step-status {
    font-size: 1rem;
    margin-top: 0.25rem;
}

.tutorial-main {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.tutorial-demo {
    display: flex;
    align-items: center;
    justify-content: center;
}

.stroke-demo-box {
    width: 150px;
    height: 150px;
    background: var(--paper);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    box-shadow: var(--shadow-soft);
}

.stroke-arrow {
    position: absolute;
    width: 80%;
    height: 4px;
    background: var(--accent-gold);
    top: 50%;
    left: 10%;
    transform: translateY(-50%);
    border-radius: 2px;
}

.stroke-arrow::after {
    content: '';
    position: absolute;
    right: -8px;
    top: 50%;
    transform: translateY(-50%);
    border: 8px solid transparent;
    border-left: 12px solid var(--accent-gold);
}

/* Different arrow styles for different strokes */
.stroke-arrow.shu {
    width: 4px;
    height: 80%;
    top: 10%;
    left: 50%;
    transform: translateX(-50%);
}

.stroke-arrow.shu::after {
    right: auto;
    left: 50%;
    top: auto;
    bottom: -8px;
    transform: translateX(-50%);
    border: 8px solid transparent;
    border-top: 12px solid var(--accent-gold);
    border-left: 8px solid transparent;
}

.stroke-arrow.pie {
    width: 4px;
    height: 100px;
    background: var(--accent-gold);
    top: 15%;
    left: 60%;
    transform: rotate(45deg);
    transform-origin: top center;
}

.stroke-arrow.pie::after {
    right: auto;
    left: 50%;
    top: auto;
    bottom: -8px;
    transform: translateX(-50%);
    border: 8px solid transparent;
    border-top: 12px solid var(--accent-gold);
    border-left: 8px solid transparent;
}

.stroke-arrow.na {
    width: 4px;
    height: 100px;
    background: var(--accent-gold);
    top: 15%;
    left: 40%;
    transform: rotate(-45deg);
    transform-origin: top center;
}

.stroke-arrow.na::after {
    right: auto;
    left: 50%;
    top: auto;
    bottom: -8px;
    transform: translateX(-50%);
    border: 8px solid transparent;
    border-top: 12px solid var(--accent-gold);
    border-left: 8px solid transparent;
}

.stroke-arrow.dian {
    width: 20px;
    height: 20px;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    top: 40%;
    left: 45%;
}

.stroke-arrow.dian::after {
    display: none;
}

.stroke-name-big {
    font-size: 3rem;
    font-family: 'KaiTi', 'STKaiti', serif;
    color: rgba(0, 0, 0, 0.15);
    position: absolute;
}

.stroke-direction {
    position: absolute;
    bottom: 10px;
    font-size: 0.85rem;
    color: var(--accent-ink);
    font-weight: 500;
}

.tutorial-practice {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.practice-area {
    position: relative;
    width: 100%;
    max-width: 550px;
    aspect-ratio: 4/3;
    background: #000;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow-soft);
}

#tutorial-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1);
}

#tutorial-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.practice-guide {
    position: absolute;
    inset: 15%;
    border: 2px dashed rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    pointer-events: none;
}

.guide-line {
    position: absolute;
    background: rgba(244, 208, 63, 0.4);
    border-radius: 4px;
    transition: all 0.3s ease;
}

.guide-line.heng {
    width: 70%;
    height: 6px;
    top: 50%;
    left: 15%;
    transform: translateY(-50%);
}

.guide-line.shu {
    width: 6px;
    height: 70%;
    top: 15%;
    left: 50%;
    transform: translateX(-50%);
}

.guide-line.pie {
    width: 6px;
    height: 80%;
    top: 10%;
    left: 55%;
    transform: rotate(45deg);
    transform-origin: top center;
}

.guide-line.na {
    width: 6px;
    height: 80%;
    top: 10%;
    left: 45%;
    transform: rotate(-45deg);
    transform-origin: top center;
}

.guide-line.dian {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    top: 40%;
    left: 45%;
}

.practice-hint {
    margin-top: 1rem;
    font-size: 1rem;
    color: var(--accent-gold);
}

.pinch-tip {
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.05);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    border-left: 3px solid var(--accent-gold);
}

.tutorial-controls {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.tutorial-feedback {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(46, 204, 113, 0.95);
    padding: 2rem 3rem;
    border-radius: 20px;
    text-align: center;
    z-index: 100;
    animation: feedback-pop 0.3s ease;
}

@keyframes feedback-pop {
    0% { transform: translate(-50%, -50%) scale(0.5); opacity: 0; }
    50% { transform: translate(-50%, -50%) scale(1.1); }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

.feedback-icon {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

.feedback-text {
    font-size: 1.5rem;
    font-weight: 600;
}

/* Mobile tutorial */
@media (max-width: 768px) {
    .tutorial-main {
        grid-template-columns: 1fr;
    }
    
    .stroke-demo-box {
        width: 120px;
        height: 120px;
    }
    
    .tutorial-progress {
        gap: 0.5rem;
    }
    
    .progress-step {
        padding: 0.5rem 0.75rem;
        min-width: 55px;
    }
    
    .step-icon {
        font-size: 1.5rem;
    }
}

/* ============================================
   Training Screen
   ============================================ */
#training-screen {
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* Header */
.app-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.back-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary);
    text-decoration: none;
    padding: 0.5rem;
    border-radius: 8px;
    transition: var(--transition-fast);
}

.back-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.back-btn .icon {
    font-size: 1.2rem;
}

.header-center h1 {
    font-size: 1.2rem;
    font-weight: 600;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.icon-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: var(--transition-fast);
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.lang-switcher {
    display: flex;
    gap: 0.25rem;
}

.lang-btn {
    padding: 0.4rem 0.6rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.85rem;
    cursor: pointer;
    border-radius: 6px;
    transition: var(--transition-fast);
}

.lang-btn.active {
    background: var(--accent-gold);
    color: var(--ink-black);
    font-weight: 600;
}

/* Game Stats */
.game-stats {
    height: var(--stats-height);
    display: flex;
    justify-content: space-around;
    align-items: center;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    flex-shrink: 0;
}

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

.stat-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 0.2rem;
}

.stat-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-item.timer .stat-value {
    color: var(--accent-gold);
    font-variant-numeric: tabular-nums;
}

.stat-item.timer.warning .stat-value {
    color: var(--accent-red);
    animation: timer-pulse 0.5s ease-in-out infinite;
}

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

/* Game Container */
.game-container {
    flex: 1;
    display: grid;
    grid-template-columns: 180px 1fr 180px;
    gap: 0.75rem;
    padding: 0.75rem;
    min-height: 0;
    overflow: hidden;
}

/* Character Panel */
.character-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.character-display {
    position: relative;
    width: 100%;
    max-width: 200px;
    aspect-ratio: 1;
    background: var(--paper);
    border-radius: 12px;
    box-shadow: var(--shadow-soft);
    overflow: hidden;
}

#character-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.character-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

#target-character {
    font-size: 8rem;
    font-weight: 400;
    color: rgba(0, 0, 0, 0.15);
    font-family: 'KaiTi', 'STKaiti', 'SimKai', serif;
    user-select: none;
}

.stroke-guide {
    text-align: center;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    display: none; /* 正式测试不显示笔画提示 */
}

#stroke-hint {
    font-size: 0.9rem;
    color: var(--accent-gold);
}

/* Writing Panel */
.writing-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    flex: 1;
    min-height: 0;
}

.camera-container {
    position: relative;
    width: 100%;
    max-width: 600px;
    max-height: 65vh;
    aspect-ratio: 4/3;
    background: #000;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow-soft);
    margin: 0 auto;
}

#camera-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1); /* Mirror for natural writing */
    z-index: 1;
}

#tracking-canvas, #writing-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

#writing-canvas {
    z-index: 4; /* ink strokes */
}

#tracking-canvas {
    z-index: 7; /* fingertip trail always visible (formal game too) */
}

#writing-canvas {
    pointer-events: auto;
    cursor: crosshair;
}

.writing-zone {
    position: absolute;
    inset: 10%;
    border: 2px dashed rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    pointer-events: none;
}

.zone-guide {
    position: absolute;
    inset: 0;
    /* Grid pattern for writing guide */
    background-image: 
        linear-gradient(rgba(255, 255, 255, 0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.1) 1px, transparent 1px);
    background-size: 50% 50%;
    background-position: center;
}

/* Embedded character for tracing */
.embedded-character {
    position: absolute;
    inset: 10%;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 2; /* behind guides/ink/trail */
}

#trace-character {
    font-size: min(30vw, 200px);
    font-family: 'KaiTi', 'STKaiti', 'SimKai', serif;
    color: rgba(255, 255, 255, 0.25);
    text-shadow: 
        0 0 10px rgba(255, 255, 255, 0.1),
        0 0 20px rgba(244, 208, 63, 0.1);
    user-select: none;
    transition: all 0.3s ease;
}

/* Show stroke guide canvas */
#stroke-guide-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    display: none; /* 正式测试不显示笔画引导线 */
    z-index: 3; /* above tracing char, below ink/trail */
}

/* Fullscreen FX canvas */
.fx-canvas {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 9998;
    display: none;
}

.fx-canvas.active {
    display: block;
}

/* Extra impact look during explosion */
.game-container.explosion-impact {
    filter: contrast(1.12) saturate(1.25) brightness(0.95);
}

/* Correct mark animation */
.correct-mark {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    font-size: 6rem;
    color: var(--accent-green);
    text-shadow: 0 0 30px rgba(46, 204, 113, 0.8);
    animation: correct-mark-pop 0.6s ease forwards;
    pointer-events: none;
    z-index: 50;
}

@keyframes correct-mark-pop {
    0% { transform: translate(-50%, -50%) scale(0) rotate(-20deg); opacity: 0; }
    40% { transform: translate(-50%, -50%) scale(1.3) rotate(10deg); opacity: 1; }
    70% { transform: translate(-50%, -50%) scale(0.9) rotate(-5deg); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(1) rotate(0deg); opacity: 0; }
}

.wrong-mark {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    font-size: 6rem;
    color: var(--accent-red);
    text-shadow: 0 0 30px rgba(231, 76, 60, 0.8);
    animation: wrong-mark-pop 0.5s ease forwards;
    pointer-events: none;
    z-index: 50;
}

@keyframes wrong-mark-pop {
    0% { transform: translate(-50%, -50%) scale(0) rotate(-20deg); opacity: 0; }
    50% { transform: translate(-50%, -50%) scale(1.2) rotate(5deg); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(1) rotate(0deg); opacity: 0; }
}

.writing-hint {
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-align: center;
    padding: 0.5rem 1rem;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    margin-top: 0.5rem;
}

.writing-hint strong {
    color: var(--accent-gold);
}

/* Pinch indicator overlay */
.pinch-indicator {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.5rem 1rem;
    background: rgba(231, 76, 60, 0.9);
    color: white;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: bold;
    animation: pinch-pulse 0.5s ease-in-out infinite;
    z-index: 20;
}

@keyframes pinch-pulse {
    0%, 100% { transform: translateX(-50%) scale(1); }
    50% { transform: translateX(-50%) scale(1.05); }
}

/* Camera container border changes when pinching */
.camera-container.pinching {
    border: 3px solid var(--accent-red);
    box-shadow: 0 0 20px rgba(231, 76, 60, 0.5);
}

/* Animation Panel */
.animation-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    padding: 1rem;
}

/* Bucket */
.bucket-container {
    position: relative;
    width: 120px;
    height: 150px;
}

.bucket {
    position: relative;
    width: 120px;
    height: 110px;
    transform-origin: top center;
    transition: transform 0.3s ease;
    filter: drop-shadow(0 10px 18px rgba(0,0,0,0.45));
}

.bucket.tilt-1 { transform: rotate(-10deg); }
.bucket.tilt-2 { transform: rotate(-20deg); }
.bucket.tilt-3 { transform: rotate(-35deg); }
.bucket.tilt-4 { transform: rotate(-50deg); }
.bucket.tilt-5 { transform: rotate(-70deg); }
.bucket.pouring { transform: rotate(-90deg); }

.bucket-body {
    position: absolute;
    bottom: 0;
    width: 100%;
    height: 88px;
    /* Realistic metal bucket */
    background:
        linear-gradient(90deg,
            rgba(255,255,255,0.10) 0%,
            rgba(255,255,255,0.04) 14%,
            rgba(0,0,0,0.08) 30%,
            rgba(255,255,255,0.08) 50%,
            rgba(0,0,0,0.18) 70%,
            rgba(255,255,255,0.05) 100%),
        radial-gradient(ellipse at 30% 20%,
            rgba(255,255,255,0.18) 0%,
            rgba(255,255,255,0.00) 55%),
        linear-gradient(180deg, #3e3e42 0%, #1b1c20 100%);
    border-radius: 0 0 14px 14px;
    clip-path: polygon(12% 0, 88% 0, 100% 100%, 0% 100%);
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.06);
}

.bucket-rim {
    position: absolute;
    left: 50%;
    top: 4px;
    transform: translateX(-50%);
    width: 118px;
    height: 20px;
    border-radius: 999px;
    background:
        linear-gradient(90deg,
            rgba(255,255,255,0.18) 0%,
            rgba(0,0,0,0.15) 35%,
            rgba(255,255,255,0.10) 60%,
            rgba(0,0,0,0.25) 100%),
        linear-gradient(180deg, #5a5c66, #2a2b31);
    box-shadow:
        inset 0 2px 2px rgba(255,255,255,0.10),
        inset 0 -2px 6px rgba(0,0,0,0.35);
    border: 1px solid rgba(255,255,255,0.10);
    z-index: 2;
}

.bucket-ribs {
    position: absolute;
    inset: 0;
    background:
        repeating-linear-gradient(90deg,
            rgba(255,255,255,0.08) 0px,
            rgba(255,255,255,0.08) 2px,
            rgba(0,0,0,0.0) 7px,
            rgba(0,0,0,0.0) 12px);
    opacity: 0.18;
    mix-blend-mode: overlay;
    pointer-events: none;
}

.bucket-label {
    position: absolute;
    left: 50%;
    top: 54%;
    transform: translate(-50%, -50%);
    padding: 6px 10px;
    border-radius: 10px;
    background: linear-gradient(180deg, rgba(0,0,0,0.55), rgba(0,0,0,0.25));
    border: 1px solid rgba(255,255,255,0.10);
    box-shadow: inset 0 1px 2px rgba(255,255,255,0.10), 0 8px 18px rgba(0,0,0,0.35);
    letter-spacing: 2px;
    font-weight: 700;
    color: rgba(255,255,255,0.9);
    font-size: 0.85rem;
    font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
    text-shadow: 0 1px 2px rgba(0,0,0,0.65);
    pointer-events: none;
}

.water {
    position: absolute;
    bottom: 0;
    left: 5%;
    width: 90%;
    height: 80%;
    background:
        radial-gradient(ellipse at 50% 10%,
            rgba(255,255,255,0.35) 0%,
            rgba(255,255,255,0.0) 55%),
        linear-gradient(180deg, rgba(120,220,255,0.95), rgba(40,120,255,0.75));
    border-radius: 0 0 8px 8px;
    transition: height 0.3s ease;
}

.bucket-handle {
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 92px;
    height: 44px;
    border: 4px solid rgba(190, 195, 210, 0.75);
    border-bottom: none;
    border-radius: 30px 30px 0 0;
    box-shadow: 0 3px 10px rgba(0,0,0,0.35);
}

.bucket-grip {
    position: absolute;
    top: -18px;
    left: 50%;
    transform: translateX(-50%);
    width: 22px;
    height: 10px;
    border-radius: 999px;
    background: rgba(0,0,0,0.35);
    box-shadow: inset 0 1px 2px rgba(255,255,255,0.08);
}

.water-drops {
    position: absolute;
    top: 70px;
    left: 50%;
    transform: translateX(-50%);
}

.water-drops .drop {
    position: absolute;
    width: 8px;
    height: 12px;
    background: #3498db;
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    animation: drop-fall 0.6s ease-in forwards;
}

.water-drops .drop:nth-child(1) { left: -20px; animation-delay: 0s; }
.water-drops .drop:nth-child(2) { left: -10px; animation-delay: 0.1s; }
.water-drops .drop:nth-child(3) { left: 0px; animation-delay: 0.05s; }
.water-drops .drop:nth-child(4) { left: 10px; animation-delay: 0.15s; }
.water-drops .drop:nth-child(5) { left: 20px; animation-delay: 0.08s; }

@keyframes drop-fall {
    0% { transform: translateY(0) scale(1); opacity: 1; }
    100% { transform: translateY(100px) scale(0.5); opacity: 0; }
}

/* Bomb - Scary Version */
.bomb-container {
    position: relative;
    width: 150px;
    height: 170px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.bomb {
    position: relative;
    width: 118px;
    height: 118px;
    margin: 0 auto;
    animation: bomb-pulse 1s ease-in-out infinite;
}

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

.bomb.urgent {
    animation: bomb-shake 0.1s ease-in-out infinite;
}

@keyframes bomb-shake {
    0%, 100% { transform: translateX(0) rotate(0deg); }
    25% { transform: translateX(-3px) rotate(-2deg); }
    75% { transform: translateX(3px) rotate(2deg); }
}

.bomb-body {
    width: 118px;
    height: 118px;
    /* More realistic metal sphere */
    background:
        radial-gradient(ellipse at 30% 28%, rgba(255,255,255,0.22) 0%, rgba(255,255,255,0.00) 55%),
        radial-gradient(ellipse at 65% 70%, rgba(0,0,0,0.55) 0%, rgba(0,0,0,0.0) 60%),
        linear-gradient(180deg, #2a2a2f 0%, #0b0b0d 100%);
    border-radius: 50%;
    box-shadow: 
        inset 0 -15px 30px rgba(0, 0, 0, 0.8),
        inset 0 5px 10px rgba(255, 255, 255, 0.1),
        0 10px 30px rgba(0, 0, 0, 0.5),
        0 0 20px rgba(255, 50, 0, 0.3);
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.06);
}

.bomb-highlight {
    position: absolute;
    top: 14px;
    left: 20px;
    width: 34px;
    height: 20px;
    background: linear-gradient(135deg, rgba(255,255,255,0.4), transparent);
    border-radius: 50%;
}

.bomb-rivets {
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0.9;
}

.bomb-rivets::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 18% 28%, rgba(200,200,210,0.85) 0 2px, rgba(0,0,0,0) 3px),
        radial-gradient(circle at 80% 25%, rgba(200,200,210,0.85) 0 2px, rgba(0,0,0,0) 3px),
        radial-gradient(circle at 84% 78%, rgba(200,200,210,0.85) 0 2px, rgba(0,0,0,0) 3px),
        radial-gradient(circle at 20% 78%, rgba(200,200,210,0.85) 0 2px, rgba(0,0,0,0) 3px),
        radial-gradient(circle at 50% 14%, rgba(200,200,210,0.65) 0 2px, rgba(0,0,0,0) 3px),
        radial-gradient(circle at 50% 88%, rgba(200,200,210,0.65) 0 2px, rgba(0,0,0,0) 3px);
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.6));
}

.bomb-seam {
    position: absolute;
    left: 50%;
    top: 52%;
    transform: translate(-50%, -50%);
    width: 112px;
    height: 26px;
    border-radius: 999px;
    background:
        linear-gradient(180deg, rgba(255,255,255,0.08), rgba(0,0,0,0.35));
    box-shadow:
        inset 0 2px 3px rgba(255,255,255,0.08),
        inset 0 -2px 6px rgba(0,0,0,0.55);
    opacity: 0.55;
    pointer-events: none;
}

.bomb-hazard {
    position: absolute;
    left: 50%;
    top: 52%;
    transform: translate(-50%, -50%);
    width: 54px;
    height: 54px;
    opacity: 0.95;
    filter: drop-shadow(0 6px 10px rgba(0,0,0,0.55));
}

.bomb-glow {
    position: absolute;
    inset: -10px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 100, 0, 0.3) 0%, transparent 70%);
    animation: glow-pulse 1.5s ease-in-out infinite;
    pointer-events: none;
}

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

.bomb.extinguished .bomb-body {
    background: radial-gradient(circle at 30% 30%, #5a5a5a, #3a3a3a);
    box-shadow: 
        inset 0 -10px 20px rgba(0, 0, 0, 0.5),
        0 5px 15px rgba(0, 0, 0, 0.3);
}

.bomb.extinguished .bomb-hazard,
.bomb.extinguished .bomb-rivets,
.bomb.extinguished .bomb-glow {
    display: none;
}

.bomb.extinguished {
    animation: none;
}

/* Danger text */
.danger-text {
    margin-top: 10px;
    font-size: 0.8rem;
    font-weight: bold;
    color: var(--accent-red);
    text-shadow: 0 0 10px rgba(255, 0, 0, 0.5);
    animation: danger-flash 0.8s ease-in-out infinite;
    letter-spacing: 2px;
    font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

.danger-text.relief {
    color: rgba(125, 255, 210, 0.95);
    text-shadow: 0 0 14px rgba(46, 204, 113, 0.35);
    letter-spacing: 3px;
    animation: relief-fade 1.4s ease-out forwards !important;
}

@keyframes relief-fade {
    0% { opacity: 1; transform: translateY(0); }
    25% { opacity: 1; }
    100% { opacity: 0; transform: translateY(-10px); }
}

.relief-overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9997;
    background: radial-gradient(circle at center,
        rgba(120, 220, 255, 0.18) 0%,
        rgba(80, 170, 255, 0.10) 35%,
        rgba(46, 204, 113, 0.06) 60%,
        rgba(0, 0, 0, 0.0) 85%);
    backdrop-filter: blur(1px);
    animation: relief-overlay 1.4s ease-out forwards;
}

@keyframes relief-overlay {
    0% { opacity: 0; }
    18% { opacity: 1; }
    100% { opacity: 0; }
}

@keyframes danger-flash {
    0%, 100% { opacity: 1; color: #ff3333; }
    50% { opacity: 0.5; color: #ff6666; }
}

/* Fuse with actual burning animation */
.fuse {
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    width: 6px;
    height: 35px;
    z-index: 10;
}

.fuse-line {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        repeating-linear-gradient(
            0deg,
            #8B4513 0px,
            #654321 3px,
            #8B4513 6px
        );
    border-radius: 3px;
    transform-origin: bottom center;
    transition: height 0.1s linear;
}

.fuse.burning .fuse-line {
    animation: fuse-burn-real var(--fuse-duration, 30s) linear forwards;
}

@keyframes fuse-burn-real {
    0% { height: 100%; }
    100% { height: 0%; }
}

/* Ember at the burning point */
.fuse-ember {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 10px;
    height: 10px;
    background: radial-gradient(circle, #fff 0%, #ffcc00 30%, #ff6600 60%, #ff0000 100%);
    border-radius: 50%;
    box-shadow: 
        0 0 8px #ff6600,
        0 0 15px #ff3300,
        0 0 25px #ff0000;
    animation: ember-glow 0.15s ease-in-out infinite alternate;
}

@keyframes ember-glow {
    0% { transform: translateX(-50%) scale(0.8); opacity: 0.8; }
    100% { transform: translateX(-50%) scale(1.2); opacity: 1; }
}

.fuse.burning .fuse-ember {
    animation: 
        ember-glow 0.15s ease-in-out infinite alternate,
        ember-move var(--fuse-duration, 30s) linear forwards;
}

@keyframes ember-move {
    0% { top: 0; }
    100% { top: calc(100% - 10px); }
}

/* Spark container with multiple sparks */
.spark-container {
    position: absolute;
    top: -5px;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 30px;
}

.spark-container .spark {
    position: absolute;
    width: 4px;
    height: 4px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 0 6px #ffcc00, 0 0 10px #ff6600;
}

.spark-container .spark:nth-child(1) {
    animation: spark-fly-1 0.4s ease-out infinite;
}

.spark-container .spark:nth-child(2) {
    animation: spark-fly-2 0.5s ease-out infinite;
    animation-delay: 0.1s;
}

.spark-container .spark:nth-child(3) {
    animation: spark-fly-3 0.45s ease-out infinite;
    animation-delay: 0.2s;
}

@keyframes spark-fly-1 {
    0% { transform: translate(0, 0) scale(1); opacity: 1; }
    100% { transform: translate(-15px, -20px) scale(0); opacity: 0; }
}

@keyframes spark-fly-2 {
    0% { transform: translate(0, 0) scale(1); opacity: 1; }
    100% { transform: translate(15px, -25px) scale(0); opacity: 0; }
}

@keyframes spark-fly-3 {
    0% { transform: translate(0, 0) scale(1); opacity: 1; }
    100% { transform: translate(5px, -30px) scale(0); opacity: 0; }
}

.fuse.burning .spark-container {
    animation: spark-container-move var(--fuse-duration, 30s) linear forwards;
}

@keyframes spark-container-move {
    0% { top: -5px; }
    100% { top: calc(100% - 15px); }
}

/* Smoke trail from burning fuse */
.smoke-trail {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 15px;
    height: 15px;
    pointer-events: none;
}

.smoke-trail::before,
.smoke-trail::after {
    content: '';
    position: absolute;
    width: 10px;
    height: 10px;
    background: rgba(100, 100, 100, 0.4);
    border-radius: 50%;
    animation: smoke-puff 0.8s ease-out infinite;
}

.smoke-trail::after {
    animation-delay: 0.4s;
    left: 5px;
}

@keyframes smoke-puff {
    0% { transform: translateY(0) scale(0.5); opacity: 0.6; }
    100% { transform: translateY(-25px) scale(1.5); opacity: 0; }
}

.fuse.burning .smoke-trail {
    animation: smoke-trail-move var(--fuse-duration, 30s) linear forwards;
}

@keyframes smoke-trail-move {
    0% { top: 0; }
    100% { top: calc(100% - 15px); }
}

/* When fuse is extinguished */
.fuse.extinguished .fuse-ember,
.fuse.extinguished .spark-container,
.fuse.extinguished .smoke-trail {
    display: none;
}

.fuse.extinguished::after {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 25px;
    height: 25px;
    background: rgba(100, 100, 100, 0.6);
    border-radius: 50%;
    animation: extinguish-smoke 1.5s ease-out forwards;
}

@keyframes extinguish-smoke {
    0% { transform: translateX(-50%) translateY(0) scale(0.5); opacity: 0.8; }
    100% { transform: translateX(-50%) translateY(-40px) scale(3); opacity: 0; }
}

/* ============================================
   MASSIVE EXPLOSION EFFECT
   ============================================ */

/* Full screen flash */
.explosion-fullscreen-flash {
    position: fixed;
    inset: 0;
    background: radial-gradient(circle at center, 
        rgba(255, 255, 255, 1) 0%, 
        rgba(255, 200, 50, 0.9) 20%, 
        rgba(255, 100, 0, 0.7) 40%, 
        rgba(255, 50, 0, 0.5) 60%,
        transparent 80%);
    animation: fullscreen-flash 0.8s ease-out forwards;
    z-index: 9999;
    pointer-events: none;
}

@keyframes fullscreen-flash {
    0% { opacity: 0; }
    10% { opacity: 1; }
    100% { opacity: 0; }
}

/* Explosion container */
.explosion {
    position: absolute;
    inset: -100px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

/* Primary fireball */
.explosion::before {
    content: '';
    position: absolute;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, 
        rgba(255, 255, 255, 1) 0%, 
        rgba(255, 220, 50, 1) 15%,
        rgba(255, 150, 0, 0.9) 30%, 
        rgba(255, 80, 0, 0.7) 50%, 
        rgba(200, 50, 0, 0.4) 70%,
        transparent 85%);
    border-radius: 50%;
    animation: massive-fireball 1s ease-out forwards;
    box-shadow: 
        0 0 100px 50px rgba(255, 150, 0, 0.8),
        0 0 200px 100px rgba(255, 100, 0, 0.5),
        0 0 300px 150px rgba(255, 50, 0, 0.3);
}

@keyframes massive-fireball {
    0% { transform: scale(0); opacity: 1; }
    30% { transform: scale(1.5); opacity: 1; }
    60% { transform: scale(2); opacity: 0.8; }
    100% { transform: scale(2.5); opacity: 0; }
}

/* Multiple shockwave rings */
.explosion::after {
    content: '';
    position: absolute;
    width: 80px;
    height: 80px;
    border: 6px solid rgba(255, 200, 0, 0.9);
    border-radius: 50%;
    animation: massive-shockwave 1s ease-out forwards;
    box-shadow: 
        0 0 20px rgba(255, 200, 0, 0.5),
        inset 0 0 20px rgba(255, 200, 0, 0.3);
}

@keyframes massive-shockwave {
    0% { transform: scale(0); opacity: 1; border-width: 12px; }
    50% { opacity: 0.8; }
    100% { transform: scale(6); opacity: 0; border-width: 2px; }
}

/* Fire particles */
.explosion-particle {
    position: absolute;
    width: 40px;
    height: 40px;
    background: radial-gradient(circle, 
        #fff 0%, 
        #ffee00 20%, 
        #ffcc00 40%, 
        #ff6600 60%, 
        #ff3300 80%, 
        #cc0000 100%);
    border-radius: 50%;
    box-shadow: 
        0 0 30px #ff6600, 
        0 0 60px #ff3300,
        0 0 90px #ff0000;
    animation: massive-explode 1.5s ease-out forwards;
}

/* 16 particles for massive effect */
.explosion-particle:nth-child(1) { --angle: 0deg; --dist: 180px; width: 50px; height: 50px; animation-delay: 0s; }
.explosion-particle:nth-child(2) { --angle: 22.5deg; --dist: 150px; width: 35px; height: 35px; animation-delay: 0.02s; }
.explosion-particle:nth-child(3) { --angle: 45deg; --dist: 170px; width: 45px; height: 45px; animation-delay: 0.04s; }
.explosion-particle:nth-child(4) { --angle: 67.5deg; --dist: 140px; width: 30px; height: 30px; animation-delay: 0.06s; }
.explosion-particle:nth-child(5) { --angle: 90deg; --dist: 190px; width: 55px; height: 55px; animation-delay: 0.03s; }
.explosion-particle:nth-child(6) { --angle: 112.5deg; --dist: 145px; width: 32px; height: 32px; animation-delay: 0.05s; }
.explosion-particle:nth-child(7) { --angle: 135deg; --dist: 165px; width: 42px; height: 42px; animation-delay: 0.07s; }
.explosion-particle:nth-child(8) { --angle: 157.5deg; --dist: 155px; width: 38px; height: 38px; animation-delay: 0.01s; }
.explosion-particle:nth-child(9) { --angle: 180deg; --dist: 175px; width: 48px; height: 48px; animation-delay: 0.08s; }
.explosion-particle:nth-child(10) { --angle: 202.5deg; --dist: 135px; width: 28px; height: 28px; animation-delay: 0.04s; }
.explosion-particle:nth-child(11) { --angle: 225deg; --dist: 160px; width: 40px; height: 40px; animation-delay: 0.06s; }
.explosion-particle:nth-child(12) { --angle: 247.5deg; --dist: 150px; width: 36px; height: 36px; animation-delay: 0.02s; }
.explosion-particle:nth-child(13) { --angle: 270deg; --dist: 185px; width: 52px; height: 52px; animation-delay: 0.05s; }
.explosion-particle:nth-child(14) { --angle: 292.5deg; --dist: 142px; width: 33px; height: 33px; animation-delay: 0.03s; }
.explosion-particle:nth-child(15) { --angle: 315deg; --dist: 168px; width: 44px; height: 44px; animation-delay: 0.07s; }
.explosion-particle:nth-child(16) { --angle: 337.5deg; --dist: 148px; width: 37px; height: 37px; animation-delay: 0.01s; }

@keyframes massive-explode {
    0% { 
        transform: rotate(var(--angle)) translateY(0) scale(0.3); 
        opacity: 1;
        filter: brightness(3);
    }
    15% {
        transform: rotate(var(--angle)) translateY(calc(var(--dist) * -0.2)) scale(1.3);
        opacity: 1;
        filter: brightness(2);
    }
    40% {
        transform: rotate(var(--angle)) translateY(calc(var(--dist) * -0.6)) scale(1);
        opacity: 0.8;
        filter: brightness(1.2);
    }
    100% { 
        transform: rotate(var(--angle)) translateY(calc(var(--dist) * -1.2)) scale(0); 
        opacity: 0;
        filter: brightness(0.3);
    }
}

/* Intense screen shake */
@keyframes screen-shake-intense {
    0%, 100% { transform: translate(0, 0) rotate(0); }
    5% { transform: translate(-20px, 10px) rotate(-2deg); }
    10% { transform: translate(20px, -10px) rotate(2deg); }
    15% { transform: translate(-15px, -15px) rotate(-1.5deg); }
    20% { transform: translate(15px, 15px) rotate(1.5deg); }
    25% { transform: translate(-12px, 8px) rotate(-1deg); }
    30% { transform: translate(12px, -8px) rotate(1deg); }
    35% { transform: translate(-10px, -5px) rotate(-0.8deg); }
    40% { transform: translate(10px, 5px) rotate(0.8deg); }
    45% { transform: translate(-8px, 3px) rotate(-0.5deg); }
    50% { transform: translate(8px, -3px) rotate(0.5deg); }
    55% { transform: translate(-6px, -2px) rotate(-0.3deg); }
    60% { transform: translate(6px, 2px) rotate(0.3deg); }
    65% { transform: translate(-4px, 1px) rotate(-0.2deg); }
    70% { transform: translate(4px, -1px) rotate(0.2deg); }
    75% { transform: translate(-3px, 0) rotate(-0.1deg); }
    80% { transform: translate(3px, 0) rotate(0.1deg); }
    85% { transform: translate(-2px, 0) rotate(0); }
    90% { transform: translate(2px, 0) rotate(0); }
    95% { transform: translate(-1px, 0) rotate(0); }
}

.explosion-shake {
    animation: screen-shake-intense 1s ease-out;
}

/* Dark smoke clouds */
.smoke-cloud {
    position: absolute;
    width: 80px;
    height: 80px;
    background: radial-gradient(circle, 
        rgba(50, 50, 50, 0.9) 0%, 
        rgba(80, 80, 80, 0.6) 40%, 
        rgba(100, 100, 100, 0.3) 70%,
        transparent 100%);
    border-radius: 50%;
    animation: dark-smoke-rise 3s ease-out forwards;
}

.smoke-cloud:nth-child(1) { --smoke-x: -40px; animation-delay: 0.2s; width: 100px; height: 100px; }
.smoke-cloud:nth-child(2) { --smoke-x: 30px; animation-delay: 0.4s; width: 70px; height: 70px; }
.smoke-cloud:nth-child(3) { --smoke-x: 0px; animation-delay: 0.3s; width: 90px; height: 90px; }
.smoke-cloud:nth-child(4) { --smoke-x: -20px; animation-delay: 0.5s; width: 60px; height: 60px; }
.smoke-cloud:nth-child(5) { --smoke-x: 50px; animation-delay: 0.6s; width: 80px; height: 80px; }

@keyframes dark-smoke-rise {
    0% { 
        transform: translate(0, 0) scale(0.3); 
        opacity: 0;
    }
    20% {
        opacity: 0.9;
    }
    50% {
        transform: translate(var(--smoke-x), -60px) scale(1.5);
        opacity: 0.6;
    }
    100% { 
        transform: translate(calc(var(--smoke-x) * 1.5), -150px) scale(2.5); 
        opacity: 0; 
    }
}

/* Flying debris */
.debris {
    position: absolute;
    background: linear-gradient(135deg, #555, #222);
    border-radius: 2px;
    animation: debris-scatter 1.5s ease-out forwards;
    box-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.debris:nth-child(1) { --dx: -120px; --dy: -80px; --rot: 720deg; width: 12px; height: 6px; animation-delay: 0.05s; }
.debris:nth-child(2) { --dx: 100px; --dy: -100px; --rot: -540deg; width: 8px; height: 8px; animation-delay: 0.08s; }
.debris:nth-child(3) { --dx: -80px; --dy: -120px; --rot: 900deg; width: 10px; height: 4px; animation-delay: 0.03s; }
.debris:nth-child(4) { --dx: 130px; --dy: -60px; --rot: -630deg; width: 6px; height: 10px; animation-delay: 0.1s; }
.debris:nth-child(5) { --dx: -100px; --dy: -40px; --rot: 450deg; width: 14px; height: 5px; animation-delay: 0.06s; }
.debris:nth-child(6) { --dx: 60px; --dy: -140px; --rot: -810deg; width: 7px; height: 7px; animation-delay: 0.04s; }
.debris:nth-child(7) { --dx: -50px; --dy: -90px; --rot: 630deg; width: 9px; height: 3px; animation-delay: 0.09s; }
.debris:nth-child(8) { --dx: 90px; --dy: -110px; --rot: -450deg; width: 5px; height: 11px; animation-delay: 0.07s; }
.debris:nth-child(9) { --dx: -140px; --dy: -50px; --rot: 540deg; width: 11px; height: 4px; animation-delay: 0.02s; }
.debris:nth-child(10) { --dx: 40px; --dy: -130px; --rot: -720deg; width: 8px; height: 6px; animation-delay: 0.11s; }

@keyframes debris-scatter {
    0% {
        transform: translate(0, 0) rotate(0deg) scale(1);
        opacity: 1;
    }
    60% {
        opacity: 1;
    }
    100% {
        transform: translate(var(--dx), var(--dy)) rotate(var(--rot)) scale(0.3);
        opacity: 0;
    }
}

/* ============================================
   WATER EXTINGUISHING EFFECT
   ============================================ */

/* Water stream from bucket */
.water-stream {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 0;
    /* Core body + shimmer highlights (more "real" water feel) */
    background:
        linear-gradient(180deg,
            rgba(180, 245, 255, 0.85) 0%,
            rgba(90, 200, 255, 0.75) 35%,
            rgba(40, 140, 255, 0.55) 75%,
            rgba(40, 140, 255, 0.35) 100%);
    border-radius: 0 0 30px 30px;
    animation: water-pour 1.5s ease-in forwards, water-wobble 0.35s ease-in-out infinite;
    overflow: visible;
    filter: drop-shadow(0 10px 10px rgba(30, 120, 255, 0.25));
}

.water-stream::before {
    /* Moving specular highlights */
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 30% 15%,
            rgba(255,255,255,0.8) 0%,
            rgba(255,255,255,0.25) 28%,
            transparent 60%),
        linear-gradient(90deg,
            transparent 0%,
            rgba(255,255,255,0.22) 20%,
            transparent 45%,
            rgba(255,255,255,0.18) 70%,
            transparent 100%);
    mix-blend-mode: screen;
    opacity: 0.8;
    border-radius: inherit;
    animation: water-highlight 0.55s linear infinite;
}

.water-stream::after {
    /* Subtle noisy texture movement */
    content: '';
    position: absolute;
    inset: 0;
    background:
        repeating-linear-gradient(105deg,
            rgba(255,255,255,0.10) 0px,
            rgba(255,255,255,0.10) 3px,
            transparent 6px,
            transparent 11px);
    opacity: 0.25;
    filter: blur(0.6px);
    border-radius: inherit;
    animation: water-texture 0.25s linear infinite;
}

.water-strand {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: var(--w, 10px);
    height: 0;
    border-radius: 0 0 999px 999px;
    background: linear-gradient(180deg,
        rgba(210, 255, 255, 0.8) 0%,
        rgba(120, 220, 255, 0.7) 45%,
        rgba(60, 160, 255, 0.4) 100%);
    filter: blur(0.1px);
    animation: strand-fall 1.25s ease-in forwards;
    opacity: 0.9;
}

@keyframes water-pour {
    0% { height: 0; opacity: 0; }
    10% { opacity: 1; }
    50% { height: 200px; }
    100% { height: 300px; opacity: 0.8; }
}

@keyframes water-wobble {
    0%, 100% { transform: translateX(-50%) skewX(0deg); }
    50% { transform: translateX(-50%) skewX(-2deg); }
}

@keyframes water-highlight {
    0% { transform: translateX(-10%); opacity: 0.7; }
    50% { opacity: 0.85; }
    100% { transform: translateX(10%); opacity: 0.7; }
}

@keyframes water-texture {
    0% { background-position: 0 0; }
    100% { background-position: 30px 50px; }
}

@keyframes strand-fall {
    0% { height: 0; opacity: 0; }
    10% { opacity: 0.9; }
    70% { height: var(--h, 240px); opacity: 0.95; }
    100% { height: calc(var(--h, 240px) + 80px); opacity: 0.0; }
}

/* Water splash on bomb */
.water-splash {
    position: absolute;
    width: 150px;
    height: 80px;
    pointer-events: none;
}

.water-impact {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.water-spray {
    position: absolute;
    left: 50%;
    top: 35%;
    width: 200px;
    height: 160px;
    transform: translate(-50%, -50%);
    pointer-events: none;
    filter: drop-shadow(0 10px 12px rgba(120, 220, 255, 0.2));
}

.spray-drop {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: radial-gradient(circle,
        rgba(255, 255, 255, 0.85) 0%,
        rgba(160, 230, 255, 0.75) 40%,
        rgba(80, 170, 255, 0.25) 100%);
    transform: translate(-50%, -50%);
    animation: spray-fly 0.65s ease-out forwards;
    opacity: 0.9;
}

@keyframes spray-fly {
    0% { transform: translate(-50%, -50%) translate(0, 0) scale(0.7); opacity: 0; }
    10% { opacity: 1; }
    100% {
        transform: translate(-50%, -50%) translate(var(--dx, 0px), var(--dy, -80px)) scale(0.2);
        opacity: 0;
    }
}

.water-ripple {
    position: absolute;
    left: 50%;
    top: 72%;
    width: 30px;
    height: 30px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    border: 2px solid rgba(160, 230, 255, 0.55);
    box-shadow: 0 0 18px rgba(120, 220, 255, 0.25);
    animation: ripple-expand 0.9s ease-out forwards;
    opacity: 0.9;
}

@keyframes ripple-expand {
    0% { transform: translate(-50%, -50%) scale(0.2); opacity: 0; }
    20% { opacity: 0.9; }
    100% { transform: translate(-50%, -50%) scale(4.8); opacity: 0; }
}

.splash-drop {
    position: absolute;
    width: 20px;
    height: 20px;
    background: radial-gradient(circle, 
        rgba(150, 220, 255, 0.9) 0%, 
        rgba(100, 180, 255, 0.7) 50%,
        rgba(50, 150, 255, 0.4) 100%);
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    animation: splash-fly 0.8s ease-out forwards;
}

.splash-drop:nth-child(1) { --splash-x: -60px; --splash-y: -40px; animation-delay: 0s; width: 25px; height: 25px; }
.splash-drop:nth-child(2) { --splash-x: 50px; --splash-y: -50px; animation-delay: 0.05s; width: 18px; height: 18px; }
.splash-drop:nth-child(3) { --splash-x: -30px; --splash-y: -60px; animation-delay: 0.1s; width: 22px; height: 22px; }
.splash-drop:nth-child(4) { --splash-x: 70px; --splash-y: -35px; animation-delay: 0.08s; width: 15px; height: 15px; }
.splash-drop:nth-child(5) { --splash-x: -50px; --splash-y: -55px; animation-delay: 0.03s; width: 20px; height: 20px; }
.splash-drop:nth-child(6) { --splash-x: 40px; --splash-y: -65px; animation-delay: 0.12s; width: 16px; height: 16px; }
.splash-drop:nth-child(7) { --splash-x: 0px; --splash-y: -70px; animation-delay: 0.06s; width: 24px; height: 24px; }
.splash-drop:nth-child(8) { --splash-x: -70px; --splash-y: -45px; animation-delay: 0.09s; width: 14px; height: 14px; }

@keyframes splash-fly {
    0% { 
        transform: translate(0, 0) scale(0.5); 
        opacity: 0;
    }
    20% {
        opacity: 1;
    }
    100% { 
        transform: translate(var(--splash-x), var(--splash-y)) scale(0.2); 
        opacity: 0; 
    }
}

/* Steam rising effect */
.steam {
    position: absolute;
    width: 40px;
    height: 40px;
    background: radial-gradient(circle, 
        rgba(255, 255, 255, 0.8) 0%, 
        rgba(200, 200, 200, 0.4) 50%,
        transparent 100%);
    border-radius: 50%;
    animation: steam-rise 2s ease-out forwards;
}

.steam:nth-child(1) { --steam-x: -20px; animation-delay: 0.3s; width: 50px; height: 50px; }
.steam:nth-child(2) { --steam-x: 15px; animation-delay: 0.5s; width: 35px; height: 35px; }
.steam:nth-child(3) { --steam-x: -5px; animation-delay: 0.4s; width: 45px; height: 45px; }
.steam:nth-child(4) { --steam-x: 25px; animation-delay: 0.6s; width: 30px; height: 30px; }
.steam:nth-child(5) { --steam-x: -30px; animation-delay: 0.7s; width: 40px; height: 40px; }

@keyframes steam-rise {
    0% { 
        transform: translate(0, 0) scale(0.3); 
        opacity: 0;
    }
    20% {
        opacity: 0.9;
    }
    100% { 
        transform: translate(var(--steam-x), -120px) scale(2); 
        opacity: 0; 
    }
}

/* Extinguished bomb state */
.bomb.wet .bomb-body {
    /* Wet sheen + darker metal */
    background: radial-gradient(circle at 30% 30%,
        #3e3e3e 0%,
        #1f1f1f 70%,
        #151515 100%);
    box-shadow:
        inset -6px -6px 12px rgba(0,0,0,0.45),
        inset 6px 6px 12px rgba(255,255,255,0.06),
        0 0 22px rgba(120, 220, 255, 0.15);
}

.bomb.wet .bomb-highlight {
    opacity: 0.9;
    filter: saturate(1.2) brightness(1.1);
    animation: wet-shimmer 0.7s ease-in-out infinite;
}

@keyframes wet-shimmer {
    0%, 100% { transform: translateY(0) scale(1); opacity: 0.75; }
    50% { transform: translateY(1px) scale(1.03); opacity: 0.95; }
}

.bomb-drips {
    position: absolute;
    left: 50%;
    top: 58%;
    transform: translateX(-50%);
    width: 120px;
    height: 140px;
    pointer-events: none;
}

.bomb-drip {
    position: absolute;
    top: 0;
    left: 50%;
    width: 6px;
    height: 16px;
    border-radius: 999px;
    background: linear-gradient(180deg,
        rgba(255,255,255,0.75) 0%,
        rgba(130, 220, 255, 0.55) 45%,
        rgba(80, 170, 255, 0.15) 100%);
    transform: translateX(-50%);
    filter: blur(0.1px);
    animation: drip-fall 0.9s ease-in forwards;
}

@keyframes drip-fall {
    0% { transform: translateX(-50%) translateY(0) scaleY(0.6); opacity: 0; }
    10% { opacity: 0.9; }
    100% { transform: translateX(-50%) translateY(110px) scaleY(0.2); opacity: 0; }
}

.bomb.extinguished {
    filter: grayscale(0.5) brightness(0.7);
    animation: none !important;
}

.bomb.extinguished::after {
    content: '';
    position: absolute;
    top: -26px;
    left: 50%;
    transform: translateX(-50%);
    width: 70px;
    height: 60px;
    background: radial-gradient(circle,
        rgba(255,255,255,0.45) 0%,
        rgba(200,200,200,0.18) 45%,
        rgba(0,0,0,0) 75%);
    filter: blur(1.2px);
    opacity: 0.0;
    animation: calm-steam 1.6s ease-out infinite;
    pointer-events: none;
}

@keyframes calm-steam {
    0% { opacity: 0.0; transform: translateX(-50%) translateY(8px) scale(0.85); }
    20% { opacity: 0.35; }
    100% { opacity: 0.0; transform: translateX(-50%) translateY(-16px) scale(1.35); }
}

/* Water puddle under bomb */
.water-puddle {
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 10px;
    background: radial-gradient(ellipse, 
        rgba(100, 180, 255, 0.6) 0%, 
        rgba(50, 150, 255, 0.3) 70%,
        transparent 100%);
    border-radius: 50%;
    animation: puddle-spread 1s ease-out forwards;
}

@keyframes puddle-spread {
    0% { width: 0; opacity: 0; }
    50% { opacity: 0.8; }
    100% { width: 120px; opacity: 0.6; }
}

/* Tilt Indicator */
.tilt-indicator {
    width: 100%;
    max-width: 100px;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.tilt-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent-green), var(--accent-blue));
    border-radius: 4px;
    transition: width 0.3s ease;
}

/* Game Controls */
.game-controls {
    height: var(--controls-height);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem 1rem;
    background: rgba(0, 0, 0, 0.3);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.control-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition-fast);
}

.control-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.control-btn:active {
    transform: scale(0.95);
}

/* ============================================
   Modals
   ============================================ */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 1rem;
    backdrop-filter: blur(5px);
}

.modal-content {
    background: var(--bg-card);
    border-radius: 20px;
    padding: 2rem;
    max-width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: var(--shadow-soft);
}

.close-modal {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    font-size: 1.2rem;
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition-fast);
}

.close-modal:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Result Modal */
.result-content {
    text-align: center;
    max-width: 400px;
}

.result-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.result-title {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.result-message {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.result-stats {
    display: flex;
    justify-content: space-around;
    margin-bottom: 2rem;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
}

.result-stat {
    text-align: center;
}

.result-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.result-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--accent-gold);
}

#res-character {
    font-family: 'KaiTi', 'STKaiti', 'SimKai', serif;
    font-size: 2rem;
}

.result-buttons {
    display: flex;
    gap: 1rem;
}

.result-buttons .btn-primary,
.result-buttons .btn-secondary {
    flex: 1;
    margin: 0;
}

/* Settings Modal */
.settings-content {
    max-width: 450px;
    width: 100%;
}

.settings-content h2 {
    text-align: center;
    margin-bottom: 1.5rem;
}

.setting-group {
    margin-bottom: 1.5rem;
}

.setting-group label {
    display: block;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.setting-options {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.option-btn {
    flex: 1;
    min-width: 80px;
    padding: 0.6rem 1rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition-fast);
}

.option-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

.option-btn.active {
    background: var(--accent-gold);
    color: var(--ink-black);
    border-color: var(--accent-gold);
}

/* Character Select Modal */
.char-select-content {
    max-width: 500px;
    width: 100%;
}

.char-select-content h2 {
    text-align: center;
    margin-bottom: 1.5rem;
}

.char-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    max-height: 300px;
    overflow-y: auto;
    padding: 0.5rem;
}

.char-grid .char-item {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid transparent;
    border-radius: 10px;
    font-size: 2rem;
    font-family: 'KaiTi', 'STKaiti', 'SimKai', serif;
    cursor: pointer;
    transition: var(--transition-fast);
}

.char-grid .char-item:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: var(--accent-gold);
}

.char-grid .char-item.selected {
    background: var(--accent-gold);
    color: var(--ink-black);
}

.char-grid .char-item.completed {
    background: rgba(46, 204, 113, 0.2);
    border-color: var(--accent-green);
}

/* ============================================
   Responsive Design
   ============================================ */

/* Tablet Portrait & Below */
@media (max-width: 1024px) {
    .game-container {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr auto;
        gap: 0.5rem;
    }
    
    .character-panel {
        grid-row: 1;
        flex-direction: row;
        justify-content: center;
        gap: 1rem;
        padding: 0.5rem;
    }
    
    .character-display {
        max-width: 100px;
    }
    
    .writing-panel {
        grid-row: 2;
    }
    
    .camera-container {
        max-width: 500px;
        max-height: 50vh;
    }
    
    .animation-panel {
        grid-row: 3;
        flex-direction: row;
        justify-content: space-around;
        padding: 0.5rem;
    }
    
    .bucket-container {
        transform: scale(0.7);
    }
    
    .bomb-container {
        transform: scale(0.7);
    }
}

/* Mobile Landscape */
@media (max-width: 768px) and (orientation: landscape) {
    .game-container {
        grid-template-columns: 1fr 2fr 1fr;
        grid-template-rows: 1fr;
        gap: 0.5rem;
        padding: 0.5rem;
    }
    
    .character-panel {
        grid-column: 1;
        grid-row: 1;
    }
    
    .writing-panel {
        grid-column: 2;
        grid-row: 1;
    }
    
    .animation-panel {
        grid-column: 3;
        grid-row: 1;
        flex-direction: column;
    }
    
    .character-display {
        max-width: 120px;
    }
    
    #target-character {
        font-size: 5rem;
    }
    
    .bucket-container, .bomb-container {
        transform: scale(0.6);
    }
    
    :root {
        --header-height: 50px;
        --stats-height: 40px;
        --controls-height: 50px;
    }
}

/* Mobile Portrait */
@media (max-width: 768px) and (orientation: portrait) {
    .game-container {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr auto;
        gap: 0.5rem;
        padding: 0.5rem;
    }
    
    .character-panel {
        grid-row: 1;
        flex-direction: row;
        gap: 0.75rem;
        padding: 0.25rem;
    }
    
    .character-display {
        max-width: 80px;
    }
    
    #target-character {
        font-size: 3.5rem;
    }
    
    .stroke-guide {
        flex: 1;
        padding: 0.5rem;
    }
    
    .writing-panel {
        grid-row: 2;
    }
    
    .camera-container {
        aspect-ratio: 3/4;
        max-width: 100%;
        max-height: 45vh;
    }
    
    .animation-panel {
        grid-row: 3;
        flex-direction: row;
        justify-content: space-around;
        padding: 0.25rem;
        gap: 0.5rem;
    }
    
    .bucket-container, .bomb-container {
        transform: scale(0.5);
    }
    
    .tilt-indicator {
        max-width: 60px;
    }
    
    .back-btn .text {
        display: none;
    }
    
    .header-center h1 {
        font-size: 1rem;
    }
    
    .game-stats {
        gap: 0.5rem;
    }
    
    .stat-label {
        font-size: 0.65rem;
    }
    
    .stat-value {
        font-size: 0.95rem;
    }
    
    .control-btn {
        padding: 0.5rem 0.8rem;
        font-size: 0.8rem;
    }
    
    .control-btn span:not(.icon) {
        display: none;
    }
    
    .writing-hint {
        font-size: 0.75rem;
        padding: 0.3rem 0.6rem;
    }
}

/* Small Mobile */
@media (max-width: 375px) {
    .character-display {
        max-width: 80px;
    }
    
    #target-character {
        font-size: 3rem;
    }
    
    .bucket-container, .bomb-container {
        transform: scale(0.5);
    }
    
    .game-controls {
        gap: 0.5rem;
    }
    
    .control-btn {
        padding: 0.4rem 0.6rem;
    }
}

/* Touch Devices */
@media (hover: none) and (pointer: coarse) {
    .btn-primary, .btn-secondary, .control-btn, .option-btn {
        min-height: 44px;
        min-width: 44px;
    }
    
    .char-grid .char-item {
        min-height: 50px;
    }
}

/* Dark Mode Preference (already dark, but ensure contrast) */
@media (prefers-color-scheme: dark) {
    :root {
        --paper: #f0ebe0;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Print */
@media print {
    body {
        background: #fff;
        color: #000;
    }
    
    #loading-screen,
    #permission-screen,
    #calibration-screen,
    .modal,
    .game-controls,
    .app-header {
        display: none !important;
    }
}

