/* css/samurai_slice.css */

/* ===========================
   SAMURAI SLICE MINIGAME STYLES
   =========================== */

/* Background for Samurai Slice scene */
.background-samuraiSlice {
    background-image:
        linear-gradient(to bottom, rgba(15, 23, 42, 0.3), rgba(15, 23, 42, 0.7)),
        url('../assets/backgrounds/dojo_bg.jpg'),
        url('../assets/backgrounds/landing.jpg');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
}

/* Top control bar */
.samurai-top-control-bar {
    position: fixed;
    top: 70px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    padding: 15px 20px;
    z-index: 100;
    pointer-events: none;
}

.samurai-external-btn {
    background: rgba(15, 23, 42, 0.9);
    border: 2px solid rgba(255, 215, 0, 0.3);
    color: #ffd700;
    padding: 10px 20px;
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    pointer-events: all;
}

.samurai-external-btn:hover {
    background: rgba(30, 41, 59, 0.95);
    border-color: #ffd700;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.3);
}

/* Main container */
#samurai-slice-container {
    position: relative;
    width: 100%;
    height: 100vh;
    max-height: 700px;
    /* Limit height on desktop for landscape feel */
    margin: 0 auto;
    overflow: hidden;
    touch-action: none;
    /* CRITICAL: Disables browser handling of gestures */
    overscroll-behavior: none;
    /* Prevents "bounce" effect */
}

/* Game area */
.samurai-game-area {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

/* Stats UI at top */
.samurai-ui {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 50;
    padding: 20px;
}

.samurai-stats-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    gap: 20px;
}

.stat-capsule {
    background: rgba(15, 23, 42, 0.85);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 50px;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.stat-capsule .stat-icon {
    font-size: 1.5rem;
}

.stat-capsule .stat-value {
    font-size: 1.3rem;
    font-weight: 700;
    color: #e2e8f0;
}

.hp-capsule {
    border-color: rgba(239, 68, 68, 0.3);
}

.score-capsule {
    border-color: rgba(74, 222, 128, 0.3);
}

/* Equation display */
.equation-capsule {
    background: rgba(15, 23, 42, 0.9);
    border: 2px solid rgba(255, 215, 0, 0.4);
    border-radius: 50px;
    padding: 12px 30px;
    display: flex;
    align-items: center;
    gap: 8px;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 20px rgba(255, 215, 0, 0.2);
    font-size: 1.2rem;
    font-weight: 700;
}

.equation-text {
    color: #ffd700;
    font-size: 1.1rem;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
}

/* Phase transition overlay */
.phase-transition {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.95);
    border: 3px solid #ffd700;
    border-radius: 20px;
    padding: 40px 60px;
    z-index: 300;
    text-align: center;
    animation: phaseAppear 0.5s ease-out;
}

.phase-transition h2 {
    font-family: 'Cinzel', serif;
    font-size: 3rem;
    color: #ffd700;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.8);
    margin: 0 0 20px 0;
}

.phase-transition p {
    font-size: 1.5rem;
    color: #e2e8f0;
    margin: 10px 0;
}

.phase-transition.fade-out {
    animation: phaseFadeOut 0.5s ease-out forwards;
}

@keyframes phaseAppear {
    0% {
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 0;
    }

    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

@keyframes phaseFadeOut {
    0% {
        opacity: 1;
    }

    100% {
        opacity: 0;
    }
}

.target-val {
    color: #ffd700;
    font-size: 2rem;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.equation-operator,
.equation-equal {
    color: #e2e8f0;
}

.equation-blank {
    color: #60a5fa;
    font-size: 1.8rem;
}

.equation-target {
    color: #4ade80;
    font-size: 1.8rem;
}

/* Game area */
.samurai-game-area {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    border: 4px solid rgba(255, 215, 0, 0.5);
    border-radius: 12px;
    box-shadow:
        inset 0 0 40px rgba(255, 215, 0, 0.15),
        0 0 25px rgba(255, 215, 0, 0.3);
}

/* Flying numbers */
.flying-number {
    position: absolute;
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    border: 3px solid #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    font-weight: 900;
    color: #fff;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    box-shadow:
        0 8px 20px rgba(0, 0, 0, 0.3),
        inset 0 2px 10px rgba(255, 255, 255, 0.3);
    cursor: pointer;
    user-select: none;
    transition: transform 0.1s ease;
    z-index: 10;
}

.flying-number:hover {
    transform: scale(1.05);
}

/* Sliced animations */
.sliced-correct {
    animation: sliceCorrect 0.5s ease-out forwards;
}

.sliced-wrong {
    animation: sliceWrong 0.5s ease-out forwards;
}

@keyframes sliceCorrect {
    0% {
        transform: translate(-50%, 50%) rotate(0deg) scale(1);
        opacity: 1;
    }

    50% {
        transform: translate(-50%, 50%) rotate(180deg) scale(1.2);
        filter: brightness(1.5);
    }

    100% {
        transform: translate(-50%, 50%) rotate(360deg) scale(0);
        opacity: 0;
    }
}

@keyframes sliceWrong {
    0% {
        transform: translate(-50%, 50%) rotate(0deg) scale(1);
        opacity: 1;
        filter: hue-rotate(0deg);
    }

    25% {
        transform: translate(-50%, 50%) rotate(-10deg) scale(1.1);
    }

    50% {
        transform: translate(-50%, 50%) rotate(10deg) scale(1.1);
        filter: hue-rotate(-45deg) saturate(300%) brightness(0.8);
        /* Orange -> Red */
    }

    75% {
        transform: translate(-50%, 50%) rotate(-10deg) scale(0.9);
    }

    100% {
        transform: translate(-50%, 50%) rotate(0deg) scale(0);
        opacity: 0;
    }
}

/* ... existing code ... */

/* =========================================
   NEW: Satisfaction Effects (Game Juice) 
   ========================================= */

.floating-text {
    position: absolute;
    color: #4ade80;
    /* Green */
    font-weight: 900;
    font-size: 1.8rem;
    /* Smaller */
    pointer-events: none;
    animation: floatUp 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    text-shadow:
        0 0 5px #000,
        0 0 10px rgba(74, 222, 128, 0.5);
    z-index: 200;
}

/* Slice trail canvas */
.slice-trail-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 20;
}

/* Slice particles */
.slice-particle {
    position: fixed;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 100;
    animation: particleExplode 0.6s ease-out forwards;
}

@keyframes particleExplode {
    0% {
        transform: translate(0, 0) scale(1);
        opacity: 1;
    }

    100% {
        transform: translate(var(--vx, 0), var(--vy, 0)) scale(0);
        opacity: 0;
    }
}

/* Intro/End screen */
.samurai-intro {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 200;
    animation: fadeIn 0.5s ease-out;
}

.samurai-intro h1 {
    font-family: 'Cinzel', serif;
    font-size: 3rem;
    color: #ffd700;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
    margin-bottom: 30px;
    text-align: center;
}

.samurai-intro .intro-box {
    background: rgba(15, 23, 42, 0.8);
    border: 2px solid #ffd700;
    border-radius: 16px;
    padding: 40px;
    max-width: 600px;
    text-align: center;
    backdrop-filter: blur(10px);
}

.samurai-intro p {
    font-size: 1.2rem;
    color: #e2e8f0;
    margin: 15px 0;
    line-height: 1.6;
}

/* Shake animation for errors */
@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    10%,
    30%,
    50%,
    70%,
    90% {
        transform: translateX(-10px);
    }

    20%,
    40%,
    60%,
    80% {
        transform: translateX(10px);
    }
}

.shake {
    animation: shake 0.5s ease-in-out;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    #samurai-slice-container {
        max-height: none;
        /* Use full height on mobile */
    }

    .samurai-stats-top {
        flex-direction: column;
        gap: 10px;
    }

    .stat-capsule {
        padding: 8px 15px;
    }

    .stat-capsule .stat-icon {
        font-size: 1.2rem;
    }

    .stat-capsule .stat-value {
        font-size: 1.1rem;
    }

    .equation-capsule {
        padding: 10px 20px;
        font-size: 1.2rem;
    }

    .target-val {
        font-size: 1.5rem;
    }

    .equation-blank,
    .equation-target {
        font-size: 1.4rem;
    }

    .flying-number {
        width: 60px;
        height: 60px;
        font-size: 2rem;
    }

    .samurai-intro h1 {
        font-size: 2rem;
    }

    .samurai-intro .intro-box {
        padding: 30px 20px;
        max-width: 90%;
    }

    .samurai-intro p {
        font-size: 1rem;
    }

    .samurai-top-control-bar {
        top: 60px;
        padding: 10px 15px;
    }

    .samurai-external-btn {
        padding: 8px 15px;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .equation-capsule {
        font-size: 1rem;
        padding: 8px 15px;
    }

    .target-val {
        font-size: 1.3rem;
    }

    .flying-number {
        width: 50px;
        height: 50px;
        font-size: 1.6rem;
    }
}

/* =========================================
   NEW: Satisfaction Effects (Game Juice) 
   ========================================= */

.floating-text {
    position: absolute;
    color: #4ade80;
    /* Green */
    font-weight: 900;
    font-size: 1.8rem;
    /* Smaller */
    pointer-events: none;
    animation: floatUp 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    text-shadow:
        0 0 5px #000,
        0 0 10px rgba(74, 222, 128, 0.5);
    z-index: 200;
}

@keyframes floatUp {
    0% {
        transform: translate(-50%, -50%) scale(0.5) rotate(-10deg);
        opacity: 0;
    }

    20% {
        transform: translate(-50%, -100%) scale(1.2) rotate(0deg);
        opacity: 1;
    }

    100% {
        transform: translate(-50%, -150%) scale(1);
        opacity: 0;
    }
}

.stat-pulse {
    animation: statPulse 0.3s ease-out;
}

@keyframes statPulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.5);
        color: #fff;
        text-shadow: 0 0 20px #fff;
    }

    100% {
        transform: scale(1);
    }
}