:root {
    --primary-red: #D12027;
    --primary-red-dark: #A5191E;
    --primary-red-light: #FDE8E9;
    --bg-light: #F9FAFB;
    --text-main: #111827;
    --text-muted: #4B5563;
    --white: #FFFFFF;
    --gray-100: #F3F4F6;
    --gray-200: #E5E7EB;
    --gray-300: #D1D5DB;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --radius-lg: 1rem;
    --radius-md: 0.75rem;
    --radius-sm: 0.5rem;
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-light);
    color: var(--text-main);
    overflow-x: hidden;
    min-height: 100vh;
}

/* Screens Management */
.screen {
    display: none;
    min-height: 100vh;
    animation: fadeIn 0.5s ease;
}

.screen.active {
    display: flex;
    flex-direction: column;
}

.hidden {
    display: none !important;
}

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

/* Home Screen Styling */
#home-screen {
    background: radial-gradient(circle at 0% 0%, #fff 0%, #f3f4f6 100%);
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 2rem;
    position: relative;
}

.home-content {
    max-width: 800px;
    z-index: 2;
}

.main-logo {
    max-width: 200px;
    height: auto;
    filter: drop-shadow(0 10px 20px rgba(0,0,0,0.2));
    margin-bottom: 1rem;
    animation: logoFloat 4s ease-in-out infinite;
}

@keyframes logoFloat {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    50% {
        transform: translateY(-15px) rotate(1deg);
    }
}

#nav-logo {
    height: 40px;
    width: auto;
    margin-right: 0.5rem;
}

.header-logo {
    display: flex;
    align-items: center;
}

.logo-text {
    text-align: left;
}

.logo-title {
    display: block;
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -1px;
    line-height: 1;
}

.logo-subtitle {
    font-size: 1rem;
    color: var(--primary-red);
    font-weight: 600;
    text-transform: uppercase;
}

.hero-section h1 {
    font-size: 3.5rem;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 1.5rem;
    background: linear-gradient(135deg, var(--text-main) 0%, var(--primary-red) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-section p {
    font-size: 1.25rem;
    color: var(--text-muted);
    margin-bottom: 3rem;
    line-height: 1.6;
}

.home-actions {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
}

.floating-icons {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 1;
}

.floating-icons i {
    position: absolute;
    font-size: 4rem;
    color: rgba(209, 32, 39, 0.05);
    animation: float 6s infinite ease-in-out;
}

.floating-icons i:nth-child(1) { top: 15%; left: 10%; }
.floating-icons i:nth-child(2) { top: 60%; left: 15%; animation-delay: 1s; }
.floating-icons i:nth-child(3) { top: 20%; right: 10%; animation-delay: 2s; }
.floating-icons i:nth-child(4) { top: 70%; right: 15%; animation-delay: 3s; }

@keyframes float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(10deg); }
}

/* Game Screen Styling */
.game-header {
    background-color: var(--white);
    padding: 1.25rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-sm);
    border-bottom: 1px solid var(--gray-200);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.header-left h1 {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--primary-red);
}

.player-badge {
    background-color: var(--gray-100);
    color: var(--text-muted);
    padding: 0.4rem 1rem;
    border-radius: 2rem;
    font-size: 0.8rem;
    font-weight: 600;
    border: 1px solid var(--gray-200);
}

.level-badge {
    background-color: var(--primary-red-light);
    color: var(--primary-red);
    padding: 0.5rem 1rem;
    border-radius: 2rem;
    font-weight: 600;
    font-size: 0.875rem;
}

.score-badge {
    background-color: #DEF7EC;
    color: #03543F;
    padding: 0.5rem 1rem;
    border-radius: 2rem;
    font-weight: 700;
    font-size: 0.875rem;
    border: 1px solid #BCF0DA;
}

.game-container {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 2rem;
    padding: 2rem;
    flex: 1;
}

/* Inventory Panel */
.inventory-panel {
    background-color: var(--white);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
    border: 1px solid var(--gray-200);
}

.panel-tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 2rem;
    font-size: 0.75rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    text-align: center;
}

.red-tag {
    background-color: var(--primary-red);
    color: white;
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    padding-top: 1.5rem; /* Space for tooltips */
}

.tool-item {
    aspect-ratio: 1/1;
    background-color: var(--gray-100);
    border-radius: var(--radius-md);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: grab;
    transition: all 0.2s;
    font-size: 1.5rem;
    color: var(--text-muted);
    border: 2px solid transparent;
    position: relative;
}

.tool-item:hover {
    background-color: var(--primary-red-light);
    color: var(--primary-red);
    transform: scale(1.05);
}

.tool-item.dragging {
    opacity: 0.4;
    cursor: grabbing;
}

/* Tooltip */
.tooltip {
    position: absolute;
    top: -35px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--text-main);
    color: white;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.7rem;
    white-space: nowrap;
    opacity: 0;
    transition: all 0.2s;
    pointer-events: none;
    z-index: 100;
    box-shadow: var(--shadow-md);
}

.tooltip::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: var(--text-main) transparent transparent transparent;
}

.tool-item:hover .tooltip {
    opacity: 1;
}

/* Action Panel */
.action-panel {
    display: flex;
    flex-direction: column;
}

.case-card {
    background-color: var(--white);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    box-shadow: var(--shadow-md);
    flex: 1;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--gray-200);
}

.case-label {
    color: var(--primary-red);
    font-weight: 700;
    font-size: 0.875rem;
    letter-spacing: 1px;
}

.case-header h2 {
    font-size: 2rem;
    font-weight: 800;
    margin-top: 0.5rem;
    margin-bottom: 1rem;
}

.case-instruction {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 3rem;
}

.slots-container {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    margin-bottom: auto;
}

.drop-zone {
    width: 120px;
    height: 120px;
    background-color: var(--gray-100);
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius-lg);
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.3s;
}

.drop-zone.drag-over {
    border-color: var(--primary-red);
    background-color: var(--primary-red-light);
    transform: scale(1.05);
}

.drop-zone .tool-item {
    width: 100%;
    height: 100%;
    background-color: var(--white);
    box-shadow: var(--shadow-sm);
    border: 2px solid var(--gray-200);
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    filter: grayscale(1);
    transform: none !important;
    box-shadow: none !important;
}

.btn-hero {
    background-color: var(--primary-red);
    color: white;
    padding: 1.25rem 2.5rem;
    font-size: 1.25rem;
    border-radius: 4rem;
    box-shadow: 0 10px 20px rgba(209, 32, 39, 0.3);
}

.btn-hero:hover {
    background-color: var(--primary-red-dark);
    transform: translateY(-3px);
    box-shadow: 0 15px 30px rgba(209, 32, 39, 0.4);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--gray-300);
    color: var(--text-main);
    border-radius: 4rem;
    padding: 1.25rem 2.5rem;
    font-size: 1.25rem;
}

.btn-outline:hover {
    border-color: var(--text-main);
    background: var(--gray-100);
}

.btn-primary {
    background-color: var(--primary-red);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-red-dark);
}

.btn-secondary {
    background-color: var(--gray-100);
    color: var(--text-main);
}

.btn-secondary:hover {
    background-color: var(--gray-200);
}

.btn-warning {
    background-color: #FEF3C7;
    color: #92400E;
    border: 1px solid #FCD34D;
}

.btn-warning:hover {
    background-color: #FDE68A;
}

.btn-icon {
    background: transparent;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: var(--text-muted);
}

.btn-icon:hover {
    color: var(--primary-red);
}

/* Input Styles */
.input-group {
    margin-bottom: 2rem;
    text-align: left;
}

.input-group input {
    width: 100%;
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    border: 2px solid var(--gray-200);
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.3s;
    outline: none;
}

.input-group input:focus {
    border-color: var(--primary-red);
    box-shadow: 0 0 0 4px var(--primary-red-light);
}

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

.modal:not(.hidden) {
    opacity: 1;
    pointer-events: auto;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: white;
    padding: 3rem;
    border-radius: 2rem;
    text-align: center;
    max-width: 450px;
    width: 90%;
    box-shadow: var(--shadow-lg);
    animation: zoomIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes zoomIn {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal-icon-container {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.5rem;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2.5rem;
}

.success .modal-icon-container { background-color: #DEF7EC; color: #03543F; }
.error .modal-icon-container { background-color: #FDE8E8; color: #9B1C1C; }
.warning .modal-icon-container { background-color: #FEF3C7; color: #92400E; }

.modal h2 {
    margin-bottom: 0.75rem;
    font-size: 1.75rem;
    font-weight: 800;
}

.modal p {
    color: var(--text-muted);
    margin-bottom: 2rem;
    line-height: 1.5;
}

/* Responsive */
@media (max-width: 1024px) {
    .game-container {
        grid-template-columns: 1fr;
    }
    .inventory-panel {
        order: 2;
    }
    .action-panel {
        order: 1;
    }
    .hero-section h1 {
        font-size: 2.5rem;
    }
}

@media (max-width: 640px) {
    .home-actions {
        flex-direction: column;
    }
    .slots-container {
        flex-wrap: wrap;
    }
    .drop-zone {
        width: 80px;
        height: 80px;
    }
}

/* Photo Booth Styling */
.booth-container {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 3rem;
    padding: 3rem;
    flex: 1;
    max-width: 1200px;
    margin: 0 auto;
}

.booth-left {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    align-items: center;
}

.preview-container {
    width: 100%;
    max-width: 600px;
    aspect-ratio: 1/1;
    background-color: var(--text-main);
    border-radius: var(--radius-lg);
    overflow: hidden;
    position: relative;
    box-shadow: var(--shadow-lg);
}

#webcam, #photo-preview, #booth-canvas {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.frame-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
    background-size: cover;
    background-position: center;
}

.booth-controls {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
}

.booth-right {
    background-color: var(--white);
    padding: 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--gray-200);
}

.booth-right h3 {
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
    font-weight: 700;
    text-align: center;
}

.frame-selector {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.frame-option {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    border-radius: var(--radius-md);
    border: 2px solid var(--gray-100);
    cursor: pointer;
    transition: all 0.2s;
}

.frame-option img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
}

.frame-option span {
    font-size: 0.9rem;
    font-weight: 600;
}

.frame-option:hover {
    background-color: var(--gray-100);
}

.frame-option.active {
    border-color: var(--primary-red);
    background-color: var(--primary-red-light);
}

/* Photo Booth Responsive */
@media (max-width: 1024px) {
    .booth-container {
        grid-template-columns: 1fr;
    }
}
