/* 369 Mastery — styles */
:root {
    --bg: #0B0D0B;
    --surface: #131613;
    --surface-2: #1B1F1B;
    --border: rgba(255, 255, 255, 0.07);
    --text: #F1F5F1;
    --muted: #8C968C;
    --green: #00CC00;
    --green-hi: #4DFF4D;
    --green-dim: rgba(0, 204, 0, 0.13);
    --gold: #FFD700;
    --gold-dim: rgba(255, 215, 0, 0.13);
    --danger: #FF6060;
    --radius: 18px;
    --tabbar-h: 64px;
    --safe-t: env(safe-area-inset-top, 0px);
    --safe-b: env(safe-area-inset-bottom, 0px);
    --green-ball: radial-gradient(circle at 35% 30%, #7DFF7D, var(--green) 58%, #008A00);
    --gold-ball: radial-gradient(circle at 35% 30%, #FFF3A6, var(--gold) 58%, #CFA300);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { background: var(--bg); color: var(--text); min-height: 100%; }
body {
    font-family: 'Outfit', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    font-size: 16px;
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
    overscroll-behavior-y: none;
}
body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(420px 320px at 100% -5%, rgba(0, 204, 0, 0.10), transparent 70%),
        radial-gradient(480px 380px at -10% 105%, rgba(255, 215, 0, 0.07), transparent 70%);
    z-index: 0;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }

#app {
    position: relative;
    z-index: 1;
    max-width: 520px;
    margin: 0 auto;
    min-height: 100vh;
    min-height: 100dvh;
    padding-bottom: calc(var(--tabbar-h) + var(--safe-b) + 16px);
}

/* ---------- Top bar ---------- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: calc(12px + var(--safe-t)) 18px 12px;
    background: rgba(11, 13, 11, 0.82);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
}
.brand { display: flex; gap: 10px; align-items: center; }
.brand-logo { width: 34px; height: 34px; border-radius: 10px; }
.brand-title { font-weight: 800; letter-spacing: 0.3px; font-size: 17px; line-height: 1.1; }
.brand-title .g { color: var(--green); }
.brand-sub { font-size: 12px; color: var(--muted); }
.icon-btn {
    width: 40px; height: 40px; border-radius: 12px;
    display: grid; place-items: center;
    color: var(--muted); transition: background 0.15s, color 0.15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn svg { width: 22px; height: 22px; }

/* ---------- Layout ---------- */
main { padding: 18px; }
.view { display: flex; flex-direction: column; gap: 14px; animation: fadeIn 0.25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.greeting h1 { font-size: 26px; font-weight: 800; line-height: 1.15; }
.greeting p { font-size: 14px; margin-top: 3px; }
.muted { color: var(--muted); }
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
}
.card h2 { font-size: 18px; font-weight: 800; }
.eyebrow { font-size: 11px; text-transform: uppercase; letter-spacing: 1.4px; color: var(--muted); font-weight: 600; }
.hint { font-size: 13px; color: var(--muted); margin-top: 10px; }
.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: 1.4px; color: var(--muted); font-weight: 600; margin: 6px 2px -4px; }

/* ---------- Progress card ---------- */
.progress-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 6px; }
.big { font-size: 42px; font-weight: 800; line-height: 1; margin-top: 4px; }
.big span { color: var(--muted); font-size: 22px; font-weight: 600; }
.big small { font-size: 14px; color: var(--gold); font-weight: 600; margin-left: 4px; }
.streak {
    display: flex; flex-direction: column; align-items: center;
    background: var(--surface-2); border-radius: 14px; padding: 8px 14px;
    font-weight: 800; font-size: 20px; line-height: 1.1;
}
.streak small { font-size: 10px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 1px; }
.label-row { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin: 14px 0 8px; font-weight: 600; }

.dots-row { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; }
.dots-row .dot { width: 100%; max-width: 46px; justify-self: center; }
.dot {
    display: inline-block;
    aspect-ratio: 1;
    border-radius: 50%;
    border: 2px solid rgba(0, 204, 0, 0.35);
    background: rgba(255, 255, 255, 0.02);
    transition: all 0.35s cubic-bezier(0.3, 1.6, 0.5, 1);
}
.dot.filled {
    background: var(--green-ball);
    border-color: var(--green);
    box-shadow: 0 0 14px rgba(0, 204, 0, 0.5);
}
.dot.sm { width: 18px; height: 18px; }
.dot.pop { animation: pop 0.5s cubic-bezier(0.3, 1.6, 0.5, 1); }
@keyframes pop { 0% { transform: scale(0.4); } 100% { transform: scale(1); } }

.stars-row { display: grid; grid-template-columns: repeat(9, 1fr); gap: 6px; }
.stars-row.center { width: 100%; max-width: 320px; }
.star {
    aspect-ratio: 1;
    display: grid; place-items: center;
    border-radius: 50%;
    border: 2px solid rgba(255, 215, 0, 0.3);
    color: rgba(255, 215, 0, 0.22);
    transition: all 0.35s cubic-bezier(0.3, 1.6, 0.5, 1);
}
.star svg { width: 58%; height: 58%; }
.star.on {
    background: var(--gold-ball);
    border-color: var(--gold);
    color: #5A4500;
    box-shadow: 0 0 14px rgba(255, 215, 0, 0.45);
}

.banner {
    width: 100%; text-align: left;
    padding: 14px 16px; border-radius: 16px;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.22), rgba(255, 215, 0, 0.06));
    border: 1px solid rgba(255, 215, 0, 0.4);
    color: var(--gold); font-weight: 600; font-size: 14px;
}

/* ---------- Segmented control ---------- */
.seg {
    display: grid; grid-template-columns: 1fr 1fr;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 14px; padding: 4px;
}
.seg button { padding: 8px; border-radius: 10px; font-size: 14px; font-weight: 600; color: var(--muted); transition: 0.2s; }
.seg button.active { background: var(--surface-2); color: var(--text); }

/* ---------- Goals ---------- */
.goals-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.pill { font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 99px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.pill-green { background: var(--green-dim); color: var(--green-hi); }
.pill-gold { background: var(--gold-dim); color: var(--gold); }

.goal { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.goal:last-of-type { border-bottom: 0; }
.check {
    flex: none; width: 42px; height: 42px; border-radius: 50%;
    border: 2px solid rgba(0, 204, 0, 0.45);
    display: grid; place-items: center;
    transition: all 0.3s cubic-bezier(0.3, 1.6, 0.5, 1);
}
.check svg { width: 20px; height: 20px; opacity: 0; transform: scale(0.4); transition: 0.25s; color: #032B03; }
.check:active { transform: scale(0.88); }
.goal.done .check { background: var(--green-ball); border-color: var(--green); box-shadow: 0 0 16px rgba(0, 204, 0, 0.5); }
.goal.done .check svg { opacity: 1; transform: none; }
.goal-input {
    flex: 1; min-width: 0;
    background: transparent; border: 0; outline: 0;
    font-size: 16px; padding: 8px 0;
    border-bottom: 1px dashed transparent;
}
.goal-input:focus { border-bottom-color: rgba(0, 204, 0, 0.5); }
.goal-input::placeholder { color: #556055; }
.goal.done .goal-input { color: var(--muted); text-decoration: line-through; text-decoration-color: rgba(0, 204, 0, 0.6); }
.shake { animation: shake 0.4s; }
@keyframes shake {
    20%, 60% { transform: translateX(-6px); }
    40%, 80% { transform: translateX(6px); }
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    width: 100%; padding: 13px 18px; border-radius: 14px;
    font-weight: 600; font-size: 15px;
    transition: transform 0.1s, opacity 0.2s, background 0.2s;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.35; pointer-events: none; }
.btn-primary { background: var(--green); color: #021A02; }
.btn-gold { background: var(--gold); color: #2B2200; }
.btn-ghost { background: var(--surface-2); border: 1px solid var(--border); }
.btn-danger { background: transparent; border: 1px solid rgba(255, 96, 96, 0.35); color: var(--danger); }
.btn-sm { width: auto; padding: 9px 14px; font-size: 13px; }
.btn-link { color: var(--green); font-weight: 600; font-size: 14px; padding: 8px 0 0; }

/* ---------- Journey ---------- */
.tracker { display: flex; flex-direction: column; gap: 4px; }
.trow { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; border: 1px solid transparent; }
.trow.current { background: var(--green-dim); border-color: rgba(0, 204, 0, 0.3); }
.tnum { width: 16px; color: var(--muted); font-weight: 800; font-size: 13px; }
.tdots { display: flex; gap: 8px; flex: 1; min-width: 0; }
.tdots .dot { flex: 1 1 0; min-width: 0; max-width: 24px; }
.tarrow { color: var(--muted); font-weight: 800; }
.trow .star { width: 32px; height: 32px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 12px 6px; text-align: center; }
.stat b { display: block; font-size: 22px; font-weight: 800; line-height: 1.2; }
.stat span { font-size: 11px; color: var(--muted); }
.past-cycle { display: flex; flex-direction: column; gap: 6px; }
.past-cycle-head { display: flex; justify-content: space-between; align-items: center; }
.past-cycle q { font-size: 14px; color: var(--muted); font-style: italic; }

/* ---------- Manifest ---------- */
textarea {
    width: 100%; margin-top: 8px; padding: 12px;
    background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px;
    resize: none; outline: 0; font-size: 16px; line-height: 1.4;
}
textarea:focus { border-color: rgba(255, 215, 0, 0.5); }
.session-head { display: flex; align-items: center; gap: 12px; }
.session-head h3 { font-size: 16px; }
.session-head p { font-size: 13px; }
.session-head .pill { margin-left: auto; }
.session-icon { font-size: 22px; width: 44px; height: 44px; border-radius: 12px; background: var(--surface-2); display: grid; place-items: center; flex: none; }
.mdots { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.mdot { width: 18px; height: 18px; border-radius: 50%; border: 2px solid rgba(255, 215, 0, 0.35); transition: all 0.3s cubic-bezier(0.3, 1.6, 0.5, 1); }
.mdot.on { background: var(--gold-ball); border-color: var(--gold); box-shadow: 0 0 10px rgba(255, 215, 0, 0.45); }
.session-actions { display: flex; gap: 10px; }
.session-actions .btn-gold { flex: 1; }
.session.done { border-color: rgba(255, 215, 0, 0.3); }
.affirmation-quote { font-size: 15px; font-style: italic; color: var(--text); margin-top: 10px; padding-left: 12px; border-left: 3px solid var(--gold); }

/* Voice manifesting */
.aff-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.btn-xs { width: auto; padding: 6px 12px; font-size: 13px; border-radius: 10px; }
.btn-gold-outline { background: transparent; border: 1px solid rgba(255, 215, 0, 0.5); color: var(--gold); }
.session-actions .btn-gold-outline { flex: 1; }
.mic-ico { width: 16px; height: 16px; flex: none; }
.voice-panel {
    display: flex; align-items: center; gap: 14px;
    margin: 12px 0; padding: 12px 14px; border-radius: 14px;
    background: var(--gold-dim); border: 1px solid rgba(255, 215, 0, 0.3);
}
.mic-orb {
    position: relative; flex: none;
    width: 48px; height: 48px; border-radius: 50%;
    display: grid; place-items: center;
    background: var(--gold-ball); color: #3A2D00;
}
.mic-orb .mic-ico { width: 22px; height: 22px; }
.mic-orb::before, .mic-orb::after {
    content: ''; position: absolute; inset: 0; border-radius: 50%;
    border: 2px solid var(--gold); animation: ripple 1.6s ease-out infinite;
}
.mic-orb::after { animation-delay: 0.8s; }
@keyframes ripple { from { transform: scale(1); opacity: 0.8; } to { transform: scale(1.9); opacity: 0; } }
.voice-text { flex: 1; min-width: 0; }
.voice-status { font-size: 13px; font-weight: 600; color: var(--gold); }
.voice-status.miss { color: #FFB4A0; }
.voice-live { font-size: 15px; font-style: italic; margin-top: 2px; min-height: 1.4em; overflow-wrap: anywhere; }

/* ---------- History ---------- */
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-top: 12px; }
.wday { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); font-weight: 600; }
.wday .stack3 { display: flex; flex-direction: column-reverse; gap: 4px; }
.wday .dot { width: 14px; height: 14px; }
.wday.is-today .lbl { color: var(--green); }
.hday-head { display: flex; justify-content: space-between; align-items: center; }
.hdate { font-weight: 600; }
.hdots { display: flex; gap: 6px; }
.hgoals { list-style: none; margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.hgoals li { font-size: 14px; padding-left: 20px; position: relative; color: var(--muted); }
.hgoals li::before { content: ''; position: absolute; left: 0; top: 5px; width: 10px; height: 10px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.2); }
.hgoals li.done { color: var(--text); }
.hgoals li.done::before { background: var(--green); border-color: var(--green); }
.hmanifest { font-size: 12px; color: var(--gold); margin-top: 8px; }
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty .dot { width: 36px; height: 36px; margin-bottom: 12px; }

/* ---------- Tab bar ---------- */
.tabbar {
    position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
    width: 100%; max-width: 520px;
    display: grid; grid-template-columns: repeat(4, 1fr);
    height: calc(var(--tabbar-h) + var(--safe-b));
    padding-bottom: var(--safe-b);
    background: rgba(15, 18, 15, 0.9);
    backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--border);
    z-index: 20;
}
.tabbar button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11px; font-weight: 600; color: var(--muted); transition: color 0.2s; }
.tabbar svg { width: 22px; height: 22px; }
.tabbar button.active { color: var(--green); }

/* ---------- Modals ---------- */
.backdrop {
    position: fixed; inset: 0; z-index: 50;
    display: flex; align-items: flex-end; justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
    opacity: 0; transition: opacity 0.2s;
}
.backdrop.open { opacity: 1; }
.sheet {
    width: 100%; max-width: 520px; max-height: 92vh; overflow-y: auto;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 24px 24px 0 0;
    padding: 24px 20px calc(24px + var(--safe-b));
    display: flex; flex-direction: column; gap: 14px;
    transform: translateY(30px); transition: transform 0.25s cubic-bezier(0.2, 0.9, 0.3, 1);
}
.backdrop.open .sheet { transform: none; }
.sheet > * { flex-shrink: 0; }
@media (min-width: 600px) {
    .backdrop { align-items: center; }
    .sheet { border-radius: 24px; }
}
.sheet h2 { font-size: 22px; font-weight: 800; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.field input {
    background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px;
    padding: 12px; outline: 0; color: var(--text); font-size: 16px;
}
.field input:focus { border-color: rgba(0, 204, 0, 0.5); }
.toggle-row { display: flex; justify-content: space-between; align-items: center; font-weight: 600; }
.switch { position: relative; width: 50px; height: 30px; flex: none; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--surface-2); border: 1px solid var(--border); border-radius: 99px; transition: 0.2s; cursor: pointer; }
.switch span::after { content: ''; position: absolute; top: 4px; left: 4px; width: 20px; height: 20px; border-radius: 50%; background: #9AA39A; transition: 0.2s; }
.switch input:checked + span { background: var(--green); }
.switch input:checked + span::after { transform: translateX(20px); background: #fff; }
.switch input:focus-visible + span { outline: 2px solid var(--green); outline-offset: 2px; }
.divider { height: 1px; background: var(--border); margin: 2px 0; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.fine { font-size: 11px; color: var(--muted); text-align: center; line-height: 1.6; }
.install-hint { font-size: 13px; color: var(--muted); background: var(--surface-2); border-radius: 12px; padding: 12px; }

.celebrate { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.celebrate p { color: var(--muted); }
.celebrate strong { color: var(--text); }
.big-star {
    width: 104px; height: 104px; border-radius: 50%;
    display: grid; place-items: center;
    background: var(--gold-ball); color: #5A4500;
    box-shadow: 0 0 50px rgba(255, 215, 0, 0.5);
    animation: pop 0.6s cubic-bezier(0.3, 1.6, 0.5, 1), glow 2s ease-in-out infinite alternate;
}
.big-star svg { width: 56%; height: 56%; }
.big-star.trophy { font-size: 52px; }
@keyframes glow { to { box-shadow: 0 0 80px rgba(255, 215, 0, 0.75); } }
.stack { display: flex; flex-direction: column; gap: 10px; width: 100%; }
.cycle-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; width: 100%; }
.cycle-stats .stat { background: var(--surface-2); }

/* ---------- Onboarding ---------- */
.ob { min-height: 430px; display: flex; flex-direction: column; justify-content: space-between; text-align: center; gap: 18px; }
.ob-art { height: 150px; display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; }
.ob-art img { width: 120px; height: 120px; border-radius: 28px; box-shadow: 0 0 60px rgba(0, 204, 0, 0.25); }
.ob-art .dot { width: 40px; height: 40px; }
.ob-art .star { width: 30px; height: 30px; }
.ob-art .arrow { color: var(--muted); font-weight: 800; font-size: 22px; }
.ob-art .star.big { width: 52px; height: 52px; }
.ob-body h2 { font-size: 26px; font-weight: 800; margin-bottom: 8px; }
.ob-body p { color: var(--muted); }
.ob-dots { display: flex; justify-content: center; gap: 6px; }
.ob-dots span { width: 8px; height: 8px; border-radius: 99px; background: var(--surface-2); transition: 0.25s; }
.ob-dots span.on { width: 22px; background: var(--green); }
.ob-nav { display: grid; grid-template-columns: 1fr 2fr; gap: 10px; }
.ob .field { text-align: left; margin-top: 16px; }

/* ---------- Toast & confetti ---------- */
#toast {
    position: fixed; left: 50%; z-index: 60;
    bottom: calc(var(--tabbar-h) + var(--safe-b) + 16px);
    transform: translate(-50%, 20px);
    max-width: 90vw; padding: 10px 16px; border-radius: 12px;
    background: #F1F5F1; color: #0B0D0B; font-size: 14px; font-weight: 600;
    opacity: 0; pointer-events: none; transition: 0.25s;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 70; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}
