/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #2c1810 0%, #8b4513 50%, #2c1810 100%);
    color: #fff;
    min-height: 100vh;
    padding: 10px;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.title {
    font-family: 'Creepster', cursive;
    font-size: clamp(2rem, 5vw, 3.5rem);
    text-align: center;
    color: #dc143c;
    text-shadow: 3px 3px 6px rgba(0,0,0,0.8);
    margin-bottom: 10px;
    animation: flicker 3s infinite alternate;
}

.subtitle {
    font-family: 'Nosifer', cursive;
    text-align: center;
    font-size: clamp(1rem, 3vw, 1.5rem);
    margin-bottom: 30px;
    opacity: 0.9;
}

@keyframes flicker {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

/* Doll container */
.doll-container {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 40px;
    min-height: 400px;
}

/* Doll styling */
.doll {
    position: relative;
    transform-origin: bottom center;
    filter: drop-shadow(0 10px 20px rgba(0,0,0,0.5));
}

.doll.talking {
    animation: bounce 0.5s ease-in-out infinite alternate;
}

@keyframes bounce {
    from { transform: translateY(0px); }
    to { transform: translateY(-10px); }
}

/* Head */
.head {
    position: relative;
    width: 120px;
    height: 140px;
    margin: 0 auto;
}

.hair {
    position: absolute;
    top: -10px;
    left: -15px;
    width: 150px;
    height: 80px;
    background: linear-gradient(45deg, #ff4500, #dc143c, #ff6600);
    border-radius: 75px 75px 20px 20px;
    z-index: 1;
}

.hair::before {
    content: '';
    position: absolute;
    top: 15px;
    left: 10px;
    width: 130px;
    height: 60px;
    background: linear-gradient(135deg, #ff6600, #dc143c);
    border-radius: 65px 65px 15px 15px;
}

.hair::after {
    content: '';
    position: absolute;
    top: 5px;
    left: 5px;
    width: 20px;
    height: 30px;
    background: linear-gradient(45deg, #ff4500, #cc3300);
    border-radius: 10px;
    transform: rotate(-20deg);
}

/* Face */
.face {
    position: absolute;
    top: 20px;
    left: 10px;
    width: 100px;
    height: 110px;
    background: linear-gradient(135deg, #ffdbaa, #f0c587);
    border-radius: 50px;
    border: 2px solid #d4a574;
    z-index: 2;
}

/* Eyes */
.eyes {
    position: absolute;
    top: 25px;
    left: 15px;
    width: 70px;
    height: 20px;
}

.eye {
    position: absolute;
    width: 20px;
    height: 20px;
    background: radial-gradient(circle at 30% 30%, #87ceeb, #4169e1);
    border-radius: 50%;
    border: 2px solid #333;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.3);
}

.left-eye {
    left: 8px;
}

.right-eye {
    right: 8px;
}

.pupil {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 10px;
    height: 10px;
    background: radial-gradient(circle at 30% 30%, #333, #000);
    border-radius: 50%;
    animation: lookAround 4s infinite;
}

.pupil::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 3px;
    height: 3px;
    background: rgba(255,255,255,0.8);
    border-radius: 50%;
}

@keyframes lookAround {
    0%, 100% { transform: translate(-50%, -50%); }
    25% { transform: translate(-70%, -50%); }
    50% { transform: translate(-30%, -50%); }
    75% { transform: translate(-50%, -70%); }
}

/* Nose */
.nose {
    position: absolute;
    top: 45px;
    left: 50%;
    transform: translateX(-50%);
    width: 8px;
    height: 12px;
    background: #e6b88a;
    border-radius: 50%;
    border: 1px solid #d4a574;
}

/* Mouth */
.mouth {
    position: absolute;
    top: 65px;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 15px;
    background: #2c1810;
    border-radius: 0 0 15px 15px;
    border: 2px solid #8b4513;
    overflow: hidden;
    transition: all 0.2s ease;
}

.mouth.open {
    height: 25px;
    animation: mouthMove 0.3s ease-in-out infinite;
}

.mouth.closed {
    height: 6px;
    border-radius: 15px;
}

@keyframes mouthMove {
    0%, 100% { height: 20px; }
    50% { height: 25px; }
}

.teeth {
    position: absolute;
    top: 0;
    left: 2px;
    width: 26px;
    height: 4px;
    background: white;
    border-radius: 2px;
}

/* Scars */
.scar {
    position: absolute;
    background: linear-gradient(90deg, #8b0000, #cc6666, #8b0000);
    border-radius: 1px;
    box-shadow: 0 0 2px rgba(139,0,0,0.5);
}

.scar1 {
    top: 35px;
    right: 15px;
    width: 25px;
    height: 3px;
    transform: rotate(25deg);
}

.scar1::before {
    content: '';
    position: absolute;
    top: 0;
    left: 5px;
    width: 2px;
    height: 3px;
    background: #654321;
    transform: rotate(90deg);
}

.scar1::after {
    content: '';
    position: absolute;
    top: 0;
    right: 5px;
    width: 2px;
    height: 3px;
    background: #654321;
    transform: rotate(90deg);
}

.scar2 {
    top: 80px;
    left: 12px;
    width: 18px;
    height: 3px;
    transform: rotate(-15deg);
}

.scar2::before {
    content: '';
    position: absolute;
    top: 0;
    left: 3px;
    width: 2px;
    height: 3px;
    background: #654321;
    transform: rotate(90deg);
}

.scar2::after {
    content: '';
    position: absolute;
    top: 0;
    right: 3px;
    width: 2px;
    height: 3px;
    background: #654321;
    transform: rotate(90deg);
}

/* Additional scars for movie accuracy */
.face::after {
    content: '';
    position: absolute;
    top: 60px;
    right: 20px;
    width: 12px;
    height: 2px;
    background: linear-gradient(90deg, #8b0000, #cc6666);
    transform: rotate(-45deg);
}

/* Body */
.body {
    position: relative;
    width: 80px;
    height: 100px;
    margin: 0 auto;
    margin-top: -10px;
}

.shirt {
    position: absolute;
    width: 80px;
    height: 60px;
    background: linear-gradient(135deg, #ff6600, #ee5500);
    border-radius: 10px;
    border: 1px solid #cc4400;
}

.stripe {
    position: absolute;
    width: 100%;
    height: 6px;
    background: linear-gradient(135deg, #dc143c, #b22222);
    border: 1px solid #8b0000;
}

.stripe:nth-child(1) {
    top: 12px;
}

.stripe:nth-child(2) {
    top: 28px;
}

.stripe:nth-child(3) {
    top: 44px;
    height: 4px;
}

.overalls {
    position: absolute;
    top: 40px;
    left: 10px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #4169e1, #1e3cb8);
    border-radius: 0 0 15px 15px;
    border: 2px solid #0f2595;
}

.overalls::before {
    content: 'Good Guys';
    position: absolute;
    top: 15px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    font-size: 6px;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
}

.strap {
    position: absolute;
    width: 8px;
    height: 40px;
    background: linear-gradient(135deg, #4169e1, #1e3cb8);
    border-radius: 4px;
    top: -20px;
    border: 1px solid #0f2595;
}

.left-strap {
    left: 15px;
}

.right-strap {
    right: 15px;
}

/* Add overall buckles */
.left-strap::after,
.right-strap::after {
    content: '';
    position: absolute;
    top: 5px;
    left: 50%;
    transform: translateX(-50%);
    width: 6px;
    height: 6px;
    background: #silver;
    border: 1px solid #666;
    border-radius: 2px;
}

/* Speech bubble */
.speech-bubble {
    position: absolute;
    top: -60px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255,255,255,0.95);
    color: #333;
    padding: 15px 20px;
    border-radius: 20px;
    border: 3px solid #dc143c;
    max-width: 300px;
    word-wrap: break-word;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 10;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.speech-bubble::after {
    content: '';
    position: absolute;
    bottom: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 15px solid transparent;
    border-right: 15px solid transparent;
    border-top: 15px solid rgba(255,255,255,0.95);
}

.speech-bubble.show {
    opacity: 1;
    visibility: visible;
    animation: pulse 0.5s ease-in-out;
}

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

.speech-text {
    font-family: 'Creepster', cursive;
    font-size: 14px;
    font-weight: bold;
    text-align: center;
    line-height: 1.3;
}

/* Controls */
.controls {
    background: rgba(0,0,0,0.3);
    padding: 30px;
    border-radius: 15px;
    border: 2px solid #dc143c;
    backdrop-filter: blur(10px);
}

.input-section {
    margin-bottom: 20px;
}

.input-section label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #ffdbaa;
}

.input-section input {
    width: 100%;
    padding: 12px;
    border: 2px solid #dc143c;
    border-radius: 8px;
    background: rgba(255,255,255,0.1);
    color: #fff;
    font-size: 16px;
}

.input-section input::placeholder {
    color: rgba(255,255,255,0.6);
}

.button-section {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
    flex-wrap: wrap;
    justify-content: center;
}

.speak-btn {
    flex: 1;
    min-width: 140px;
    padding: 15px 20px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, #dc143c, #b31230);
    color: white;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Creepster', cursive;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.speak-btn:hover {
    background: linear-gradient(135deg, #ff1744, #dc143c);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(220,20,60,0.4);
}

.speak-btn:active {
    transform: translateY(0);
}

.speak-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Voice controls */
.voice-controls {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 10px 15px;
    align-items: center;
    margin-top: 20px;
}

.voice-controls label {
    color: #ffdbaa;
    font-weight: bold;
    white-space: nowrap;
}

.voice-controls select,
.voice-controls input[type="range"] {
    background: rgba(255,255,255,0.1);
    border: 1px solid #dc143c;
    border-radius: 5px;
    color: #fff;
    padding: 5px;
}

.voice-controls span {
    color: #ffdbaa;
    font-weight: bold;
    min-width: 30px;
    text-align: center;
}

/* Footer */
footer {
    text-align: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid rgba(220,20,60,0.3);
    color: #ffdbaa;
    font-style: italic;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .doll-container {
        min-height: 350px;
    }
    
    .head {
        width: 100px;
        height: 120px;
    }
    
    .hair {
        width: 130px;
        height: 70px;
        left: -15px;
    }
    
    .face {
        width: 80px;
        height: 90px;
        left: 10px;
    }
    
    .body {
        width: 60px;
        height: 80px;
    }
    
    .shirt {
        width: 60px;
        height: 50px;
    }
    
    .overalls {
        width: 50px;
        height: 50px;
        left: 5px;
    }
    
    .speech-bubble {
        max-width: 250px;
        padding: 12px 15px;
        font-size: 12px;
    }
    
    .controls {
        padding: 20px;
    }
    
    .button-section {
        flex-direction: column;
    }
    
    .voice-controls {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .voice-controls label {
        margin-bottom: 5px;
    }
    
    .input-section input {
        font-size: 16px; /* Prevent zoom on iOS */
    }
}

@media (max-width: 480px) {
    .title {
        font-size: 2rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .doll-container {
        min-height: 300px;
    }
    
    .head {
        width: 80px;
        height: 100px;
    }
    
    .hair {
        width: 110px;
        height: 60px;
        left: -15px;
    }
    
    .face {
        width: 70px;
        height: 80px;
        left: 5px;
    }
    
    .body {
        width: 50px;
        height: 70px;
    }
}