:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --text-primary: #1a1a1a;
    --text-secondary: #6b7280;
    --accent: #2d7a5f;
    --accent-light: #34d399;
    --border: #e5e7eb;
    --shadow: rgba(0, 0, 0, 0.05);
    --button-bg: #2d7a5f;
    --button-hover: #236049;
}

[data-theme="dark"] {
    --bg-primary: #1a1a1a;
    --bg-secondary: #262626;
    --text-primary: #f5f5f5;
    --text-secondary: #a3a3a3;
    --accent: #34d399;
    --accent-light: #6ee7b7;
    --border: #404040;
    --shadow: rgba(0, 0, 0, 0.3);
    --button-bg: #34d399;
    --button-hover: #6ee7b7;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    color: var(--text-primary);
    transition: background 0.3s ease, color 0.3s ease;
}

/* Burger Menu Button */
.menu-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 0;
    transition: all 0.3s ease;
    z-index: 2000;
}

.menu-toggle span {
    width: 24px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: all 0.3s ease;
}

.menu-toggle:hover {
    background: var(--accent);
}

.menu-toggle:hover span {
    background: white;
}

.menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(8px, 8px);
}

.menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(8px, -8px);
}

.container {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 50px 40px;
    max-width: 500px;
    width: 100%;
    box-shadow: 0 4px 20px var(--shadow);
    text-align: center;
    position: relative;
    z-index: 1;
}

h1 {
    color: var(--accent);
    margin-bottom: 20px;
    font-size: 32px;
    font-weight: 600;
    letter-spacing: -0.5px;
}

.step {
    display: none;
}

.step.active {
    display: block;
    animation: fadeIn 0.4s ease-out;
}

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

.instruction {
    font-size: 17px;
    line-height: 1.7;
    margin-bottom: 25px;
    color: var(--text-secondary);
    font-weight: 400;
}

button {
    background: var(--button-bg);
    color: white;
    border: none;
    padding: 14px 32px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    margin: 8px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

button:hover {
    background: var(--button-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px var(--shadow);
}

button:active {
    transform: translateY(0);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.breathing-circle {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    background: var(--accent);
    margin: 35px auto;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 22px;
    font-weight: 500;
    border: 3px solid var(--accent-light);
}

.breathing-circle.inhale {
    animation: breatheIn 4s ease-in-out;
}

.breathing-circle.exhale {
    animation: breatheOut 6s ease-in-out;
}

@keyframes breatheIn {
    0% {
        transform: scale(1);
        opacity: 0.8;
    }
    100% {
        transform: scale(1.4);
        opacity: 1;
    }
}

@keyframes breatheOut {
    0% {
        transform: scale(1.4);
        opacity: 1;
    }
    100% {
        transform: scale(1);
        opacity: 0.8;
    }
}

#photoPreview {
    max-width: 100%;
    border-radius: 8px;
    margin: 20px 0;
    display: none;
    border: 1px solid var(--border);
}

#videoPreview {
    max-width: 100%;
    border-radius: 8px;
    margin: 20px 0;
    display: none;
    border: 1px solid var(--border);
}

.chew-counter {
    font-size: 80px;
    font-weight: 700;
    color: var(--accent);
    margin: 30px 0;
    letter-spacing: -2px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-secondary);
    border-radius: 4px;
    overflow: hidden;
    margin: 25px 0;
    border: 1px solid var(--border);
}

.progress-fill {
    height: 100%;
    background: var(--accent);
    width: 0%;
    transition: width 0.3s ease;
}

textarea {
    width: 100%;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 16px;
    font-family: inherit;
    resize: vertical;
    min-height: 120px;
    margin: 20px 0;
    background: var(--bg-secondary);
    color: var(--text-primary);
}

textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.hidden {
    display: none;
}

.pulse {
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.05);
    }
}

input[type="file"] {
    display: none;
}

.emoji {
    font-size: 52px;
    margin: 25px 0;
}

strong {
    color: var(--accent);
    font-weight: 600;
}

/* Menu Panel */
.menu-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 280px;
    height: 100vh;
    background: var(--bg-primary);
    border-left: 1px solid var(--border);
    box-shadow: -4px 0 20px var(--shadow);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    z-index: 1999;
    padding: 20px;
}

.menu-panel.active {
    transform: translateX(0);
}

.menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border);
}

.menu-header h3 {
    color: var(--accent);
    font-size: 24px;
    margin: 0;
}

.menu-close {
    background: none;
    border: none;
    font-size: 36px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    margin: 0;
}

.menu-close:hover {
    color: var(--accent);
    background: none;
    transform: none;
}

.menu-items {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.menu-item {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border);
    padding: 16px 20px;
    border-radius: 8px;
    font-size: 16px;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 12px;
}

.menu-item:hover {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
    transform: translateX(-4px);
}

/* Menu Overlay */
.menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1998;
}

.menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 30px;
    max-width: 500px;
    width: 100%;
    box-shadow: 0 20px 60px var(--shadow);
}

.modal-content h2 {
    color: var(--accent);
    margin-bottom: 20px;
    font-size: 24px;
}

.modal-content label {
    display: block;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
    text-align: left;
}

.modal-content input[type="text"],
.modal-content input[type="password"] {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    background: var(--bg-secondary);
    color: var(--text-primary);
    margin-bottom: 15px;
}

.modal-content input:focus {
    outline: none;
    border-color: var(--accent);
}

.privacy-notice {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 15px;
    margin: 15px 0;
    font-size: 13px;
    color: var(--text-secondary);
    text-align: left;
    line-height: 1.5;
}

.privacy-notice strong {
    color: var(--text-primary);
}

.toggle-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 15px 0;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: 8px;
}

.toggle-container label {
    margin: 0;
    flex: 1;
}

.toggle-switch {
    position: relative;
    width: 50px;
    height: 26px;
    background: var(--border);
    border-radius: 13px;
    cursor: pointer;
    transition: background 0.3s;
}

.toggle-switch.active {
    background: var(--accent);
}

.toggle-switch::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: white;
    top: 3px;
    left: 3px;
    transition: left 0.3s;
}

.toggle-switch.active::after {
    left: 27px;
}

.calorie-result {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
    text-align: left;
}

.calorie-result h3 {
    color: var(--accent);
    margin-bottom: 15px;
    font-size: 20px;
}

.calorie-result p {
    margin: 10px 0;
    color: var(--text-primary);
    line-height: 1.6;
}

.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid var(--border);
    border-top: 3px solid var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Mobile-specific fixes */
@media (max-width: 768px) {
    body {
        -webkit-tap-highlight-color: transparent;
    }

    .container {
        padding: 40px 20px;
    }

    .menu-panel {
        width: 100%;
        max-width: 320px;
    }

    button {
        min-height: 44px;
        font-size: 16px;
    }
}

