* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Hiragino Sans', sans-serif;
    background: linear-gradient(135deg, #0f0c29, #302b63, #24243e);
    color: #fff;
    min-height: 100vh;
    overflow-x: hidden;
}

#app {
    max-width: 500px;
    margin: 0 auto;
    padding: 20px;
    text-align: center;
}

h1 {
    font-size: 1.8rem;
    margin: 20px 0;
    background: linear-gradient(90deg, #f7971e, #ffd200);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.desc {
    color: #aaa;
    margin: 20px 0 30px;
    line-height: 1.8;
}

button {
    background: linear-gradient(135deg, #f7971e, #ffd200);
    border: none;
    color: #1a1a2e;
    font-size: 1.2rem;
    font-weight: bold;
    padding: 15px 40px;
    border-radius: 50px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    -webkit-tap-highlight-color: transparent;
}

button:active {
    transform: scale(0.95);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.hidden {
    display: none !important;
}

/* Score */
#score-board {
    font-size: 1.3rem;
    margin: 10px 0 20px;
    display: flex;
    justify-content: center;
    gap: 10px;
}

/* Battle Area */
#battle-area {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin: 20px 0;
}

.hand-icon {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
    border: 3px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s;
}

.label {
    margin-top: 8px;
    font-size: 0.9rem;
    color: #aaa;
}

#vs {
    font-size: 2rem;
    font-weight: bold;
    color: #f7971e;
}

#result-text {
    font-size: 1.8rem;
    font-weight: bold;
    min-height: 2em;
    display: flex;
    align-items: center;
    justify-content: center;
}

.result-win {
    color: #ffd200;
}

.result-lose {
    color: #ff4757;
}

.result-draw {
    color: #aaa;
}

/* Camera */
#camera-container {
    position: relative;
    width: 60%;
    max-width: 200px;
    margin: 15px auto;
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.15);
}

#camera {
    width: 100%;
    display: block;
    transform: scaleX(-1);
}

#overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform: scaleX(-1);
}

#detected-hand {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 1rem;
    white-space: nowrap;
}

/* Countdown */
#countdown-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

#countdown-text {
    font-size: 5rem;
    font-weight: bold;
    animation: pulse 0.5s ease-in-out;
}

@keyframes pulse {
    0% { transform: scale(0.5); opacity: 0; }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes shake {
    0%, 100% { transform: translateY(0); }
    25% { transform: translateY(-20px); }
    75% { transform: translateY(10px); }
}

.shake {
    animation: shake 0.4s ease-in-out infinite;
}

#play-btn {
    margin: 15px 0;
}

#instruction {
    color: #888;
    font-size: 0.85rem;
    margin-top: 10px;
}

/* AI Comment Bubble */
#ai-comment {
    font-size: 1.1rem;
    min-height: 1.6em;
    color: #ff6b6b;
    font-weight: bold;
    margin-bottom: 5px;
    transition: opacity 0.3s;
}

/* Streak */
#streak-text {
    font-size: 0.95rem;
    color: #ffd200;
    min-height: 1.4em;
    margin-bottom: 5px;
}

/* Scan line on camera */
#scan-line {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, transparent, #00ff88, transparent);
    z-index: 10;
    animation: scan 2s linear infinite;
    box-shadow: 0 0 10px #00ff88, 0 0 20px #00ff88;
}

@keyframes scan {
    0% { top: 0; }
    100% { top: 100%; }
}

/* Screen shake */
@keyframes screenShake {
    0%, 100% { transform: translate(0, 0); }
    10% { transform: translate(-8px, -5px); }
    20% { transform: translate(8px, 5px); }
    30% { transform: translate(-6px, 4px); }
    40% { transform: translate(6px, -4px); }
    50% { transform: translate(-4px, 3px); }
    60% { transform: translate(4px, -2px); }
    70% { transform: translate(-2px, 2px); }
    80% { transform: translate(2px, -1px); }
    90% { transform: translate(-1px, 1px); }
}

.screen-shake {
    animation: screenShake 0.5s ease-out;
}

/* AI win glow */
@keyframes aiGlow {
    0% { box-shadow: 0 0 10px #ff4757; }
    50% { box-shadow: 0 0 40px #ff4757, 0 0 80px #ff4757; }
    100% { box-shadow: 0 0 10px #ff4757; }
}

.ai-glow {
    animation: aiGlow 0.8s ease-in-out;
    border-color: #ff4757 !important;
}

/* Particle effects */
#particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 200;
}

.particle {
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    animation: particleFly 1s ease-out forwards;
}

@keyframes particleFly {
    0% { opacity: 1; transform: translate(0, 0) scale(1); }
    100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(0); }
}

/* Flash overlay */
@keyframes flashRed {
    0% { opacity: 0.4; }
    100% { opacity: 0; }
}

#flash-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #ff4757;
    pointer-events: none;
    z-index: 150;
    animation: flashRed 0.3s ease-out forwards;
}
