/* ============================================
   Fart Reaction Game Styles
   ============================================ */

.fart-reaction-game {
    width: 100%;
    max-width: 760px;
    margin: 40px auto;
    padding: var(--spacing-md);
}

.fart-reaction-header {
    text-align: center;
    margin-bottom: var(--spacing-md);
}

.fart-reaction-header h2 {
    font-size: 1.75rem;
    background: linear-gradient(135deg, #8B4513, #D2691E);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: var(--spacing-xs);
}

.fart-reaction-instruction {
    font-size: 1rem;
    color: var(--color-text-dark);
    opacity: 0.8;
    margin: 0 0 var(--spacing-xs) 0;
}

/* Level Indicator */
.level-indicator {
    font-size: 0.95rem;
    color: var(--color-text-dark);
    margin-bottom: var(--spacing-sm);
}

.level-indicator strong {
    color: #8B4513;
}

/* Game Stats */
.fart-stats {
    display: flex;
    justify-content: center;
    gap: var(--spacing-md);
    margin-top: var(--spacing-xs);
}

.fart-stat-item {
    font-size: 0.875rem;
    color: var(--color-text-dark);
}

.fart-stat-item strong {
    color: #8B4513;
    font-weight: 700;
}

/* Game Container */
.fart-game-container {
    display: flex;
    justify-content: space-between;
    align-items: stretch;
    gap: var(--spacing-md);
    padding: 24px;
    background: linear-gradient(135deg, #87CEEB, #B0E0E6);
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(139, 69, 19, 0.2);
    border: 2px solid rgba(139, 69, 19, 0.3);
    min-height: 360px;
    position: relative;
    overflow: hidden;
}

/* Left Side - Person */
.person-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    min-height: 320px;
}

/* Photo placeholder / card behind the figure */
.person-photo {
    width: 160px;
    height: 230px;
    background: linear-gradient(135deg, #FFE4C4, #FFDAB9);
    border-radius: 0px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

/* Stick Figure with photo head */
.stick-figure {
    position: relative;
    width: 100px;
    height: 200px;
}

/* Head container – no visible circle, only used to place the photo */
.stick-head {
    width: 48px;
    height: 48px;
    border: none;                 /* remove circle outline */
    border-radius: 50%;
    position: absolute;
    top: 4px;
    left: 50%;
    transform: translateX(-50%);
    background: transparent;
    overflow: hidden;
}

/* Your head as the stick figure head */
.player-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}

/* Body and limbs */
.stick-body {
    width: 4px;
    height: 80px;
    background: #333;
    position: absolute;
    top: 52px;
    left: 50%;
    transform: translateX(-50%);
}

.stick-arm-left,
.stick-arm-right {
    width: 40px;
    height: 4px;
    background: #333;
    position: absolute;
    top: 72px;
}

.stick-arm-left {
    left: 30%;
    transform: rotate(-30deg);
    transform-origin: right center;
}

.stick-arm-right {
    right: 30%;
    transform: rotate(30deg);
    transform-origin: left center;
}

.stick-leg-left,
.stick-leg-right {
    width: 4px;
    height: 60px;
    background: #333;
    position: absolute;
    top: 132px;
}

.stick-leg-left {
    left: 45%;
    transform: rotate(-10deg);
    transform-origin: top center;
}

.stick-leg-right {
    right: 45%;
    transform: rotate(10deg);
    transform-origin: top center;
}

/* Fart Cloud */
.fart-cloud {
    position: center;
    right: 50px;
    font-size: 3rem;
    opacity: 0;
    animation: none;
    z-index: 10;
}

.fart-cloud.active {
    animation: fartAnimation 1.5s ease-out forwards;
}

@keyframes fartAnimation {
    0% {
        opacity: 0;
        transform: scale(0.3) translateX(0) translateY(0);
    }
    30% {
        opacity: 1;
        transform: scale(1) translateX(-10px) translateY(-10px);
    }
    100% {
        opacity: 0.3;
        transform: scale(1.5) translateX(-30px) translateY(-30px);
    }
}

/* Status Text */
.person-status {
    margin-top: var(--spacing-md);
    font-size: 1.05rem;
    font-weight: 600;
    color: #333;
    min-height: 28px;
}

/* Right Side - Window */
.window-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}

/* Window Frame */
.window-frame {
    width: 200px;
    height: 250px;
    position: relative;
    perspective: 1000px;
}

.window-background {
    position: absolute;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #8B7355, #A0826D);
    border: 8px solid #654321;
    border-radius: 8px;
    box-shadow:
        inset 0 2px 5px rgba(0, 0, 0, 0.2),
        0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Window Opening Animation */
.window-left,
.window-right {
    position: absolute;
    width: 50%;
    height: 100%;
    background: white;
    border: 4px solid #654321;
    transition: transform 0.5s ease-out;
    transform-origin: left center;
    cursor: pointer;
    z-index: 5;
}

.window-left {
    left: 0;
    background: linear-gradient(135deg, #FFF, #F0F0F0);
    box-shadow: inset -2px 0 5px rgba(0, 0, 0, 0.1);
}

.window-right {
    right: 0;
    transform-origin: right center;
    background: linear-gradient(135deg, #F0F0F0, #FFF);
    box-shadow: inset 2px 0 5px rgba(0, 0, 0, 0.1);
}

/* Glass effect */
.window-left::before,
.window-right::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        135deg,
        rgba(135, 206, 235, 0.3) 0%,
        rgba(176, 224, 230, 0.3) 100%
    );
    pointer-events: none;
}

/* Window Handle */
.window-handle {
    position: absolute;
    width: 18px;
    height: 36px;
    background: linear-gradient(135deg, #D4AF37, #FFD700);
    border: 2px solid #B8860B;
    border-radius: 4px;
    top: 50%;
    transform: translateY(-50%);
    box-shadow:
        inset 0 1px 2px rgba(255, 255, 255, 0.5),
        0 2px 4px rgba(0, 0, 0, 0.2);
}

.window-left .window-handle {
    right: 10px;
}

.window-right .window-handle {
    left: 10px;
}

/* Window Open State */
.window-frame.open .window-left {
    transform: rotateY(-85deg);
}

.window-frame.open .window-right {
    transform: rotateY(85deg);
}

/* Fresh Air Effect */
.fresh-air {
    position: absolute;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0) 0%, rgba(135, 206, 235, 0.2) 100%);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

.window-frame.open .fresh-air {
    opacity: 1;
    animation: breathe 2s ease-in-out infinite;
}

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

/* Window Status */
.window-status {
    margin-top: var(--spacing-md);
    font-size: 0.98rem;
    font-weight: 600;
    color: #333;
}

/* Timer Bar */
.timer-container {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 70%;
    max-width: 360px;
    height: 26px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 15px;
    overflow: hidden;
    opacity: 0;
    transition: opacity 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.timer-container.active {
    opacity: 1;
}

.timer-bar {
    height: 100%;
    background: linear-gradient(90deg, #FF6B6B, #FF4757);
    border-radius: 15px;
    transition: width 1s linear;
    box-shadow: 0 0 10px rgba(255, 71, 87, 0.5);
}

.timer-bar.success {
    background: linear-gradient(90deg, #26de81, #20bf6b);
    box-shadow: 0 0 10px rgba(32, 191, 107, 0.5);
}

/* Game Over Overlay */
.game-over-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(139, 69, 19, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
    z-index: 100;
}

.game-over-overlay.show {
    opacity: 1;
    pointer-events: all;
}

.game-over-content {
    text-align: center;
    color: white;
    animation: slideUp 0.5s ease-out;
}

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

.game-over-content h3 {
    font-size: 2rem;
    margin-bottom: var(--spacing-md);
}

.game-over-content p {
    font-size: 1.125rem;
    margin-bottom: var(--spacing-md);
}

/* Success State */
.game-success {
    text-align: center;
    padding: var(--spacing-lg);
    animation: successPop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes successPop {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.game-success h3 {
    font-size: 1.5rem;
    color: #26de81;
    margin-bottom: var(--spacing-md);
}

.success-message {
    font-size: 1.05rem;
    line-height: 1.7;
    color: var(--color-text-dark);
    margin-bottom: var(--spacing-md);
}

/* Play Again Button */
.play-again-btn {
    padding: 10px 22px;
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: #333;
    border: none;
    border-radius: 24px;
    font-size: 0.98rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(255, 165, 0, 0.3);
}

.play-again-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 165, 0, 0.4);
}

/* Hint */
.fart-hint {
    text-align: center;
    margin-top: var(--spacing-sm);
}

.fart-hint small {
    color: var(--color-text-dark);
    opacity: 0.6;
    font-size: 0.875rem;
}

/* Responsive */
@media (max-width: 768px) {
    .fart-reaction-game {
        margin: 24px auto;
        padding: 12px;
    }

    .fart-reaction-header h2 {
        font-size: 1.4rem;
    }

    .fart-reaction-instruction {
        font-size: 0.9rem;
    }

    .fart-game-container {
        flex-direction: column;
        align-items: center;
        gap: 16px;
        padding: 16px;
        min-height: 440px;
    }

    .person-container {
        min-height: 260px;
    }

    .person-photo {
        width: 240px;
        height: 420px;
    }

    .stick-figure {
        width: 90px;
        height: 190px;
    }

    .stick-head {
        width: 44px;
        height: 44px;
        top: 4px;
    }

    .stick-body {
        top: 50px;
        height: 76px;
    }

    .stick-leg-left,
    .stick-leg-right {
        top: 130px;
        height: 56px;
    }

    .window-frame {
        width: 180px;
        height: 220px;
    }

    .timer-container {
        bottom: 14px;
        height: 22px;
        width: 80%;
    }

    .game-over-content h3 {
        font-size: 1.6rem;
    }

    .game-over-content p {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .fart-reaction-game {
        margin: 12px auto;
        padding: 8px;
    }

    .fart-reaction-header {
        margin-bottom: 10px;
    }

    .fart-reaction-header h2 {
        font-size: 1.2rem;
    }

    .level-indicator {
        font-size: 0.8rem;
        margin-bottom: 6px;
    }

    .fart-stats {
        gap: 10px;
    }

    .fart-stat-item {
        font-size: 0.75rem;
    }

    .fart-game-container {
        gap: 10px;
        padding: 12px;
        min-height: auto;
    }

    .person-container {
        min-height: 220px;
    }

    .person-photo {
        width: 220px;
        height: 190px;
    }

    .stick-figure {
        width: 70px;
        height: 150px;
    }

    .stick-head {
        width: 40px;
        height: 40px;
        top: 4px;
    }

    .stick-body {
        top: 48px;
        height: 70px;
    }

    .stick-leg-left,
    .stick-leg-right {
        top: 125px;
        height: 45px;
    }

    .person-status {
        font-size: 0.9rem;
        margin-top: 8px;
    }

    .window-frame {
        width: 140px;
        height: 180px;
    }

    .window-background {
        border-width: 6px;
    }

    .window-left,
    .window-right {
        border-width: 3px;
    }

    .window-handle {
        width: 14px;
        height: 28px;
    }

    .window-status {
        font-size: 0.85rem;
        margin-top: 10px;
    }

    .timer-container {
        bottom: 10px;
        height: 18px;
        width: 85%;
        max-width: 280px;
    }

    .fart-cloud {
        font-size: 2rem;
        bottom: 60px;
    }

    .game-over-content h3 {
        font-size: 1.4rem;
    }

    .game-over-content p,
    .success-message {
        font-size: 0.9rem;
    }

    .play-again-btn {
        padding: 8px 18px;
        font-size: 0.85rem;
        border-radius: 20px;
    }
}
