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

:root {
    --primary: #4CAF50;
    --primary-dark: #388E3C;
    --danger: #f44336;
    --bg: #1a1a2e;
    --surface: #16213e;
    --text: #e0e0e0;
    --text-secondary: #a0a0a0;
    --radius: 12px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    height: 100dvh;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.screen { display: none; position: absolute; inset: 0; }
.screen.active { display: flex; }

/* ── Auth Screen ── */
#auth-screen {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}

.auth-container { width: 100%; max-width: 360px; text-align: center; }
.logo { font-size: 72px; margin-bottom: 8px; }
h1 { font-size: 24px; margin-bottom: 4px; }
.subtitle { color: var(--text-secondary); font-size: 14px; margin-bottom: 32px; }

.btn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: var(--radius);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 12px;
    transition: opacity 0.2s;
}
.btn:active { opacity: 0.8; }

.btn-google {
    background: white;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}
.google-icon {
    background: linear-gradient(135deg, #4285F4, #34A853, #FBBC05, #EA4335);
    color: white;
    width: 24px; height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
}

.btn-primary { background: var(--primary); color: white; }
.btn-secondary { background: #333; color: var(--text); }
.btn-text { background: none; border: none; color: var(--primary); font-size: 14px; cursor: pointer; margin-top: 8px; }
.btn-icon { background: none; border: none; font-size: 20px; cursor: pointer; padding: 8px; }

.divider {
    display: flex; align-items: center; gap: 12px;
    margin: 16px 0; color: var(--text-secondary); font-size: 13px;
}
.divider::before, .divider::after {
    content: ''; flex: 1; height: 1px; background: #333;
}

#email-auth-form { display: flex; flex-direction: column; gap: 10px; }
#email-auth-form input {
    padding: 14px;
    border-radius: var(--radius);
    border: 1px solid #333;
    background: var(--surface);
    color: var(--text);
    font-size: 16px;
}
#email-auth-form input:focus { outline: none; border-color: var(--primary); }

.error-message { color: var(--danger); font-size: 13px; margin-top: 8px; min-height: 20px; }

/* ── Main App ── */
#app-screen { flex-direction: column; }

#top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--surface);
    z-index: 1000;
    position: relative;
}
#top-bar h2 { font-size: 18px; }

#map { flex: 1; z-index: 1; }

/* ── FAB ── */
.fab {
    position: absolute;
    bottom: 100px;
    right: 16px;
    width: 56px; height: 56px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    font-size: 28px;
    border: none;
    cursor: pointer;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
}
.fab:active { transform: scale(0.95); }

/* ── Radius Control ── */
#radius-control {
    position: absolute;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--surface);
    padding: 8px 16px;
    border-radius: 20px;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
#radius-slider { width: 100px; accent-color: var(--primary); }

/* ── Tab Bar ── */
#tab-bar {
    display: flex;
    background: var(--surface);
    z-index: 1000;
}
.tab {
    flex: 1;
    padding: 12px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}
.tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* ── Panels ── */
.panel {
    position: absolute;
    bottom: 50px;
    left: 0; right: 0;
    max-height: 50%;
    background: var(--surface);
    padding: 16px;
    border-radius: 16px 16px 0 0;
    overflow-y: auto;
    z-index: 999;
    box-shadow: 0 -4px 12px rgba(0,0,0,0.4);
}
.hidden { display: none !important; }

#log-list > div {
    padding: 12px;
    border-bottom: 1px solid #333;
    font-size: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mushroom-normal { border-left: 3px solid #f44336; }
.mushroom-giant { border-left: 3px solid #9c27b0; }
.mushroom-mystery { border-left: 3px solid #2196F3; }
.mushroom-event { border-left: 3px solid #FF9800; }

/* ── Modal ── */
.modal {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 2000;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}
.modal-content {
    background: var(--surface);
    width: 100%;
    max-width: 420px;
    padding: 24px;
    border-radius: 16px 16px 0 0;
}
.modal-content select {
    width: 100%;
    padding: 12px;
    border-radius: var(--radius);
    border: 1px solid #333;
    background: var(--bg);
    color: var(--text);
    font-size: 16px;
    margin: 12px 0;
}
.modal-buttons { display: flex; gap: 12px; margin-top: 16px; }
.modal-buttons .btn { flex: 1; margin: 0; }

#report-coords { color: var(--text-secondary); font-size: 13px; margin: 8px 0; }

/* ── Toast ── */
#toast {
    position: absolute;
    bottom: 120px;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 10px 24px;
    border-radius: 20px;
    font-size: 14px;
    z-index: 3000;
    transition: opacity 0.3s;
}

/* ── History ── */
.stat { padding: 8px 0; font-size: 15px; border-bottom: 1px solid #333; }

/* ── Leaflet Overrides ── */
.leaflet-control-attribution { font-size: 10px !important; }
.leaflet-popup-content { color: #333; font-size: 14px; }
.leaflet-popup-content button {
    background: var(--primary);
    color: white;
    border: none;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    margin-top: 6px;
}
