/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --primary-color: #2C1810;
    --secondary-color: #8B4513;
    --accent-color: #D4AF37;
    --background: rgba(255, 248, 240, 0.95);
    --surface: rgba(255, 255, 255, 0.92);
    --text-primary: #2C1810;
    --text-secondary: #6B5D54;
    --border-color: #E8DDD0;
    --success: #4CAF50;
    --error: #F44336;
    --shadow: rgba(44, 24, 16, 0.15);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--background);
    background-image: url('main.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    color: var(--text-primary);
    overflow-x: hidden;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* Screen Management */
.screen {
    display: none;
    min-height: 100vh;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.screen.active {
    display: block;
    opacity: 1;
}

.screen:not(#welcomeScreen) {
    background-image: url('main.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
}

/* Welcome Screen */
#welcomeScreen {
    background-image: url('welcome.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.welcome-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem;
    background: linear-gradient(135deg, rgba(44, 24, 16, 0.7) 0%, rgba(139, 69, 19, 0.7) 100%);
}

.chef-icon {
    font-size: 6rem;
    margin-bottom: 1.5rem;
    animation: bounce 2s infinite;
}

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

.app-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--accent-color);
    margin-bottom: 0.5rem;
    text-align: center;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.app-subtitle {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 3rem;
    text-align: center;
}

.start-button {
    background-color: var(--accent-color);
    color: var(--primary-color);
    border: none;
    padding: 1rem 3rem;
    font-size: 1.2rem;
    font-weight: 600;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.4);
}

.start-button:active {
    transform: scale(0.95);
    box-shadow: 0 2px 10px rgba(212, 175, 55, 0.3);
}

/* Header */
.app-header {
    background-color: var(--primary-color);
    color: white;
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 2px 10px var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.app-header h2 {
    font-size: 1.3rem;
    font-weight: 600;
    flex: 1;
}

.back-button {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    line-height: 1;
}

/* Main Menu */
.menu-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    padding: 1.5rem;
    max-width: 600px;
    margin: 0 auto;
}

.menu-card {
    background: var(--surface);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid var(--border-color);
    box-shadow: 0 2px 8px var(--shadow);
}

.menu-card:active {
    transform: scale(0.95);
    box-shadow: 0 1px 4px var(--shadow);
}

.menu-icon {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

.menu-card h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
    color: var(--primary-color);
}

.menu-card p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Content Container */
.content {
    padding: 1.5rem;
    max-width: 600px;
    margin: 0 auto;
}

/* Add backdrop blur to all cards */
.calculator-section,
.encyclopedia-content,
.quiz-card,
.quiz-game,
.stat-card,
.stat-item-card,
.achievement,
.game-header,
.game-section {
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

/* Calculator Sections */
.calculator-section {
    background: var(--surface);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 8px var(--shadow);
}

.calculator-section h3 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.input-group {
    margin-bottom: 1rem;
}

.input-group label {
    display: block;
    font-size: 0.9rem;
    margin-bottom: 0.4rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.input-group input,
.input-group select {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    background: var(--background);
    color: var(--text-primary);
    transition: border-color 0.3s ease;
}

.input-group input:focus,
.input-group select:focus {
    outline: none;
    border-color: var(--accent-color);
}

.action-button {
    width: 100%;
    padding: 0.9rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 0.5rem;
}

.action-button:active {
    transform: scale(0.98);
    background: var(--secondary-color);
}

.action-button.secondary {
    background: var(--text-secondary);
}

.result-box {
    margin-top: 1rem;
    padding: 1rem;
    background: var(--background);
    border-radius: 8px;
    border-left: 4px solid var(--accent-color);
    font-weight: 500;
    min-height: 20px;
}

/* Encyclopedia */
.encyclopedia-nav {
    display: flex;
    overflow-x: auto;
    gap: 0.5rem;
    padding-bottom: 1rem;
    margin-bottom: 1rem;
    -webkit-overflow-scrolling: touch;
}

.encyclopedia-nav::-webkit-scrollbar {
    display: none;
}

.tab-button {
    padding: 0.6rem 1.2rem;
    background: var(--surface);
    border: 2px solid var(--border-color);
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.3s ease;
    color: var(--text-primary);
}

.tab-button.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.encyclopedia-content {
    background: var(--surface);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px var(--shadow);
    line-height: 1.8;
}

.encyclopedia-content h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.4rem;
}

.encyclopedia-content h4 {
    color: var(--secondary-color);
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
}

.encyclopedia-content p {
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.encyclopedia-content ul {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

.encyclopedia-content li {
    margin-bottom: 0.5rem;
}

/* Quiz */
.quiz-selection {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.quiz-card {
    background: var(--surface);
    border-radius: 12px;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid var(--border-color);
    box-shadow: 0 2px 8px var(--shadow);
}

.quiz-card:active {
    transform: scale(0.98);
}

.quiz-card h3 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
}

.quiz-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 0.8rem;
}

.quiz-score {
    font-weight: 600;
    color: var(--accent-color);
    font-size: 0.95rem;
}

.quiz-game {
    background: var(--surface);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px var(--shadow);
}

.quiz-progress {
    text-align: center;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

.quiz-question {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--primary-color);
    line-height: 1.6;
}

.quiz-options {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.quiz-option {
    padding: 1rem;
    background: var(--background);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
    font-size: 1rem;
}

.quiz-option:active {
    transform: scale(0.98);
}

.quiz-option.correct {
    background: var(--success);
    color: white;
    border-color: var(--success);
}

.quiz-option.incorrect {
    background: var(--error);
    color: white;
    border-color: var(--error);
}

.quiz-option.disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.quiz-feedback {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 8px;
    text-align: center;
    font-weight: 500;
}

.quiz-feedback.show {
    background: var(--background);
    border-left: 4px solid var(--accent-color);
}

/* Stats */
.stats-summary {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--surface);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    box-shadow: 0 2px 8px var(--shadow);
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent-color);
    margin-bottom: 0.3rem;
}

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

.section-title {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.quiz-stats {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-item-card {
    background: var(--surface);
    border-radius: 12px;
    padding: 1rem;
    box-shadow: 0 2px 8px var(--shadow);
}

.stat-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.8rem;
}

.stat-item-title {
    font-weight: 600;
    color: var(--primary-color);
}

.stat-item-score {
    font-weight: 700;
    color: var(--accent-color);
}

.progress-bar {
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--secondary-color), var(--accent-color));
    transition: width 0.5s ease;
    border-radius: 4px;
}

.achievements {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.achievement {
    background: var(--surface);
    border-radius: 12px;
    padding: 1rem;
    text-align: center;
    box-shadow: 0 2px 8px var(--shadow);
    border: 2px solid var(--border-color);
}

.achievement.unlocked {
    border-color: var(--accent-color);
}

.achievement.locked {
    opacity: 0.5;
}

.achievement-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.achievement-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 0.3rem;
}

.achievement-desc {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Game */
.game-header {
    display: flex;
    justify-content: space-around;
    background: var(--surface);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 8px var(--shadow);
}

.resource {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
}

.resource-icon {
    font-size: 1.5rem;
}

.resource span:last-child {
    font-weight: 700;
    color: var(--primary-color);
}

.game-section {
    background: var(--surface);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 8px var(--shadow);
}

.game-section h3 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.restaurant-stats {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.stat-item {
    padding: 0.5rem;
    background: var(--background);
    border-radius: 6px;
    font-weight: 500;
}

.menu-items,
.game-upgrades {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.menu-item,
.upgrade-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: var(--background);
    border-radius: 8px;
    border: 2px solid var(--border-color);
}

.item-info {
    flex: 1;
}

.item-name {
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 0.2rem;
}

.item-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.item-level {
    font-size: 0.8rem;
    color: var(--accent-color);
    font-weight: 600;
}

.buy-button {
    padding: 0.5rem 1rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.3s ease;
}

.buy-button:active {
    transform: scale(0.95);
}

.buy-button:disabled {
    background: var(--text-secondary);
    opacity: 0.5;
    cursor: not-allowed;
}

.game-controls {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

/* Responsive Design */
@media (min-width: 768px) {
    .menu-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .app-title {
        font-size: 3rem;
    }
}

/* Utility Classes */
.text-center {
    text-align: center;
}

.mt-1 { margin-top: 1rem; }
.mb-1 { margin-bottom: 1rem; }

