:root{
  color-scheme:light;
  --bg:#EFF8F6;
  --surface:#FFFFFF;
  --surface-soft:#F7FCFB;
  --ink:#132421;
  --muted:#607974;
  --primary:#0F8C86;
  --primary-dark:#0A6B66;
  --primary-soft:#E3F4F1;
  --pink:#F06C97;
  --pink-soft:#FCEAF0;
  --peach:#FFF3E8;
  --border:#D9EAE6;
  --sidebar:#0B1716;
  --sidebar-2:#102522;
  --shadow-sm:0 4px 14px rgba(15,53,48,.06);
  --shadow:0 12px 32px rgba(15,53,48,.09);
  --shadow-lg:0 22px 60px rgba(10,43,39,.16);
  --radius:18px;
}

*{box-sizing:border-box}
html,body{min-height:100%;max-width:100%;margin:0;overflow-x:hidden}
html{scroll-behavior:smooth;scrollbar-gutter:stable}
body{
  color:var(--ink);
  font-family:Inter,ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,Arial,sans-serif;
  background:
    radial-gradient(900px 520px at 88% -12%,rgba(240,108,151,.10),transparent 66%),
    radial-gradient(900px 560px at 18% 0%,rgba(15,140,134,.12),transparent 65%),
    linear-gradient(160deg,#F5FBFA 0%,#EDF7F5 56%,#FCF2F5 100%);
  background-attachment:fixed;
  -webkit-font-smoothing:antialiased;
  text-rendering:optimizeLegibility;
}
button,input,textarea,select{font:inherit}
button{color:inherit}
button:focus-visible,a:focus-visible,input:focus-visible,textarea:focus-visible,select:focus-visible{outline:3px solid rgba(15,140,134,.35);outline-offset:2px}
[hidden]{display:none!important}

/* App shell */
.app{display:flex;align-items:stretch;min-height:100vh;width:100%;max-width:100%}
.sidebar{
  position:sticky;top:0;align-self:flex-start;flex:0 0 286px;width:286px;height:100vh;min-height:0;
  display:flex;flex-direction:column;gap:16px;padding:22px 16px 18px;
  overflow-y:auto;overflow-x:hidden;overscroll-behavior:contain;
  color:#EAF6F3;background:
    radial-gradient(340px 250px at 0% 0%,rgba(15,140,134,.2),transparent 70%),
    linear-gradient(155deg,var(--sidebar),var(--sidebar-2) 58%,#0C1918);
  border-right:1px solid rgba(193,230,222,.12);
  scrollbar-width:thin;scrollbar-color:rgba(220,245,240,.22) transparent;
}
.sidebar::-webkit-scrollbar{width:6px}
.sidebar::-webkit-scrollbar-thumb{background:rgba(220,245,240,.2);border-radius:10px}
/* Remove redundant Milo promo panels in the sidebar; the chat and settings remain accessible elsewhere. */
.sidebar>.milo-card,.sidebar>.ai-status{display:none!important}
.logo{display:flex;align-items:center;gap:12px;padding:2px 4px 4px;flex:0 0 auto}
.logo-icon{width:46px;height:46px;flex:0 0 46px;display:grid;place-items:center;border-radius:15px;background:linear-gradient(135deg,var(--primary),var(--pink));color:#fff;font-size:23px;box-shadow:0 8px 20px rgba(15,140,134,.28);overflow:hidden}
.logo strong{display:block;color:#F4FCFA;font-size:20px;line-height:1.05;letter-spacing:-.04em}
.logo span{display:block;margin-top:4px;color:#94B7B0;font-size:11px;line-height:1.35}

/* Scrollable left navigation: selected destination is recentered by app.js. */
.nav{
  position:relative;isolation:isolate;flex:0 1 auto;min-height:0;max-height:min(50vh,480px);
  display:flex;flex-direction:column;gap:5px;padding:22px 3px;
  overflow-y:auto;overflow-x:hidden;overscroll-behavior:contain;scrollbar-gutter:stable;
  scrollbar-width:thin;scrollbar-color:rgba(220,245,240,.28) transparent;
}
.nav::-webkit-scrollbar{width:6px}
.nav::-webkit-scrollbar-track{background:transparent}
.nav::-webkit-scrollbar-thumb{background:rgba(220,245,240,.24);border-radius:20px}
.nav-btn{
  position:relative;z-index:1;flex:0 0 auto;min-height:42px;width:100%;
  display:flex;align-items:center;gap:11px;padding:10px 12px;
  color:#B7D0CB;background:transparent;border:1px solid transparent;border-radius:12px;
  text-align:left;font-size:13px;font-weight:620;letter-spacing:.005em;cursor:pointer;
  transition:background .18s ease,color .18s ease,border-color .18s ease,transform .18s ease,opacity .18s ease;
}
.nav-btn span{width:20px;flex:0 0 20px;text-align:center;font-size:15px}
.nav-btn:hover{color:#fff;background:rgba(255,255,255,.075);border-color:rgba(220,245,240,.09);transform:translateX(2px)}
.nav-btn.active{color:#fff;background:linear-gradient(115deg,rgba(15,140,134,.94),rgba(10,107,102,.92));border-color:rgba(154,239,226,.2);box-shadow:0 7px 18px rgba(2,8,8,.22)}
.nav::before,.nav::after{
  content:"";position:absolute;z-index:4;left:0;right:0;height:34px;pointer-events:none;
  opacity:0;backdrop-filter:blur(5px);-webkit-backdrop-filter:blur(5px);transition:opacity .2s ease;
}
.nav::before{top:0;background:linear-gradient(to bottom,rgba(10,22,20,.96),rgba(10,22,20,.42),transparent)}
.nav::after{bottom:0;background:linear-gradient(to top,rgba(10,22,20,.96),rgba(10,22,20,.42),transparent)}
.nav.has-scroll-up::before,.nav.has-scroll-down::after{opacity:1}

.account-box{padding:14px;border:1px solid rgba(198,232,224,.16);border-radius:16px;background:rgba(255,255,255,.055);box-shadow:inset 0 1px rgba(255,255,255,.035);flex:0 0 auto}
.account-box strong{display:block;color:#F2FAF8;font-size:12px;line-height:1.5;overflow-wrap:anywhere}
.account-box .muted{color:#A0BDB7}
.account-box p{margin:7px 0 10px}
.account-actions{display:flex;gap:7px;flex-wrap:wrap}
.account-actions .btn{flex:1 1 92px;justify-content:center;min-width:0}
.account-actions .btn:not(.btn-ghost){color:#fff!important;-webkit-text-fill-color:#fff!important;background:linear-gradient(135deg,#119A91,#08716C)!important;border:1px solid #08716C!important;box-shadow:0 4px 12px rgba(15,140,134,.2)}
.milo-card{display:flex;align-items:flex-start;gap:11px;padding:14px;border:1px solid rgba(217,234,230,.85);border-radius:17px;color:var(--ink);background:linear-gradient(135deg,#FFF8F1,#E8F7F4);box-shadow:0 8px 22px rgba(0,0,0,.12);flex:0 0 auto}
.milo-avatar{width:40px;height:40px;flex:0 0 40px;display:grid;place-items:center;border-radius:14px;color:#fff;background:linear-gradient(145deg,var(--primary),var(--primary-dark));font-weight:800}
.milo-card strong{font-size:14px}
.milo-card p{margin:4px 0 9px;color:#647B76;font-size:12px;line-height:1.48}
.ai-status{padding:14px;border:1px solid rgba(220,205,241,.75);border-radius:17px;color:#28243A;background:linear-gradient(145deg,#F4F0FC,#FFF2F1);box-shadow:0 8px 22px rgba(0,0,0,.1);flex:0 0 auto}
.ai-status strong{font-size:13px}
.ai-status p{margin:6px 0 10px;color:#716A83;font-size:12px;line-height:1.5}
.progress-box{padding:15px;border:1px solid rgba(191,226,218,.13);border-radius:17px;color:#F0FAF7;background:linear-gradient(145deg,#102522,#123B36);box-shadow:0 10px 24px rgba(0,0,0,.16);flex:0 0 auto}
.progress-head{display:flex;justify-content:space-between;align-items:center;gap:8px;font-size:12px}
.progress-head strong{color:#fff;font-size:13px}
.progress-bar{height:7px;margin:10px 0;border-radius:99px;overflow:hidden;background:rgba(255,255,255,.16)}
#progressFill{height:100%;width:0;background:linear-gradient(90deg,#50C8B4,var(--pink));border-radius:inherit;transition:width .5s ease}
.progress-box p{margin:6px 0 12px;color:#BFD8D3;font-size:11px;line-height:1.45}
.stats-row{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:7px;text-align:center}
.stats-row>div{min-width:0;padding:9px 5px;border:1px solid rgba(255,255,255,.055);border-radius:11px;background:rgba(255,255,255,.06)}
.stats-row strong{display:block;font-size:17px;line-height:1.2;color:#fff}
.stats-row span{display:block;margin-top:3px;color:#BFD8D3;font-size:10px;line-height:1.25}
.disclaimer{margin:0;padding:10px 12px;border:1px solid rgba(240,108,151,.2);border-radius:12px;color:#D6B8C1;background:rgba(240,108,151,.08);font-size:10px;line-height:1.5;flex:0 0 auto}

/* Main workspace and header */
.main{flex:1 1 auto;min-width:0;width:auto;max-width:none;margin:0;padding:28px clamp(22px,3.2vw,52px) 64px}
.topbar{display:flex;align-items:center;justify-content:space-between;gap:20px;margin:0 0 24px;padding:0 0 18px;border-bottom:1px solid rgba(16,81,73,.11)}
.topbar>div:first-of-type{min-width:220px;flex:1 1 260px}
.topbar h1{margin:0;color:#132421;font-size:clamp(25px,2.4vw,34px);line-height:1.12;letter-spacing:-.045em}
.topbar p{margin:6px 0 0;color:var(--muted);font-size:14px;line-height:1.45}
.top-actions{display:flex;align-items:center;justify-content:flex-end;gap:9px;min-width:0;max-width:100%;flex-wrap:wrap}
.sound-bar{flex-wrap:wrap}
.bar-sound,.bar-actions{display:flex;align-items:center;gap:8px;flex-wrap:wrap;min-width:0}
.icon-btn{width:40px;height:40px;display:grid;place-items:center;border:1px solid var(--border);border-radius:12px;color:var(--primary-dark);background:#fff;cursor:pointer;box-shadow:var(--shadow-sm);transition:transform .18s ease,box-shadow .18s ease}
.icon-btn:hover{transform:translateY(-1px);box-shadow:var(--shadow)}
.date-pill{padding:9px 12px;border:1px solid var(--border);border-radius:99px;color:#42635E;background:rgba(255,255,255,.8);font-size:12px;font-weight:700;white-space:nowrap}
.hamburger{display:none;flex:0 0 auto;width:42px;height:42px;border:1px solid var(--border);border-radius:13px;color:var(--primary-dark);background:#fff;box-shadow:var(--shadow-sm);font-size:19px;cursor:pointer}
.view{display:none;min-width:0}
.view.active{display:block;animation:enter .28s ease both}
@keyframes enter{from{opacity:0;transform:translateY(7px)}to{opacity:1;transform:translateY(0)}}

/* Buttons, fields, common surfaces */
.btn{min-height:40px;display:inline-flex;align-items:center;justify-content:center;gap:7px;padding:10px 15px;border:1px solid transparent;border-radius:12px;font-size:13px;font-weight:750;line-height:1.25;text-align:center;text-decoration:none;cursor:pointer;transition:transform .16s ease,background .16s ease,border-color .16s ease,box-shadow .16s ease,color .16s ease}
.btn:hover{transform:translateY(-1px)}
.btn:active{transform:translateY(0)}
.btn:disabled,.btn[disabled]{opacity:.52;cursor:not-allowed;transform:none}
.btn-primary{color:#fff;background:linear-gradient(135deg,#119A91,#08716C);box-shadow:0 7px 16px rgba(15,140,134,.2)}
.btn-primary:hover{background:linear-gradient(135deg,#18A99F,#0A6B66);box-shadow:0 9px 20px rgba(15,140,134,.25)}
.btn-secondary{color:#AF3D65;background:var(--pink-soft);border-color:#F4C9D7}
.btn-secondary:hover{background:#F9DDE6;border-color:#EDB6C9}
.btn-ghost{color:var(--primary-dark);background:#fff;border-color:var(--border);box-shadow:0 2px 8px rgba(15,53,48,.04)}
.btn-ghost:hover{border-color:#A8D7CE;background:#F8FCFB}
.btn-small{min-height:34px;padding:7px 11px;border-radius:10px;font-size:11px}
.card{min-width:0;margin:0 0 16px;padding:22px;border:1px solid rgba(202,226,220,.92);border-radius:var(--radius);background:var(--surface);box-shadow:var(--shadow-sm)}
.card h2,.card h3{color:var(--ink);letter-spacing:-.025em}
.card h2{font-size:21px}
.card h3{font-size:17px}
.card p{line-height:1.62}
.card-head{display:flex;align-items:center;justify-content:space-between;gap:12px}
.muted{color:var(--muted);line-height:1.6}
.small{font-size:12px}
.project-credit{margin:6px 0 0;text-align:center;font-size:11px}
.project-credit a{color:var(--primary-dark);text-decoration:underline;text-underline-offset:2px}
.center{text-align:center}

input:not([type="range"]):not([type="checkbox"]):not([type="radio"]),textarea,select{
  min-width:0;max-width:100%;padding:11px 13px;border:1px solid var(--border);border-radius:12px;
  color:var(--ink);background:#FBFEFD;box-shadow:inset 0 1px 2px rgba(12,54,48,.025);transition:border-color .18s ease,box-shadow .18s ease
}
textarea{width:100%;resize:vertical;line-height:1.55}
input:not([type="range"]):not([type="checkbox"]):not([type="radio"]):focus,textarea:focus,select:focus{border-color:#72BFB4;box-shadow:0 0 0 4px rgba(15,140,134,.1);outline:none}
input::placeholder,textarea::placeholder{color:#93A9A4}
input[type="range"],.range{width:100%;accent-color:var(--primary)}

/* Home and information panels */
.hero{display:grid;grid-template-columns:minmax(0,1.12fr) minmax(270px,.88fr);gap:24px;margin:0 0 18px;padding:clamp(22px,3vw,34px);border:1px solid rgba(13,70,63,.18);border-radius:24px;color:#F1FAF8;background:radial-gradient(520px 260px at 100% 0%,rgba(240,108,151,.19),transparent 68%),linear-gradient(130deg,#0B1716 0%,#10312D 64%,#12443E 100%);box-shadow:var(--shadow-lg);overflow:hidden}
.hero-text{min-width:0}
.badge{display:inline-flex;align-items:center;gap:6px;padding:6px 10px;border:1px solid rgba(240,108,151,.35);border-radius:99px;color:#FFC4D5;background:rgba(240,108,151,.13);font-size:10px;font-weight:800;letter-spacing:.045em}
.hero h2{margin:15px 0 11px;color:#F6FCFA;font-size:clamp(30px,3vw,44px);line-height:1.03;letter-spacing:-.05em}
.hero p{color:#C3D9D5;font-size:14px;line-height:1.7}
.hero-btns{display:flex;gap:9px;flex-wrap:wrap;margin:18px 0}
.hero-principles{display:flex;gap:8px 13px;flex-wrap:wrap;color:#A8D9D0;font-size:11px;font-weight:650;line-height:1.5}
.hero-visual{min-width:0;align-self:stretch}
.milo-big{height:100%;min-height:230px;padding:20px;border:1px solid rgba(217,234,230,.8);border-radius:19px;color:var(--ink);background:linear-gradient(145deg,#fff,#F6FBFA);text-align:center;box-shadow:0 12px 28px rgba(0,0,0,.12)}
.milo-face{width:82px;height:82px;display:grid;place-items:center;margin:0 auto 12px;border-radius:25px;color:#fff;font-size:32px;background:radial-gradient(circle at 32% 25%,#F06C97,#0F8C86 72%);box-shadow:0 10px 24px rgba(15,140,134,.2)}
.milo-big p{color:#617773;font-size:13px;line-height:1.65}
.speech{display:inline-block;margin-top:6px;padding:8px 12px;border:1px solid #C9EAE4;border-radius:99px;color:var(--primary-dark);background:var(--primary-soft);font-size:12px;font-weight:750}
.mini-emotions{display:flex;justify-content:center;gap:7px;flex-wrap:wrap;margin-top:9px}
.mini-emotions span{padding:6px 9px;border:1px solid #E8E4D9;border-radius:99px;color:#526C67;background:#FFF9F0;font-size:11px}
.grid-3{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:14px;margin-bottom:15px}
.grid-2{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px;margin-bottom:15px}
.grid-2>.card,.grid-3>.card{margin:0}
.step-card{position:relative;cursor:pointer;transition:transform .18s ease,box-shadow .18s ease,border-color .18s ease}
.step-card:hover{transform:translateY(-3px);border-color:#A9D8D0;box-shadow:var(--shadow)}
.step-num{width:34px;height:34px;display:grid;place-items:center;margin-bottom:9px;border-radius:12px;color:#fff;background:linear-gradient(145deg,var(--primary),var(--primary-dark));font-size:13px;font-weight:850;box-shadow:0 5px 12px rgba(15,140,134,.2)}
.step-card span{color:var(--primary-dark);font-size:12px;font-weight:800}
.progress-box p{line-height:1.5}
.breath-box{display:grid;place-items:center;padding:12px 0}
.breath-circle{width:92px;height:92px;display:grid;place-items:center;border:1px solid #BFE9E2;border-radius:50%;color:var(--primary-dark);background:radial-gradient(circle,#E7F8F5,#C3EEE6);font-size:13px;font-weight:750;transition:transform 4s ease-in-out,box-shadow .3s ease}
.breath-circle.in{transform:scale(1.22);box-shadow:0 0 0 10px rgba(15,140,134,.08)}
.recent-list{display:flex;flex-direction:column;gap:9px}
.recent-item{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;padding:12px 14px;border:1px solid var(--border);border-radius:13px;background:#F8FCFB}

/* Check-in and emotion selection */
.field-label{display:block;margin:18px 0 9px;color:#263E39;font-size:14px;font-weight:750;line-height:1.45}
.emotion-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(120px,1fr));gap:9px}
.emotion-btn{min-height:94px;padding:12px 9px;border:1px solid var(--border);border-radius:15px;color:var(--ink);background:#fff;cursor:pointer;text-align:center;transition:transform .16s ease,border-color .16s ease,background .16s ease,box-shadow .16s ease}
.emotion-btn:hover{transform:translateY(-2px);border-color:#A9D8D0;box-shadow:var(--shadow-sm)}
.emotion-btn .emoji{display:block;margin-bottom:5px;font-size:25px}
.emotion-btn.selected{border-color:var(--primary);background:var(--primary-soft);box-shadow:0 0 0 3px rgba(15,140,134,.11)}
.range{height:28px}
.range-labels{display:flex;justify-content:space-between;gap:8px;color:var(--muted);font-size:11px}
.chips{display:flex;gap:8px;flex-wrap:wrap}
.chip{padding:8px 11px;border:1px solid var(--border);border-radius:99px;color:#45635E;background:#fff;cursor:pointer;font-size:12px;transition:background .16s ease,color .16s ease,border .16s ease}
.chip:hover{border-color:#9BCFC6;background:#F4FBF9}
.chip.selected{border-color:var(--primary);color:#fff;background:var(--primary)}
.i-statement{display:flex;align-items:center;gap:8px;flex-wrap:wrap;padding:13px;border:1px dashed #C9DCD7;border-radius:15px;background:#F7FBFA}
.i-statement span{color:#607974;font-size:13px;font-weight:650}
.i-statement input{flex:1 1 130px;width:auto;min-width:120px}
.i-statement.big input{min-width:160px}
.preview-box{margin:13px 0;padding:14px;border:1px solid #C8E8E2;border-radius:14px;color:#285B55;background:linear-gradient(135deg,#EAF8F5,#F7FCFB);line-height:1.6}
.form-actions{display:flex;gap:8px;flex-wrap:wrap;margin-top:15px}
.success-msg{min-height:20px;color:var(--primary-dark);font-weight:750}

/* Tabs, simulation, exercise interactions */
.tabs{display:flex;gap:7px;flex-wrap:wrap;margin-bottom:15px}
.tab{padding:9px 13px;border:1px solid var(--border);border-radius:99px;color:#56716C;background:#fff;cursor:pointer;font-size:12px;font-weight:750;transition:all .16s ease}
.tab:hover{border-color:#A5D5CC;color:var(--primary-dark)}
.tab.active{border-color:var(--primary-dark);color:#fff;background:var(--primary-dark);box-shadow:0 5px 13px rgba(10,107,102,.15)}
.tab-panel{display:none}
.tab-panel.active{display:block}
.scenario-box{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap;margin:13px 0;padding:14px;border:1px solid #F0DCCD;border-radius:14px;background:linear-gradient(120deg,#FFF8F1,#FFFDFB)}
.tips{margin:13px 0;padding:14px;border:1px solid #F1E1CF;border-radius:14px;background:#FFF8F0}
.tips ul{margin:8px 0 0;padding-left:20px;line-height:1.65}
.sim-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:11px}
.sim-card{padding:15px;border:1px solid var(--border);border-radius:16px;background:#FBFEFD;cursor:pointer;transition:transform .16s ease,border-color .16s ease,box-shadow .16s ease}
.sim-card:hover{transform:translateY(-2px);border-color:#9BCFC6;box-shadow:var(--shadow-sm)}
.sim-card h4{margin:0 0 6px;color:var(--ink)}
.sim-card p{margin:0;color:var(--muted);font-size:13px;line-height:1.55}
.sim-badge{display:inline-block;margin-left:5px;padding:3px 6px;border:1px solid #BBDDD6;border-radius:6px;color:var(--primary-dark);background:var(--primary-soft);font-size:9px;font-weight:850;letter-spacing:.06em;text-transform:uppercase;vertical-align:middle}
.sim-head{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:12px}
.sim-story{margin-bottom:13px;padding:15px;border-left:4px solid var(--pink);border-radius:0 13px 13px 0;color:#3E5752;background:#FFF6F1;line-height:1.7}
.sim-reflect{display:grid;gap:10px;margin-top:14px;padding:15px;border:1px solid #CBE8E1;border-radius:15px;background:#F3FAF8}
.sim-reflect h4{margin:0;color:#294943}
.milo-question{margin-bottom:13px;padding:15px;border:1px solid #C8E8E2;border-radius:14px;color:#285B55;background:#EAF8F5;font-weight:700;line-height:1.6}
.sim-choices{display:flex;flex-direction:column;gap:9px}
.choice-btn{padding:13px 14px;border:1px solid var(--border);border-radius:13px;color:#294640;background:#fff;cursor:pointer;text-align:left;font-weight:650;line-height:1.5;transition:border-color .16s ease,background .16s ease,transform .16s ease}
.choice-btn:hover{transform:translateX(2px);border-color:#92CBC0;background:#F2FAF8}
.exercise-options{display:flex;flex-direction:column;gap:9px;margin:13px 0}
.feedback{margin:11px 0;padding:13px;border-radius:13px;line-height:1.6}
.feedback.good{border:1px solid #BDE5DB;background:#EAF8F3}
.feedback.try{border:1px solid #F1D5C1;background:#FFF5EB}

/* Chat and journal */
.chat-layout{display:grid;grid-template-columns:minmax(0,1.4fr) minmax(260px,.6fr);align-items:start;gap:14px}
.chat-card{padding:0;overflow:hidden}
.chat-head{display:flex;align-items:center;gap:11px;padding:14px 17px;border-bottom:1px solid var(--border);background:#FCFEFD}
.chat-head p{margin:2px 0 0;color:var(--muted);font-size:12px}
.chat-head .btn{margin-left:auto}
.chat-messages{height:460px;display:flex;flex-direction:column;gap:11px;padding:16px;overflow:auto;background:#F7FBFA}
.msg{max-width:84%;padding:11px 13px;border-radius:15px;line-height:1.6;font-size:14px;overflow-wrap:anywhere}
.msg.milo{align-self:flex-start;border:1px solid var(--border);border-bottom-left-radius:5px;background:#fff}
.msg.user{align-self:flex-end;border:1px solid var(--primary-dark);border-bottom-right-radius:5px;color:#fff;background:var(--primary)}
.msg .who{display:block;margin-bottom:4px;font-size:10px;font-weight:850;letter-spacing:.07em;opacity:.7;text-transform:uppercase}
.quick-prompts{display:flex;gap:7px;flex-wrap:wrap;padding:10px 12px;border-top:1px solid var(--border);background:#fff}
.quick-prompts button{padding:7px 10px;border:1px solid var(--border);border-radius:99px;color:#45635E;background:#F7FBFA;cursor:pointer;font-size:11px}
.chat-form{display:flex;gap:8px;padding:11px 12px;border-top:1px solid var(--border);background:#fff}
.chat-form input{flex:1;min-width:0}
.chat-voice-bar{display:flex;align-items:center;gap:12px;flex-wrap:wrap;padding:10px 13px;border-bottom:1px solid #CBEAE4;background:#EAF8F5;font-size:12px}
.chat-voice-bar label{display:flex;align-items:center;gap:6px;font-weight:650}
.chat-voice-bar select{width:auto;padding:6px 8px}
.chat-voice-bar input[type="range"]{width:80px}
.typing{display:inline-flex;gap:4px;padding:4px 0}
.typing span{width:7px;height:7px;border-radius:50%;background:var(--primary);animation:blink 1s infinite}
.typing span:nth-child(2){animation-delay:.2s}.typing span:nth-child(3){animation-delay:.4s}
@keyframes blink{0%,100%{opacity:.3}50%{opacity:1}}
.msg .speak-btn{margin-top:6px;padding:4px 8px;border:1px solid var(--border);border-radius:8px;color:var(--primary-dark);background:var(--primary-soft);cursor:pointer;font-size:11px}
.express-msg{max-width:86%;margin:7px 0;padding:10px 12px;border:1px solid var(--border);border-radius:13px;color:#294943;background:#fff;line-height:1.55;overflow-wrap:anywhere}
.express-msg.milo{border-color:#CBE8E1;background:#EFF9F6}
.express-msg.user{margin-left:auto;border-color:#0A6B66;color:#fff;background:var(--primary)}
.express-who{display:block;margin-bottom:3px;font-size:10px;font-weight:850;letter-spacing:.06em;text-transform:uppercase;opacity:.72}
.check-list{padding-left:19px;line-height:1.85}
.journal-item{margin-bottom:11px;padding:14px;border:1px solid var(--border);border-radius:15px;background:#FBFEFD}
.journal-item .meta{display:flex;gap:7px;flex-wrap:wrap;margin-bottom:7px;color:var(--muted);font-size:11px}
.pill{padding:4px 8px;border:1px solid #F2CFD9;border-radius:99px;color:#A74667;background:var(--pink-soft);font-size:11px;font-weight:750}
.search-row input{max-width:520px}
.lib-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(240px,1fr));gap:12px;margin-top:15px}
.lib-card{padding:15px;border:1px solid var(--border);border-radius:16px;background:#FBFEFD;cursor:pointer;transition:border-color .16s ease,box-shadow .16s ease}
.lib-card:hover{border-color:#9BCFC6;box-shadow:var(--shadow-sm)}
.lib-card h4{margin:0 0 6px}
.lib-card .body{display:none;margin-top:10px;color:var(--muted);font-size:13px;line-height:1.65}
.lib-card.open .body{display:block}
.lib-section-title{margin:17px 0 7px;color:var(--muted);font-size:11px;font-weight:850;letter-spacing:.08em;text-transform:uppercase}
.wheel-word-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(180px,1fr));gap:8px;margin-top:8px}
.wheel-word{padding:9px 11px;border:1px solid var(--border);border-radius:12px;color:#45635E;background:#F7FBFA}
.wheel-word b{display:block;color:var(--ink);font-size:13px}
.wheel-word span{color:var(--muted);font-size:11px}
.wheel-word i{display:block;margin-top:3px;color:var(--primary-dark);font-size:9px;font-style:normal;letter-spacing:.06em;text-transform:uppercase}

/* Settings and modal dialogs */
.modal-overlay{position:fixed;inset:0;z-index:1000;display:grid;place-items:center;padding:16px;overflow:auto;background:rgba(7,27,25,.62);backdrop-filter:blur(7px);-webkit-backdrop-filter:blur(7px)}
.modal{width:min(640px,100%);max-height:92vh;overflow:auto;padding:23px;border:1px solid rgba(255,255,255,.75);border-radius:22px;background:#fff;box-shadow:var(--shadow-lg)}
.modal-head{display:flex;align-items:center;justify-content:space-between;gap:12px}
.modal-head h2{margin:0;font-size:21px;letter-spacing:-.035em}
.modal label{display:block;margin:12px 0 6px;font-size:13px;font-weight:750}
.modal input[type="text"],.modal input[type="password"],.modal input[type="email"],.modal select{width:100%;margin-top:4px;padding:10px 12px}
.modal input[type="range"]{width:100%;accent-color:var(--primary)}
.check-row{display:flex!important;align-items:center;gap:9px;line-height:1.45;font-weight:650!important}
.check-row input{width:auto!important}
.settings-actions{display:flex;gap:8px;flex-wrap:wrap;margin:15px 0}
.help-box{margin-top:12px;padding:13px;border:1px solid #F0DFD0;border-radius:13px;background:#FFF8F0;font-size:12px;line-height:1.6}
.help-box code{padding:2px 5px;border:1px solid var(--border);border-radius:5px;background:#fff}
.milo-captcha-overlay{position:fixed;inset:0;z-index:1100;display:flex;align-items:center;justify-content:center;padding:16px;background:rgba(4,22,20,.72);backdrop-filter:blur(5px)}
.milo-captcha-card{width:min(440px,100%);max-height:90vh;overflow:auto;padding:22px;border-radius:19px;background:#fff;box-shadow:var(--shadow-lg)}
.milo-captcha-card h2{margin-top:0}.milo-captcha-card p{font-size:13px;line-height:1.55}.milo-captcha-card #milo-captcha-widget{min-height:70px;margin:12px 0}

/* Account, auth, API keys */
.auth-tabs{display:flex;gap:6px;margin:13px 0 5px}
.auth-tab{flex:1;padding:10px 7px;border:1px solid var(--border);border-radius:11px;color:var(--muted);background:#F8FCFB;font-size:12px;font-weight:750;cursor:pointer}
.auth-tab.active{border-color:var(--primary);color:var(--primary-dark);background:var(--primary-soft)}
.auth-tab:focus-visible{outline:2px solid var(--primary);outline-offset:2px}
.auth-msg{min-height:20px;margin:11px 0 0;color:var(--muted);font-size:12px;line-height:1.5}
.auth-msg.error{color:#B42318;font-weight:750}
.auth-resend{margin:13px 0 0;font-size:12px;line-height:1.5}
.auth-resend a{color:var(--primary-dark);font-weight:750;text-decoration:underline;text-underline-offset:2px}
.sync-ok{color:var(--primary)}
.sync-error{color:#B42318}
.keys-section-title{margin:17px 0 8px;color:var(--ink);font-size:13px;font-weight:800}
.provider-list{display:flex;flex-direction:column;gap:8px}
.provider-item{display:flex;align-items:flex-start;gap:10px;width:100%;padding:11px;border:1px solid var(--border);border-radius:13px;color:var(--ink);background:#fff;text-align:left;cursor:pointer;transition:border-color .16s ease,background .16s ease}
.provider-item:hover{border-color:#8FCBC0}
.provider-item.active{border-color:var(--primary);background:var(--primary-soft)}
.provider-item:focus-visible{outline:2px solid var(--primary);outline-offset:2px}
.provider-radio{width:18px;height:18px;flex:0 0 18px;display:inline-flex;align-items:center;justify-content:center;margin-top:2px;border:1.5px solid #B9D2CC;border-radius:50%}
.provider-radio.active{border-color:var(--primary)}
.provider-radio.active::after{content:"";width:9px;height:9px;border-radius:50%;background:var(--primary)}
.provider-body{display:flex;flex-direction:column;gap:2px;min-width:0}
.provider-label{font-size:13px;font-weight:800}
.provider-hint{color:var(--muted);font-size:11px;line-height:1.45}
.keys-hint{margin:4px 0 0;color:var(--muted);font-size:11px;line-height:1.55}
.keys-text{margin:8px 0 0;color:var(--ink);font-size:12px;line-height:1.6}
.keys-row{display:flex;gap:9px;flex-wrap:wrap;margin-top:12px}
.keys-status{min-height:20px;margin:11px 0 0;color:var(--muted);font-size:12px}
.keys-status.error{color:#B42318;font-weight:750}
#view-keys input{width:100%;margin-bottom:6px;padding:11px 12px}
#sendMailBtn{transition:opacity .15s ease}
#sendMailBtn:disabled{opacity:.45;cursor:not-allowed}

/* Personality test and result */
.bf-wrap{max-width:820px;margin:0 auto}
.bf-progress{height:8px;margin:14px 0 6px;overflow:hidden;border-radius:99px;background:#E6F1EF}
.bf-progress>div{height:100%;width:0;border-radius:inherit;background:linear-gradient(90deg,var(--primary),var(--pink));transition:width .3s ease}
.bf-q{margin:18px 0 6px;color:var(--ink);font-size:18px;line-height:1.5}
.bf-facet{display:inline-block;padding:4px 8px;border-radius:7px;color:var(--primary-dark);background:var(--primary-soft);font-size:10px;letter-spacing:.08em;text-transform:uppercase}
.bf-scale{display:grid;gap:8px;margin-top:14px}
.bf-opt{display:flex;align-items:center;gap:10px;padding:13px 14px;border:1px solid var(--border);border-radius:13px;color:var(--ink);background:#FBFEFD;cursor:pointer;text-align:left;font-size:13px;transition:transform .15s ease,border-color .15s ease,background .15s ease}
.bf-opt:hover{transform:translateY(-1px);border-color:#8FCBC0;background:#F2FAF8}
.bf-opt b{width:23px;height:23px;flex:0 0 23px;display:grid;place-items:center;border-radius:8px;color:var(--primary-dark);background:var(--primary-soft);font-size:11px}
.bf-nav{display:flex;justify-content:space-between;gap:10px;margin-top:16px}
.bf-result-grid{display:grid;grid-template-columns:minmax(0,1.1fr) minmax(260px,.9fr);gap:15px}
.bf-dim{margin-bottom:13px}
.bf-dim-head{display:flex;justify-content:space-between;gap:8px;margin-bottom:5px;font-size:12px}
.bf-dim-bar{height:9px;overflow:hidden;border-radius:99px;background:#EAF2F0}
.bf-dim-bar>div{height:100%;border-radius:inherit}
.animal-card{position:relative;overflow:hidden;padding:20px;border:1px solid rgba(255,255,255,.12);border-radius:20px;color:#F3FBFA;background:radial-gradient(360px 190px at 100% 0%,rgba(240,108,151,.3),transparent 68%),linear-gradient(145deg,#0B1716,#10332E 72%,#12443E)}
.animal-emoji{font-size:48px;line-height:1;filter:drop-shadow(0 6px 14px rgba(240,108,151,.28))}
.animal-name{margin:7px 0 2px;color:#F3FBFA;font-size:24px}
.animal-key{color:#F58BAC;font-size:10px;letter-spacing:.1em;text-transform:uppercase}
.animal-line{margin:12px 0;color:#D2E7E2;font-size:14px;line-height:1.6}
.animal-row{display:flex;align-items:flex-start;gap:8px;margin-top:8px;color:#BBD8D2;font-size:12px;line-height:1.55}
.animal-row b{flex:0 0 auto;color:#fff;font-weight:750}
.animal-alt{display:flex;gap:8px;flex-wrap:wrap;margin-top:13px}
.animal-chip{display:flex;align-items:center;gap:6px;padding:8px 10px;border:1px solid var(--border);border-radius:11px;color:#45635E;background:#FBFEFD;font-size:11px}

/* Exercise progression, hearts and feedback */
.ex-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;margin-bottom:8px}
.ex-head h2{margin:0 0 4px;font-size:20px}
.ex-score{flex:0 0 auto;text-align:right}
.ex-hearts-total{display:block;color:#D2426B;font-size:16px;font-weight:850}
.ex-score .muted{font-size:9px;letter-spacing:.06em;text-transform:uppercase}
.ex-progress{height:7px;margin:10px 0 14px;overflow:hidden;border-radius:99px;background:#E8F3F0}
.ex-progress>div{height:100%;border-radius:inherit;background:linear-gradient(90deg,var(--primary),var(--pink));transition:width .3s ease}
.ex-prompt{margin:0 0 10px;font-size:15px;font-weight:700;line-height:1.5}
.ex-story{margin:10px 0;padding:14px;border-left:4px solid var(--pink);border-radius:0 13px 13px 0;color:#3E5752;background:#FFF6F1;line-height:1.65}
.ex-hint{margin-top:12px;opacity:.86}
.ex-rules{margin:12px 0;padding:12px;border:1px solid #D9ECE7;border-radius:13px;background:#F3FAF8}
.ex-rules p{margin:0;color:#31564F;font-size:12px;line-height:1.6}
.hearts{margin:14px 0 2px;font-size:29px;letter-spacing:5px;line-height:1}
.hearts .on{color:#E24A72}
.hearts .off{color:#E7D3DA}
.ex-hearts-label{margin:0 0 13px;color:var(--muted);font-size:12px}
.ex-review{display:grid;gap:9px;margin-bottom:14px}
.ex-review-item{padding:11px 12px;border:1px solid var(--border);border-radius:12px;background:#FBFEFD}
.ex-review-item.ok{border-left:4px solid var(--primary)}
.ex-review-item.no{border-left:4px solid #E2A0B4;background:#FFF8FA}
.ex-review-top{display:flex;align-items:flex-start;gap:8px;margin-bottom:4px}
.ex-mark{color:#E24A72;font-size:16px;line-height:1.2}
.ex-review-q{font-size:13px;font-weight:750}
.ex-review-item p{margin:3px 0;font-size:12px;line-height:1.55}
.ex-actions{display:flex;gap:8px;flex-wrap:wrap}
.ex-extra{margin:6px 0 10px;padding:9px 11px;border:1px solid #F0DECA;border-radius:9px;color:#795D40;background:#FFF8F0;font-size:11px;line-height:1.5}
.award-image{display:block;width:min(220px,85%);height:auto;margin:16px auto;border-radius:17px}

/* Ambient sound status */
.ambient-status{display:inline-flex;align-items:center;gap:6px;padding:5px 8px;border:1px solid #CBE9E5;border-radius:9px;color:var(--primary-dark);background:var(--primary-soft);font-size:10px;letter-spacing:.02em;white-space:nowrap}
.ambient-status:empty{display:none}
.ambient-status.live{border-color:var(--primary-dark);color:#fff;background:var(--primary)}
.ambient-status.warn{border-color:#F7CBD9;color:#B0395F;background:var(--pink-soft)}
.ambient-status .eq{display:inline-flex;align-items:flex-end;gap:2px;height:10px}
.ambient-status .eq i{display:block;width:2px;border-radius:2px;background:currentColor;animation:eqBar .9s ease-in-out infinite}
.ambient-status .eq i:nth-child(1){height:5px;animation-delay:0s}
.ambient-status .eq i:nth-child(2){height:9px;animation-delay:.18s}
.ambient-status .eq i:nth-child(3){height:6px;animation-delay:.36s}
@keyframes eqBar{0%,100%{transform:scaleY(.55)}50%{transform:scaleY(1.15)}}

/* Emotion wheel */
#wheelHost{display:block;min-width:0}
.wheel-card{padding:20px 16px;border:1px solid var(--border);border-radius:22px;background:#fff;box-shadow:var(--shadow-sm)}
.wheel-eyebrow{margin:0 0 8px;color:#688B85;text-align:center;font-size:10px;font-weight:800;letter-spacing:.14em}
.wheel-title{margin:0;color:#284C4B;text-align:center;font-size:clamp(23px,3vw,30px);font-weight:800;letter-spacing:-.04em}
.wheel-intro{max-width:520px;margin:9px auto 16px;color:#617B76;text-align:center;font-size:13px;line-height:1.6}
.wheel-canvas{display:flex;align-items:center;justify-content:center;overflow-x:auto;padding:6px 0}
.wheel-canvas svg{width:min(100%,580px);max-width:min(100%,580px);max-height:68vh;height:auto;flex:0 0 auto;transition:width .28s cubic-bezier(.2,.7,.2,1)}
.wheel-canvas.zoomed svg{width:min(112%,650px);max-width:min(112%,650px)}
.wheel-hint{margin:12px 0;color:#718C86;text-align:center;font-size:11px}
.wheel-zoom{display:block;margin:0 auto 8px}
.wheel-areas{display:flex;justify-content:center;gap:7px;flex-wrap:wrap;margin-top:12px}
.wheel-area{padding:8px 11px;border:1px solid transparent;border-radius:99px;color:#284C4B;font-size:11px;font-weight:700;cursor:pointer}
.wheel-area.active{border-color:#406A64;box-shadow:0 0 0 2px rgba(15,140,134,.08)}
.wheel-area.home{background:#FFF4F6}
.wheel-selected{margin:12px 0 0;color:#466762;text-align:center;font-size:12px;font-weight:700}
.wheel-detail{margin-top:16px}
.wheel-detail h3{margin:4px 0 6px;color:#284C4B;font-size:21px}
.wheel-detail-intro{margin:0 0 12px;color:#69817D;font-size:12px;line-height:1.6}
.wheel-group{padding:10px 0;border-top:1px solid #EDF3F0}
.wheel-group-btn{display:inline-block;padding:7px 9px;border:0;border-radius:9px;color:#284C4B;background:transparent;font-size:14px;font-weight:750;cursor:pointer}
.wheel-words{display:flex;gap:7px;flex-wrap:wrap;margin-top:3px}
.wheel-word{padding:8px 10px;border:1px solid #E2EEEA;border-radius:99px;color:#466762;background:#F2F8F5;font-size:12px;cursor:pointer}
.wheel-group-btn.selected,.wheel-word.selected{border-color:#77A99A;background:#D6EDE4}
.wheel-reflection{margin-top:12px;padding:14px;border-radius:15px;background:#F8F3F3}
.wheel-reflection-word{margin:4px 0 0;color:#284C4B;font-size:17px;font-weight:800}
.wheel-reflection-text{margin:6px 0 0;color:#556F6A;font-size:13px;line-height:1.55}
.wheel-reflection-note{margin:8px 0 0;color:#78908A;font-size:11px}
.wheel-empty{margin-top:16px;border-color:#E1EEE8;background:#F4FAF7}
.wheel-empty h3{margin:0 0 6px;color:#284C4B;font-size:15px}
.wheel-disclaimer{margin:16px 0;color:#7B8E89;font-size:11px;line-height:1.55}
.wheel-wrap{display:grid;place-items:center;padding:10px}
.wheel-wrap svg{max-width:100%;height:auto}
.wheel-seg{cursor:pointer;stroke:#fff;stroke-width:2}
.wheel-seg:hover{opacity:.9}
.wheel-reference{display:grid;gap:8px;width:100%}
.wheel-reference .choice-btn{width:100%}

/* Small extras used by content modules */
.stat-box{border-radius:14px;color:#fff;background:linear-gradient(145deg,#102522,#123B36)}
.bf-dim-bar>div{background:linear-gradient(90deg,var(--primary),var(--pink))}
.chat-layout .card{margin-bottom:0}
#view-keys input:focus{outline:none}

/* Tablet: keep the application as a two-column workspace. */
@media (min-width:741px) and (max-width:1020px){
  .sidebar{flex-basis:230px;width:230px;padding:18px 12px}
  .main{padding:22px 20px 52px}
  .topbar{align-items:flex-start;flex-direction:column}
  .top-actions{width:100%;justify-content:flex-start}
  .hero{grid-template-columns:1fr;padding:23px}
  .grid-3{grid-template-columns:repeat(2,minmax(0,1fr))}
  .grid-3>.step-card:last-child{grid-column:1/-1}
  .grid-2,.chat-layout,.bf-result-grid{grid-template-columns:1fr}
}

/* Phone: drawer navigation, full-width content, no clipped controls. */
.sidebar-backdrop{display:none}
@media (max-width:740px){
  .app{display:block;min-height:100vh}
  .sidebar{
    position:fixed;inset:0 auto 0 0;z-index:80;width:min(88vw,340px);height:100dvh;max-height:100dvh;
    padding:18px 14px;transform:translateX(-105%);transition:transform .25s cubic-bezier(.4,0,.2,1);
    box-shadow:var(--shadow-lg)
  }
  .sidebar.open{transform:translateX(0)}
  .sidebar-backdrop{position:fixed;inset:0;z-index:70;display:none;background:rgba(6,25,23,.56);backdrop-filter:blur(3px)}
  .sidebar-backdrop.show{display:block}
  .main{width:100%;max-width:none;padding:14px 14px 74px}
  .topbar{align-items:flex-start;gap:10px;margin-bottom:16px;padding-bottom:13px}
  .topbar>div:first-of-type{min-width:0;flex:1 1 auto}
  .topbar h1{font-size:22px}
  .topbar p{font-size:12px}
  .hamburger{display:grid;place-items:center;position:sticky;top:8px;z-index:40}
  .top-actions{width:100%;justify-content:flex-start;gap:7px}
  .topbar{flex-wrap:wrap}
  .bar-sound,.bar-actions{flex:1 1 100%;gap:6px}
  .bar-sound select{flex:1 1 130px;width:auto;min-width:0}
  .bar-sound input[type="range"]{width:70px}
  .bar-actions .btn{flex:1 1 130px}
  .date-pill{flex:1 1 100%;text-align:center}
  .hero{grid-template-columns:1fr;gap:15px;margin-bottom:13px;padding:20px 16px;border-radius:20px}
  .hero h2{font-size:29px}
  .hero p{font-size:13px}
  .hero-principles{font-size:10px}
  .milo-big{min-height:0;padding:16px}
  .grid-3,.grid-2,.chat-layout,.bf-result-grid{grid-template-columns:1fr;gap:10px}
  .grid-3>.step-card:last-child{grid-column:auto}
  .card{padding:16px;border-radius:16px}
  .card h2{font-size:19px}
  .tabs{flex-wrap:nowrap;overflow-x:auto;padding-bottom:6px;scrollbar-width:none;-webkit-overflow-scrolling:touch}
  .tabs::-webkit-scrollbar{display:none}
  .tab{flex:0 0 auto;white-space:nowrap}
  .emotion-grid{grid-template-columns:repeat(auto-fill,minmax(100px,1fr))}
  .i-statement input{flex:1 1 100%;width:100%;min-width:0}
  .chat-messages{height:min(56vh,460px);min-height:280px}
  .chat-form{align-items:stretch}
  .chat-form .btn{flex:0 0 auto}
  .chat-voice-bar{gap:7px}
  .modal{width:100%;max-height:88dvh;padding:18px;border-radius:18px}
  .modal-overlay{padding:10px}
  .settings-actions,.form-actions,.keys-row{gap:7px}
  .settings-actions .btn,.form-actions .btn{flex:1 1 140px}
  .wheel-card{padding:16px 11px;border-radius:18px}
  .bf-q{font-size:16px}
}
@media (max-width:520px){
  .main{padding:11px 11px 68px}
  .topbar h1{font-size:20px}
  .hero h2{font-size:25px}
  .hero-btns .btn{flex:1 1 145px}
  .account-actions{flex-direction:column}
  .keys-row{flex-direction:column}
  .keys-row .btn{width:100%}
  .ex-head{gap:7px}
  .ex-score .muted{font-size:8px}
  .hearts{font-size:25px;letter-spacing:3px}
  .wheel-word-grid{grid-template-columns:repeat(auto-fill,minmax(145px,1fr))}
}
@media (max-width:380px){
  .sidebar{width:min(92vw,340px)}
  .main{padding-inline:9px}
  .hero{padding:18px 13px}
  .card{padding:14px}
  .chat-form{flex-wrap:wrap}
  .chat-form .btn{width:100%}
}
@media (prefers-reduced-motion:reduce){
  *,*::before,*::after{scroll-behavior:auto!important;animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important}
}

/* Floating desktop sidebar: inset from the viewport with a soft rounded frame. */
@media (min-width:741px){
  .app{gap:16px}
  .sidebar{
    top:16px;height:calc(100vh - 32px);height:calc(100dvh - 32px);
    margin:16px 0 16px 16px;border:1px solid rgba(183,229,219,.18);border-radius:24px;
    box-shadow:0 0 0 1px rgba(255,255,255,.025) inset,0 18px 48px rgba(8,38,34,.19)
  }
}
@media (min-width:741px) and (max-width:1020px){
  .app{gap:13px}
  .sidebar{top:13px;height:calc(100vh - 26px);height:calc(100dvh - 26px);margin:13px 0 13px 13px;border-radius:21px}
}

/* Mobile PWA polish: compact, scroll-safe side drawer and high-contrast sign-in. */
@media (max-width:740px){
  .app{width:100%;overflow-x:clip}
  .sidebar{
    width:min(90vw,360px);max-width:calc(100vw - 16px);height:100vh;height:100dvh;max-height:100dvh;
    padding:max(10px,env(safe-area-inset-top)) 12px max(10px,env(safe-area-inset-bottom));
    gap:7px;overflow-x:hidden;overflow-y:scroll;overscroll-behavior-y:contain;scrollbar-width:none;
    -webkit-overflow-scrolling:touch;touch-action:pan-y;
    border:1px solid rgba(183,229,219,.18);border-left:0;border-radius:0 22px 22px 0;
  }
  .sidebar::-webkit-scrollbar{display:none}
  /* One touch-scroll area for the whole drawer; keep useful sections compact. */
  .sidebar>.logo{gap:9px;padding:0 3px;min-height:38px}
  .sidebar>.logo .logo-icon{width:36px;height:36px;flex-basis:36px;border-radius:11px}
  .sidebar>.logo strong{font-size:17px}
  .sidebar>.logo span{margin-top:2px;font-size:9px}
  .nav{flex:0 0 auto;min-height:0;max-height:none!important;padding:6px 2px;gap:3px;overflow:visible}
  .nav-btn{min-height:42px;padding:9px 10px;font-size:13px}
  .nav::before,.nav::after{display:none}
  .account-box{flex:0 0 auto;padding:8px 10px;margin:0}
  .account-box strong{font-size:11px}
  .account-box p{margin:3px 0 6px;font-size:10px;line-height:1.35}
  .account-actions{flex-direction:row;gap:6px}
  .account-actions .btn{min-height:32px;padding:6px 8px;font-size:10px}
  .milo-card{gap:8px;padding:9px;border-radius:13px}
  .milo-avatar{width:30px;height:30px;flex-basis:30px;border-radius:10px;font-size:13px}
  .milo-card strong,.ai-status strong{font-size:11px}
  .milo-card p,.ai-status p{margin:3px 0 6px;font-size:10px;line-height:1.33}
  .milo-card .btn,.ai-status .btn{min-height:29px;padding:5px 8px;font-size:9px}
  .ai-status{padding:9px;border-radius:13px}
  .progress-box{padding:9px;border-radius:13px}
  .progress-head{font-size:10px}
  .progress-head strong{font-size:11px}
  .progress-box p{margin:4px 0 7px;font-size:9px;line-height:1.3}
  .progress-bar{height:5px;margin:6px 0}
  .stats-row{gap:5px}
  .stats-row>div{padding:6px 4px;border-radius:8px}
  .stats-row strong{font-size:13px}
  .stats-row span{font-size:8px}
  .sidebar>.disclaimer{position:sticky;bottom:0;z-index:10;display:block!important;flex:0 0 auto;max-height:76px;overflow-y:auto;margin-top:auto;padding:7px 9px;border-color:rgba(240,108,151,.27);background:rgba(11,23,22,.96);backdrop-filter:blur(10px);font-size:9px;line-height:1.32}
  .top-actions,.bar-sound,.bar-actions{max-width:100%;min-width:0}
  .bar-actions .btn{min-width:0;overflow-wrap:anywhere}
  .modal-overlay#authModal{display:flex;align-items:center;justify-content:center;padding:12px;overflow-y:auto}
  #authModal .modal{width:100%;max-width:520px;color:var(--ink);background:#fff}
  #authModal .auth-tabs{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:5px}
  #authModal .auth-tab{min-width:0;padding:9px 4px;color:#45635E!important;background:#F2F8F6!important;font-size:11px;line-height:1.25}
  #authModal .auth-tab.active{color:#075D59!important;background:#DDF2EE!important;border-color:#0F8C86!important}
  #authModal .settings-actions{display:grid;grid-template-columns:1fr 1fr;gap:8px}
  #authModal #authSubmit{display:inline-flex!important;align-items:center;justify-content:center;min-height:44px;color:#063F3A!important;-webkit-text-fill-color:#063F3A!important;font-size:14px!important;font-weight:850!important;line-height:1.25!important;visibility:visible!important;background:linear-gradient(135deg,#C5F0E9,#A8E2D8)!important;border:1px solid #72C3B7!important;text-shadow:none;opacity:1!important}
  #authModal #authSubmit:disabled{opacity:.82!important}
  #authModal .settings-actions .btn-ghost{color:#0A6B66!important;-webkit-text-fill-color:#0A6B66!important;background:#fff!important}
}

/* Night theme: explicit foreground/background pairs for accessible contrast. */
html[data-theme="night"]{
  color-scheme:dark;
  --bg:#111925;--surface:#1B2635;--surface-soft:#222F40;--ink:#F2F5FB;--muted:#BBC7D7;
  --primary:#9BB8FF;--primary-dark:#B4C9FF;--primary-soft:#2B3B56;--pink:#E0B0FF;--pink-soft:#44364F;
  --peach:#413748;--border:#46566B;--sidebar:#111622;--sidebar-2:#1A2332;
  --shadow-sm:0 4px 14px rgba(0,0,0,.24);--shadow:0 12px 32px rgba(0,0,0,.32);--shadow-lg:0 22px 60px rgba(0,0,0,.44);
}
html[data-theme="night"] body{color:var(--ink);background:radial-gradient(900px 520px at 88% -12%,rgba(211,155,255,.12),transparent 66%),linear-gradient(160deg,#111925 0%,#172131 58%,#211D2B 100%)}
html[data-theme="night"] .sidebar{background:linear-gradient(155deg,var(--sidebar),var(--sidebar-2) 58%,#202A3A)}
html[data-theme="night"] .topbar{border-bottom-color:#3C4A5E}
html[data-theme="night"] .topbar h1,html[data-theme="night"] .card h2,html[data-theme="night"] .card h3,html[data-theme="night"] .field-label{color:#F2F5FB}
html[data-theme="night"] .topbar p,html[data-theme="night"] .muted,html[data-theme="night"] .range-labels{color:#BBC7D7}
html[data-theme="night"] .card,html[data-theme="night"] .modal,html[data-theme="night"] .view .card{color:var(--ink);background:#1B2635;border-color:#3C4A5E}
html[data-theme="night"] .journal-item{color:#F2F5FB!important;background:#1B2635!important;border-color:#3C4A5E!important}
html[data-theme="night"] .journal-item .meta{color:#BBC7D7!important}
html[data-theme="night"] .journal-item .meta .pill{color:#FFE4EF!important;background:#493449!important;border-color:#805A77!important}
html[data-theme="night"] .lib-card{color:#F2F5FB!important;background:#222F40!important;border-color:#46566B!important}
html[data-theme="night"] .lib-card h4{color:#F2F5FB!important}
html[data-theme="night"] .lib-card p,html[data-theme="night"] .lib-card .body{color:#BBC7D7!important}
html[data-theme="night"] .wheel-word{color:#DCE6F2!important;background:#28374B!important;border-color:#526278!important}
html[data-theme="night"] .wheel-word b{color:#F2F5FB!important}
html[data-theme="night"] .wheel-word span{color:#BBC7D7!important}
html[data-theme="night"] .wheel-word i{color:#C6D3FF!important}
html[data-theme="night"] .wheel-group{border-top-color:#46566B!important}
html[data-theme="night"] .wheel-group-btn{color:#F2F5FB!important;background:#28374B!important}
html[data-theme="night"] .wheel-group-btn.selected,html[data-theme="night"] .wheel-word.selected{color:#111925!important;background:#B4C9FF!important;border-color:#D0DDFF!important}
html[data-theme="night"] .wheel-reflection{color:#F2F5FB!important;background:#2B2834!important}
html[data-theme="night"] .wheel-reflection-word{color:#F2F5FB!important}
html[data-theme="night"] .wheel-reflection-text{color:#D2DBE8!important}
html[data-theme="night"] .wheel-reflection-note,html[data-theme="night"] .wheel-detail-intro,html[data-theme="night"] .wheel-disclaimer{color:#BBC7D7!important}
html[data-theme="night"] .wheel-detail h3,html[data-theme="night"] .wheel-empty h3{color:#F2F5FB!important}
html[data-theme="night"] .wheel-empty{color:#F2F5FB!important;background:#222F40!important;border-color:#46566B!important}
html[data-theme="night"] .ex-review-item{color:#F2F5FB!important;background:#222F40!important;border-color:#46566B!important}
html[data-theme="night"] .ex-review-item p{color:#D2DBE8!important}
html[data-theme="night"] .ex-review-item.ok{border-left-color:#79D6BA!important}
html[data-theme="night"] .ex-review-item.no{color:#F2F5FB!important;background:#3A2D3B!important;border-left-color:#F0A9C0!important}
html[data-theme="night"] .ex-extra{color:#E9DDCC!important;background:#39332D!important;border-color:#6E5D49!important}
html[data-theme="night"] input:not([type="range"]):not([type="checkbox"]):not([type="radio"]),html[data-theme="night"] textarea,html[data-theme="night"] select{color:#F2F5FB!important;-webkit-text-fill-color:#F2F5FB!important;background:#182332!important;border-color:#526278!important;caret-color:#F2F5FB!important;opacity:1!important}
html[data-theme="night"] input::placeholder,html[data-theme="night"] textarea::placeholder{color:#AAB8CA!important;-webkit-text-fill-color:#AAB8CA!important;opacity:1!important}
html[data-theme="night"] .emotion-btn,html[data-theme="night"] .chip,html[data-theme="night"] .tab,html[data-theme="night"] .sim-card,html[data-theme="night"] .choice-btn,html[data-theme="night"] .provider-item{color:#F2F5FB!important;-webkit-text-fill-color:#F2F5FB!important;background:#28374B!important;border-color:#526278!important}
html[data-theme="night"] .emotion-btn:hover,html[data-theme="night"] .chip:hover,html[data-theme="night"] .tab:hover,html[data-theme="night"] .sim-card:hover,html[data-theme="night"] .choice-btn:hover{background:#32445C!important;border-color:#8196B2!important}
html[data-theme="night"] .emotion-btn.selected,html[data-theme="night"] .provider-item.active{color:#FFFFFF!important;-webkit-text-fill-color:#FFFFFF!important;background:#3C5377!important;border-color:#B4C9FF!important}
html[data-theme="night"] .chip.selected,html[data-theme="night"] .tab.active{color:#111925!important;-webkit-text-fill-color:#111925!important;background:#B4C9FF!important;border-color:#D0DDFF!important}
html[data-theme="night"] .i-statement{color:#F2F5FB;background:#222F40;border-color:#526278}
html[data-theme="night"] .i-statement span{color:#D2DBE8}
html[data-theme="night"] .preview-box{color:#F2F5FB;background:#26374B;border-color:#526A83}
html[data-theme="night"] .scenario-box,html[data-theme="night"] .tips,html[data-theme="night"] .recent-item{color:#F2F5FB;background:#222F40;border-color:#46566B}
html[data-theme="night"] .scenario-box strong,html[data-theme="night"] .tips strong{color:#F2F5FB}
html[data-theme="night"] .btn-ghost{color:#F1F4FA!important;-webkit-text-fill-color:#F1F4FA!important;background:#263549!important;border-color:#52647A!important}
html[data-theme="night"] .btn-ghost:hover{color:#FFFFFF!important;-webkit-text-fill-color:#FFFFFF!important;background:#31435A!important;border-color:#8196B2!important}
html[data-theme="night"] .btn-secondary{color:#FFE7F1!important;-webkit-text-fill-color:#FFE7F1!important;background:#493449!important;border-color:#805A77!important}
html[data-theme="night"] .btn-secondary:hover{color:#FFFFFF!important;-webkit-text-fill-color:#FFFFFF!important;background:#5A3D58!important;border-color:#A8789A!important}
/* Big Five response buttons: the light default surface paired with night-theme ink made the labels disappear. */
html[data-theme="night"] .bf-opt{color:#F2F5FB!important;-webkit-text-fill-color:#F2F5FB!important;background:#28374B!important;border-color:#526278!important}
html[data-theme="night"] .bf-opt:hover{color:#FFFFFF!important;-webkit-text-fill-color:#FFFFFF!important;background:#32445C!important;border-color:#8196B2!important}
html[data-theme="night"] .bf-opt b{color:#FFFFFF!important;-webkit-text-fill-color:#FFFFFF!important;background:#3C5377!important}
/* Chat: avoid light hard-coded surfaces with night-theme white text; keep every bubble legible. */
html[data-theme="night"] .chat-head{color:#F2F5FB!important;background:#222F40!important;border-bottom-color:#46566B!important}
html[data-theme="night"] .chat-head .milo-avatar{color:#111925!important;-webkit-text-fill-color:#111925!important}
html[data-theme="night"] .chat-messages{background:#141E2C!important}
html[data-theme="night"] .msg.milo{color:#F2F5FB!important;background:#28374B!important;border-color:#526278!important}
html[data-theme="night"] .msg.user{color:#111925!important;-webkit-text-fill-color:#111925!important;background:#B4C9FF!important;border-color:#D0DDFF!important}
html[data-theme="night"] .msg .who{color:#D2DBE8!important;opacity:1!important}
html[data-theme="night"] .msg .speak-btn{color:#E4EAFF!important;-webkit-text-fill-color:#E4EAFF!important;background:#3C5377!important;border-color:#7187A7!important}
html[data-theme="night"] .quick-prompts{border-color:#46566B!important}
html[data-theme="night"] .chat-form{background:#1B2635!important;border-color:#46566B!important}
html[data-theme="night"] .chat-voice-bar{color:#F2F5FB!important;background:#222F40!important;border-color:#46566B!important}
html[data-theme="night"] .express-msg{color:#F2F5FB!important;background:#28374B!important;border-color:#526278!important}
html[data-theme="night"] .express-msg.milo{background:#26384A!important;border-color:#526A83!important}
html[data-theme="night"] .express-msg.user{color:#111925!important;background:#B4C9FF!important;border-color:#D0DDFF!important}
html[data-theme="night"] .icon-btn,html[data-theme="night"] .hamburger{color:#F1F4FA!important;-webkit-text-fill-color:#F1F4FA!important;background:#263549!important;border-color:#52647A!important}
html[data-theme="night"] .quick-prompts{background:#1B2635!important}
html[data-theme="night"] .quick-prompts button{color:#F2F5FB!important;-webkit-text-fill-color:#F2F5FB!important;background:#263549!important;border-color:#52647A!important}
html[data-theme="night"] .date-pill{color:#F2F5FB;background:#263549;border-color:#52647A}
html[data-theme="night"] .success-msg{color:#B7E4D8}
html[data-theme="night"] a{color:#B4C9FF}
html[data-theme="night"] #authModal .modal{color:#F2F5FB!important;background:#1B2635!important;border-color:#46566B!important}
html[data-theme="night"] #authModal label,html[data-theme="night"] #authModal p,html[data-theme="night"] #authModal h2,html[data-theme="night"] #authModal h3{color:#F2F5FB}
html[data-theme="night"] #authModal .auth-tab{color:#E4EAF4!important;-webkit-text-fill-color:#E4EAF4!important;background:#273449!important;border-color:#52647A!important}
html[data-theme="night"] #authModal .auth-tab.active{color:#FFFFFF!important;-webkit-text-fill-color:#FFFFFF!important;background:#354B68!important;border-color:#B4C9FF!important}
html[data-theme="night"] #authModal .settings-actions .btn-ghost{color:#F1F4FA!important;-webkit-text-fill-color:#F1F4FA!important;background:#263549!important;border-color:#52647A!important}

html[data-theme="lilac"]{
  color-scheme:light;
  --bg:#F6F2FB;--surface:#FFFFFF;--surface-soft:#FBF8FF;--ink:#28243A;--muted:#716A83;
  --primary:#7966B8;--primary-dark:#5E4A9D;--primary-soft:#EEE8FB;--pink:#C978A6;--pink-soft:#F8EAF2;
  --peach:#FBF0E8;--border:#E5DCF1;--sidebar:#28243A;--sidebar-2:#39324F;
  --shadow-sm:0 4px 14px rgba(56,44,82,.07);--shadow:0 12px 32px rgba(56,44,82,.11);--shadow-lg:0 22px 60px rgba(56,44,82,.18);
}
html[data-theme="lilac"] body{background:radial-gradient(900px 520px at 88% -12%,rgba(201,120,166,.13),transparent 66%),linear-gradient(160deg,#FBF8FF 0%,#F2ECFA 60%,#FCEEF4 100%)}
html[data-theme="lilac"] .sidebar{background:linear-gradient(155deg,var(--sidebar),var(--sidebar-2) 58%,#423957)}
