:root {
    --home-bg: #0a0200; /* Deep charcoal background */
    --accent-color: #ff5500; /* Bright orange-red flame */
    --focus-color: #ff8800; /* Bright amber flame */
    --white: #fff8f0; /* Slightly warm white */
    --glass-bg: rgba(255, 60, 0, 0.15); /* Semi-transparent flame color */
    --ember-glow: rgba(255, 100, 0, 0.3); /* Ember glow effect */
    --flame-gradient: linear-gradient(to bottom, #ff5500, #ff8800); /* Vertical flame gradient */
    --flame-highlight: #ffcc00; /* Yellow flame highlight */
    --flame-dark: #a02800; /* Dark ember color */
    --flame-shadow: 0 0 15px rgba(255, 80, 0, 0.6); /* Flame-like glow */
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --border-radius-sm: 4px;
    --border-radius-md: 12px;
    --border-radius-lg: 16px;
    --shadow-default: 0 4px 12px rgba(80, 20, 0, 0.3);
    --shadow-elevated: 0 8px 24px rgba(120, 30, 0, 0.4);
    --transition-fast: 150ms ease;
    --transition-normal: 200ms ease-out;
    --transition-slow: 300ms ease-in-out;
}

body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    background-color: var(--home-bg);
    color: var(--white);
    height: 100vh;
    overflow: hidden;
}

#home-section {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--home-bg);
    background-image: radial-gradient(circle at center, rgba(40, 10, 0, 0.4) 0%, rgba(10, 2, 0, 0.8) 70%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    z-index: 1;
}

#camera-preview {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* Added camera controls container */
#camera-controls-container {
    position: absolute;
    bottom: var(--spacing-lg);
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 40px;
    z-index: 3;
}

#video-stream {
    width: 100%;
    height: 100%;
    object-fit: cover;
    box-shadow: inset 0 0 60px rgba(255, 60, 0, 0.2);
    animation: flame-pulse 3s infinite alternate;
}

@keyframes flame-pulse {
    0% { opacity: 0.95; filter: brightness(1); }
    50% { opacity: 0.98; filter: brightness(1.05); }
    100% { opacity: 1; filter: brightness(1.1); }
}

#thumbnails-rail {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 10vh;
    display: flex;
    align-items: center;
    padding: var(--spacing-md);
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    z-index: 2;
    transition: height var(--transition-normal);
    border-bottom: 1px solid rgba(255, 80, 0, 0.3);
    box-shadow: 0 2px 10px rgba(255, 60, 0, 0.2);
}

#thumbnails-rail.expanded {
    height: 20vh;
}

.thumb {
    width: 64px;
    height: 80px;
    object-fit: cover;
    border-radius: var(--border-radius-sm);
    margin-right: var(--spacing-md);
    border: 2px solid var(--accent-color);
    box-shadow: var(--shadow-default), 0 0 8px rgba(255, 80, 0, 0.5);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.thumb:hover {
    box-shadow: var(--shadow-default), 0 0 12px rgba(255, 120, 0, 0.7);
    transform: scale(1.05);
}

.thumb:active {
    transform: scale(0.95);
}

.control-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border-radius: var(--border-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 80, 0, 0.3);
    box-shadow: 0 0 15px rgba(255, 60, 0, 0.2);
}

/* Updated Upload Control */
#upload-control {
    width: 48px;
    height: 48px;
}

#upload-button {
    width: 28px;
    height: 28px;
    background: transparent;
    border: none;
    cursor: pointer;
    opacity: 0.3;
    transition: opacity var(--transition-fast), transform var(--transition-fast);
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

#upload-button:hover, #upload-button:focus {
    opacity: 1;
    outline: none;
    transform: scale(1.1);
}

#upload-button:focus-visible {
    box-shadow: 0 0 0 2px var(--focus-color), 0 0 8px rgba(255, 120, 0, 0.5);
    border-radius: var(--border-radius-sm);
}

#upload-button svg {
    width: 28px;
    height: 28px;
    stroke: var(--white);
    fill: none;
    stroke-width: 2;
    filter: drop-shadow(0 0 2px rgba(255, 120, 0, 0.5));
}

/* Updated Shutter Control */
#shutter-control {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: rgba(40, 10, 0, 0.5);
    box-shadow: 0 0 20px rgba(255, 60, 0, 0.3);
}

#shutter-button {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: radial-gradient(circle at center, #fff8f0, #ffcc00);
    border: 4px solid var(--accent-color);
    cursor: pointer;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
    box-shadow: 0 0 15px rgba(255, 80, 0, 0.5);
}

#shutter-button:focus {
    outline: none;
    box-shadow: 0 0 0 4px var(--focus-color), 0 0 20px rgba(255, 120, 0, 0.7);
}

#shutter-button:hover {
    box-shadow: 0 0 20px rgba(255, 120, 0, 0.7);
    transform: scale(1.05);
}

#shutter-button:active {
    transform: scale(0.95);
}

@keyframes flame-pulse-hint {
    0% { box-shadow: 0 0 0 0 rgba(255, 80, 0, 0.6); }
    70% { box-shadow: 0 0 0 15px rgba(255, 80, 0, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 80, 0, 0); }
}

.pulse-animation {
    animation: flame-pulse-hint 3s infinite;
}

#send-button-container {
    position: absolute;
    bottom: 12px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    transform: translateY(100px);
    opacity: 0;
    transition: transform var(--transition-normal), opacity var(--transition-normal);
    z-index: 4;
}

#send-button-container.visible {
    transform: translateY(0);
    opacity: 1;
}

#send-control {
    width: 48px;
    height: 48px;
    background: var(--glass-bg);
    border-radius: 50%;
    border: 1px solid rgba(255, 80, 0, 0.3);
    box-shadow: 0 0 15px rgba(255, 60, 0, 0.2);
}

#send-button {
    width: 28px;
    height: 28px;
    background: transparent;
    border: none;
    cursor: pointer;
    opacity: 1;
    transition: opacity var(--transition-fast), transform var(--transition-fast);
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

#send-button:hover, #send-button:focus {
    opacity: 1;
    outline: none;
    transform: scale(1.1);
}

#send-button:focus-visible {
    box-shadow: 0 0 0 2px var(--focus-color), 0 0 8px rgba(255, 120, 0, 0.5);
    border-radius: var(--border-radius-sm);
}

#send-button svg {
    width: 35px;
    height: 35px;
    fill: none;
    stroke: var(--flame-highlight);
    stroke-width: 2;
    filter: drop-shadow(0 0 3px rgba(255, 120, 0, 0.5));
}

#response-view {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, rgba(30, 5, 0, 0.97), rgba(10, 2, 0, 0.98));
    backdrop-filter: blur(20px);
    z-index: 100;
    padding: var(--spacing-lg);
    overflow-y: auto;
    display: none;
    box-shadow: inset 0 0 100px rgba(255, 60, 0, 0.1);
}

#response-view.visible {
    display: block;
}

#close-response {
    position: fixed;
    top: var(--spacing-md);
    right: var(--spacing-md);
    background: var(--glass-bg);
    border: 1px solid rgba(255, 80, 0, 0.3);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform var(--transition-fast), background-color var(--transition-fast);
    z-index: 101;
    box-shadow: 0 0 10px rgba(255, 60, 0, 0.2);
}

#close-response:hover {
    background-color: rgba(255, 60, 0, 0.25);
    transform: scale(1.05);
}

#close-response svg {
    width: 24px;
    height: 24px;
    fill: var(--flame-highlight);
}

#close-response:active {
    transform: scale(0.9);
}

#response-content {
    max-width: 800px;
    margin: 0 auto;
    padding: var(--spacing-lg);
    color: var(--white);
    line-height: 1.6;
    min-height: 100%;
    border-radius: var(--border-radius-lg);
    background: linear-gradient(to bottom, rgba(40, 10, 0, 0.1), rgba(20, 5, 0, 0.2));
    border: 1px solid rgba(255, 80, 0, 0.1);
    box-shadow: 0 0 30px rgba(255, 60, 0, 0.1);
}

#response-text {
    font-size: 16px;
    margin-top: 40px;
    color: #ffd1b3;
}

#retake-button {
    color: var(--flame-highlight);
    background: transparent;
    border: none;
    padding: var(--spacing-sm) 0;
    font-size: 16px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: all var(--transition-fast);
}

#retake-button:hover, #retake-button:focus {
    text-decoration: none;
    outline: none;
    text-shadow: 0 0 8px rgba(255, 180, 0, 0.7);
    transform: scale(1.05);
}

#retake-button {
    width: 28px;
    height: 28px;
    background: transparent;
    border: none;
    cursor: pointer;
    opacity: 0.3;
    transition: opacity var(--transition-fast), transform var(--transition-fast);
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

#retake-button:hover, #retake-button:focus {
    opacity: 1;
    outline: none;
}

#retake-button:focus-visible {
    box-shadow: 0 0 0 2px var(--focus-color), 0 0 8px rgba(255, 120, 0, 0.5);
    border-radius: var(--border-radius-sm);
}

#retake-button svg {
    width: 28px;
    height: 28px;
    stroke: var(--flame-highlight);
    fill: none;
    stroke-width: 2;
    filter: drop-shadow(0 0 2px rgba(255, 120, 0, 0.5));
}

/* Ensure good tap target sizes */
button {
    min-width: 48px;
    min-height: 48px;
}

/* Ensure hidden elements are truly hidden */
.hidden {
    display: none !important;
}

[hidden] {
    display: none !important;
}

/* Camera switch button styling */
#switch-camera-button {
    position: absolute;
    top: var(--spacing-md);
    right: var(--spacing-md);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background-color: rgba(40, 10, 0, 0.5);
    border: 2px solid var(--accent-color);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: 0 0 10px rgba(255, 60, 0, 0.3);
}

#switch-camera-button:hover {
    background-color: rgba(60, 15, 0, 0.7);
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(255, 80, 0, 0.5);
}

#switch-camera-button:active {
    transform: scale(0.95);
}

#switch-camera-button svg {
    width: 24px;
    height: 24px;
    fill: var(--flame-highlight);
    filter: drop-shadow(0 0 2px rgba(255, 120, 0, 0.5));
}