/* CSS Variables for theming */
:root {
    /* Monet palette */
    --monet-bg: #e8f4e8;
    --monet-primary: #7ba17b;
    --monet-secondary: #9ec49e;
    --monet-accent: #c9a0dc;
    --monet-text: #4a5d4a;

    /* Drive-thru palette */
    --drivethru-bg: #fff3d4;
    --drivethru-primary: #d4382d;
    --drivethru-secondary: #ffcc00;
    --drivethru-accent: #ff6b35;
    --drivethru-text: #2d2d2d;

    /* Current palette (interpolated) */
    --current-bg: #f0f4e0;
    --current-primary: #a08850;
    --current-secondary: #d0b060;
    --current-accent: #c9a0dc;
    --current-text: #3d4a3d;

    /* UI colors */
    --panel-bg: rgba(255, 255, 255, 0.95);
    --panel-border: #ccc;
    --shadow: rgba(0, 0, 0, 0.1);
}

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

body {
    font-family: 'Georgia', serif;
    background: linear-gradient(135deg, var(--current-bg) 0%, #f5f5f0 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

#game-container {
    display: grid;
    grid-template-areas:
        "header header"
        "main controls"
        "footer footer";
    grid-template-columns: 1fr 280px;
    grid-template-rows: auto 1fr auto;
    gap: 15px;
    max-width: 1200px;
    width: 100%;
    background: var(--panel-bg);
    border-radius: 12px;
    box-shadow: 0 4px 20px var(--shadow);
    padding: 20px;
}

/* Header */
#game-header {
    grid-area: header;
    text-align: center;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--current-primary);
}

#game-header h1 {
    font-size: 1.8rem;
    color: var(--current-text);
    font-style: italic;
}

.subtitle {
    font-size: 0.9rem;
    color: var(--current-primary);
    margin-top: 5px;
}

/* Main game area */
#game-main {
    grid-area: main;
    position: relative;
}

#game-canvas {
    width: 100%;
    height: 500px;
    border-radius: 8px;
    background: #f9f9f0;
    box-shadow: inset 0 2px 10px var(--shadow);
}

/* Dialogue box */
#dialogue-box {
    position: absolute;
    bottom: 20px;
    left: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.97);
    border-radius: 12px;
    padding: 15px 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
    border-left: 4px solid var(--current-primary);
    display: flex;
    gap: 15px;
    align-items: flex-start;
}

#dialogue-portrait {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

#dialogue-portrait canvas {
    display: block;
    border-radius: 6px;
}

#dialogue-content {
    flex: 1;
    min-width: 0;
}

#speaker-name {
    font-weight: bold;
    color: var(--current-primary);
    margin-bottom: 8px;
    font-size: 1.1rem;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
}

#dialogue-text {
    line-height: 1.6;
    color: var(--current-text);
    margin-bottom: 10px;
    min-height: 40px;
}

#dialogue-choices {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.dialogue-choice {
    padding: 10px 15px;
    background: linear-gradient(135deg, var(--current-secondary), var(--current-primary));
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    text-align: left;
    transition: transform 0.2s, box-shadow 0.2s;
    font-family: inherit;
    font-size: 0.95rem;
}

.dialogue-choice:hover {
    transform: translateX(5px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

#dialogue-continue {
    padding: 8px 20px;
    background: var(--current-primary);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    align-self: flex-end;
}

/* Control Panel */
#control-panel {
    grid-area: controls;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.control-group {
    background: linear-gradient(180deg, #fafafa 0%, #f0f0f0 100%);
    border-radius: 10px;
    padding: 15px;
    border: 1px solid var(--panel-border);
}

.control-group h3 {
    font-size: 1rem;
    color: var(--current-text);
    margin-bottom: 12px;
    text-align: center;
    border-bottom: 1px solid var(--panel-border);
    padding-bottom: 8px;
}

/* Slider (4-position) */
.slider-container {
    padding: 10px 0;
}

#potato-slider {
    width: 100%;
    height: 8px;
    -webkit-appearance: none;
    appearance: none;
    background: linear-gradient(to right, #8B4513, #D2691E, #A0522D, #1a1a1a);
    border-radius: 4px;
    outline: none;
    cursor: pointer;
}

#potato-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    background: radial-gradient(circle at 30% 30%, #c9a67a, #8B4513);
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid white;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

#potato-slider::-moz-range-thumb {
    width: 24px;
    height: 24px;
    background: radial-gradient(circle at 30% 30%, #c9a67a, #8B4513);
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid white;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 0.7rem;
    color: #666;
}

.slider-labels span {
    flex: 1;
    text-align: center;
    padding: 2px;
    transition: color 0.3s, font-weight 0.3s;
}

.slider-labels span.active {
    color: var(--current-primary);
    font-weight: bold;
}

#appearance-description {
    margin-top: 12px;
    font-size: 0.85rem;
    color: var(--current-text);
    text-align: center;
    font-style: italic;
    min-height: 40px;
}

/* Dial (continuous) */
.dial-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

#dial-wrapper {
    position: relative;
    width: 120px;
    height: 120px;
}

#dial {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: conic-gradient(
        from 225deg,
        #7ba17b 0deg,
        #9ec49e 45deg,
        #c9dfc9 90deg,
        #f0f0e0 135deg,
        #fff3d4 180deg,
        #ffcc00 225deg,
        #d4382d 270deg
    );
    position: relative;
    box-shadow:
        inset 0 2px 10px rgba(0, 0, 0, 0.2),
        0 4px 15px rgba(0, 0, 0, 0.15);
    cursor: pointer;
}

#dial::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    background: radial-gradient(circle at 30% 30%, #f5f5f5, #d0d0d0);
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

#dial-indicator {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 8px;
    height: 20px;
    background: linear-gradient(180deg, #333, #666);
    border-radius: 4px;
    transform-origin: center 50px;
}

#dial-track {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90px;
    height: 90px;
    border-radius: 50%;
    border: 2px dashed rgba(0, 0, 0, 0.1);
    pointer-events: none;
}

.dial-labels {
    display: flex;
    justify-content: space-between;
    width: 100%;
    font-size: 0.85rem;
    font-weight: bold;
}

.dial-label-left {
    color: var(--monet-primary);
}

.dial-label-right {
    color: var(--drivethru-primary);
}

.dial-input {
    width: 100%;
    margin-top: 5px;
}

#world-description {
    margin-top: 12px;
    font-size: 0.85rem;
    color: var(--current-text);
    text-align: center;
    font-style: italic;
    min-height: 40px;
}

/* Footer */
#game-footer {
    grid-area: footer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 10px;
    border-top: 2px solid var(--current-primary);
}

#scene-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

#current-scene {
    font-weight: bold;
    color: var(--current-text);
}

#objective {
    font-size: 0.9rem;
    color: var(--current-primary);
    font-style: italic;
}

#game-controls {
    display: flex;
    gap: 10px;
}

.game-btn {
    padding: 8px 16px;
    background: var(--current-secondary);
    color: var(--current-text);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.2s;
}

.game-btn:hover {
    background: var(--current-primary);
    color: white;
}

/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 12px;
    max-width: 500px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.title-content h1 {
    font-size: 2rem;
    color: var(--current-text);
    margin-bottom: 15px;
}

.tagline {
    font-size: 1.2rem;
    color: var(--current-primary);
    margin-bottom: 10px;
}

.title-content p {
    margin-bottom: 15px;
    line-height: 1.6;
    color: #555;
}

.start-btn {
    padding: 15px 40px;
    font-size: 1.2rem;
    background: linear-gradient(135deg, var(--monet-primary), var(--drivethru-primary));
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    margin-top: 10px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.start-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.close-modal {
    padding: 10px 25px;
    background: #666;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    margin-top: 15px;
}

#inventory-items {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin: 20px 0;
    min-height: 100px;
}

.inventory-item {
    padding: 10px;
    background: #f5f5f5;
    border-radius: 6px;
    text-align: center;
    font-size: 0.85rem;
}

/* Utility classes */
.hidden {
    display: none !important;
}

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

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

#dialogue-box {
    animation: slideUp 0.3s ease-out;
}

/* Responsive */
@media (max-width: 900px) {
    #game-container {
        grid-template-areas:
            "header"
            "main"
            "controls"
            "footer";
        grid-template-columns: 1fr;
    }

    #control-panel {
        flex-direction: row;
        justify-content: center;
        flex-wrap: wrap;
    }

    .control-group {
        flex: 1;
        min-width: 250px;
    }
}
