* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --purple: #9945FF;
    --pink: #FF6B9D;
    --teal: #00FFC8;
    --dark: #0a0a14;
    --darker: #050508;
    --glass: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
}

body {
    font-family: 'Bricolage Grotesque', sans-serif;
    background: var(--darker);
    color: #fff;
    min-height: 100vh;
    overflow-x: hidden;
}

.matrix-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

.app-container {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Wobble animations based on intox level */
.intox-3 .app-header,
.intox-4 .app-header,
.intox-5 .app-header {
    animation: wobble 3s ease-in-out infinite;
}

.intox-4 .code-panel,
.intox-5 .code-panel {
    animation: gentleWobble 4s ease-in-out infinite;
}

.intox-5 .main-content {
    animation: drunkVision 5s ease-in-out infinite;
}

@keyframes wobble {
    0%, 100% { transform: rotate(-1deg); }
    50% { transform: rotate(1deg); }
}

@keyframes gentleWobble {
    0%, 100% { transform: translateX(-2px) rotate(-0.5deg); }
    50% { transform: translateX(2px) rotate(0.5deg); }
}

@keyframes drunkVision {
    0%, 100% { filter: blur(0px); }
    25% { filter: blur(0.5px); }
    50% { filter: blur(0px); }
    75% { filter: blur(0.3px); }
}

/* Header */
.app-header {
    text-align: center;
    padding: 2rem;
    transform-origin: center;
}

.header-title {
    font-size: clamp(2rem, 8vw, 4rem);
    font-weight: 800;
    background: linear-gradient(135deg, var(--purple), var(--pink), var(--teal));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 40px rgba(153, 69, 255, 0.5);
    animation: titleGlow 2s ease-in-out infinite alternate;
}

@keyframes titleGlow {
    from { filter: drop-shadow(0 0 20px rgba(153, 69, 255, 0.5)); }
    to { filter: drop-shadow(0 0 40px rgba(255, 107, 157, 0.5)); }
}

.header-subtitle {
    font-family: 'JetBrains Mono', monospace;
    color: rgba(255, 255, 255, 0.6);
    font-size: 1rem;
    margin-top: 0.5rem;
}

/* Intoxication Slider */
.intox-slider-container {
    max-width: 500px;
    margin: 0 auto 2rem;
    padding: 1.5rem;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    backdrop-filter: blur(10px);
}

.slider-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    font-weight: 600;
}

.drink-display {
    font-size: 1.5rem;
}

.intox-slider {
    width: 100%;
    height: 12px;
    border-radius: 6px;
    background: linear-gradient(90deg, var(--teal), var(--purple), var(--pink));
    outline: none;
    -webkit-appearance: none;
    cursor: pointer;
}

.intox-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 0 10px rgba(153, 69, 255, 0.5);
    cursor: pointer;
}

.intox-label {
    text-align: center;
    margin-top: 0.75rem;
    color: var(--pink);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 0 1rem 2rem;
}

.main-grid {
    display: grid;
    grid-template-columns: 1fr;
    max-width: 1400px;
    margin: 0 auto;
}

@media (min-width: 1024px) {
    .main-grid {
        grid-template-columns: 2fr 1fr;
    }
}

/* Code Panel */
.code-panel {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.code-textarea {
    width: 100%;
    min-height: 400px;
    padding: 1.5rem;
    background: rgba(10, 10, 20, 0.8);
    border: 2px solid var(--purple);
    border-radius: 16px;
    color: var(--teal);
    font-family: 'JetBrains Mono', monospace;
    line-height: 1.8;
    resize: vertical;
    outline: none;
    box-shadow: 0 0 30px rgba(153, 69, 255, 0.2), inset 0 0 60px rgba(0, 0, 0, 0.5);
    caret-color: var(--pink);
    transition: all 0.3s ease;
}

.code-textarea::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.code-textarea:focus {
    border-color: var(--pink);
    box-shadow: 0 0 40px rgba(255, 107, 157, 0.3), inset 0 0 60px rgba(0, 0, 0, 0.5);
}

/* Action Buttons */
.action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.action-buttons button {
    flex: 1;
    min-width: 140px;
    border: none;
    border-radius: 16px;
    font-family: 'Bricolage Grotesque', sans-serif;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.btn-ship {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: white;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 20px rgba(34, 197, 94, 0.4); }
    50% { transform: scale(1.02); box-shadow: 0 0 30px rgba(34, 197, 94, 0.6); }
}

.btn-nope {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
}

.btn-random {
    background: linear-gradient(135deg, var(--purple), #7c3aed);
    color: white;
}

.btn-save {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
}

.btn-pizza {
    background: linear-gradient(135deg, #f97316, #ea580c);
    color: white;
}

.action-buttons button:hover {
    transform: translateY(-2px) scale(1.02);
    filter: brightness(1.1);
}

.action-buttons button:active {
    transform: translateY(0) scale(0.98);
}

/* Side Panel */
.side-panel {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.glass-panel {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 1.25rem;
    backdrop-filter: blur(10px);
}

.glass-panel h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--pink);
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* Vibe Panel */
.vibe-status {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: rgba(153, 69, 255, 0.2);
    border-radius: 12px;
}

.vibe-emoji {
    font-size: 2rem;
}

.vibe-text {
    font-weight: 600;
    font-size: 1.1rem;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--glass-border);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
}

.stat-value {
    color: var(--teal);
    font-weight: 600;
}

.confidence-meter {
    margin-top: 1rem;
}

.confidence-meter span {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
}

.confidence-bar {
    height: 12px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 6px;
    overflow: hidden;
}

.confidence-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--teal), var(--purple), var(--pink));
    border-radius: 6px;
    transition: width 0.3s ease;
}

.motivational-quote {
    margin-top: 1rem;
    font-style: italic;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
    text-align: center;
    padding: 0.75rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
}

/* Snippets Panel */
.snippets-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.snippet-btn {
    padding: 0.75rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: var(--teal);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
}

.snippet-btn:hover {
    background: rgba(153, 69, 255, 0.2);
    border-color: var(--purple);
    transform: translateX(4px);
}

/* Settings Panel */
.sound-toggle {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
}

.sound-toggle input {
    width: 20px;
    height: 20px;
    accent-color: var(--purple);
}

/* Achievement Toast */
.achievement-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    background: linear-gradient(135deg, var(--purple), var(--pink));
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(153, 69, 255, 0.5);
    animation: toastIn 0.5s ease, toastOut 0.5s ease 2.5s forwards;
    z-index: 1000;
}

.achievement-emoji {
    font-size: 2rem;
}

.achievement-text {
    font-weight: 700;
    font-size: 1.1rem;
}

@keyframes toastIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes toastOut {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}

/* Hydration Modal */
.hydration-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

.hydration-content {
    background: var(--dark);
    border: 2px solid var(--teal);
    border-radius: 24px;
    padding: 2rem;
    text-align: center;
    max-width: 400px;
    animation: bounceIn 0.5s ease;
}

.hydration-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.hydration-content h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.hydration-content p {
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 1.5rem;
}

.hydration-buttons {
    display: flex;
    gap: 1rem;
}

.hydration-btn-water,
.hydration-btn-dismiss {
    flex: 1;
    padding: 1rem;
    border: none;
    border-radius: 12px;
    font-family: 'Bricolage Grotesque', sans-serif;
    font-weight: 600;
    cursor: pointer;
}

.hydration-btn-water {
    background: var(--teal);
    color: var(--dark);
}

.hydration-btn-dismiss {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

/* Pizza Modal */
.pizza-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.pizza-timer {
    text-align: center;
}

.pizza-emojis {
    font-size: 3rem;
    margin-bottom: 1rem;
    animation: pizzaBounce 0.5s ease infinite;
}

@keyframes pizzaBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.pizza-time {
    font-size: 4rem;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    color: var(--pink);
    text-shadow: 0 0 20px var(--pink);
}

.pizza-timer p {
    color: rgba(255, 255, 255, 0.7);
    margin: 1rem 0;
}

.pizza-skip {
    padding: 0.75rem 2rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: white;
    font-family: 'Bricolage Grotesque', sans-serif;
    cursor: pointer;
}

/* Ship Overlay */
.ship-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

.ship-rocket {
    font-size: 6rem;
    animation: rocketLaunch 2s ease forwards;
}

@keyframes rocketLaunch {
    0% { transform: translateY(100px) scale(1); }
    50% { transform: translateY(0) scale(1.2); }
    100% { transform: translateY(-200px) scale(0); opacity: 0; }
}

.ship-text {
    font-size: 2rem;
    font-weight: 800;
    color: var(--teal);
    text-shadow: 0 0 30px var(--teal);
    animation: textPop 0.5s ease 0.3s both;
}

@keyframes textPop {
    from { transform: scale(0); }
    to { transform: scale(1); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes bounceIn {
    0% { transform: scale(0.8); opacity: 0; }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); opacity: 1; }
}

/* Footer */
.app-footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    padding: 1.5rem;
    background: rgba(0, 0, 0, 0.5);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
}

.app-footer a {
    color: var(--pink);
    text-decoration: none;
}

.app-footer a:hover {
    text-decoration: underline;
}

.disclaimer {
    color: rgba(255, 255, 255, 0.5);
}

.counter {
    color: var(--teal);
}

/* Responsive */
@media (max-width: 768px) {
    .main-grid {
        gap: 1.5rem;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .action-buttons button {
        min-width: 100%;
    }
    
    .app-footer {
        flex-direction: column;
        text-align: center;
    }
}

/* Intoxication level specific adjustments */
.intox-3 .code-textarea,
.intox-4 .code-textarea,
.intox-5 .code-textarea {
    line-height: 2.2;
}

.intox-4 .action-buttons button,
.intox-5 .action-buttons button {
    font-size: 1.25rem;
    padding: 1.25rem 2rem;
    border-radius: 20px;
}

.intox-5 .code-textarea {
    border-width: 3px;
}