/* ===== VibeCheck - Dark Editorial Theme ===== */
:root {
    --bg: #0a0a0f;
    --surface: rgba(22, 22, 35, 0.85);
    --surface-2: rgba(35, 35, 55, 0.7);
    --text: #e8e8f0;
    --muted: #8888a0;
    --border: rgba(120, 120, 180, 0.15);
    --primary: #9b6dff;
    --primary-contrast: #ffffff;
    --accent: #00d4aa;
    --danger: #ff4d6a;
    --success: #00d4aa;
    --warning: #ffb84d;
    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 18px;
    --shadow-1: 0 2px 8px rgba(0,0,0,0.3);
    --shadow-2: 0 8px 32px rgba(0,0,0,0.4);
    --ring: 0 0 0 2px var(--primary);
    --mood-1: #ff4d6a;
    --mood-2: #ff8a4d;
    --mood-3: #ffb84d;
    --mood-4: #7dd87d;
    --mood-5: #00d4aa;
}

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

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Pretendard', 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100dvh;
    line-height: 1.5;
    overflow-x: hidden;
}

/* Background gradient */
body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(ellipse at 30% 20%, rgba(155, 109, 255, 0.08) 0%, transparent 50%),
                radial-gradient(ellipse at 70% 80%, rgba(0, 212, 170, 0.05) 0%, transparent 50%);
    z-index: -1;
    animation: bgShift 20s ease-in-out infinite alternate;
}

@keyframes bgShift {
    0% { transform: translate(0, 0); }
    100% { transform: translate(-5%, 3%); }
}

/* ===== App Bar ===== */
.app-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    min-height: 72px;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(10, 10, 15, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    z-index: 100;
}

.app-title {
    font-size: 20px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.app-bar-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* ===== Bottom Nav ===== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-around;
    align-items: center;
    min-height: 64px;
    padding: 8px 0 env(safe-area-inset-bottom, 8px);
    background: rgba(10, 10, 15, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--border);
    z-index: 100;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 4px 16px;
    border: none;
    background: none;
    color: var(--muted);
    font-size: 11px;
    cursor: pointer;
    transition: color 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.nav-item .nav-icon { font-size: 22px; }
.nav-item.active { color: var(--primary); }

/* ===== Main Content ===== */
.main-content {
    padding: 88px 16px 80px;
    max-width: 480px;
    margin: 0 auto;
}

/* ===== Screens ===== */
.screen {
    display: none;
    flex-direction: column;
    gap: 24px;
}
.screen.active { display: flex; }

/* ===== Cards ===== */
.card {
    background: var(--surface);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px 24px;
    box-shadow: var(--shadow-1);
}

.card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 16px;
}

/* ===== Mood Selector ===== */
.mood-selector {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 0;
}

.mood-btn {
    flex: 1;
    aspect-ratio: 1;
    max-width: 64px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface-2);
    color: var(--text);
    font-size: 28px;
    cursor: pointer;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.mood-btn .mood-label {
    font-size: 10px;
    color: var(--muted);
}

.mood-btn:active { transform: scale(0.92); }
.mood-btn.selected {
    border-color: var(--primary);
    background: rgba(155, 109, 255, 0.15);
    box-shadow: var(--ring);
}

/* ===== Energy Slider ===== */
.energy-bar {
    display: flex;
    gap: 8px;
    padding: 8px 0;
}

.energy-dot {
    flex: 1;
    height: 40px;
    border-radius: var(--radius-sm);
    border: 2px solid var(--border);
    background: var(--surface-2);
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    -webkit-tap-highlight-color: transparent;
}

.energy-dot.filled {
    border-color: var(--accent);
    background: rgba(0, 212, 170, 0.2);
}

.energy-dot.filled::after {
    content: '';
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
}

/* ===== Tags ===== */
.tag-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag-chip {
    padding: 8px 14px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--muted);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.tag-chip.selected {
    border-color: var(--primary);
    background: rgba(155, 109, 255, 0.15);
    color: var(--text);
}

/* ===== Note Input ===== */
.note-input {
    width: 100%;
    min-height: 80px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface-2);
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    outline: none;
    transition: border-color 0.2s;
}

.note-input:focus {
    border-color: var(--primary);
}

.note-input::placeholder { color: var(--muted); }

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), #7b4dff);
    color: var(--primary-contrast);
    box-shadow: 0 4px 16px rgba(155, 109, 255, 0.3);
}

.btn-primary:active {
    transform: scale(0.97);
    box-shadow: 0 2px 8px rgba(155, 109, 255, 0.2);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-full { width: 100%; }

.btn-ghost {
    background: transparent;
    color: var(--muted);
    padding: 8px 12px;
    font-size: 13px;
}

.btn-small {
    padding: 8px 16px;
    font-size: 13px;
}

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: var(--surface-2);
    color: var(--text);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ===== Calendar ===== */
.calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.calendar-month {
    font-size: 18px;
    font-weight: 700;
}

.calendar-nav {
    display: flex;
    gap: 8px;
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    margin-bottom: 8px;
}

.calendar-weekdays span {
    text-align: center;
    font-size: 11px;
    color: var(--muted);
    font-weight: 600;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.cal-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--muted);
    position: relative;
}

.cal-day.has-entry {
    color: var(--text);
    font-weight: 600;
}

.cal-day.today {
    border: 1px solid var(--primary);
}

.cal-day .mood-dot {
    position: absolute;
    bottom: 2px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

/* ===== Stats ===== */
.stat-row {
    display: flex;
    gap: 12px;
}

.stat-box {
    flex: 1;
    text-align: center;
    padding: 16px 8px;
    background: var(--surface-2);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.stat-value {
    font-size: 28px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-label {
    font-size: 11px;
    color: var(--muted);
    margin-top: 4px;
}

/* ===== Weekly Chart ===== */
.weekly-chart {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    height: 120px;
    padding: 8px 0;
    gap: 8px;
}

.chart-bar-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    height: 100%;
}

.chart-bars {
    flex: 1;
    display: flex;
    gap: 3px;
    align-items: flex-end;
    width: 100%;
}

.chart-bar {
    flex: 1;
    border-radius: 4px 4px 0 0;
    min-height: 4px;
    transition: height 0.4s ease;
}

.chart-bar.mood-bar { background: var(--primary); opacity: 0.8; }
.chart-bar.energy-bar-vis { background: var(--accent); opacity: 0.8; }

.chart-day-label {
    font-size: 11px;
    color: var(--muted);
}

/* ===== Mood Distribution ===== */
.mood-dist {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mood-dist-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.mood-dist-emoji { font-size: 18px; width: 28px; text-align: center; }

.mood-dist-bar-bg {
    flex: 1;
    height: 24px;
    background: var(--surface-2);
    border-radius: 12px;
    overflow: hidden;
}

.mood-dist-bar {
    height: 100%;
    border-radius: 12px;
    transition: width 0.5s ease;
    min-width: 2px;
}

.mood-dist-count {
    font-size: 13px;
    color: var(--muted);
    width: 28px;
    text-align: right;
}

/* ===== Streak ===== */
.streak-display {
    text-align: center;
    padding: 24px;
}

.streak-number {
    font-size: 48px;
    font-weight: 900;
    background: linear-gradient(135deg, #ff8a4d, var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.streak-label {
    font-size: 14px;
    color: var(--muted);
    margin-top: 4px;
}

.streak-fire {
    font-size: 36px;
    animation: fireGlow 1.5s ease-in-out infinite alternate;
}

@keyframes fireGlow {
    0% { filter: brightness(1); transform: scale(1); }
    100% { filter: brightness(1.3); transform: scale(1.1); }
}

/* ===== Timeline ===== */
.timeline {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.timeline-item {
    display: flex;
    gap: 12px;
    padding: 16px;
    background: var(--surface-2);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.timeline-date {
    min-width: 48px;
    text-align: center;
}

.timeline-date-day {
    font-size: 20px;
    font-weight: 800;
    color: var(--text);
}

.timeline-date-month {
    font-size: 11px;
    color: var(--muted);
}

.timeline-body {
    flex: 1;
}

.timeline-mood-energy {
    display: flex;
    gap: 12px;
    margin-bottom: 4px;
}

.timeline-badge {
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 10px;
    background: var(--surface);
}

.timeline-note {
    font-size: 13px;
    color: var(--muted);
    margin-top: 4px;
}

.timeline-tags {
    display: flex;
    gap: 4px;
    margin-top: 6px;
    flex-wrap: wrap;
}

.timeline-tag {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 8px;
    background: rgba(155, 109, 255, 0.1);
    color: var(--primary);
}

/* ===== Empty State ===== */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--muted);
}

.empty-state-icon { font-size: 48px; margin-bottom: 16px; }
.empty-state-title { font-size: 18px; font-weight: 600; color: var(--text); margin-bottom: 8px; }
.empty-state-desc { font-size: 14px; line-height: 1.6; }

/* ===== Toast ===== */
.toast {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    padding: 12px 24px;
    border-radius: var(--radius-md);
    background: var(--surface);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 14px;
    font-weight: 500;
    box-shadow: var(--shadow-2);
    z-index: 200;
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
    white-space: nowrap;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast.success { border-color: var(--success); }
.toast.error { border-color: var(--danger); }

/* ===== Settings ===== */
.settings-section {
    margin-bottom: 24px;
}

.settings-section h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.setting-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.setting-item:last-child { border-bottom: none; }

/* ===== Animations ===== */
@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.screen.active > * {
    animation: slideUp 0.3s ease forwards;
}

.screen.active > *:nth-child(2) { animation-delay: 0.05s; }
.screen.active > *:nth-child(3) { animation-delay: 0.1s; }
.screen.active > *:nth-child(4) { animation-delay: 0.15s; }

/* ===== Responsive ===== */
@media (max-height: 667px) {
    .card { padding: 20px 18px; }
    .mood-btn { max-width: 52px; }
    .streak-number { font-size: 36px; }
}

@media (max-height: 568px) {
    .app-bar { min-height: 56px; padding: 8px 16px; }
    .main-content { padding-top: 72px; }
    .card { padding: 16px 14px; }
}

/* ===== Greeting ===== */
.greeting {
    font-size: clamp(20px, 6vw, 28px);
    font-weight: 800;
    line-height: 1.3;
}

.greeting-sub {
    font-size: 14px;
    color: var(--muted);
    margin-top: 4px;
}

/* ===== Guest Banner ===== */
.guest-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    background: rgba(255, 184, 77, 0.1);
    border: 1px solid rgba(255, 184, 77, 0.25);
    border-radius: var(--radius-md);
}

.guest-banner-text {
    font-size: 13px;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 6px;
}

.guest-banner-icon { font-size: 16px; }

/* ===== User Profile Indicator ===== */
.auth-badge {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
}

.today-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: rgba(155, 109, 255, 0.1);
    border-radius: var(--radius-md);
    border: 1px solid rgba(155, 109, 255, 0.2);
}

.today-status-icon { font-size: 20px; }
.today-status-text { font-size: 13px; color: var(--text); }

/* Confetti burst */
.confetti-container {
    position: fixed;
    top: 20%;
    left: 0;
    right: 0;
    pointer-events: none;
    z-index: 300;
    display: flex;
    justify-content: center;
}

/* ===== Pet Select Screen ===== */
.pet-select-title {
    text-align: center;
    font-size: clamp(22px, 6vw, 30px);
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.pet-select-subtitle {
    text-align: center;
    color: var(--muted);
    font-size: 14px;
    margin-top: 4px;
}

.pet-select-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.pet-select-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 24px 16px;
    background: var(--surface);
    backdrop-filter: blur(16px);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
    font-family: inherit;
    color: var(--text);
}

.pet-select-card:active { transform: scale(0.95); }
.pet-select-card.selected {
    border-color: var(--primary);
    background: rgba(155, 109, 255, 0.1);
    box-shadow: var(--ring), var(--shadow-1);
}

.pet-preview {
    width: 64px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    image-rendering: pixelated;
}

.pet-select-name {
    font-size: 16px;
    font-weight: 700;
}

.pet-select-desc {
    font-size: 12px;
    color: var(--muted);
    text-align: center;
}

#pet-confirm-area {
    display: none;
}

.pet-name-input {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface-2);
    color: var(--text);
    font-size: 15px;
    font-family: inherit;
    outline: none;
    text-align: center;
    transition: border-color 0.2s;
}

.pet-name-input:focus { border-color: var(--primary); }
.pet-name-input::placeholder { color: var(--muted); }

/* ===== Pet Display (Home Screen) ===== */
.pet-card {
    background: var(--surface);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.pet-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center, rgba(155, 109, 255, 0.05) 0%, transparent 70%);
    pointer-events: none;
}

.pet-stage-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--accent);
    margin-bottom: 4px;
}

.pet-sprite-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60px;
    margin: 8px 0;
    image-rendering: pixelated;
}

.pixel-art-sprite {
    image-rendering: pixelated;
    transition: transform 0.3s ease;
}

.pet-name-display {
    font-size: 16px;
    font-weight: 700;
    margin: 4px 0;
}

.pet-xp-bar {
    width: 100%;
    height: 8px;
    background: var(--surface-2);
    border-radius: 4px;
    overflow: hidden;
    margin: 8px 0 4px;
}

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

.pet-xp-label {
    font-size: 11px;
    color: var(--muted);
}

.pet-actions {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 8px;
}
