/**
 * Drips Game Styles
 * A water-filling estimation game
 */

/* ============================================
   CSS Custom Properties
   ============================================ */
:root {
    /* Colors - Ocean/Nautical Theme (inspired by Bilge Pumping) */
    --color-bg: #1a3a4a;
    --color-bg-light: #2a5a6a;
    --color-primary: #3b82f6;
    --color-primary-dark: #2563eb;
    --color-water: #60a5fa;
    --color-water-dark: #3b82f6;
    --color-success: #22c55e;
    --color-danger: #ef4444;
    --color-warning: #f59e0b;
    --color-text: #f0e6d2;
    --color-text-muted: #a09080;
    --color-curtain: #8b2942;
    --color-curtain-dark: #5c1a2a;
    --color-cup: #e2e8f0;
    --color-cup-dark: #cbd5e1;
    --color-spigot: #64748b;
    --color-spigot-dark: #475569;

    /* Wood & Gold accents */
    --color-wood: #6b4c3a;
    --color-wood-dark: #4a3528;
    --color-wood-light: #8b6c4a;
    --color-gold: #d4a650;
    --color-gold-light: #f4c670;

    /* Sizing */
    --game-max-width: 400px;
    --game-height: 600px;
    --spigot-width: 60px;
    --cup-width: 100px;
    --cup-height: 120px;
    --curtain-height: 55%;
    --button-height: 60px;

    /* Animation */
    --transition-fast: 150ms ease;
    --transition-normal: 300ms ease;
    --transition-slow: 500ms ease;

    /* Spacing */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;

    /* Border radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 16px;
    --radius-full: 9999px;
}

/* ============================================
   Base Styles
   ============================================ */
* {
    box-sizing: border-box;
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow: hidden;
}

/* Screen reader only */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.skip-to-content {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--color-primary);
    color: white;
    padding: var(--spacing-sm) var(--spacing-md);
    z-index: 100;
    transition: top var(--transition-fast);
}

.skip-to-content:focus {
    top: 0;
}

/* ============================================
   Header
   ============================================ */
.game-header {
    background: linear-gradient(180deg, var(--color-wood) 0%, var(--color-wood-dark) 100%);
    padding: var(--spacing-sm) var(--spacing-md);
    border-bottom: 3px solid var(--color-gold);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.header-container {
    max-width: var(--game-max-width);
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.back-link {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    color: var(--color-text);
    text-decoration: none;
    font-size: 0.875rem;
    transition: color var(--transition-fast);
    opacity: 0.8;
}

.back-link:hover {
    color: var(--color-gold-light);
    opacity: 1;
}

.back-arrow {
    font-size: 1.25rem;
}

.game-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0;
    color: var(--color-gold-light);
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.header-buttons {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}

.mute-button {
    background: transparent;
    border: none;
    padding: var(--spacing-sm);
    cursor: pointer;
    font-size: 1.25rem;
    opacity: 0.7;
    transition: opacity var(--transition-fast);
}

.mute-button:hover {
    opacity: 1;
}

.mute-button .sound-off {
    display: none;
}

.mute-button[aria-pressed="true"] .sound-on {
    display: none;
}

.mute-button[aria-pressed="true"] .sound-off {
    display: inline;
}

/* ============================================
   Main Game Container
   ============================================ */
.game-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--spacing-md);
}

.game-container {
    width: 100%;
    max-width: var(--game-max-width);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    position: relative;
}

/* ============================================
   Game Area
   ============================================ */
.game-area {
    position: relative;
    width: 100%;
    height: var(--game-height);
    background: linear-gradient(180deg, var(--color-bg-light) 0%, var(--color-bg) 100%);
    border-radius: var(--radius-lg);
    overflow: hidden;
    /* Wood frame with gold inset (Bilge Pumping inspired) */
    border: 4px solid var(--color-wood);
    box-shadow:
        inset 0 0 0 2px var(--color-gold),
        0 8px 24px rgba(0, 0, 0, 0.4),
        0 4px 8px rgba(0, 0, 0, 0.2);
}

/* Decorative corner accents */
.game-area::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 6px;
    background: linear-gradient(90deg,
        var(--color-wood-dark) 0%,
        var(--color-wood-light) 50%,
        var(--color-wood-dark) 100%
    );
    z-index: 30;
}

/* ============================================
   Faucet (Side View - Coming from Left Wall)
   ============================================ */
.faucet {
    position: absolute;
    top: 40px;
    left: 0;
    z-index: 10;
}

/* Wall mounting plate - anchored to left wall */
.faucet-wall-plate {
    position: absolute;
    left: 0;
    top: 15px;
    width: 16px;
    height: 50px;
    background: linear-gradient(90deg, #2d3748 0%, #4a5568 30%, #718096 70%, #4a5568 100%);
    border-radius: 0 4px 4px 0;
    box-shadow:
        inset -2px 0 4px rgba(0, 0, 0, 0.3),
        2px 0 4px rgba(0, 0, 0, 0.2);
}

/* Horizontal pipe from wall - extends to center */
.faucet-pipe-horizontal {
    position: absolute;
    left: 12px;
    top: 28px;
    width: 140px;
    height: 18px;
    background: linear-gradient(180deg, #a0aec0 0%, #718096 30%, #4a5568 70%, #2d3748 100%);
    border-radius: 0 10px 10px 0;
    box-shadow:
        0 2px 4px rgba(0, 0, 0, 0.3),
        inset 0 2px 4px rgba(255, 255, 255, 0.2);
}

/* Main faucet body (where valve connects) */
.faucet-body {
    position: absolute;
    left: 140px;
    top: 12px;
    width: 28px;
    height: 50px;
    background: linear-gradient(90deg, #718096 0%, #a0aec0 30%, #e2e8f0 50%, #a0aec0 70%, #718096 100%);
    border-radius: 8px;
    box-shadow:
        0 2px 6px rgba(0, 0, 0, 0.3),
        inset 0 1px 2px rgba(255, 255, 255, 0.3);
}

/* Valve stem */
.faucet-valve-stem {
    position: absolute;
    left: 50%;
    top: -8px;
    transform: translateX(-50%);
    width: 10px;
    height: 12px;
    background: linear-gradient(90deg, #4a5568 0%, #718096 50%, #4a5568 100%);
    border-radius: 2px;
}

/* Valve handle (cross shape) */
.faucet-valve-handle {
    position: absolute;
    left: 50%;
    top: -30px;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}

.faucet-valve-handle.open {
    transform: translateX(-50%) rotate(-90deg);
}

.handle-center {
    width: 14px;
    height: 14px;
    background: linear-gradient(135deg, #a0aec0 0%, #718096 50%, #4a5568 100%);
    border-radius: 50%;
    box-shadow:
        0 1px 3px rgba(0, 0, 0, 0.3),
        inset 0 1px 2px rgba(255, 255, 255, 0.3);
    z-index: 2;
}

.handle-grip {
    width: 20px;
    height: 8px;
    background: linear-gradient(180deg, #a0aec0 0%, #718096 50%, #4a5568 100%);
    border-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.handle-grip.left {
    position: absolute;
    left: -15px;
    border-radius: 4px 0 0 4px;
}

.handle-grip.right {
    position: absolute;
    right: -15px;
    border-radius: 0 4px 4px 0;
}

/* Curved section - turns downward */
.faucet-curve {
    position: absolute;
    left: 155px;
    top: 38px;
    width: 40px;
    height: 40px;
    border: 12px solid transparent;
    border-top: 12px solid #718096;
    border-right: 12px solid #718096;
    border-radius: 0 24px 0 0;
    box-sizing: border-box;
    background:
        linear-gradient(135deg, #a0aec0, #718096) padding-box,
        linear-gradient(180deg, #a0aec0 0%, #4a5568 100%) border-box;
}

/* Add a pseudo-element for the 3D pipe effect on curve */
.faucet-curve::before {
    content: '';
    position: absolute;
    top: -12px;
    right: -12px;
    width: 40px;
    height: 40px;
    border: 12px solid transparent;
    border-top-color: rgba(255, 255, 255, 0.15);
    border-right-color: rgba(0, 0, 0, 0.1);
    border-radius: 0 24px 0 0;
    pointer-events: none;
}

/* Nozzle/spout - water comes out here */
.faucet-nozzle {
    position: absolute;
    left: 183px;
    top: 58px;
    width: 14px;
    height: 30px;
    background: linear-gradient(90deg, #4a5568 0%, #718096 30%, #a0aec0 50%, #718096 70%, #4a5568 100%);
    border-radius: 0 0 6px 6px;
    box-shadow:
        0 2px 4px rgba(0, 0, 0, 0.3),
        inset 0 -5px 10px rgba(0, 0, 0, 0.1);
}

/* Nozzle opening where water comes out */
.faucet-nozzle::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 2px;
    width: 10px;
    height: 4px;
    background: linear-gradient(90deg, #1a202c, #2d3748, #1a202c);
    border-radius: 0 0 4px 4px;
}

/* ============================================
   Water Drops Container & Individual Drops
   ============================================ */
.water-drops-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 15;
    overflow: hidden;
}

/* Individual water drop element (created by JS) */
.water-drop {
    position: absolute;
    width: 8px;
    height: 12px;
    background: radial-gradient(ellipse at 30% 30%,
        rgba(200, 220, 255, 0.95) 0%,
        var(--color-water) 40%,
        var(--color-water-dark) 100%
    );
    border-radius: 50% 50% 50% 50% / 30% 30% 70% 70%;
    box-shadow:
        0 0 4px rgba(96, 165, 250, 0.6),
        0 0 8px rgba(59, 130, 246, 0.3),
        inset 0 -2px 4px rgba(59, 130, 246, 0.4),
        inset 1px 1px 2px rgba(255, 255, 255, 0.5);
    transform-origin: center center;
    will-change: transform, top;
}

/* Drop stretches as it falls faster */
.water-drop.falling {
    animation: dropStretch 0.1s ease-out forwards;
}

@keyframes dropStretch {
    0% {
        transform: scaleY(1) scaleX(1);
    }
    100% {
        transform: scaleY(1.3) scaleX(0.85);
    }
}

/* Splash effect when drop hits water */
.water-splash {
    position: absolute;
    width: 16px;
    height: 6px;
    background: radial-gradient(ellipse at center,
        rgba(147, 197, 253, 0.8) 0%,
        rgba(96, 165, 250, 0.4) 50%,
        transparent 100%
    );
    border-radius: 50%;
    transform: translateX(-50%);
    animation: splash 0.3s ease-out forwards;
    pointer-events: none;
}

@keyframes splash {
    0% {
        transform: translateX(-50%) scale(0.5);
        opacity: 1;
    }
    50% {
        transform: translateX(-50%) scale(1.5);
        opacity: 0.8;
    }
    100% {
        transform: translateX(-50%) scale(2);
        opacity: 0;
    }
}

/* ============================================
   Curtain
   ============================================ */
.curtain {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--curtain-height);
    z-index: 20;
    pointer-events: none;
}

.curtain-rod {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 12px;
    background: linear-gradient(180deg, #94a3b8 0%, #64748b 100%);
    border-radius: var(--radius-sm);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    z-index: 2;
}

.curtain-fabric {
    position: absolute;
    top: 10px;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(180deg, var(--color-curtain) 0%, var(--color-curtain-dark) 100%);
    transition: transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
    transform-origin: top center;
    overflow: hidden;
}

.curtain-pattern {
    position: absolute;
    inset: 0;
    background-image: repeating-linear-gradient(
        90deg,
        transparent,
        transparent 20px,
        rgba(255, 255, 255, 0.05) 20px,
        rgba(255, 255, 255, 0.05) 22px
    );
}

/* Curtain reveal animation */
.curtain.revealed .curtain-fabric {
    transform: scaleY(0);
}

.curtain.revealed .curtain-rod {
    opacity: 0;
    transition: opacity 0.3s ease 0.5s;
}

/* ============================================
   Hidden Area & Cup
   ============================================ */
.hidden-area {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--curtain-height);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 15;
}

.cup-container {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Glass tumbler - transparent with visible water */
.cup {
    position: relative;
    width: var(--cup-width);
    height: var(--cup-height);
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.1) 0%,
        rgba(255, 255, 255, 0.05) 20%,
        transparent 40%,
        transparent 60%,
        rgba(255, 255, 255, 0.05) 80%,
        rgba(255, 255, 255, 0.1) 100%
    );
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-bottom: 8px solid rgba(255, 255, 255, 0.15);
    border-radius: 4px 4px 12px 12px;
    overflow: hidden;
    box-shadow:
        inset 0 0 20px rgba(255, 255, 255, 0.05),
        inset -2px 0 8px rgba(255, 255, 255, 0.1),
        inset 2px 0 8px rgba(0, 0, 0, 0.1),
        0 8px 32px rgba(0, 0, 0, 0.3);
    /* Slight taper - wider at top */
    clip-path: polygon(3% 0%, 97% 0%, 100% 100%, 0% 100%);
}

/* Glass rim highlight */
.cup::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.3) 0%,
        rgba(255, 255, 255, 0.5) 30%,
        rgba(255, 255, 255, 0.6) 50%,
        rgba(255, 255, 255, 0.5) 70%,
        rgba(255, 255, 255, 0.3) 100%
    );
    border-radius: 4px 4px 0 0;
    z-index: 3;
}

/* Glass side reflection */
.cup::after {
    content: '';
    position: absolute;
    top: 10%;
    left: 5px;
    width: 8px;
    height: 60%;
    background: linear-gradient(
        180deg,
        rgba(255, 255, 255, 0.2) 0%,
        rgba(255, 255, 255, 0.1) 50%,
        transparent 100%
    );
    border-radius: 4px;
    z-index: 3;
}

/* Water inside the glass */
.cup-water {
    position: absolute;
    bottom: 0;
    left: 2px;
    right: 2px;
    height: 0%;
    background: linear-gradient(
        180deg,
        rgba(147, 197, 253, 0.6) 0%,
        rgba(96, 165, 250, 0.7) 30%,
        rgba(59, 130, 246, 0.8) 100%
    );
    transition: height 0.1s linear;
    border-radius: 0 0 10px 10px;
    z-index: 1;
}

/* Water surface highlight */
.cup-water::before {
    content: '';
    position: absolute;
    top: 0;
    left: 5%;
    right: 5%;
    height: 6px;
    background: linear-gradient(
        180deg,
        rgba(255, 255, 255, 0.5) 0%,
        rgba(147, 197, 253, 0.3) 100%
    );
    border-radius: 50%;
    z-index: 2;
}

/* Water bubbles effect when filling */
.cup-water.filling::after {
    content: '';
    position: absolute;
    top: 5%;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    height: 30%;
    background-image:
        radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.4) 0%, transparent 3%),
        radial-gradient(circle at 60% 20%, rgba(255, 255, 255, 0.3) 0%, transparent 2%),
        radial-gradient(circle at 40% 50%, rgba(255, 255, 255, 0.3) 0%, transparent 2.5%),
        radial-gradient(circle at 80% 40%, rgba(255, 255, 255, 0.2) 0%, transparent 2%),
        radial-gradient(circle at 30% 70%, rgba(255, 255, 255, 0.3) 0%, transparent 2%);
    animation: bubbles 0.8s ease-in-out infinite;
    z-index: 2;
}

@keyframes bubbles {
    0%, 100% {
        opacity: 0.6;
        transform: translateX(-50%) translateY(0);
    }
    50% {
        opacity: 1;
        transform: translateX(-50%) translateY(-10px);
    }
}

.cup-shadow {
    width: 80px;
    height: 10px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 50%;
    margin-top: 10px;
    filter: blur(3px);
}

/* Overflow water */
.cup-overflow {
    position: absolute;
    top: 0;
    left: -10px;
    right: -10px;
    height: 0;
    opacity: 0;
    overflow: visible;
}

.cup-overflow.active {
    opacity: 1;
}

.cup-overflow::before,
.cup-overflow::after {
    content: '';
    position: absolute;
    top: 0;
    width: 15px;
    height: 50px;
    background: var(--color-water);
    border-radius: 0 0 10px 10px;
    animation: overflowDrip 0.5s ease-in infinite;
}

.cup-overflow::before {
    left: 0;
    animation-delay: 0s;
}

.cup-overflow::after {
    right: 0;
    animation-delay: 0.25s;
}

@keyframes overflowDrip {
    0% {
        height: 0;
        opacity: 1;
    }
    100% {
        height: 80px;
        opacity: 0;
    }
}

/* ============================================
   Game Info
   ============================================ */
.game-info {
    text-align: center;
    padding: var(--spacing-sm) 0;
}

.game-prompt {
    color: var(--color-text-muted);
    font-size: 0.875rem;
    margin: 0;
}

/* ============================================
   Controls
   ============================================ */
.game-controls {
    display: flex;
    gap: var(--spacing-md);
    justify-content: center;
}

.control-button {
    flex: 1;
    max-width: 150px;
    height: var(--button-height);
    border: none;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 1.125rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-transform: uppercase;
    /* Layout for label + kbd */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
}

.control-button kbd {
    display: block;
    font-family: inherit;
    font-size: 0.625rem;
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    opacity: 0.7;
    padding: 1px 6px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

.flow-button {
    background: linear-gradient(180deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    color: white;
    box-shadow:
        0 4px 0 #1d4ed8,
        0 6px 10px rgba(0, 0, 0, 0.3);
}

.flow-button:hover {
    transform: translateY(-2px);
    box-shadow:
        0 6px 0 #1d4ed8,
        0 8px 15px rgba(0, 0, 0, 0.3);
}

.flow-button:active,
.flow-button.pressed {
    transform: translateY(4px);
    box-shadow:
        0 0 0 #1d4ed8,
        0 2px 5px rgba(0, 0, 0, 0.3);
}

.done-button {
    background: linear-gradient(180deg, var(--color-success) 0%, #16a34a 100%);
    color: white;
    box-shadow:
        0 4px 0 #15803d,
        0 6px 10px rgba(0, 0, 0, 0.3);
}

.done-button:hover {
    transform: translateY(-2px);
    box-shadow:
        0 6px 0 #15803d,
        0 8px 15px rgba(0, 0, 0, 0.3);
}

.done-button:active {
    transform: translateY(4px);
    box-shadow:
        0 0 0 #15803d,
        0 2px 5px rgba(0, 0, 0, 0.3);
}

.done-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.replay-button {
    background: linear-gradient(180deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    color: white;
    box-shadow:
        0 4px 0 #1d4ed8,
        0 6px 10px rgba(0, 0, 0, 0.3);
    max-width: 250px;
    min-width: 180px;
    padding: var(--spacing-md) var(--spacing-xl);
    margin-top: var(--spacing-lg);
}

.replay-button:hover {
    transform: translateY(-2px);
}

.replay-button:active {
    transform: translateY(4px);
    box-shadow: none;
}

/* ============================================
   Score Display
   ============================================ */
.score-display {
    position: absolute;
    inset: 0;
    background: var(--color-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-normal), visibility var(--transition-normal);
}

.score-display.visible {
    opacity: 1;
    visibility: visible;
}

.score-content {
    text-align: center;
    padding: var(--spacing-xl);
    width: 100%;
    max-width: 300px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.score-title {
    font-size: 1.5rem;
    color: var(--color-gold);
    margin: 0 0 var(--spacing-sm) 0;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.score-value {
    font-size: 5rem;
    font-weight: 800;
    color: var(--color-gold-light);
    line-height: 1;
    margin-bottom: var(--spacing-sm);
    animation: scoreReveal 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.score-value.perfect {
    color: var(--color-success);
    text-shadow: 0 0 30px var(--color-success), 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.score-value.overflow {
    color: var(--color-danger);
}

@keyframes scoreReveal {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.score-message {
    font-size: 1.125rem;
    color: var(--color-text-muted);
    margin: 0;
}

/* ============================================
   Overflow Effect
   ============================================ */
.overflow-effect {
    position: absolute;
    inset: 0;
    background: rgba(239, 68, 68, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.overflow-effect.active {
    opacity: 1;
    visibility: visible;
    animation: screenShake 0.5s ease-out;
}

@keyframes screenShake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.overflow-text {
    font-size: 3rem;
    font-weight: 800;
    color: white;
    text-shadow:
        0 0 10px var(--color-danger),
        0 0 20px var(--color-danger),
        0 0 40px var(--color-danger);
    animation: overflowPulse 0.3s ease-in-out infinite alternate;
}

@keyframes overflowPulse {
    0% { transform: scale(1); }
    100% { transform: scale(1.1); }
}

/* ============================================
   Nozzle Dripping Animation
   ============================================ */
.faucet-nozzle.dripping::before {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 6px;
    height: 6px;
    background: var(--color-water);
    border-radius: 50% 50% 50% 50% / 40% 40% 60% 60%;
    animation: nozzleDrip 0.4s ease-in infinite;
    box-shadow: 0 0 4px var(--color-water);
}

@keyframes nozzleDrip {
    0% {
        opacity: 0.8;
        transform: translateX(-50%) translateY(0) scale(0.8);
    }
    50% {
        opacity: 1;
        transform: translateX(-50%) translateY(2px) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateX(-50%) translateY(8px) scale(0.6);
    }
}

/* ============================================
   Game State Modifiers
   ============================================ */
.game-container.game-over .game-controls,
.game-container.game-over .game-info {
    display: none;
}

/* ============================================
   Responsive Design
   ============================================ */
@media (max-width: 480px) {
    :root {
        --game-height: 500px;
        --button-height: 50px;
        --cup-width: 80px;
        --cup-height: 100px;
    }

    .game-area {
        border-radius: var(--radius-md);
    }

    .control-button {
        font-size: 1rem;
    }

    .score-value {
        font-size: 4rem;
    }
}

@media (min-width: 768px) {
    :root {
        --game-height: 650px;
    }
}

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