@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;700;900&display=swap');
:root { --bg: #080d1a; --card: #111827; --accent: #ff9800; --success: #4caf50; --gold: #ffd700; --blue: #00d2ff; --text: #e0e0e0; --missed: #444; --danger: #ff5252; }
        @media (min-width: 768px) { 
            html, body { zoom: 1.35; background: #080d1a; overflow-y: auto !important; display: block !important; } 
            .container { border-radius: 20px; box-shadow: 0 0 50px rgba(0,0,0,0.8); height: auto !important; min-height: calc(100vh / 1.35 - 40px); margin: 20px auto !important; background: var(--bg); border: 1px solid #333; overflow-y: visible !important; } 
            .modal { align-items: flex-start !important; padding-top: 40px; } 
            .modal-content { max-height: calc(100vh / 1.35 - 80px) !important; } 
            .header h1 { font-size: 28px !important; }
            .streak-count { font-size: 32px !important; }
        }
        @media (min-width: 1024px) { 
            html, body { zoom: 1.5; } 
            .container { min-height: calc(100vh / 1.5 - 40px); } 
            .modal { padding-top: 60px; } 
            .modal-content { max-height: calc(100vh / 1.5 - 100px) !important; } 
        }
        html, body { width: 100%; height: 100%; margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: 'Inter', -apple-system, sans-serif; overflow: hidden; font-size: 16px; }
        body::before { content: ''; position: fixed; top: -60px; left: 50%; transform: translateX(-50%); width: 420px; height: 420px; background: radial-gradient(circle, rgba(30,80,255,0.22) 0%, rgba(10,40,180,0.08) 60%, transparent 80%); pointer-events: none; z-index: 9999; }
        .container { width: 100%; max-width: 500px; height: 100dvh; margin: 0 auto; padding: 16px; padding-top: max(16px, env(safe-area-inset-top)); box-sizing: border-box; overflow-y: auto; display: flex; flex-direction: column; }
        .header { display: flex; flex-direction: column; align-items: center; text-align: center; margin-bottom: 16px; width: 100%; flex-shrink: 0; }
        .header h1 { font-size: clamp(32px, 10vw, 42px); font-weight: 900; letter-spacing: -2px; line-height: 0.9; margin: 0; text-transform: uppercase; color: #fff; }
        .sub-header { font-size: 11px; font-weight: 700; color: var(--gold); text-transform: uppercase; letter-spacing: 1px; margin-top: 4px; opacity: 0.8; }
        
        .action-column { display: flex; flex-direction: column; gap: 8px; flex: 1; min-width: 0; }
        .action-column.left-col { flex: 40; }
        .action-column.right-col { flex: 60; }
        .action-row { display: flex; justify-content: space-between; align-items: stretch; width: 100%; margin-top: 10px; gap: 10px; }
        
        .action-pill { background: rgba(255,255,255,0.05); border: 1px solid #333; border-radius: 8px; padding: 0 10px; display: flex; align-items: center; gap: 8px; cursor: pointer; transition: 0.15s; height: 30px; min-height: 30px; width: 100%; box-sizing: border-box; }
        .action-pill:active { transform: scale(0.97); background: rgba(255,255,255,0.1); }
        .action-pill span { font-size: 11px; font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
        .action-pill svg, .action-pill .token-icon { flex-shrink: 0; }
        .ticker-item { height: 30px; display: flex; align-items: center; justify-content: flex-start; gap: 6px; width: 100%; background: rgba(255,255,255,0.03); border: 1px solid #333; border-radius: 8px; padding: 0 8px; box-sizing: border-box; transition: 0.2s; overflow: hidden; }
        .ticker-item:hover { transform: scale(1.02); background: rgba(255,255,255,0.06); }

        /* Collapsible action panel */
        .action-panel {
            width: 100%;
            margin-top: 16px;
            border-radius: 12px;
            background: rgba(255,255,255,0.01);
            border: 1px dashed rgba(255,255,255,0.05);
            padding: 6px;
            box-sizing: border-box;
            transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        }
        .action-panel.expanded {
            background: rgba(255,255,255,0.02);
            border: 1px solid #222;
            padding: 10px;
        }
        .collapsed-bar {
            display: flex;
            flex-direction: column;
            justify-content: center;
            width: 100%;
            height: 72px;
            padding: 8px 16px;
            box-sizing: border-box;
            cursor: default;
            background: rgba(255,255,255,0.03);
            border: 1px solid #222;
            border-radius: 15px;
            gap: 6px;
        }
        .collapsed-row-1 {
            display: flex;
            justify-content: space-between;
            align-items: center;
            width: 100%;
        }
        .collapsed-row-2 {
            display: flex;
            align-items: center;
            justify-content: center;
            width: 100%;
            height: 30px;
            border-top: 1px dashed rgba(255, 255, 255, 0.08);
            padding-top: 4px;
            overflow: hidden;
            box-sizing: border-box;
        }
        .friends-scroll-container {
            display: flex;
            align-items: center;
            gap: 32px;
            width: max-content;
            animation: friendsMarquee 15s linear infinite;
        }
        .friends-scroll-container:hover {
            animation-play-state: paused;
        }
        @keyframes friendsMarquee {
            0% { transform: translateX(0); }
            100% { transform: translateX(calc(-50% - 16px)); }
        }
        .action-panel.expanded .collapsed-bar {
            display: none;
        }
        .expanded-grid {
            display: none;
            animation: panelFadeIn 0.25s ease-out forwards;
        }
        .action-panel.expanded .expanded-grid {
            display: block;
        }
        .collapsed-icons {
            display: flex;
            align-items: center;
            gap: 12px;
        }
        .collapsed-icons svg, .collapsed-icons .token-icon {
            opacity: 0.7;
        }
        .expand-header-row {
            display: flex;
            justify-content: center;
            align-items: center;
            width: 100%;
            padding-top: 8px;
            margin-top: 8px;
            border-top: 1px solid #222;
            cursor: pointer;
            color: #666;
            font-size: 8px;
            font-weight: 700;
            letter-spacing: 1px;
            text-transform: uppercase;
            transition: color 0.15s;
        }
        .expand-header-row:hover {
            color: var(--gold);
        }
        @keyframes panelFadeIn {
            from { opacity: 0; transform: translateY(-5px); }
            to { opacity: 1; transform: translateY(0); }
        }
        .gold-square { width: 24px; height: 24px; border-radius: 6px; background: var(--gold); display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; color: #000; flex-shrink: 0; text-transform: uppercase; box-shadow: 0 0 15px rgba(255, 215, 0, 0.6); border: none; }
        .ticker-info { display: flex; flex-direction: row; align-items: center; justify-content: space-between; min-width: 0; flex: 1; gap: 5px; }
        .ticker-name { font-size: 13px; font-weight: 700; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
        .ticker-streak { font-size: 11px; font-weight: 700; color: var(--gold); white-space: nowrap; flex-shrink: 0; }
        
        .branded-title { display: flex; gap: 4px; justify-content: center; align-items: center; margin: 0; }
        .app-icon { display: inline-flex; width: 48px; height: 48px; background: var(--gold); color: #000; border-radius: 11px; align-items: center; justify-content: center; box-shadow: 0 0 15px rgba(255, 215, 0, 0.6); border: none; font-size: 40px; font-weight: 900; line-height: 1; }
        
        .friend-item-card { background: rgba(255,255,255,0.03); border: 1px solid #333; border-radius: 15px; padding: 16px; margin-bottom: 16px; transition: 0.2s; }
        .friend-item-card:hover { border-color: var(--gold); background: rgba(255,255,255,0.05); }
        
        .primary-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; margin-top: 16px; }
        .welcome-banner, .ai-message { position: relative; background: #252525; border-radius: 15px; padding: 16px; margin-bottom: 24px; border-left: 5px solid var(--gold); font-style: italic; font-size: 16px; line-height: 1.4; color: #eee; width: 100%; box-sizing: border-box; min-height: 50px; height: auto; text-align: left; word-wrap: break-word; overflow-wrap: break-word; flex-shrink: 0; display: block; }
        .banner-close { position: absolute; top: 10px; right: 10px; width: 24px; height: 24px; border-radius: 50%; background: rgba(255,255,255,0.1); display: flex; align-items: center; justify-content: center; font-size: 14px; color: #aaa; cursor: pointer; border: none; font-style: normal; z-index: 10; }
        .banner-close:hover { background: rgba(255,255,255,0.2); color: #fff; }
        
        .confetti-container { position: fixed; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; overflow: hidden; z-index: 2000; display: none; }
        .confetti { position: absolute; width: 10px; height: 10px; background: var(--gold); border-radius: 2px; animation: confettiFall 3s linear forwards; }
        @keyframes confettiFall {
            0% { transform: translateY(-10vh) rotate(0deg); opacity: 1; }
            100% { transform: translateY(110vh) rotate(720deg); opacity: 0; }
        }

        .full-screen-glow { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: radial-gradient(circle, rgba(255,215,0,0.3) 0%, rgba(0,0,0,0) 70%); pointer-events: none; z-index: 1500; opacity: 0; transition: opacity 0.5s; }
        .full-screen-glow.active { opacity: 1; }

        /* ── Page transition animations ─────────────────────────── */
        @keyframes pageIn {
            from { opacity: 0; transform: translateY(6px); }
            to   { opacity: 1; transform: translateY(0); }
        }
        @keyframes victoryCardIn {
            from { opacity: 0; transform: scale(0.94) translateY(14px); }
            to   { opacity: 1; transform: scale(1) translateY(0); }
        }
        .page-in { animation: pageIn 0.24s cubic-bezier(0.16, 1, 0.3, 1) both; }
        .victory-in { animation: victoryCardIn 0.26s cubic-bezier(0.16, 1, 0.3, 1) both; }
        #home-page, #detail-page, #streak-detail-page, #friends-page,
        #setup-page, #walkthrough-page, #commitment-page, #ready-checkin-page,
        #streak-saver-page { will-change: transform, opacity; }
        /* ────────────────────────────────────────────────────────── */


        .streak-change { animation: streakPop 0.8s ease-out; }
        @keyframes streakPop {
            0% { transform: scale(1); opacity: 1; }
            40% { transform: scale(1.1); opacity: 0.9; color: var(--gold); }
            70% { transform: scale(1.3); opacity: 1; color: var(--gold); text-shadow: 0 0 20px var(--gold); }
            100% { transform: scale(1); opacity: 1; }
        }

        .gold-sweep { animation: goldSweep 1s forwards; }
        @keyframes goldSweep {
            0% { background: #333; transform: scale(1); }
            50% { background: var(--gold); transform: scale(1.3); box-shadow: 0 0 30px var(--gold); }
            100% { background: var(--gold); transform: scale(1); box-shadow: 0 0 15px rgba(255,215,0,0.4); }
        }

        .card.just-completed { border-color: var(--gold); box-shadow: 0 0 20px rgba(255, 215, 0, 0.2); }

        .card { background: var(--card); border-radius: 20px; margin-bottom: 15px; box-shadow: 0 8px 30px rgba(0,0,0,0.5); border: 1px solid #333; cursor: pointer; transition: transform 0.2s; position: relative; display: grid; grid-template-columns: 1fr clamp(80px, 25vw, 110px); padding: 0; min-height: 90px; overflow: hidden; }
        .card:active { transform: scale(0.98); }
        
        .card-main { grid-column: 1; padding: 16px; display: flex; flex-direction: column; justify-content: space-between; gap: 6px; min-width: 0; }
        .habit-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; width: 100%; }
        .habit-name { font-size: 16px; font-weight: 700; color: #fff; line-height: 1.2; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; text-overflow: ellipsis; opacity: 0.9; flex: 1; min-width: 0; }
        .habit-goal { display: block; font-style: italic; font-size: 12px; color: #888; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.2; }
        
        .token-badge { display: flex; align-items: center; gap: 6px; flex-shrink: 0; background: rgba(0, 210, 255, 0.1); padding: 4px 8px; border-radius: 10px; border: 1px solid rgba(0, 210, 255, 0.2); }
        .token-icon { background: var(--blue); width: 18px; height: 18px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 8px var(--blue); animation: tokenPulse 2s address-in-out infinite alternate; }
        .token-text { color: var(--blue); font-weight: 700; font-size: 14px; }
        
        .token-pool { display: flex; justify-content: center; gap: 20px; margin: 30px 0; }
        .token-circle { width: 54px; height: 54px; border-radius: 50%; border: 2px dashed #333; background: var(--bg); display: flex; align-items: center; justify-content: center; font-size: 26px; transition: all 0.5s ease; position: relative; }
        .token-circle.filled { border: 2.5px solid #fff; background: var(--blue); box-shadow: 0 0 25px rgba(0, 210, 255, 0.6); border-style: solid; animation: tokenPop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275), tokenRotate 6s linear infinite; }
        @keyframes tokenPop { 0% { transform: scale(0.5); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
        @keyframes tokenRotate { 0% { transform: perspective(400px) rotateY(0deg); } 100% { transform: perspective(400px) rotateY(360deg); } }
        
        @keyframes tokenPulse { 0% { box-shadow: 0 0 4px var(--blue); transform: scale(0.95); } 100% { box-shadow: 0 0 12px var(--blue); transform: scale(1.05); } }
        
        .streak-sidebar { grid-column: 2; background: #0e1525; display: flex; flex-direction: column; align-items: center; justify-content: center; border-left: 1px solid #222; height: 100%; gap: 10px; border-radius: 0 20px 20px 0; }
        .perfect-sidebar { background: rgba(255, 215, 0, 0.1) !important; border-left: 2px solid var(--gold) !important; box-shadow: inset 0 0 20px rgba(255, 215, 0, 0.2); }
        .streak-block { text-align: center; width: 100%; display: flex; flex-direction: column; align-items: center; }
        .streak-pre-label { font-size: 8px; color: #666; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; margin-bottom: 2px; text-align: center; display: block; line-height: 1.2; }
        .streak-post-label { font-size: 8px; color: #666; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; margin-top: 2px; text-align: center; display: block; line-height: 1.2; }
        .perfect-text { color: var(--gold) !important; text-shadow: 0 0 10px var(--gold); font-size: 9px !important; }
        .streak-count { font-size: clamp(24px, 6.5vw, 34px); font-weight: 700; color: #ff4500; line-height: 1; text-shadow: 0 0 10px rgba(255, 69, 0, 0.4); }
        .weekly-streak-count { color: #fff !important; text-shadow: 0 0 10px rgba(255, 215, 0, 0.3); }

        .week-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; width: 100%; margin-top: auto; border-radius: 10px; transition: box-shadow 0.5s; }
        .perfect-week-glow { box-shadow: 0 0 25px rgba(255, 215, 0, 0.4); background: rgba(255, 215, 0, 0.05); padding: 4px; }
        .perfect-card { border-color: var(--gold) !important; box-shadow: 0 0 20px rgba(255, 215, 0, 0.3) !important; }
        
        .checkin-hint-bubble { position: absolute; bottom: 120%; left: 50%; transform: translateX(-50%); background: var(--gold); color: #000; padding: 6px 10px; border-radius: 10px; font-size: 11px; font-weight: 700; text-transform: uppercase; white-space: nowrap; pointer-events: none; z-index: 100; animation: pulseHint 1.5s ease-in-out infinite alternate; box-shadow: 0 4px 16px rgba(255,215,0,0.3); }
        @keyframes pulseHint { 0%{opacity:0.6;} 100%{opacity:1;} }

        .day-btn { aspect-ratio: 1; border-radius: 8px; background: #333; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: #fff; border: none; text-shadow: 0 0 0.5px currentColor; }
        
        .day-btn.completed { background: var(--gold); color: #000; box-shadow: 0 0 15px rgba(255, 215, 0, 0.4); }
        .day-btn.bypassed { background: var(--blue) !important; color: #000 !important; box-shadow: 0 0 15px rgba(0, 210, 255, 0.6) !important; border: 2px solid #fff; }
        .day-btn.today { animation: todayPulse 1.5s ease-in-out infinite alternate; position: relative; z-index: 5; }
        @keyframes todayPulse { 0% { box-shadow: 0 0 0 2px var(--bg), 0 0 0 3px var(--accent), 0 0 10px rgba(255, 152, 0, 0.3); } 100% { box-shadow: 0 0 0 2px var(--bg), 0 0 0 6px var(--accent), 0 0 30px rgba(255, 152, 0, 0.7); } }
        .day-btn.today.completed, .day-btn.today.bypassed { box-shadow: 0 0 20px rgba(255, 215, 0, 0.6); }
        .day-btn.missed { background: var(--missed); }
        .day-btn.future { opacity: 0.15; pointer-events: none; }
        
        /* Marquee for long names */
        .marquee-container { flex: 1; overflow: hidden; white-space: nowrap; position: relative; display: flex; align-items: center; }
        .marquee-text { display: inline-block; animation: marquee 10s linear infinite; padding-right: 50px; }
        @keyframes marquee {
            0% { transform: translateX(0); }
            100% { transform: translateX(-100%); }
        }
        
        .modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.9); align-items: center; justify-content: center; z-index: 1000; overflow-y: auto; }
        .modal-content { background: var(--card); padding: 24px; border-radius: 25px; width: 95%; max-width: 480px; max-height: 90vh; overflow-y: auto; position: relative; text-align: center; }
        
        /* Hide scrollbars globally */
        ::-webkit-scrollbar { display: none; }
        * { scrollbar-width: none; -ms-overflow-style: none; }
        
        .cal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; margin-top: 10px; }
        .cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
        .cal-day { aspect-ratio: 1; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 700; border: 1px solid #333; background: #252525; }
        .cal-day.completed { background: var(--gold); color: #000; border: none; box-shadow: 0 0 10px rgba(255, 215, 0, 0.3); }
        .cal-day.bypassed { background: var(--blue); color: #000; border: 2px solid #fff; box-shadow: 0 0 10px rgba(0, 210, 255, 0.3); }
        .cal-day.today { animation: todayPulse 1.5s ease-in-out infinite alternate; position: relative; z-index: 5; }
        
        /* 3x4 Monthly Grid Mastery Styles */
        .calendar-12m-container { width: 100%; padding: 10px 0; display: flex; flex-direction: column; gap: 20px; }
        .calendar-12m-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; width: 100%; box-sizing: border-box; }
        @media (max-width: 480px) { .calendar-12m-grid { grid-template-columns: repeat(2, 1fr); } }
        
        .month-card { background: rgba(255,255,255,0.03); border: 1px solid #333; border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: 8px; transition: 0.3s; position: relative; overflow: hidden; }
        .month-card.perfect-month-mastery { border-color: var(--gold); background: rgba(255, 215, 0, 0.15); box-shadow: 0 0 25px rgba(255, 215, 0, 0.4); }
        .month-card.perfect-month-mastery::after { content: '🏆'; position: absolute; top: 5px; right: 5px; font-size: 12px; filter: drop-shadow(0 0 5px var(--gold)); }
        
        /* Milestone Timeline Styles */
        .milestone-timeline { display: flex; align-items: center; justify-content: flex-start; gap: 8px; overflow-x: auto; padding: 5px; margin-bottom: 0px; scrollbar-width: none; -ms-overflow-style: none; -webkit-overflow-scrolling: touch; }
        .milestone-timeline::-webkit-scrollbar { display: none; }
        .milestone-bubble { display: flex; flex-direction: column; align-items: center; gap: 2px; flex-shrink: 0; position: relative; }
        .milestone-square { width: 44px; height: 44px; border-radius: 10px; border: 2px dashed #333; background: var(--bg); display: flex; align-items: center; justify-content: center; font-size: 14px; transition: all 0.5s ease; color: #555; font-weight: 700; }
        .milestone-bubble.completed .milestone-square { background: var(--bg); border: 2px solid var(--gold); color: var(--gold); box-shadow: 0 0 10px rgba(255, 215, 0, 0.2); border-style: solid; font-size: 28px; }
        .bubble-label { font-size: 8px; font-weight: 700; color: #444; text-transform: uppercase; letter-spacing: 0px; }
        .milestone-bubble.completed .bubble-label { color: var(--gold); }
        
        .month-card-header { font-size: 11px; font-weight: 700; color: var(--gold); text-transform: uppercase; letter-spacing: 1px; text-align: left; border-bottom: 1px solid rgba(255,215,0,0.1); padding-bottom: 4px; }
        
        .month-day-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
        .month-week-row { display: contents; }
        .month-week-row.perfect-week-gold .day-square.completed:not(.bypassed) { box-shadow: 0 0 10px var(--gold); border: 1px solid #fff; }
        
        .day-square { aspect-ratio: 1; border-radius: 4px; background: #222; border: 1px solid #333; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 8px; font-weight: 700; color: #555; transition: 0.2s; }
        .day-square.completed { background: var(--gold); border-color: #fff; color: #000; }
        .day-square.bypassed { background: var(--blue); border-color: #fff; color: #000; box-shadow: 0 0 5px var(--blue); }
        .day-square.missed { background: #444; color: #888; border-color: #555; }
        .day-square.today { border-color: var(--accent); color: var(--accent); box-shadow: 0 0 10px var(--accent); z-index: 2; }
        .day-square.future { opacity: 0.6; border: 1px solid rgba(255, 255, 255, 0.2); color: #888; }
        
        .month-marker { display: none; } /* Replaced by card headers */

        button { border-radius: 15px; border: none; font-weight: 700; cursor: pointer; transition: 0.2s; font-size: 16px; padding: 16px 24px; text-transform: uppercase; letter-spacing: 1px; }
        button.primary { background: var(--accent); color: #000; width: 100%; }
        button.primary:active { transform: scale(0.98); }
        button.fab { background: var(--accent); color: #000; width: 56px; height: 56px; border-radius: 28px; font-size: 32px; display: flex; align-items: center; justify-content: center; padding: 0; box-shadow: 0 4px 15px rgba(255, 152, 0, 0.4); }
        button.ghost { background: #252525; color: #888; border: 1px solid #444; }
        button.nav-btn { background: #252525; color: #fff; padding: 10px 15px; border-radius: 10px; }
        
        .gold-fill, .blue-fill { width: 80px; height: 80px; border-radius: 50%; margin: 20px auto; display: flex; align-items: center; justify-content: center; font-size: 40px; border: 4px solid #fff; }
        .gold-fill { background: var(--gold); box-shadow: 0 0 30px var(--gold); animation: loopPulse 1.5s ease-in-out infinite; }
        .blue-fill { background: var(--blue); box-shadow: 0 0 30px var(--blue); animation: spinToken 6s linear infinite; }
        @keyframes loopPulse { 0% { transform: scale(0.9); } 50% { transform: scale(1.1); } 100% { transform: scale(0.9); } }
        @keyframes spinToken { 0% { transform: perspective(400px) rotateY(0deg); } 100% { transform: perspective(400px) rotateY(360deg); } }
        
        .loading-pulse { animation: pulseOpacity 1.5s infinite; color: var(--accent); font-weight: bold; margin-top: 10px; }
        @keyframes pulseOpacity { 0% { opacity: 0.4; } 50% { opacity: 1; } 100% { opacity: 0.4; } }
        
        #detail-page { display: none; width: 100%; height: 100dvh; flex-direction: column; padding: 0; padding-top: env(safe-area-inset-top); margin: 0 auto; box-sizing: border-box; position: fixed; top: 0; left: 0; right: 0; z-index: 500; background: var(--bg); justify-content: flex-start; align-items: center; overflow-y: auto; -webkit-overflow-scrolling: touch; }
        .checkin-header { flex: 0 0 auto; padding: 16px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #222; width: 100%; max-width: 500px; box-sizing: border-box; background: var(--bg); z-index: 10; position: sticky; top: 0; }
        .checkin-body { flex: 1 1 auto; padding: 16px 16px 150px 16px; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; width: 100%; max-width: 500px; box-sizing: border-box; }
        .checkin-body::-webkit-scrollbar { display: none; }
        .checkin-footer { flex: 0 0 auto; padding: 16px; border-top: 1px solid #222; width: 100%; box-sizing: border-box; background: var(--card); }
        
        .q-card { background: var(--card); padding: 16px; border-radius: 15px; border: 1px solid #333; margin-bottom: 16px; width: 100%; box-sizing: border-box; text-align: center; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; min-height: 100px; }
        .q-card.active { border-color: var(--accent); background: #252525; box-shadow: 0 0 30px rgba(255, 152, 0, 0.1); }
        .q-progress { color: var(--accent); text-transform: uppercase; letter-spacing: 1px; font-size: 11px; margin-bottom: 8px; font-weight: 700; }
        
        textarea, input { width: 100%; background: #060a14; border: 1px solid #444; color: #fff; padding: 10px; border-radius: 10px; text-align: center; box-sizing: border-box; font-size: 16px; margin-top: 10px; }
        textarea { min-height: 45px; resize: none; }

        .checkin-hint-bubble.top-bubble { bottom: auto; top: -35px; }
        
        .bubble-sunday { left: 0 !important; transform: none !important; }
        .bubble-saturday { right: 0 !important; left: auto !important; transform: none !important; }
        .bubble-saturday::after { left: auto !important; right: 15px !important; }
        
        .delete-btn { color: #ff5252; cursor: pointer; font-size: 11px; opacity: 0.4; text-transform: uppercase; font-weight: 700; }
        .changelog { font-size: 11px; color: #666; margin-bottom: 24px; line-height: 1.4; background: rgba(255,255,255,0.02); padding: 16px; border-radius: 10px; width: 100%; box-sizing: border-box; }

        /* Inline Inbox Styling */
        .inline-inbox { background: rgba(255,255,255,0.03); border-radius: 15px; padding: 16px; margin-bottom: 15px; border: 1px solid #333; position: relative; min-height: 60px; display: none; }
        .inbox-close { position: absolute; top: 8px; right: 12px; color: #666; cursor: pointer; font-size: 18px; font-weight: 700; }
        .inbox-title { font-size: 9px; font-weight: 700; text-transform: uppercase; color: var(--accent); margin-bottom: 4px; letter-spacing: 1px; }
        .inbox-text { font-size: 13px; line-height: 1.3; color: #eee; white-space: pre-wrap; }

        .pulsate { animation: pulseRed 1.5s infinite; }
        @keyframes pulseRed { 0% { box-shadow: 0 0 0 0 rgba(255, 82, 82, 0.7); } 70% { box-shadow: 0 0 0 10px rgba(255, 82, 82, 0); } 100% { box-shadow: 0 0 0 0 rgba(255, 82, 82, 0); } }


        /* Professional Login UI */
        .login-box { background: var(--card); border-radius: 20px; padding: 24px 16px; width: 100%; max-width: 320px; box-shadow: 0 10px 40px rgba(0,0,0,0.6); border: 1px solid #333; text-align: center; max-height: 85vh; overflow-y: auto; }
        .login-box h1:not(.branded-title) { color: var(--gold); margin-bottom: 2px; font-size: 18px; font-weight: 700; }
        .login-box p { color: #888; font-size: 11px; margin-bottom: 12px; }
        .login-field { text-align: left; margin-bottom: 10px; width: 100%; }
        .star-rating-group label { display: block; font-size: 9px; font-weight: 700; color: var(--text); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 4px; margin-left: 4px; }
        .login-field input { width: 100%; background: #060a14; border: 1px solid #444; color: #fff; padding: 10px 12px; border-radius: 10px; font-size: 14px; box-sizing: border-box; text-align: left; transition: border-color 0.2s; }
        .login-field input:focus { border-color: var(--accent); outline: none; }
        .login-box button { width: 100%; margin-top: 4px; padding: 16px; border-radius: 8px; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; }
        .fallback-link { font-size: 10px; color: #555; text-decoration: underline; cursor: pointer; margin-top: 15px; display: inline-block; font-weight: 700; text-transform: uppercase; }
        .fallback-link:hover { color: var(--accent); }

        /* Star Rating Styles */
        .star-rating-group { text-align: left; }
        .star-btn { font-size: 28px; cursor: pointer; transition: all 0.2s; }
        .star-btn.active { opacity: 1; }
        .star-q1 { font-size: 60px; cursor: pointer; transition: 0.3s; opacity: 0.2; filter: grayscale(1); display: inline-block; margin: 10px 0; }
        .star-q1.active { opacity: 1; filter: grayscale(0); transform: scale(1.1); }

        /* Weekly Reflection — calming blue ambient background */
        #weekly-reflection-page {
            background:
                radial-gradient(ellipse at 18% 18%, rgba(0, 130, 220, 0.30) 0%, transparent 52%),
                radial-gradient(ellipse at 80% 25%, rgba(0, 180, 255, 0.18) 0%, transparent 45%),
                radial-gradient(ellipse at 55% 80%, rgba(30, 90, 210, 0.25) 0%, transparent 50%),
                radial-gradient(ellipse at 10% 75%, rgba(0, 150, 220, 0.15) 0%, transparent 40%),
                radial-gradient(ellipse at 85% 85%, rgba(0, 100, 200, 0.20) 0%, transparent 45%),
                linear-gradient(160deg, #070d1a 0%, #0b1626 55%, #080e1c 100%) !important;
            border-color: rgba(0, 130, 220, 0.15) !important;
            box-shadow: none !important;
        }
