:root {
    --bg-color: #121212;
    --panel-bg: rgba(0, 0, 0, 0.3);
    /* 30% black opacity */
    --inner-bg: rgba(0, 0, 0, 0.3);
    /* 30% black opacity for right panel buttons */
    --inner-bg-dark: rgba(0, 0, 0, 0.65);
    /* 65% black opacity for left/center boxes */
    --text-primary: #ffffff;
    --text-secondary: #f0f0f0;
    --bio-green: #00ff9d;
    --bio-purple: #bd00ff;
    --bio-blue: #00d5ff;
    --danger-red: #ff4444;
    --border-color: rgba(255, 255, 255, 0.1);
    --font-main: 'Roboto Mono', monospace;
    --font-header: 'Orbitron', sans-serif;
    --glass-blur: blur(8px);
}

* {
    box-sizing: border-box;
    user-select: none;
}

body {
    margin: 0;
    padding: 0;
    background-color: var(--bg-color);
    background-image: url('kitchen_bg.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    color: var(--text-primary);
    font-family: var(--font-main);
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: var(--panel-bg);
    backdrop-filter: var(--glass-blur);
    border-bottom: 2px solid var(--bio-green);
    box-shadow: 0 0 15px rgba(0, 255, 157, 0.2);
    z-index: 10;
}

.game-title {
    font-family: var(--font-header);
    font-size: 1.5rem;
    color: var(--bio-green);
    text-shadow: 0 0 10px rgba(0, 255, 157, 0.4);
    background: rgba(0, 0, 0, 0.5);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
}

.hud-stats {
    display: flex;
    gap: 2rem;
    background: rgba(0, 0, 0, 0.5);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.stat-box {
    text-align: center;
}

.stat-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.stat-value {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--text-primary);
}

/* Main Layout */
main {
    flex: 1;
    display: flex;
    flex-direction: row;
    /* Explicitly row */
    padding: 1.5rem;
    gap: 1.5rem;
    height: 100%;
    overflow: hidden;
}

/* Panels Common */
.panel-left {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
    min-width: 250px;
    /* Transparent background */
}

.panel-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background: var(--panel-bg);
    backdrop-filter: var(--glass-blur);
    box-shadow: 0 0 10px rgba(0, 255, 157, 0.1);
    border-radius: 12px;
    padding: 1rem;
    min-width: 250px;
}

/* Left: Order & Info */
.order-card {
    background: var(--inner-bg-dark);
    border: 1px solid var(--bio-green);
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 0 15px rgba(0, 255, 157, 0.1);
    animation: slideIn 0.5s ease-out;
}

#hint-box {
    background: var(--inner-bg-dark);
    padding: 0.5rem;
    border-radius: 4px;
    border: 1px solid var(--bio-green);
    margin-bottom: 1rem;
    font-size: 0.8rem;
    color: #fff;
    text-align: center;
}

.order-header {
    font-family: var(--font-header);
    color: var(--bio-green);
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
    border-bottom: 1px solid var(--bio-green);
    padding-bottom: 0.5rem;
}

.order-reqs {
    margin-top: 1rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Center: Fermentation Chamber */
.panel-center {
    flex: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    /* Transparent background */
    position: relative;
    padding: 1rem;
    min-width: 300px;
}

.jar-container {
    width: 220px;
    height: 320px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.05);
    position: relative;
    overflow: hidden;
    margin-bottom: 1rem;
    backdrop-filter: blur(2px);
    box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.5), 0 10px 20px rgba(0, 0, 0, 0.3);
}

.jar-liquid {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 0%;
    background: var(--bio-purple);
    transition: height 0.5s, background-color 0.5s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.3);
}

.jar-label {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-weight: bold;
    text-shadow: 0 0 5px #000;
    z-index: 10;
    pointer-events: none;
    font-size: 1.2rem;
    width: 100%;
    text-align: center;
}

.bubble {
    position: absolute;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    animation: rise 2s infinite ease-in;
    box-shadow: 0 0 5px rgba(255, 255, 255, 0.8);
}

@keyframes rise {
    0% {
        transform: translateY(0);
        opacity: 0;
    }

    50% {
        opacity: 1;
    }

    100% {
        transform: translateY(-100px);
        opacity: 0;
    }
}

.controls-area {
    width: 100%;
    display: flex;
    justify-content: space-around;
    align-items: center;
    margin-top: auto;
    background: var(--inner-bg-dark);
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.temp-control {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.temp-display {
    font-family: var(--font-header);
    font-size: 1.5rem;
    color: var(--text-primary);
    margin: 0.5rem 0;
    text-shadow: 0 0 10px rgba(255, 68, 68, 0.3);
}

input[type=range] {
    width: 150px;
    accent-color: var(--danger-red);
}

/* Right: Ingredients */
.panel-right {
    overflow-y: auto;
}

.ingredient-category {
    margin-bottom: 1rem;
}

.category-title {
    font-family: var(--font-header);
    color: var(--bio-green);
    font-size: 0.8rem;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding-bottom: 0.2rem;
}

.ingredient-btn {
    width: 100%;
    padding: 0.8rem;
    margin-bottom: 0.5rem;
    background: var(--inner-bg);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    text-align: left;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ingredient-btn:hover {
    background: rgba(0, 0, 0, 0.5);
    border-color: var(--bio-green);
}

.ingredient-btn.selected {
    background: rgba(0, 255, 157, 0.15);
    border-color: var(--bio-green);
    box-shadow: 0 0 10px rgba(0, 255, 157, 0.1);
}

.ingredient-name {
    font-size: 1.1rem;
    font-weight: bold;
    color: var(--text-primary);
}

.ingredient-desc {
    font-size: 0.8rem;
    font-weight: normal;
    color: #ffffff;
    margin-top: 0.2rem;
}

/* Action Button */
.main-btn {
    background: rgba(0, 255, 157, 0.1);
    color: var(--bio-green);
    border: 2px solid var(--bio-green);
    padding: 1rem 3rem;
    font-family: var(--font-header);
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 0 10px rgba(0, 255, 157, 0.2);
    text-transform: uppercase;
    border-radius: 4px;
    backdrop-filter: blur(4px);
}

.main-btn:hover {
    background: var(--bio-green);
    color: #000;
    box-shadow: 0 0 30px rgba(0, 255, 157, 0.5);
}

.main-btn:disabled {
    border-color: #555;
    color: #777;
    background: transparent;
    cursor: not-allowed;
    box-shadow: none;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    backdrop-filter: blur(5px);
}

.modal.visible {
    opacity: 1;
    pointer-events: all;
}

.modal-content {
    background: rgba(30, 30, 36, 0.95);
    border: 1px solid var(--bio-green);
    padding: 2rem;
    max-width: 600px;
    border-radius: 8px;
    position: relative;
    box-shadow: 0 0 50px rgba(0, 255, 157, 0.2);
}

.modal-title {
    font-family: var(--font-header);
    color: var(--bio-green);
    margin-top: 0;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
}

.learn-link {
    color: var(--bio-blue);
    text-decoration: none;
    cursor: pointer;
    font-size: 0.9rem;
    margin-left: 0.5rem;
    font-weight: bold;
    text-shadow: 0 0 5px var(--bio-blue);
}

/* Animations */
@keyframes slideIn {
    from {
        transform: translateX(-20px);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.flash-success {
    animation: flashGreen 0.5s;
}

.flash-fail {
    animation: flashRed 0.5s;
}

@keyframes flashGreen {
    0% {
        background-color: rgba(0, 255, 157, 0.3);
    }

    100% {
        background-color: rgba(20, 20, 30, 0.7);
    }
}

@keyframes flashRed {
    0% {
        background-color: rgba(255, 68, 68, 0.3);
    }

    100% {
        background-color: rgba(20, 20, 30, 0.7);
    }
}