/* ── RESET & TOKENS ─────────────────────────────── */
* { margin: 0; padding: 0; box-sizing: border-box; }

html {
    color-scheme: only light;
    background: #f2f2f7;
    touch-action: manipulation;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    -webkit-overflow-scrolling: touch;
}

html.king-loading,
html.king-loading body {
    background: #ffffff;
}

html.king-loading .container {
    visibility: hidden;
}

:root {
    --green:       #34c759;
    --green-light: #30d158;
    --gold:        #ff9f0a;
    --text:        #1d1d1f;
    --text-muted:  #86868b;
    --border:      #d2d2d7;
    --card:        #ffffff;
    --bg:          #f2f2f7;
    /* env() is 0 on many Android WebViews; Capacitor injects --safe-area-inset-*. */
    --king-safe-top: max(env(safe-area-inset-top, 0px), var(--safe-area-inset-top, 0px));
    --king-safe-right: max(env(safe-area-inset-right, 0px), var(--safe-area-inset-right, 0px));
    --king-safe-bottom: max(env(safe-area-inset-bottom, 0px), var(--safe-area-inset-bottom, 0px));
    --king-safe-left: max(env(safe-area-inset-left, 0px), var(--safe-area-inset-left, 0px));
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    min-height: 100dvh;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    overscroll-behavior: none;
    touch-action: manipulation;
}

/* Keep scrolled cards from sitting under the clock / status icons. */
body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--king-safe-top);
    background: var(--bg);
    z-index: 1500;
    pointer-events: none;
}

.container {
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    padding: 16px 16px calc(40px + var(--king-safe-bottom));
    padding-top: max(16px, var(--king-safe-top));
    padding-left: max(16px, var(--king-safe-left));
    padding-right: max(16px, var(--king-safe-right));
}

/* ── CARDS ──────────────────────────────────────── */
.card {
    background: var(--card);
    border-radius: 16px;
    padding: 12px;
    margin-bottom: 10px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.07);
}

.premium-gated {
    position: relative;
}

.premium-gated.is-locked > *:not(.premium-lock-veil) {
    pointer-events: none;
}

.premium-lock-veil {
    position: absolute;
    inset: 0;
    z-index: 8;
    margin: 0;
    border: none;
    border-radius: inherit;
    background: rgba(255, 255, 255, 0.42);
    backdrop-filter: blur(1px);
    -webkit-backdrop-filter: blur(1px);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 14px;
    font-family: inherit;
}

.premium-lock-veil-label {
    display: inline-block;
    padding: 8px 14px;
    border-radius: 999px;
    background: rgba(29, 29, 31, 0.88);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: -0.1px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
}

#premiumBackupGate {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    row-gap: 8px;
    width: 100%;
    border-radius: 12px;
}

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

/* ── LIFETIME STATS ── */
.lifetime-stats {
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: 8px 0 4px;
}

.lifetime-stat {
    flex: 1;
    text-align: center;
}

.lifetime-stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.5px;
    font-variant-numeric: tabular-nums;
}

.lifetime-stat-value.green { color: var(--green); }
.lifetime-stat-value.grey  { color: var(--text-muted); }

.lifetime-stat-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    margin-top: 4px;
}

.lifetime-stat-divider {
    width: 1px;
    height: 40px;
    background: var(--border);
}

/* ── COLLAPSIBLE HISTORY PANELS ── */
.collapse-card {
    padding: 0;
    overflow: hidden;
}

.collapse-header {
    display: block;
    width: 100%;
    padding: 12px 14px;
    border: none;
    background: transparent;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.06);
    touch-action: manipulation;
}

.collapse-header:active {
    background: rgba(0, 0, 0, 0.04);
}

.collapse-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
}

.collapse-header-text {
    flex: 1;
    min-width: 0;
}

.collapse-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
}

.collapse-teaser {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    line-height: 1.4;
}

.collapse-teaser:empty {
    display: none;
    margin: 0;
}

.collapse-chevron {
    font-size: 22px;
    font-weight: 600;
    color: var(--text-muted);
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.collapse-chevron.open {
    transform: rotate(90deg);
}

.collapse-body {
    display: none;
    padding: 0 12px 12px;
    border-top: 1px solid var(--border);
}

.collapse-body.is-open {
    display: block;
}

.collapse-body .chart-toggle {
    margin-top: 14px;
}

.collapse-body .lifetime-stats {
    padding-top: 14px;
}

/* ── How King Works entry + sheet ── */
.learn-journey-card .collapse-header {
    cursor: pointer;
}

.learn-journey-overlay {
    z-index: 2100;
    align-items: flex-end;
    padding: 0;
}

.learn-journey-overlay .learn-journey-card-panel {
    max-width: 440px;
    width: 100%;
    max-height: min(88vh, 720px);
    margin: 0 auto;
    border-radius: 24px 24px 0 0;
    padding: 0;
    text-align: left;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(24px) scale(1);
}

.learn-journey-overlay.active .learn-journey-card-panel {
    transform: translateY(0);
}

.learn-journey-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 20px 18px 12px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.learn-journey-title {
    margin: 0;
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.4px;
    color: var(--text);
    line-height: 1.25;
}

.learn-journey-close {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 10px;
    background: rgba(60, 60, 67, 0.08);
    color: var(--text-muted);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    line-height: 1;
}

.learn-journey-close:active {
    background: rgba(60, 60, 67, 0.14);
}

.learn-journey-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 8px 18px 8px;
}

.learn-section {
    padding: 14px 0;
    border-bottom: 1px solid rgba(60, 60, 67, 0.08);
}

.learn-section:last-of-type {
    border-bottom: none;
}

.learn-section-title {
    margin: 0 0 10px;
    font-size: 15px;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.2px;
}

.learn-section-label {
    margin: 0 0 8px;
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.4;
    letter-spacing: -0.15px;
}

.learn-section-body {
    margin: 0 0 8px;
    font-size: 14px;
    line-height: 1.55;
    color: var(--text-muted);
    font-weight: 500;
}

.learn-section-body:last-child {
    margin-bottom: 0;
}

.learn-log-strong {
    color: var(--green);
    font-weight: 700;
}

.learn-log-slip {
    color: #ff3b30;
    font-weight: 700;
}

.learn-score-inline {
    font-weight: 700;
    color: var(--text);
}

.learn-list {
    margin: 0 0 10px;
    padding: 0 0 0 1.15em;
    font-size: 14px;
    line-height: 1.55;
    color: var(--text-muted);
    font-weight: 500;
}

.learn-list li {
    margin-bottom: 6px;
}

.learn-list li:last-child {
    margin-bottom: 0;
}

.learn-powers,
.learn-ladder {
    margin: 10px 0 12px;
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(52, 199, 89, 0.1);
    border: 1px solid rgba(52, 199, 89, 0.28);
    font-size: 16px;
    font-weight: 800;
    color: var(--green);
    letter-spacing: -0.2px;
    font-variant-numeric: tabular-nums;
}

.learn-powers.learn-seq-row {
    justify-content: center;
}

.learn-seq-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.2em 0.35em;
    line-height: 1;
}

.learn-seq-row > span:not(.learn-seq-arrow) {
    display: inline-flex;
    align-items: center;
    line-height: 1;
}

/* Numbers / arrows as flex peers so → centres on Android (Roboto baseline sits low). */
.learn-seq-num {
    display: inline-flex;
    align-items: center;
    line-height: 1;
    font-weight: 800;
}

/* Match header slip score / chances label relapse tiers */
.learn-powers .learn-pow-ok { color: var(--green); }
.learn-powers .learn-pow-warn { color: #e6ac00; }
.learn-powers .learn-pow-orange { color: #e07000; }
.learn-powers .learn-pow-danger { color: #ff453a; }
.learn-powers .learn-pow-critical { color: #7b2d26; }

.learn-seq-gap {
    display: inline-flex;
    align-items: center;
    line-height: 1;
    font-weight: 700;
    letter-spacing: 0.02em;
    opacity: 0.85;
}

.learn-seq-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    min-width: 1em;
    line-height: 1;
    font-size: 1em;
    font-weight: 600;
    opacity: 0.72;
    /* Roboto → glyph sits on baseline; lift to visual centre of adjacent text */
    transform: translateY(-0.14em);
}

.learn-score-line {
    margin: 4px 0 10px;
    letter-spacing: -0.2px;
}

.learn-score-highlight {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
}

.learn-score-example {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
}

.learn-record-example {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.35;
}

.learn-record-example:first-of-type {
    margin-top: 4px;
}

.learn-record-example:last-of-type {
    margin-bottom: 10px;
}

.learn-score-delta {
    margin: 4px 0 12px;
    font-size: 15px;
    font-weight: 800;
    color: var(--green);
    letter-spacing: -0.25px;
}

.learn-quote {
    margin: 12px 0 4px;
    padding: 12px 14px;
    border-left: 3px solid rgba(52, 199, 89, 0.55);
    background: rgba(52, 199, 89, 0.08);
    border-radius: 0 10px 10px 0;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text);
    font-weight: 600;
}

.learn-quote-emphasis {
    border-left-color: var(--green);
    background: rgba(52, 199, 89, 0.12);
    font-style: normal;
}

.learn-quote-final {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-style: normal;
    margin-top: 14px;
    margin-bottom: 4px;
}

.learn-quote-final strong {
    font-size: 15px;
    font-weight: 800;
    letter-spacing: -0.2px;
}

.learn-progress-figure {
    margin: 8px 0 12px;
    padding: 0;
}

.learn-progress-img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 12px;
    background: #fff;
}

.learn-progress-caption {
    margin-top: 10px;
    font-size: 12px;
    line-height: 1.45;
    color: var(--text-muted);
    text-align: center;
}

.btn-learn-done {
    flex-shrink: 0;
    margin: 8px 18px 18px;
    border: none;
    border-radius: 14px;
    padding: 14px 16px;
    background: var(--green);
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.2px;
    cursor: pointer;
}

.btn-learn-done:active {
    opacity: 0.9;
}

@media (min-width: 480px) {
    .learn-journey-overlay {
        align-items: center;
        padding: 20px;
    }

    .learn-journey-overlay .learn-journey-card-panel {
        border-radius: 24px;
        max-height: min(80vh, 680px);
    }
}

/* ── KNOWLEDGE CARD ── */
.knowledge-card.card {
    padding: 16px 18px;
}

.knowledge-emoji {
    font-size: 24px;
    flex-shrink: 0;
    margin-top: 2px;
}

.knowledge-content { flex: 1; }

.knowledge-headline {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 5px;
    line-height: 1.4;
}

.knowledge-body {
    font-size: 13px;
    font-weight: 400;
    color: var(--text-muted);
    line-height: 1.55;
}

.primary-stack {
    margin-bottom: 8px;
}

/* ── TOP ROW: Day + Best Journey ────────────────── */
.top-row {
    display: grid;
    grid-template-columns: 80px 1fr;
    gap: 8px;
    margin-bottom: 6px;
}

/* Small stat box (Day counter, Best Journey) */
.stat-box {
    padding: 16px;
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    gap: 4px;
}

.stat-box.green {
    background: rgba(52,199,89,0.12);
    border: 1.5px solid rgba(52,199,89,0.3);
}

.stat-box.gold {
    background: rgba(255,159,10,0.12);
    border: 1.5px solid rgba(255,159,10,0.3);
    position: relative;
    overflow: hidden;
}

/* Ghost trophy behind Best Journey card */
.stat-box.gold::before {
    content: '🏆';
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 36px;
    opacity: 0.15;
}

.stat-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.stat-label.green { color: var(--green); }
.stat-label.gold  { color: var(--gold); }

.stat-value {
    font-weight: 700;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    letter-spacing: -1px;
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 0;
}

.stat-value.green { font-size: 28px; color: var(--green); }
.stat-value.gold  { font-size: 30px; color: var(--gold); }

.stat-value.gold .score-strong,
.stat-value.gold .score-failures {
    color: var(--gold);
}

.stat-value.gold .score-sep {
    margin: 0 0.07em;
    font-weight: 600;
    color: var(--gold);
    background: none;
    -webkit-text-fill-color: currentColor;
}

.stat-hint {
    font-size: 10px;
    font-weight: 600;
    color: rgba(60, 60, 67, 0.45);
    letter-spacing: -0.1px;
    line-height: 1.3;
    white-space: pre-line;
}

.stat-hint[hidden] {
    display: none !important;
}

/* ── CURRENT JOURNEY SCORE ──────────────────────── */
.score-card {
    background: rgba(52,199,89,0.18);
    border: 2px solid rgba(52,199,89,0.4);
    border-radius: 14px;
    padding: 16px;
    text-align: center;
    margin-bottom: 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.score-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--green);
}

.score-value {
    font-size: 44px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    line-height: 1;
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 0;
    letter-spacing: -1px;
}

.score-breakdown {
    margin-top: 2px;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
    letter-spacing: -0.1px;
}

.score-strong {
    color: var(--green);
}

.score-sep {
    font-weight: 600;
    margin: 0 0.07em;
    color: var(--green);
    -webkit-text-fill-color: transparent;
    -webkit-background-clip: text;
    background-clip: text;
}

.score-failures {
    font-weight: 700;
    letter-spacing: -0.02em;
}

/* 0–1 relapse: all green */
.score-value.relapse-0 .score-sep {
    background-image: linear-gradient(90deg, var(--green), var(--green));
}
.score-value.relapse-0 .score-failures { color: var(--green); }

/* 2–3 relapse: green → yellow (bright, clearly yellow) */
.score-value.relapse-2 .score-sep {
    background-image: linear-gradient(90deg, var(--green), #ffcc00);
}
.score-value.relapse-2 .score-failures { color: #e6ac00; }

/* 4–6 relapse: green → orange (deep burnt orange, not yellow) */
.score-value.relapse-4 .score-sep {
    background-image: linear-gradient(90deg, var(--green), #e07000);
}
.score-value.relapse-4 .score-failures { color: #e07000; }

/* 7–8 relapse: green → red */
.score-value.relapse-7 .score-sep {
    background-image: linear-gradient(90deg, var(--green), #ff453a);
}
.score-value.relapse-7 .score-failures { color: #ff453a; }

/* 9 relapse: green → maroon */
.score-value.relapse-9 .score-sep {
    background-image: linear-gradient(90deg, var(--green), #7b2d26);
}
.score-value.relapse-9 .score-failures { color: #7b2d26; }

/* 10th slip — journey over, neutral grey */
.score-value.relapse-10 .score-sep {
    background-image: linear-gradient(90deg, var(--green), var(--text-muted));
}
.score-value.relapse-10 .score-failures { color: var(--text-muted); }

/* ── SLIPS (10 🛡️ shields) ─────────────────────── */
.chances-card {
    background: rgba(52, 199, 89, 0.12);
    border: 1.5px solid rgba(52, 199, 89, 0.3);
    border-radius: 12px;
    padding: 10px 12px;
    margin-bottom: 10px;
}

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

.chance {
    font-size: 24px;
    text-align: center;
}

/* Used chances go grey */
.chance.used {
    filter: grayscale(100%) brightness(0.6) opacity(0.5);
}

.chances-label {
    text-align: center;
    font-size: 15px;
    font-weight: 600;
    color: var(--green);
}

.chances-label.relapse-0 { color: var(--green); }
.chances-label.relapse-2 { color: #e6ac00; }
.chances-label.relapse-4 { color: #e07000; }
.chances-label.relapse-7 { color: #ff453a; }
.chances-label.relapse-9 { color: #7b2d26; }
.chances-label.relapse-10 { color: var(--text-muted); }

/* ── ACTION BUTTONS ─────────────────────────────── */
.action-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

button {
    padding: 11px 12px;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    letter-spacing: -0.2px;
    position: relative;
}

.btn-success {
    background: linear-gradient(180deg, var(--green-light), var(--green));
    color: white;
    box-shadow: 0 4px 12px rgba(52,199,89,0.4);
}

.btn-success:hover:not(:disabled) { transform: translateY(-2px); }
.btn-success:active:not(:disabled) { transform: translateY(0); }

.btn-success:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: linear-gradient(180deg, #9ca3af, #6b7280);
    box-shadow: none;
}

/* Darker green when already logged */
.btn-success.logged {
    background: linear-gradient(180deg, #2d9c47, #1e7a34);
    opacity: 1;
}

.btn-danger {
    background: linear-gradient(180deg, #ff453a, #ff3b30);
    color: white;
    box-shadow: 0 4px 12px rgba(255,59,48,0.4);
}

.btn-danger:hover:not(:disabled) { transform: translateY(-2px); }
.btn-danger:active:not(:disabled) { transform: translateY(0); }

.btn-danger:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: linear-gradient(180deg, #9ca3af, #6b7280);
    box-shadow: none;
}
.actions-card .collapse-body {
    padding: 0;
}

.actions-card .actions-stack {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    row-gap: 8px;
    width: 100%;
    padding: 12px 14px 14px;
    box-sizing: border-box;
}

.actions-card .btn-backup,
.actions-card .btn-reset {
    display: block;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    margin: 0;
    font-size: 13px;
    padding: 10px;
    border-radius: 12px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
    -webkit-appearance: none;
    appearance: none;
}

.actions-card .btn-backup {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
    font-weight: 600;
}
.actions-card .btn-backup:active {
    border-color: var(--green);
    color: var(--green);
}
.actions-card .btn-reset {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
    font-weight: 500;
}
@media (hover: hover) and (pointer: fine) {
    .actions-card .btn-backup:hover {
        border-color: var(--green);
        color: var(--green);
    }
    .actions-card .btn-reset:hover {
        border-color: #ff3b30;
        color: #ff3b30;
    }
}

.backup-status {
    margin: 2px 0 4px;
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
}

/* ── TABS (iOS segmented control) ───────────────── */
.tabs {
    display: flex;
    gap: 3px;
    padding: 3px;
    background: rgba(0,0,0,0.06);
    border-radius: 12px;
    margin-bottom: 14px;
}

.tab {
    flex: 1;
    padding: 10px 8px;
    background: transparent;
    border: none;
    border-radius: 9px;
    color: var(--text-muted);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.tab.active {
    background: var(--green);
    color: white;
    font-weight: 600;
}

.tab:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.tab-content { display: none; }
.tab-content.active { display: block; }

.remind-panel {
    padding: 4px 12px 16px;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
}

.remind-group {
    background: var(--bg);
    border-radius: 10px;
    overflow: hidden;
}

.remind-group-time {
    margin-top: 8px;
    padding: 0 0 2px;
}

.remind-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 44px;
    padding: 6px 16px;
    margin: 0;
    background: #ffffff;
}

.remind-copy {
    min-width: 0;
    flex: 1;
}

.remind-title {
    font-size: 17px;
    font-weight: 400;
    letter-spacing: -0.41px;
    color: #000000;
    margin: 0;
    line-height: 1.29;
}

.remind-footer {
    margin: 6px 16px 0;
    font-size: 13px;
    font-weight: 400;
    letter-spacing: -0.08px;
    color: #8e8e93;
    line-height: 1.35;
}

.remind-switch {
    position: relative;
    flex-shrink: 0;
    width: 51px;
    height: 31px;
}

.remind-switch input {
    position: absolute;
    inset: 0;
    opacity: 0;
    margin: 0;
    cursor: pointer;
    z-index: 1;
}

.remind-switch-ui {
    display: block;
    width: 51px;
    height: 31px;
    border-radius: 16px;
    background: #e9e9eb;
    position: relative;
    transition: background-color 0.22s ease;
}

.remind-switch-ui::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 27px;
    height: 27px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow:
        0 3px 8px rgba(0, 0, 0, 0.15),
        0 1px 1px rgba(0, 0, 0, 0.16);
    transition: transform 0.22s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.remind-switch input:checked + .remind-switch-ui {
    background: #34c759;
}

.remind-switch input:checked + .remind-switch-ui::after {
    transform: translateX(20px);
}

.remind-time-label {
    display: block;
    padding: 10px 16px 0;
    font-size: 13px;
    font-weight: 400;
    letter-spacing: -0.08px;
    color: #8e8e93;
    text-transform: none;
    margin: 0;
}

.remind-time-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin: 4px 12px 12px;
    padding: 10px 8px;
    border-radius: 10px;
    background: #ffffff;
    border: none;
}

.remind-time-colon {
    font-size: 28px;
    font-weight: 510;
    letter-spacing: 0.2px;
    color: #3c3c43;
    line-height: 1;
    padding: 0 2px;
    font-variant-numeric: tabular-nums;
}

.remind-time-btn {
    flex: 0 0 auto;
    min-width: 52px;
    box-sizing: border-box;
    border: none;
    background: transparent;
    color: #3c3c43;
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 28px;
    font-weight: 510;
    letter-spacing: 0.35px;
    font-family: inherit;
    font-variant-numeric: tabular-nums;
    text-align: center;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background-color 0.15s ease;
}

.remind-time-btn:active {
    background: rgba(120, 120, 128, 0.16);
}

.remind-time-ampm {
    flex: 0 0 auto;
    min-width: 58px;
    margin-left: 4px;
    font-size: 22px;
    font-weight: 510;
    letter-spacing: -0.2px;
}

.remind-time-row.is-disabled .remind-time-btn,
.remind-time-row.is-disabled .remind-time-colon {
    opacity: 0.35;
    pointer-events: none;
}

.remind-time-picker-card {
    max-width: 320px;
    padding: 0;
    text-align: left;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.22);
}

.remind-time-picker-card h3 {
    margin: 0;
    padding: 16px 16px 12px;
    text-align: center;
    font-size: 17px;
    font-weight: 600;
    letter-spacing: -0.41px;
    color: #000000;
    border-bottom: 0.5px solid rgba(60, 60, 67, 0.29);
}

.remind-time-picker-list {
    max-height: min(52vh, 360px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    border: none;
    border-radius: 0;
    background: #ffffff;
    margin: 0;
}

.remind-time-picker-option {
    display: block;
    width: 100%;
    min-height: 44px;
    border: none;
    border-bottom: 0.5px solid rgba(60, 60, 67, 0.12);
    background: #ffffff;
    color: #000000;
    font-size: 17px;
    font-weight: 400;
    letter-spacing: -0.41px;
    font-family: inherit;
    font-variant-numeric: tabular-nums;
    padding: 11px 16px;
    text-align: center;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.remind-time-picker-option:last-child {
    border-bottom: none;
}

.remind-time-picker-option.is-selected {
    background: #ffffff;
    color: #000000;
    font-weight: 600;
    box-shadow: inset 3px 0 0 #34c759;
}

.remind-time-picker-option:active {
    background: rgba(120, 120, 128, 0.16);
}

.remind-time-picker-close {
    width: 100%;
    margin: 0;
    border: none;
    border-radius: 0;
    border-top: 0.5px solid rgba(60, 60, 67, 0.29);
    background: #ffffff;
    color: #007aff;
    font-size: 17px;
    font-weight: 600;
    letter-spacing: -0.41px;
    padding: 14px 16px;
    cursor: pointer;
    font-family: inherit;
}

.remind-time-picker-close:active {
    background: rgba(120, 120, 128, 0.12);
}

/* ── WEEKLY STREAK TRACK ─────────────────────────── */
.weekly-streak-card {
    padding: 14px 16px 16px;
    border-radius: 16px;
    margin-bottom: 10px;
    overflow-x: clip;
}

.weekly-streak-insight {
    margin-bottom: 14px;
}

.weekly-streak-day-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.35;
    margin-bottom: 5px;
}

.weekly-streak-day-text {
    font-size: 13px;
    font-weight: 400;
    color: var(--text-muted);
    line-height: 1.55;
}

.weekly-streak-track {
    display: flex;
    flex-direction: column;
    position: relative;
    width: 100%;
    max-width: 100%;
    padding: 0;
    box-sizing: border-box;
}

.weekly-streak-rail {
    position: relative;
    height: 14px;
    --weekly-green: 0;
    --weekly-grey-start: 0;
    --weekly-grey-width: 0;
    --weekly-line-left: 0px;
    --weekly-line-width: 100%;
}

.weekly-streak-rail::before {
    content: '';
    position: absolute;
    left: var(--weekly-line-left, 0);
    width: var(--weekly-line-width, 100%);
    top: 50%;
    height: 2px;
    transform: translateY(-50%);
    background: var(--border);
    z-index: 0;
    pointer-events: none;
}

.weekly-streak-rail::after {
    content: '';
    position: absolute;
    left: var(--weekly-line-left, 0);
    top: 50%;
    height: 2px;
    width: calc(var(--weekly-line-width, 100%) * var(--weekly-green) / 100);
    transform: translateY(-50%);
    background: linear-gradient(90deg, var(--green), var(--green-light));
    z-index: 0;
    pointer-events: none;
}

/* Slip segment after green (freeze-day only) */
.weekly-grey-fill {
    display: none;
    position: absolute;
    left: calc(var(--weekly-line-left, 0px) + var(--weekly-line-width, 100%) * var(--weekly-grey-start) / 100);
    top: 50%;
    height: 2px;
    width: calc(var(--weekly-line-width, 100%) * var(--weekly-grey-width) / 100);
    transform: translateY(-50%);
    background: #8e8e93;
    z-index: 0;
    pointer-events: none;
}

.weekly-streak-rail.freeze .weekly-grey-fill {
    display: block;
}

.weekly-streak-labels {
    position: relative;
    width: 100%;
    margin-top: 6px;
    min-height: 12px;
}

.weekly-step-label-col {
    position: absolute;
    top: 0;
    min-width: 0;
    text-align: center;
}

.weekly-streak-rail .weekly-step {
    position: absolute;
    display: flex;
    justify-content: center;
    align-items: center;
    min-width: 0;
    z-index: 1;
}

.weekly-step-marker {
    width: 8px;
    height: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1;
    flex-shrink: 0;
}

/* Opaque pad hides the line under each dot */
.weekly-step-marker::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--card);
    transform: translate(-50%, -50%);
    z-index: 0;
}

.weekly-step.current .weekly-step-marker::after,
.weekly-step.done:not(.current) .weekly-step-marker::after {
    background: var(--green);
}

.weekly-step.slip-day .weekly-step-marker::after,
.weekly-step.slip-day.current .weekly-step-marker::after {
    background: #8e8e93;
    width: 10px;
    height: 10px;
}

.weekly-step.slip-day .weekly-step-dot {
    width: 10px;
    height: 10px;
    border: none;
    background: #8e8e93;
    box-shadow: none;
}

.weekly-step.target .weekly-step-marker {
    width: 14px;
    height: 14px;
    overflow: hidden;
}

.weekly-step.target .weekly-step-marker::after {
    width: 14px;
    height: 14px;
}

.weekly-step-dot {
    box-sizing: border-box;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: 2px solid var(--border);
    background: var(--card);
    position: relative;
    z-index: 2;
    flex-shrink: 0;
    transition: background 0.2s ease, border-color 0.2s ease;
}

/* Fixed origin — pre–Day 1 starting point */
.weekly-step-start .weekly-step-origin {
    width: 8px;
    height: 8px;
    border-color: var(--border);
    background: var(--card);
}

.weekly-step-start.done .weekly-step-marker::after {
    background: var(--green);
}

.weekly-step-start.done .weekly-step-origin {
    width: 10px;
    height: 10px;
    border-width: 0;
    background: var(--green);
}

.weekly-step.done:not(.current) .weekly-step-dot {
    width: 10px;
    height: 10px;
    border-width: 0;
    background: var(--green);
}

.weekly-step.current .weekly-step-dot {
    width: 10px;
    height: 10px;
    border-width: 0;
    background: var(--green);
    animation: none;
    box-shadow: none;
}

.weekly-step.slip-day .weekly-step-dot,
.weekly-step.slip-day.current .weekly-step-dot {
    width: 10px;
    height: 10px;
    border: none;
    background: #8e8e93;
    box-shadow: none;
    animation: none;
}

.weekly-step.slip-day .weekly-step-marker::after,
.weekly-step.slip-day.current .weekly-step-marker::after {
    background: #8e8e93;
    width: 10px;
    height: 10px;
}

/* Moving position — smaller than filled day dots (10px solid) */
.weekly-active-traveler {
    position: absolute;
    top: 50%;
    width: 8px;
    height: 8px;
    box-sizing: border-box;
    border-radius: 50%;
    border: 2px solid var(--green);
    background: linear-gradient(180deg, var(--green-light), var(--green));
    transform: translate(-50%, -50%);
    z-index: 3;
    pointer-events: none;
    animation: weekly-dot-glow 2.2s ease-in-out infinite;
    transition: left 0.5s ease;
}

@media (prefers-reduced-motion: reduce) {
    .weekly-active-traveler {
        animation: none;
        box-shadow: 0 0 0 3px rgba(52, 199, 89, 0.2);
        transition: none;
    }
}

@keyframes weekly-dot-glow {
    0%, 100% {
        box-shadow: 0 0 0 3px rgba(52, 199, 89, 0.14);
    }
    50% {
        box-shadow: 0 0 0 6px rgba(52, 199, 89, 0.28);
    }
}

.weekly-step-bullseye-svg {
    display: block;
    width: 14px;
    height: 14px;
    overflow: hidden;
    opacity: 0.55;
    position: relative;
    z-index: 2;
    transition: opacity 0.2s ease;
}

.weekly-step-bullseye-svg .dart-shaft {
    stroke: #8b6914;
}

.weekly-step-bullseye-svg .dart-feather-a {
    fill: #ff453a;
}

.weekly-step-bullseye-svg .dart-feather-b {
    fill: #fff;
    stroke: #ff453a;
    stroke-width: 0.35;
    stroke-linejoin: round;
}

.weekly-step-bullseye-svg .dart-tip {
    fill: #b0b0b5;
}

.weekly-step.target.done .weekly-step-bullseye-svg,
.weekly-step.target.current .weekly-step-bullseye-svg {
    opacity: 1;
}

.weekly-step.target.done .weekly-step-bullseye-svg .ring-outer,
.weekly-step.target.current .weekly-step-bullseye-svg .ring-outer {
    stroke: #ff3b30;
    fill: rgba(255, 59, 48, 0.18);
}

.weekly-step.target.done .weekly-step-bullseye-svg .ring-mid,
.weekly-step.target.current .weekly-step-bullseye-svg .ring-mid {
    stroke: #ff3b30;
}

.weekly-step.target.done .weekly-step-bullseye-svg .ring-core,
.weekly-step.target.current .weekly-step-bullseye-svg .ring-core {
    fill: #ff3b30;
}

.weekly-step.target.current .weekly-step-marker {
    box-shadow: 0 0 0 5px rgba(255, 59, 48, 0.22);
    border-radius: 50%;
}

.weekly-step-label {
    margin-top: 0;
    font-size: 8px;
    font-weight: 600;
    color: var(--text-muted);
    text-align: inherit;
    line-height: 1.2;
    letter-spacing: -0.2px;
    white-space: nowrap;
}

.weekly-step-label-col.done .weekly-step-label {
    color: var(--green);
}

.weekly-step-label-col.current .weekly-step-label {
    color: var(--green);
    font-weight: 700;
}

/* Slip day always grey — must beat .done / .current (same day often has both) */
.weekly-step-label-col.slip-day .weekly-step-label,
.weekly-step-label-col.slip-day.done .weekly-step-label,
.weekly-step-label-col.slip-day.current .weekly-step-label {
    color: #8e8e93;
    font-weight: 700;
}

.weekly-streak-rail.freeze {
    opacity: 1;
}

.weekly-step.frozen.done .weekly-step-dot {
    opacity: 1;
}

.weekly-step-label-col.frozen .weekly-step-label {
    color: var(--green);
}

.weekly-active-traveler.frozen {
    opacity: 1;
    animation: none;
    transition: none;
}

/* Solid grey slip marker (no ring / gradient) */
.weekly-active-traveler.frozen.slip {
    width: 10px;
    height: 10px;
    border: none;
    background: #8e8e93;
    box-shadow: none;
    animation: none;
}

/* Streak tab: slip freeze — grey instead of green */
#tab-streak.streak-freeze-day .milestone-item.achieved .milestone-name,
#tab-streak.streak-freeze-day .milestone-item.achieved .milestone-status,
#tab-streak.streak-freeze-day .milestone-item.achieved-earned .milestone-name,
#tab-streak.streak-freeze-day .milestone-item.achieved-earned .milestone-status,
#tab-streak.streak-freeze-day .milestone-item.achieved-glow .milestone-name,
#tab-streak.streak-freeze-day .milestone-item.achieved-glow .milestone-status {
    color: #8e8e93 !important;
    font-weight: 600;
}

#tab-streak.streak-freeze-day .milestone-item.achieved,
#tab-streak.streak-freeze-day .milestone-item.achieved-earned,
#tab-streak.streak-freeze-day .milestone-item.achieved-glow {
    border-color: rgba(142, 142, 147, 0.45);
    background: rgba(142, 142, 147, 0.08);
    animation: none !important;
    box-shadow: none !important;
    opacity: 1;
}

#tab-streak.streak-freeze-day > .milestone-list:first-of-type .milestone-item.achieved .milestone-status {
    font-size: 12px;
    letter-spacing: 0.02em;
    color: #8e8e93 !important;
}

#tab-streak.streak-freeze-day #bestStreakSection .milestone-status {
    font-size: 18px;
    letter-spacing: normal;
}

/* Journey tab + Progress tab: grey on journey end (pending next journey) */
#tab-journey.journey-ended-day .milestone-item.achieved .milestone-name,
#tab-journey.journey-ended-day .milestone-item.achieved .milestone-status,
#tab-journey.journey-ended-day .milestone-item.achieved-earned .milestone-name,
#tab-journey.journey-ended-day .milestone-item.achieved-earned .milestone-status,
#tab-journey.journey-ended-day .milestone-item.achieved-glow .milestone-name,
#tab-journey.journey-ended-day .milestone-item.achieved-glow .milestone-status,
#tab-journey.journey-ended-day .milestone-item.journey-ended-item .milestone-name,
#tab-journey.journey-ended-day .milestone-item.journey-ended-item .milestone-status {
    color: #8e8e93 !important;
    font-weight: 600;
}

#tab-journey.journey-ended-day .milestone-item.achieved,
#tab-journey.journey-ended-day .milestone-item.achieved-earned,
#tab-journey.journey-ended-day .milestone-item.achieved-glow,
#tab-journey.journey-ended-day .milestone-item.journey-ended-item {
    border-color: rgba(142, 142, 147, 0.45);
    background: rgba(142, 142, 147, 0.08);
    animation: none !important;
    box-shadow: none !important;
}

#tab-journey.journey-ended-day .section-label {
    color: #8e8e93;
}

/* Progress tab: grey on journey end or slip freeze (same feel as Streak tab) */
#tab-science.journey-ended-day .science-item.completed,
#tab-science.journey-ended-day .science-item.journey-ended-item,
#tab-science.streak-freeze-day .science-item.completed,
#tab-science.streak-freeze-day .science-item.journey-ended-item {
    border-color: rgba(142, 142, 147, 0.45);
    background: rgba(142, 142, 147, 0.08);
    animation: none !important;
}

#tab-science.journey-ended-day .science-item.completed .science-phase-name,
#tab-science.journey-ended-day .science-item.completed .science-days-range,
#tab-science.journey-ended-day .science-item.journey-ended-item .science-phase-name,
#tab-science.journey-ended-day .science-item.journey-ended-item .science-days-range,
#tab-science.streak-freeze-day .science-item.completed .science-phase-name,
#tab-science.streak-freeze-day .science-item.completed .science-days-range,
#tab-science.streak-freeze-day .science-item.journey-ended-item .science-phase-name,
#tab-science.streak-freeze-day .science-item.journey-ended-item .science-days-range {
    color: #8e8e93;
    font-weight: 600;
}

#tab-science.journey-ended-day .science-item.current,
#tab-science.streak-freeze-day .science-item.current {
    border-color: rgba(142, 142, 147, 0.5);
    background: rgba(142, 142, 147, 0.08);
    animation: none !important;
}

#tab-science.journey-ended-day .science-here-badge,
#tab-science.streak-freeze-day .science-here-badge {
    color: #8e8e93;
    font-weight: 600;
    background: none;
    border: none;
}

#tab-science.journey-ended-day .science-progress-fill,
#tab-science.streak-freeze-day .science-progress-fill {
    background: #8e8e93;
}

.weekly-streak-tagline {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid rgba(60, 60, 67, 0.08);
    font-size: 10px;
    color: rgba(60, 60, 67, 0.35);
    line-height: 1.5;
    font-style: italic;
}

/* ── MILESTONE CARDS ────────────────────────────── */
.milestone-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.milestone-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    transition: all 0.2s ease;
}

.milestone-item[hidden],
.milestone-item.milestone-row-hidden {
    display: none !important;
}

#tab-streak #bestStreakSection {
    margin-top: 10px;
}

.milestone-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.milestone-icon { font-size: 20px; }

.milestone-name {
    font-size: 15px;
    color: var(--text);
    font-weight: 500;
}

.milestone-status {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-muted);
}

/* Past milestone: green text, no background change */
.milestone-item.achieved .milestone-name,
.milestone-item.achieved .milestone-status {
    color: var(--green);
    font-weight: 600;
}

/* Prior journeys peaked here — default card, green label + count only */
.milestone-item.achieved-earned .milestone-name,
.milestone-item.achieved-earned .milestone-status {
    color: var(--green);
    font-weight: 600;
}

/* Active milestone within current streak: green glow */
@keyframes glowGreen {
    0%, 100% { box-shadow: none; background: rgba(52,199,89,0.08); }
    50%       { box-shadow: 0 2px 8px -2px rgba(52,199,89,0.35); background: rgba(52,199,89,0.14); }
}

@keyframes glowGold {
    0%, 100% { box-shadow: none; background: rgba(255,159,10,0.08); }
    50%       { box-shadow: 0 2px 8px -2px rgba(255,159,10,0.40); background: rgba(255,159,10,0.16); }
}

.milestone-item.achieved-glow {
    border-color: rgba(52,199,89,0.45);
    animation: glowGreen 2.4s ease-in-out infinite;
}

.milestone-item.achieved-glow .milestone-name,
.milestone-item.achieved-glow .milestone-status {
    color: var(--green);
    font-weight: 700;
}

/* Best streak: gold glow */
.milestone-item.golden {
    background: rgba(255,159,10,0.10);
    border-color: rgba(255,159,10,0.4);
    animation: glowGold 2.4s ease-in-out infinite;
}

.milestone-item.golden .milestone-name,
.milestone-item.golden .milestone-status {
    color: var(--gold);
    font-weight: 700;
}

.milestone-item.personal-best {
    border: 1.5px dashed rgba(255, 159, 10, 0.45);
    background: rgba(255, 159, 10, 0.06);
}

.milestone-item.personal-best.achieved-glow {
    border-color: rgba(255, 159, 10, 0.55);
    background: rgba(255, 159, 10, 0.1);
}

.milestone-item.personal-best .milestone-name {
    color: var(--gold);
}

/* Locked journey milestone placeholder (Warrior / King progressive reveal) */
.milestone-item.milestone-locked {
    border-style: dashed;
    background: var(--bg);
    justify-content: center;
}

.milestone-item.milestone-locked .milestone-info {
    justify-content: center;
    flex: 1;
}

.milestone-item.milestone-locked .milestone-icon {
    font-size: 18px;
}

.milestone-item.milestone-locked .milestone-name {
    color: var(--text-muted);
    font-weight: 600;
    text-align: center;
}

/* Section label above a group of milestones (Journey Strong-Warrior-King) */
.section-label {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin: 24px 0 12px 4px;
}

/* First section title in a tab (e.g. Journey → Strong) */
.tab-content > .section-label:first-child { margin-top: 0; }

/* Journey Strong / Warrior / King — same 12px rhythm; labels nudged 2px down */
#tab-journey > .section-label {
    margin-top: 14px;
    margin-bottom: 10px;
}

#tab-journey > .section-label:first-child {
    margin-top: 2px;
    margin-bottom: 10px;
}

/* ── STREAK CHART ───────────────────────────────── */
.chart-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 14px;
}

.chart-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
}

.chart-outer {
    display: flex;
    align-items: stretch;
}

.chart-plot-wrap {
    position: relative;
    flex: 1;
    min-width: 0;
}

.chart-inner {
    display: block;
    width: 100%;
    height: 180px;
    overflow: visible;
}

.chart-inner.is-empty {
    opacity: 0.4;
}

.history-empty-state {
    position: absolute;
    inset: 12px 8px 20px 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 12px 16px;
    pointer-events: none;
    z-index: 1;
}

.history-empty-state[hidden] {
    display: none;
}

.history-empty-title {
    margin: 0 0 6px;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.2px;
    color: var(--text);
    line-height: 1.3;
}

.history-empty-sub {
    margin: 0;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
    color: var(--text-muted);
    max-width: 240px;
}

.month-grid-wrap {
    position: relative;
}

.month-grid.is-empty {
    opacity: 0.35;
}

.month-empty-state {
    inset: 24px 12px 12px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.72);
}

.history-empty-hint {
    margin: 10px 0 0;
    padding: 0 4px 4px;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
    color: var(--text-muted);
    text-align: center;
}

.history-empty-hint[hidden] {
    display: none;
}

.chart-frame {
    display: flex;
    flex-direction: column;
}

.chart-nav-row {
    display: flex;
    align-items: center;
    margin-top: 4px;
}

.chart-nav-y {
    flex-shrink: 0;
    width: 36px;
    display: flex;
    justify-content: center;
}

.chart-nav-plot {
    flex: 1;
    min-width: 0;
    display: flex;
    justify-content: flex-end;
    padding-right: 2px;
}

@keyframes chart-dot-live-glow {
    0%, 100% {
        transform: scale(1);
        opacity: 0.32;
    }
    50% {
        transform: scale(1.5);
        opacity: 0.14;
    }
}

.chart-dot-live-glow {
    transform-box: fill-box;
    transform-origin: center;
    animation: chart-dot-live-glow 2.2s ease-in-out infinite;
}

.chart-dot-live-glow--green {
    fill: rgba(52, 199, 89, 0.24);
}

.chart-dot-live-glow--orange {
    fill: rgba(255, 159, 10, 0.28);
}

@media (prefers-reduced-motion: reduce) {
    .chart-dot-live-glow {
        animation: none;
        opacity: 0.22;
        transform: scale(1.15);
    }
}

/* ── SCIENCE TAB ── */
.science-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.science-item {
    display: flex;
    flex-direction: column;
    border-radius: 12px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    background: var(--bg);
    transition: all 0.2s ease;
    position: relative;
}

/* Current phase — same green glow as .milestone-item.achieved-glow */
.science-item.current {
    border-color: rgba(52,199,89,0.45);
    animation: glowGreen 2.4s ease-in-out infinite;
}

.science-item.current .science-phase-name,
.science-item.current .science-here-badge {
    color: var(--green);
    font-weight: 700;
}

/* Completed phase — green text + soft green fill (highlighted like Streak) */
.science-item.completed {
    border-color: rgba(52,199,89,0.45);
    background: rgba(52,199,89,0.08);
}

.science-item.completed .science-phase-name,
.science-item.completed .science-days-range {
    color: var(--green);
    font-weight: 600;
}

/* Upcoming phases — same solid look as unreached milestones */
.science-item.future {
    opacity: 1;
}

.science-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.science-item-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.science-emoji { font-size: 20px; }

/* Match .milestone-name */
.science-phase-name {
    font-size: 15px;
    font-weight: 500;
    color: var(--text);
}

/* Day criteria — smaller than milestone status (status is short nums; ranges are longer labels) */
.science-days-range {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    background: none;
    padding: 0;
    border: none;
    border-radius: 0;
    white-space: nowrap;
}

/* Current position label — same scale as day criteria */
.science-here-badge {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: normal;
    text-transform: none;
    color: var(--green);
    background: none;
    padding: 0;
    border: none;
    border-radius: 0;
    white-space: nowrap;
}

.science-desc {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.55;
}

/* Progress bar inside current phase */
.science-progress-track {
    height: 4px;
    background: rgba(0,0,0,0.06);
    border-radius: 99px;
    overflow: hidden;
    margin-top: 10px;
}

.science-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--green-light), var(--green));
    border-radius: 99px;
}

.science-progress-label {
    font-size: 11px;
    color: var(--green);
    font-weight: 600;
    margin-top: 5px;
}

.science-disclaimer {
    margin-top: 14px;
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.6;
    padding: 10px 12px;
    background: rgba(0,0,0,0.03);
    border-radius: 10px;
    border: 1px solid var(--border);
}

.science-collapsed { cursor: pointer; }
.science-collapsed:hover { background: rgba(0,0,0,0.02); }

.science-chevron {
    font-size: 16px;
    color: var(--text-muted);
    font-weight: 300;
    line-height: 1;
    display: inline-block;
}

/* ── MONTHLY GRID ── */
.month-nav-btn {
    background: rgba(52, 199, 89, 0.1);
    border: 1.5px solid rgba(52, 199, 89, 0.35);
    border-radius: 8px;
    width: 32px;
    height: 32px;
    font-size: 18px;
    font-weight: 700;
    color: var(--green);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-family: inherit;
    transition: all 0.15s;
}

.month-nav-btn:hover:not(:disabled) {
    background: rgba(52, 199, 89, 0.16);
    border-color: var(--green);
    color: var(--green-light);
}

.month-nav-btn:active:not(:disabled) {
    transform: scale(0.96);
}

.month-nav-btn:disabled {
    opacity: 1;
    background: rgba(52, 199, 89, 0.05);
    border-color: rgba(52, 199, 89, 0.15);
    color: rgba(52, 199, 89, 0.35);
    cursor: not-allowed;
}
.month-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 3px;
    margin-bottom: 12px;
}

.month-cell {
    aspect-ratio: 1;
    border-radius: 4px;
    background: var(--bg);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 700;
    color: var(--text-muted);
    transition: all 0.2s;
    position: relative;
    line-height: 1.1;
}

.month-cell-day { font-size: 16px; }

.month-slip-count {
    font-size: 9px;
    font-weight: 800;
    color: #ff3b30;
    margin-top: 1px;
    letter-spacing: -0.2px;
}

.month-cell.slip-multi {
    background: rgba(255,59,48,0.28);
    border-color: rgba(255,59,48,0.55);
}

.month-cell.strong {
    background: var(--green);
    border-color: var(--green);
    color: white;
}

.month-cell.slip {
    background: rgba(255,59,48,0.15);
    border-color: rgba(255,59,48,0.3);
    color: #ff3b30;
}

.month-cell.future {
    opacity: 0.28;
    background: var(--bg);
    border-color: var(--border);
    color: var(--text-muted);
}

/* Before install / Calendar Day 1 — grey, not green */
.month-cell.pre-journey {
    background: var(--bg);
    border-color: var(--border);
    color: var(--text-muted);
    opacity: 1;
}

/* Past/today with no log yet — neutral (not auto-green) */
.month-cell.unlogged {
    background: var(--bg);
    border-color: var(--border);
    color: var(--text-muted);
}

.month-cell.today.strong {
    box-shadow: 0 0 0 2px rgba(52, 199, 89, 0.45);
}

.month-cell.today.slip {
    box-shadow: 0 0 0 2px rgba(255, 59, 48, 0.28);
}

.month-cell.today {
    border-width: 2px;
}

.month-legend {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: nowrap;
    gap: 20px;
    margin-top: 12px;
    padding-top: 4px;
    white-space: nowrap;
}

.month-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.month-stat-strong,
.month-stat-slip {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    line-height: 1;
    white-space: nowrap;
}

.legend-swatch {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    flex-shrink: 0;
    box-sizing: border-box;
}

.legend-swatch.strong {
    background: var(--green);
    border: 1px solid var(--green);
}

.legend-swatch.slip {
    background: rgba(255, 59, 48, 0.15);
    border: 1px solid rgba(255, 59, 48, 0.35);
}

.month-day-label {
    font-size: 9px;
    font-weight: 600;
    color: var(--text-muted);
    text-align: center;
    padding-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* ── PROGRESSIVE REVEAL — King section mystery lock (before 400 days) ── */
.mystery-lock {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 28px 16px;
    background: var(--bg);
    border: 1.5px dashed var(--border);
    border-radius: 14px;
    gap: 8px;
}

.mystery-lock-icon { font-size: 28px; }

.mystery-lock-text {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-muted);
    line-height: 1.35;
    text-align: center;
    padding: 0 8px;
}

/* ── CHART TOGGLE ── */
.chart-toggle {
    display: flex;
    gap: 2px;
    padding: 3px;
    background: rgba(0,0,0,0.06);
    border-radius: 9px;
    margin-bottom: 8px;
    width: fit-content;
}

.chart-toggle-btn {
    padding: 6px 18px;
    border: none;
    border-radius: 7px;
    background: transparent;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s ease;
    box-shadow: none;
}

.chart-toggle-btn.active {
    background: var(--green);
    color: white;
    font-weight: 600;
}

/* ── CONFIRMATION MODAL ─────────────────────────── */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 3500;
    justify-content: center;
    align-items: center;
    padding: max(20px, var(--king-safe-top)) 20px calc(20px + var(--king-safe-bottom));
}
@media (hover: hover) and (pointer: fine) {
    .modal { backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
}

.modal.active { display: flex; }

.modal-card {
    background: var(--card);
    padding: 28px;
    border-radius: 20px;
    max-width: 340px;
    width: 100%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: popIn 0.3s ease;
}

@keyframes popIn {
    from { opacity: 0; transform: scale(0.9) translateY(20px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-card h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 24px;
    color: var(--text);
}

.export-choice-card h3 {
    margin-bottom: 10px;
}

.export-choice-note {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
    margin: 0 0 16px;
}

.export-choice-btn {
    display: block;
    width: 100%;
    box-sizing: border-box;
    margin: 0 0 8px;
    font-size: 13px;
    padding: 10px;
    border-radius: 12px;
    cursor: pointer;
    font-family: inherit;
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
    font-weight: 600;
    -webkit-appearance: none;
    appearance: none;
}

.export-choice-btn:active {
    transform: scale(0.98);
}

.export-choice-cancel {
    width: 100%;
    margin-top: 4px;
}

.modal-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.modal-btn {
    padding: 12px 20px;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.1s;
}

.modal-btn:hover  { transform: scale(1.02); }
.modal-btn:active { transform: scale(0.98); }
.modal-btn.confirm { background: var(--green); color: white; }
.modal-btn.cancel  { background: var(--bg); color: var(--text); border: 1px solid var(--border); }

/* ── CELEBRATION POPUP ──────────────────────────── */
.celebration-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 3200;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}
@media (hover: hover) and (pointer: fine) {
    .celebration-overlay { backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
}

.celebration-overlay.active {
    display: flex;
    opacity: 1;
    visibility: visible;
    pointer-events: all;
}

.celebration-card {
    background: var(--card);
    border-radius: 28px;
    padding: 36px 28px 28px;
    max-width: 340px;
    width: calc(100% - 40px);
    text-align: center;
    transform: scale(0.8) translateY(30px);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 24px 60px rgba(0,0,0,0.25);
}

.celebration-overlay.active .celebration-card {
    transform: scale(1) translateY(0);
}

.celebration-emoji {
    font-size: 64px;
    display: block;
    margin-bottom: 14px;
    animation: celebBounce 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.3s both;
}

@keyframes celebBounce {
    from { transform: scale(0) rotate(-15deg); opacity: 0; }
    to   { transform: scale(1) rotate(0deg);  opacity: 1; }
}

.celebration-stage {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--gold);
    margin-bottom: 6px;
}

.celebration-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
}

.celebration-message {
    font-size: 15px;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 24px;
}

.celebration-close {
    width: 100%;
    padding: 14px;
    background: linear-gradient(180deg, var(--green-light), var(--green));
    color: white;
    border: none;
    border-radius: 14px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    box-shadow: 0 4px 14px rgba(52,199,89,0.45);
}

/* ── TOAST ──────────────────────────────────────── */
#toast {
    position: fixed;
    bottom: calc(32px + var(--king-safe-bottom));
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--green);
    color: white;
    padding: 13px 20px;
    border-radius: 16px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    max-width: 300px;
    width: max-content;
    text-align: center;
    opacity: 0;
    pointer-events: none;
    z-index: 1100;
    box-shadow: 0 8px 24px rgba(52,199,89,0.4);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

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

/* ── URGE BUTTON ── */
.btn-urge {
    grid-column: 1 / -1;
    background: #007aff;
    color: white;
    border: none;
    font-size: 15px;
    font-weight: 600;
    padding: 13px;
    border-radius: 12px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(0,122,255,0.35);
}
.btn-urge:hover { background: #0066d6; }

/* ── GENERIC OVERLAY (shared by urge, journal, compare) ── */
.overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: max(20px, var(--king-safe-top)) 20px calc(20px + var(--king-safe-bottom));
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}
@media (hover: hover) and (pointer: fine) {
    .overlay { backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
}
.overlay.active {
    display: flex;
    opacity: 1;
    visibility: visible;
    pointer-events: all;
}
#journeyCompareOverlay {
    z-index: 3600;
}
.overlay-card {
    background: var(--card);
    border-radius: 28px;
    padding: 32px 24px 24px;
    max-width: 360px;
    width: 100%;
    text-align: center;
    box-shadow: 0 24px 60px rgba(0,0,0,0.3);
    transform: scale(0.9) translateY(20px);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.overlay.active .overlay-card {
    transform: scale(1) translateY(0);
}
@media (hover: none) {
    .overlay-card,
    .overlay.active .overlay-card,
    .celebration-card,
    .celebration-overlay.active .celebration-card {
        transform: none;
        transition: none;
    }
}

/* ── URGE TIMER ── */
.urge-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
    letter-spacing: -0.4px;
}
.urge-subtitle {
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 24px;
}
.breathing-ring-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: 16px;
}
.breathing-ring { width: 140px; height: 140px; }
.urge-phase {
    font-size: 13px;
    font-weight: 500;
    color: var(--green);
    margin-bottom: 24px;
    min-height: 20px;
}
.btn-urge-survived {
    width: 100%;
    padding: 14px;
    background: linear-gradient(180deg, var(--green-light), var(--green));
    color: white;
    border: none;
    border-radius: 14px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    margin-bottom: 10px;
    box-shadow: 0 4px 14px rgba(52,199,89,0.4);
}
.btn-urge-cancel {
    width: 100%;
    padding: 12px;
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
    border-radius: 14px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    box-shadow: none;
}

/* ── JOURNEY COMPARISON ── */
.compare-card { padding: 28px 20px 20px; }

.journey-compare-popup {
    margin: 0;
    text-align: left;
}

.journey-compare-popup .journey-compare-card-green {
    border-color: rgba(52, 199, 89, 0.45);
    background: rgba(52, 199, 89, 0.08);
}

.journey-compare-popup .journey-compare-card-green .onb-journey-label {
    color: var(--green);
}

.journey-compare-popup .journey-compare-card-green .onb-journey-score strong {
    color: var(--green);
}

.journey-compare-popup .journey-compare-card-gold {
    border-color: rgba(255, 159, 10, 0.5);
    background: rgba(255, 159, 10, 0.1);
}

.journey-compare-popup .journey-compare-card-gold .onb-journey-label {
    color: var(--gold);
}

.journey-compare-popup .journey-compare-card-gold .onb-journey-score strong {
    color: var(--gold);
}

.journey-compare-popup .onb-journey-label {
    display: block;
    margin-bottom: 8px;
    padding-bottom: 0;
    border-bottom: none;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.journey-compare-popup .journey-compare-verdict {
    margin-top: 14px;
    margin-bottom: 0;
    color: var(--green);
}

.journey-compare-popup .journey-compare-verdict-muted {
    color: var(--text-muted);
    font-weight: 700;
}

.journey-compare-popup .journey-compare-first-end {
    margin: 0;
}

.journey-compare-popup .journey-compare-first-end .onb-journey-arrow {
    margin: 10px 0;
    text-align: center;
    font-size: 18px;
    color: var(--text-muted);
}

.compare-header[hidden] {
    display: none !important;
}
.compare-header { margin-bottom: 20px; }
.compare-badge {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--gold);
    margin-bottom: 6px;
}
.compare-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.3px;
}
.compare-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin-bottom: 20px;
}
.compare-stat {
    background: var(--bg);
    border-radius: 14px;
    padding: 14px 10px;
    text-align: center;
}
.compare-stat-wide {
    padding: 16px 12px;
}
.compare-stat-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    margin-bottom: 6px;
}
.compare-stat-values {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 16px;
    font-weight: 700;
}
.compare-val-old { color: var(--text-muted); font-size: 14px; }
.compare-arrow   { color: var(--text-muted); font-size: 12px; }
.compare-val-new { color: var(--green); }
.compare-val-new.worse  { color: #ff3b30; }
.compare-val-new.same   { color: var(--text-muted); }
.compare-improvement {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}
.compare-improvement-value {
    font-size: 22px;
    font-weight: 800;
    color: var(--green);
    letter-spacing: -0.4px;
    line-height: 1.1;
}
.compare-message {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-muted);
    margin-bottom: 20px;
    padding: 14px;
    background: var(--bg);
    border-radius: 12px;
}
.btn-compare-close {
    width: 100%;
    padding: 14px;
    background: linear-gradient(180deg, var(--green-light), var(--green));
    color: white;
    border: none;
    border-radius: 14px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    box-shadow: 0 4px 14px rgba(52,199,89,0.4);
}

/* ── ONBOARDING ─────────────────────────────────── */
.onboarding-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg);
    z-index: 4000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    overflow: hidden;
    transition: opacity 0.4s ease;
}

.onboarding-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.onboarding-card {
    max-width: 360px;
    width: 100%;
    text-align: center;
}

.onboarding-slide {
    display: none;
    animation: fadeUp 0.35s ease both;
}

.onboarding-slide.active { display: block; }

.onboarding-emoji {
    font-size: 72px;
    margin-bottom: 28px;
    display: block;
}

.onboarding-title {
    font-size: 26px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.5px;
    margin-bottom: 14px;
}

.onboarding-body {
    font-size: 16px;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 40px;
    padding: 0 8px;
}

.onboarding-log-intro p {
    margin: 0 0 16px;
}

.onboarding-inline-log-btn {
    display: inline-block;
    vertical-align: middle;
    margin-top: 8px;
    font-size: 13px;
    padding: 10px 12px;
    pointer-events: none;
    cursor: default;
    white-space: nowrap;
}

.onboarding-log-effect {
    display: inline-block;
    margin-top: 8px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.35;
}

.onboarding-log-effect-strong {
    color: rgba(52, 199, 89, 0.9);
}

.onboarding-log-effect-slip {
    color: rgba(60, 60, 67, 0.62);
}

.onboarding-log-intro p:last-child {
    margin-bottom: 0;
}

.onboarding-journey-scroll {
    overflow: visible;
    margin-bottom: 8px;
    padding-right: 0;
}

.onb-journey-intro {
    margin: 0 0 12px;
    font-size: 13px;
    line-height: 1.4;
    text-align: center;
    font-weight: 700;
    font-style: italic;
}

.onb-journey-slide-title {
    text-transform: uppercase;
    font-size: 20px;
    letter-spacing: 0.03em;
}

.onb-journey-example-divider {
    margin: 0 0 10px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-align: center;
    color: var(--text-muted);
}

.onb-journey-compare-vertical {
    margin: 0 0 10px;
    text-align: center;
}

.onb-journey-compare-vertical .onb-journey-step {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    margin: 0;
}

.onb-journey-compare-vertical .onb-journey-step + .onb-journey-step {
    margin-top: 0;
}

.onb-journey-compare-vertical .onb-journey-step > .onb-journey-label {
    display: block;
    margin: 0 0 6px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.02em;
    color: var(--text-muted);
    text-transform: uppercase;
}

.onb-journey-compare-vertical .onb-journey-label-mixed {
    text-transform: none;
    font-weight: 700;
    font-size: 11px;
    line-height: 1.35;
}

.onb-journey-label-upper {
    text-transform: uppercase;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.onb-journey-label-target {
    text-transform: none;
    font-weight: 600;
}

.onb-journey-compare-vertical .onb-journey-block {
    margin-bottom: 0;
    padding: 12px 10px;
}

.onb-journey-compact-line {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
    color: var(--text);
}

.onb-journey-compact-label {
    font-weight: 700;
    letter-spacing: -0.1px;
    text-transform: none;
    color: var(--text);
}

.onb-journey-compact-line-mixed {
    font-weight: 600;
}

.onb-journey-bridge {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 0;
    gap: 0;
    line-height: 1;
}

.onb-journey-bridge-stem {
    display: block;
    width: 1px;
    height: 10px;
    margin: 0;
    background: rgba(60, 60, 67, 0.16);
}

.onb-journey-bridge-note {
    margin: 4px 0 2px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.35;
    color: rgba(60, 60, 67, 0.62);
    text-align: center;
}

.onb-journey-bridge-note-gain {
    font-weight: 700;
    color: rgba(52, 199, 89, 0.88);
}

.onb-journey-bridge-note-sub {
    font-weight: 600;
    color: rgba(60, 60, 67, 0.55);
}

.onb-journey-bridge-final {
    margin-bottom: 0;
}

.onb-journey-bridge-chevron {
    display: block;
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    color: rgba(60, 60, 67, 0.28);
}

.onb-journey-compare-vertical .onb-journey-step > .onb-journey-bridge + .onb-journey-block {
    margin-top: 0;
}

.onb-journey-compare-vertical .onb-journey-block .onb-journey-label {
    position: static;
    display: block;
    margin-bottom: 4px;
}

.onb-journey-compare-vertical .onb-journey-verdict {
    margin: 8px 0 0;
    font-size: 12px;
    font-weight: 600;
    color: rgba(52, 199, 89, 0.88);
    line-height: 1.35;
}

.onb-journey-compare-vertical .onb-journey-step-next {
    margin-top: 0;
}

.onb-journey-target-step {
    margin: 0;
}

.onb-journey-next-label {
    margin: 0 0 4px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.onb-journey-next-beat {
    margin: 0;
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.35;
}

.onb-journey-next-line {
    margin: 0;
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text);
    line-height: 1.35;
}

.onb-journey-next-line strong {
    font-weight: 900;
}

.onb-journey-total-line {
    margin: 4px 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.35;
}

.onb-journey-total-line strong {
    font-size: 16px;
    font-weight: 800;
}

.onb-journey-target-line {
    margin: 0;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    line-height: 1.35;
}

.onb-journey-target-line strong {
    color: var(--text);
    font-weight: 800;
}

.onb-journey-compare-vertical .onb-journey-target-bracket {
    margin: 8px 0 0;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.35;
}

.onb-journey-compare-vertical + .onb-journey-next,
.onboarding-journey-scroll > .onb-journey-next {
    margin: 12px 0 0;
    padding: 0;
    border: none;
    background: none;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    color: rgba(60, 60, 67, 0.62);
    line-height: 1.35;
}

.onboarding-journey-scroll > .onb-journey-outro {
    margin-top: 10px;
}

.onb-journey-rules {
    margin: 0 0 12px;
    padding: 0;
    list-style: none;
    font-size: 12px;
    line-height: 1.45;
    color: var(--text-muted);
    text-align: center;
}

.onb-journey-rules li {
    margin: 0;
}

.onb-journey-rules strong {
    color: var(--text);
    font-weight: 800;
}

.onb-journey-horizontal {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 10px;
}

.onb-journey-horizontal-arrow {
    flex: 0 0 auto;
    font-size: 22px;
    font-weight: 800;
    color: var(--green);
    line-height: 1;
}

.onb-journey-score-card {
    flex: 1 1 0;
    min-width: 0;
    background: var(--card, #fff);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px 8px;
    text-align: center;
}

.onb-journey-score-card-better {
    border-color: rgba(52, 199, 89, 0.45);
    background: rgba(52, 199, 89, 0.08);
}

.onb-journey-score-card .onb-journey-label {
    margin-bottom: 6px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.onb-journey-target-inline {
    margin: 0 0 6px;
    padding: 4px 6px;
    border-radius: 8px;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #1a7a34;
    background: rgba(52, 199, 89, 0.28);
    border: 1.5px solid rgba(52, 199, 89, 0.65);
}

.onb-journey-target-inline strong {
    font-size: 13px;
    font-weight: 900;
    color: var(--green);
}

.onb-journey-score-main {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    line-height: 1.3;
}

.onb-journey-score-main strong {
    display: block;
    margin-bottom: 2px;
    font-size: 26px;
    font-weight: 900;
    letter-spacing: -0.5px;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.onb-journey-score-card-better .onb-journey-score-main strong {
    color: var(--green);
}

.onb-journey-score-sub {
    margin-top: 4px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
}

.onb-journey-compare-row {
    display: flex;
    align-items: stretch;
    gap: 8px;
    margin-bottom: 8px;
}

.onb-journey-compare-row .onb-journey-block {
    flex: 1 1 0;
    min-width: 0;
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
}

.onb-journey-block {
    background: var(--card, #fff);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 8px 6px;
    margin-bottom: 12px;
}

.onb-journey-block-better {
    border-color: rgba(52, 199, 89, 0.45);
    background: rgba(52, 199, 89, 0.08);
}

.onb-journey-block-next {
    border: 1px solid rgba(255, 159, 10, 0.35);
    background: rgba(255, 159, 10, 0.1);
}

.onb-journey-block .onb-journey-label {
    margin-bottom: 0;
}

.onb-journey-block-header {
    flex: 0 0 auto;
    width: 100%;
    margin-bottom: 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    min-height: 51px;
}

.onb-journey-block:not(.onb-journey-block-better) .onb-journey-block-header {
    position: relative;
    justify-content: center;
}

.onb-journey-block:not(.onb-journey-block-better) .onb-journey-label {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
}

.onb-journey-block:not(.onb-journey-block-better) .onb-journey-meta {
    display: none;
}

.onb-journey-block-header .onb-journey-label {
    width: 100%;
    margin-bottom: 0;
    text-align: center;
    line-height: 1.2;
    min-height: 13px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.onb-journey-meta {
    height: 34px;
    width: 100%;
    margin-top: 4px;
    box-sizing: border-box;
    border: 1.5px solid transparent;
    display: flex;
    align-items: center;
    justify-content: center;
}

.onb-journey-block-body {
    flex: 1 1 auto;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    min-height: 0;
}

.onb-journey-meta.onb-journey-target {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 0 6px;
    box-sizing: border-box;
    border-radius: 8px;
    text-align: center;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #1a7a34;
    background: rgba(52, 199, 89, 0.28);
    border-color: rgba(52, 199, 89, 0.65);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.35) inset;
}

.onb-journey-target strong {
    margin-left: 3px;
    font-size: 14px;
    font-weight: 900;
    letter-spacing: 0;
    font-variant-numeric: tabular-nums;
    color: var(--green);
}

.onb-streak-table {
    flex: 0 0 auto;
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
    font-variant-numeric: tabular-nums;
}

.onb-streak-table th,
.onb-streak-table td {
    padding: 2px 3px;
    height: 18px;
    line-height: 1.2;
    box-sizing: border-box;
    vertical-align: middle;
}

.onb-streak-table th:first-child,
.onb-streak-table td:first-child {
    text-align: left;
}

.onb-streak-table th {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    height: 22px;
    vertical-align: bottom;
}

.onb-streak-table th:last-child,
.onb-streak-table td:last-child {
    text-align: right;
    font-weight: 700;
    color: var(--text);
}

.onb-streak-table th:last-child {
    line-height: 1.1;
    white-space: nowrap;
}

.onb-streak-table tbody tr:nth-child(even) {
    background: rgba(0, 0, 0, 0.03);
}

.onb-journey-total {
    flex: 0 0 auto;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    margin-top: auto;
    padding-top: 6px;
    border-top: 1px solid var(--border);
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-align: center;
}

.onb-journey-total strong {
    font-size: 14px;
    font-weight: 800;
    color: var(--text);
}

.onb-journey-block-better .onb-journey-total strong {
    color: var(--green);
}

.onb-journey-total-sep {
    opacity: 0.5;
}

.onboarding-slide:has(.onboarding-journey-scroll) .onboarding-title {
    margin-bottom: 8px;
    font-size: 22px;
}

.onboarding-slide:has(.onboarding-journey-scroll) .onboarding-body {
    margin-bottom: 4px;
}

.onboarding-slide:has(.onboarding-journey-scroll) .onb-journey-verdict {
    margin: 8px 0 0;
    font-size: 15px;
}

.onboarding-card:has(.onboarding-journey-scroll) .onboarding-dots {
    margin-bottom: 18px;
}

/* Journey score example (Progress slide) */
.onboarding-slide:has(.onboarding-journey-compare) .onboarding-emoji {
    font-size: 48px;
    margin-bottom: 16px;
}

.onboarding-slide:has(.onboarding-journey-compare) .onboarding-body {
    margin-bottom: 18px;
    font-size: 15px;
}

.onboarding-journey-compare {
    margin: 0 4px 28px;
    text-align: left;
}

.onb-journey-card {
    background: var(--card, #fff);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 12px 14px;
}

.onb-journey-card-better {
    border-color: rgba(52, 199, 89, 0.45);
    background: rgba(52, 199, 89, 0.08);
}

.onb-journey-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.onb-journey-card-better .onb-journey-label {
    color: var(--green);
}

.onb-journey-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    font-size: 14px;
    color: var(--text-muted);
    font-weight: 500;
    padding: 3px 0;
}

.onb-journey-row strong {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.onb-journey-score {
    margin-top: 4px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
    font-weight: 600;
    color: var(--text);
}

.onb-journey-score strong {
    font-size: 18px;
    font-weight: 800;
    color: var(--text);
}

.onb-journey-card-better .onb-journey-score strong {
    color: var(--green);
}

.onb-journey-arrow {
    text-align: center;
    font-size: 18px;
    font-weight: 700;
    color: var(--text-muted);
    line-height: 1;
    padding: 8px 0;
}

.onb-journey-verdict {
    margin: 12px 0 0;
    text-align: center;
    font-size: 16px;
    font-weight: 800;
    letter-spacing: -0.3px;
    color: var(--green);
}

.onb-journey-outro {
    margin: 6px 0 0;
    text-align: center;
    font-size: 12px;
    line-height: 1.4;
    font-weight: 500;
    color: var(--text-muted);
}

.onb-journey-next {
    margin: 6px 0 0;
    text-align: center;
    font-size: 11px;
    line-height: 1.35;
    font-weight: 600;
    color: var(--text-muted);
}

.onb-journey-outro strong,
.onb-journey-next strong {
    font-weight: 800;
    color: var(--green);
    font-variant-numeric: tabular-nums;
}

.onb-improve-ladder {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 4px 6px;
    margin: 14px 0 8px;
    padding: 12px 10px;
    border-radius: 14px;
    background: rgba(52, 199, 89, 0.08);
    border: 1px solid rgba(52, 199, 89, 0.22);
    font-size: 14px;
    font-weight: 700;
    color: var(--green);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.2px;
}

.onb-improve-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    height: 1em;
    color: var(--green);
    font-weight: 700;
    opacity: 0.55;
    transform: translateY(-0.06em);
}

.onb-improve-peak {
    color: var(--green);
    font-weight: 800;
}

/* Journey strong-day / score figures on Progress slide */
.onboarding-journey-compare .onb-journey-card .onb-journey-row:first-of-type strong,
.onboarding-journey-compare .onb-journey-score strong {
    color: var(--green);
}

.onboarding-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 28px;
}

.onboarding-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border);
    transition: all 0.3s ease;
}

.onboarding-dot.active {
    background: var(--green);
    width: 24px;
    border-radius: 4px;
}

.onboarding-next {
    width: 100%;
    padding: 16px;
    background: linear-gradient(180deg, var(--green-light), var(--green));
    color: white;
    border: none;
    border-radius: 14px;
    font-size: 17px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    letter-spacing: -0.3px;
    box-shadow: 0 4px 16px rgba(52,199,89,0.4);
    margin-bottom: 12px;
    transition: transform 0.15s ease;
}

.onboarding-next:active { transform: scale(0.98); }

.onboarding-skip {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    padding: 8px;
    box-shadow: none;
}

/* ── CONFETTI CANVAS ── */
#confettiCanvas {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 999;
}

/* Wider screens — keep same gutter as phone (reference uses fixed 480px column) */
@media (min-width: 600px) {
    .card {
        padding: 16px;
        margin-bottom: 12px;
        border-radius: 18px;
    }

    .collapse-header {
        padding: 14px 16px;
    }

    .collapse-body {
        padding: 0 16px 16px;
    }
}

/* ── PREMIUM ── */
.premium-panel-card.premium-active-state .collapse-title {
    color: var(--green);
}

.premium-panel-card.premium-trial-state .collapse-title {
    color: #9a7209;
}

.premium-panel-inner {
    padding-top: 12px;
}

.premium-panel-status {
    margin: 0 0 12px;
    font-size: 13px;
    line-height: 1.45;
    color: var(--text-muted);
}

.premium-panel-status:empty {
    display: none;
    margin: 0;
}

.premium-panel-features {
    list-style: none;
    margin: 0 0 14px;
    padding: 0;
    text-align: left;
}

.premium-panel-features li {
    position: relative;
    padding: 8px 0 8px 18px;
    font-size: 13px;
    line-height: 1.4;
    color: var(--text);
    border-bottom: 1px solid var(--border);
}

.premium-panel-features li:last-child {
    border-bottom: none;
}

.premium-panel-features li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--green);
    font-weight: 700;
}

.btn-premium-panel {
    width: 100%;
    padding: 14px 16px;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    background: linear-gradient(180deg, var(--green-light), var(--green));
    color: #fff;
}

.premium-overlay .premium-card {
    max-width: 360px;
    text-align: center;
    padding: 28px 22px 22px;
}

.premium-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--green);
    background: rgba(52, 199, 89, 0.12);
    padding: 5px 10px;
    border-radius: 999px;
    margin-bottom: 12px;
}

.premium-title {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.4px;
    margin-bottom: 8px;
}

.premium-subtitle {
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-muted);
    margin-bottom: 18px;
}

.premium-backup-note {
    margin: 0 0 16px;
    padding: 10px 12px;
    text-align: left;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.45;
    color: var(--text-muted);
    background: rgba(60, 60, 67, 0.06);
    border-radius: 10px;
}

.premium-backup-note[hidden] {
    display: none;
}

.premium-panel-features + .premium-backup-note {
    margin-top: 4px;
    margin-bottom: 14px;
}

.premium-plans {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 14px;
}
.premium-plans[hidden] {
    display: none;
}
.premium-plan {
    width: 100%;
    text-align: left;
    padding: 12px 14px;
    border: 2px solid rgba(60, 60, 67, 0.18);
    border-radius: 14px;
    background: var(--card);
    color: var(--text);
    font-family: inherit;
    cursor: pointer;
}
.premium-plan.is-featured {
    border-color: rgba(52, 199, 89, 0.45);
}
.premium-plan.is-selected {
    border-color: var(--green);
    background: rgba(52, 199, 89, 0.10);
}
.premium-plan-label {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--text-muted);
    margin-bottom: 2px;
}
.premium-plan-price {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 8px;
    font-size: 20px;
    font-weight: 800;
}
.premium-plan-list {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: line-through;
}
.premium-plan-sale {
    font-size: 20px;
    font-weight: 800;
}
.premium-plan-off {
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    background: var(--green);
    border-radius: 999px;
    padding: 2px 8px;
    letter-spacing: 0.02em;
}
.premium-plan-message {
    margin-top: 6px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.35;
    color: var(--green);
}

.premium-price-note {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    margin-top: 2px;
}
.premium-price-note:empty {
    display: none;
}

.premium-price-unavailable {
    display: block;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    color: var(--text-muted);
    padding: 12px 0;
    text-align: center;
}

.btn-premium-buy {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    background: linear-gradient(180deg, #30d158, #34c759);
    color: #fff;
    margin-bottom: 10px;
}

.btn-premium-restore,
.btn-premium-later {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    background: var(--bg);
    color: var(--text-muted);
    margin-bottom: 8px;
}

.btn-premium-later {
    margin-bottom: 0;
}