:root {
  --bg: #08110d;
  --text: rgba(255,255,255,.96);
  --muted: rgba(255,255,255,.58);
  --soft: rgba(255,255,255,.36);
  --glass-alpha: .14;
  --glass: rgba(255,255,255,var(--glass-alpha));
  --glass-soft: rgba(255,255,255,.075);
  --line: rgba(255,255,255,.18);
  --line-soft: rgba(255,255,255,.11);
  --shadow: 0 20px 60px rgba(0,0,0,.33);
  --radius-lg: 28px;
  --radius-md: 22px;
  --radius-sm: 16px;
  --ease: cubic-bezier(.2,.75,.25,1);
}

* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; background: #030605; }
body { color: var(--text); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, input, textarea, select { font: inherit; }
button { color: inherit; }
button, [role="button"] { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 2px solid rgba(255,255,255,.72); outline-offset: 2px; }
.hidden { display: none !important; }
.visually-hidden { position:absolute!important; width:1px!important; height:1px!important; padding:0!important; margin:-1px!important; overflow:hidden!important; clip:rect(0,0,0,0)!important; white-space:nowrap!important; border:0!important; }

.app-shell {
  width: 100%; height: 100%; display: grid; place-items: center; background: #030605;
}
.device {
  width: min(430px, 100vw);
  height: min(900px, 100vh);
  position: relative;
  overflow: hidden;
  border-radius: 46px;
  background: var(--bg);
  box-shadow: 0 34px 110px rgba(0,0,0,.7), 0 0 0 10px #080a09, 0 0 0 11px rgba(255,255,255,.09);
  isolation: isolate;
}
@media (max-width: 520px), (max-height: 930px) {
  .device { width: 100vw; height: 100vh; border-radius: 0; box-shadow: none; }
}

.background-stack, .theme-scene, .theme-blur, .theme-scrim { position: absolute; inset: 0; }
.background-stack { z-index: -3; background: #07100c; overflow: hidden; }
.theme-scene, .theme-blur {
  background-size: cover;
  background-position: center;
  transition: opacity .85s var(--ease), transform 1.2s var(--ease), filter .85s var(--ease);
  will-change: opacity, transform, filter;
}
.theme-scene { filter: saturate(.9) brightness(.72); transform: scale(1.02); }
.theme-blur {
  filter: blur(24px) saturate(.82) brightness(.68);
  transform: scale(1.11);
  opacity: .88;
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 21%, rgba(0,0,0,.88) 38%, transparent 68%);
  mask-image: linear-gradient(to bottom, #000 0%, #000 21%, rgba(0,0,0,.88) 38%, transparent 68%);
}
.theme-scrim {
  background:
    linear-gradient(to bottom, rgba(3,8,6,.22) 0%, rgba(3,8,6,.08) 22%, rgba(3,8,6,.25) 48%, rgba(3,8,6,.93) 100%),
    radial-gradient(circle at 50% 25%, transparent 0%, rgba(0,0,0,.12) 60%, rgba(0,0,0,.42) 100%);
}
.bg-layer { position: absolute; inset: 0; transition: opacity .9s var(--ease); }
.bg-layer.is-hidden { opacity: 0; }

.statusbar {
  flex: 0 0 auto; height: 45px; display: flex; align-items: center; justify-content: space-between;
  padding: 12px 24px 0; font-size: 12px; font-weight: 600; letter-spacing: -.01em; z-index: 10;
}
.status-icons { display: flex; align-items: center; gap: 6px; }
.status-icons svg { width: 16px; height: 16px; fill: currentColor; }

.screen {
  position: absolute; inset: 0; display: flex; flex-direction: column; opacity: 1; transform: translate3d(0,0,0);
  transition: opacity .34s ease, transform .46s var(--ease); pointer-events: auto;
}
.screen.is-hidden { opacity: 0; transform: translate3d(0,12px,0); pointer-events: none; }
.screen.is-left { transform: translate3d(-5%,0,0); }
.scroll { overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.scroll::-webkit-scrollbar { display:none; }

.serif { font-family: "Playfair Display", Georgia, serif; }
.eyebrow { text-transform: uppercase; font-size: 10px; letter-spacing: .14em; color: var(--soft); font-weight: 600; }
.muted { color: var(--muted); }
.soft { color: var(--soft); }

.icon-btn {
  width: 44px; height: 44px; border: 1px solid var(--line-soft); border-radius: 999px;
  display: grid; place-items: center; background: rgba(255,255,255,.08); backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px); cursor:pointer; transition: .22s ease;
}
.icon-btn:hover { background: rgba(255,255,255,.14); }
.icon-btn:active { transform: scale(.96); }
.icon-btn svg { width: 20px; height: 20px; }

.btn {
  border: 0; border-radius: 999px; min-height: 48px; padding: 0 20px; display: inline-flex; align-items:center; justify-content:center;
  gap: 9px; font-size: 14px; font-weight: 600; cursor:pointer; transition: transform .18s ease, background .18s ease, opacity .18s ease;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .42; cursor:not-allowed; }
.btn-primary { background: rgba(255,255,255,.95); color:#101512; box-shadow: 0 12px 28px rgba(0,0,0,.25); }
.btn-primary:hover { background:#fff; }
.btn-glass { background: rgba(255,255,255,.12); border:1px solid var(--line); color:var(--text); backdrop-filter: blur(18px); }
.btn-danger { background: rgba(229,84,84,.16); border:1px solid rgba(255,126,126,.28); color:#ffc1c1; }
.btn-small { min-height: 40px; padding:0 15px; font-size:13px; }
.btn-wide { width:100%; }

.glass {
  background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(24px) saturate(1.08);
  -webkit-backdrop-filter: blur(24px) saturate(1.08); box-shadow: var(--shadow);
}
.glass-soft {
  background: var(--glass-soft); border: 1px solid var(--line-soft); backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

/* Lock and intro */
.lock-screen { z-index: 80; background: transparent; }
.lock-screen .lock-panel {
  margin-top: auto; padding: 20px 28px calc(34px + env(safe-area-inset-bottom));
  border-radius: 36px 36px 0 0; border: 1px solid rgba(255,255,255,.18); border-bottom:0;
  background: rgba(10,18,14,.55); backdrop-filter: blur(28px); -webkit-backdrop-filter: blur(28px);
}
.lock-handle { width: 44px; height: 4px; border-radius:99px; background:rgba(255,255,255,.25); margin:0 auto 22px; }
.lock-mark { width:58px; height:58px; border-radius:20px; display:grid; place-items:center; margin:0 auto 19px; background:rgba(255,255,255,.12); border:1px solid rgba(255,255,255,.16); }
.lock-mark svg { width:26px; height:26px; }
.lock-title { margin:0; font-size:32px; text-align:center; font-weight:400; }
.lock-copy { margin:7px 0 24px; text-align:center; color:var(--muted); font-size:13px; }
.pin-dots { display:flex; justify-content:center; gap:14px; margin: 2px 0 22px; }
.pin-dot { width:13px; height:13px; border:1px solid rgba(255,255,255,.45); border-radius:50%; transition:.2s ease; }
.pin-dot.filled { background:#fff; border-color:#fff; transform:scale(1.06); }
.pin-keypad { display:grid; grid-template-columns:repeat(3,1fr); gap:11px; max-width:300px; margin:0 auto; }
.pin-key {
  height:54px; border:1px solid rgba(255,255,255,.13); border-radius:18px; background:rgba(255,255,255,.07);
  color:#fff; font-size:19px; cursor:pointer; transition:.16s ease; backdrop-filter: blur(12px);
}
.pin-key:active { transform:scale(.95); background:rgba(255,255,255,.15); }
.pin-key.utility { color:rgba(255,255,255,.62); font-size:13px; }
.pin-error { min-height:18px; margin:9px 0 0; text-align:center; color:#ffc0c0; font-size:12px; }

.intro-screen { z-index:75; overflow:hidden; background:#06100c; }
.intro-image { position:absolute; inset:-4%; background-size:cover; background-position:center; filter:brightness(.72) saturate(.86) blur(2px); }
.intro-screen.playing .intro-image { animation:introZoom 2.55s var(--ease) forwards; }
.intro-overlay { position:absolute; inset:0; background:linear-gradient(to bottom,rgba(3,8,6,.22),rgba(3,8,6,.2) 45%,rgba(3,8,6,.85)); }
.intro-content { position:relative; margin:auto 0 82px; text-align:center; padding:0 28px; opacity:0; transform:translateY(12px); }
.intro-screen.playing .intro-content { animation:introText 1.8s .35s var(--ease) forwards; }
.intro-content h2 { margin:0; font-size:34px; font-weight:400; }
.intro-content p { margin:8px 0 0; font-size:13px; color:rgba(255,255,255,.67); }
@keyframes introZoom { from{transform:scale(.94); filter:brightness(.68) saturate(.82) blur(3px);} to{transform:scale(1.08); filter:brightness(.76) saturate(.9) blur(0);} }
@keyframes introText { 0%{opacity:0;transform:translateY(12px)} 40%,78%{opacity:1;transform:translateY(0)} 100%{opacity:0;transform:translateY(-5px)} }

/* Dashboard */
.dashboard-scroll { padding: 8px 22px 40px; }
.dashboard-head { display:flex; align-items:flex-start; justify-content:space-between; margin: 7px 0 10px; }
.dashboard-head h1 { font-size:34px; line-height:1.05; font-weight:400; margin:0; }
.dashboard-head p { font-size:18px; margin:7px 0 0; color:rgba(255,255,255,.72); }
.head-actions { display:flex; gap:9px; }
.avatar-btn { overflow:hidden; font-size:12px; font-weight:600; }
.avatar-btn img, .profile-avatar img { width:100%; height:100%; object-fit:cover; }

.next-card { padding:20px; border-radius:var(--radius-lg); margin: 20px 0 30px; cursor:pointer; position:relative; overflow:hidden; }
.next-card::after { content:""; position:absolute; inset:0; background:linear-gradient(135deg,rgba(255,255,255,.07),transparent 45%); pointer-events:none; }
.next-row { display:flex; align-items:flex-start; justify-content:space-between; gap:14px; }
.next-label { font-size:11px; color:rgba(255,255,255,.72); margin-bottom:9px; }
.next-title { margin:0; font-size:21px; font-weight:600; }
.next-date { margin:5px 0 0; font-size:13px; color:var(--muted); }
.next-focus { margin:15px 0 0; font-family:"Playfair Display",Georgia,serif; font-size:18px; line-height:1.35; max-width:260px; }
.therapist-badge { width:44px; height:44px; border-radius:50%; display:grid; place-items:center; border:1px solid var(--line); background:rgba(255,255,255,.11); font-family:"Playfair Display",Georgia,serif; font-size:12px; }
.card-actions { display:flex; gap:11px; margin-top:19px; }
.card-actions .btn { flex:1; min-width:0; }

.section-title { font-family:"Playfair Display",Georgia,serif; font-size:23px; font-weight:400; margin:0 0 14px; }
.session-list { display:flex; flex-direction:column; gap:13px; }
.session-card { border-radius:22px; padding:17px 18px; cursor:pointer; position:relative; overflow:hidden; transition:background .2s ease, transform .18s ease; }
.session-card:hover { background:rgba(255,255,255,.12); }
.session-card:active { transform:scale(.992); }
.session-top { display:flex; align-items:center; justify-content:space-between; gap:14px; }
.session-date { font-size:13px; color:rgba(255,255,255,.75); }
.session-focus { font-size:15px; margin:10px 0 12px; line-height:1.35; }
.tag-row { display:flex; flex-wrap:wrap; gap:7px; }
.tag { padding:7px 10px; border-radius:11px; background:rgba(255,255,255,.08); border:1px solid rgba(255,255,255,.06); color:rgba(255,255,255,.74); font-size:11px; }
.progress-pill { display:flex; align-items:center; gap:6px; white-space:nowrap; color:rgba(255,255,255,.78); font-size:12px; }
.progress-ring { width:19px; height:19px; border-radius:50%; border:1.5px solid rgba(255,255,255,.55); display:grid; place-items:center; font-size:10px; }
.empty-state { padding:26px 20px; text-align:center; border-radius:22px; color:var(--muted); }
.empty-state strong { display:block; color:var(--text); margin-bottom:6px; font-size:15px; }

/* Session detail */
.topbar { display:grid; grid-template-columns:44px 1fr 44px; align-items:center; gap:12px; padding:8px 20px 13px; }
.topbar-center { text-align:center; min-width:0; }
.topbar-center h2 { margin:0; font-size:23px; font-weight:400; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; }
.topbar-center p { margin:3px 0 0; font-size:12px; color:var(--muted); }
.tabs { display:flex; gap:9px; padding:0 22px 16px; }
.tab { flex:1; height:43px; border-radius:999px; border:1px solid var(--line-soft); background:rgba(255,255,255,.06); color:rgba(255,255,255,.55); cursor:pointer; transition:.2s ease; }
.tab.active { background:rgba(255,255,255,.16); border-color:var(--line); color:#fff; }
.session-content { padding:0 22px 36px; }
.progress-copy { font-size:12px; color:var(--muted); margin:1px 0 13px; }

.assignment-list { display:flex; flex-direction:column; gap:13px; }
.swipe-wrap { position:relative; overflow:hidden; border-radius:22px; touch-action:pan-y; }
.swipe-delete { position:absolute; inset:0; display:flex; justify-content:flex-end; align-items:center; background:rgba(205,62,62,.92); padding-right:24px; opacity:0; }
.swipe-delete button { background:transparent; border:0; color:#fff; display:grid; place-items:center; gap:3px; font-size:11px; }
.assignment-card { position:relative; border-radius:22px; padding:18px; transition:transform .22s ease; }
.assignment-row { display:flex; align-items:flex-start; gap:13px; }
.check-btn { flex:0 0 auto; width:25px; height:25px; border-radius:50%; border:1px solid rgba(255,255,255,.45); background:transparent; display:grid; place-items:center; cursor:pointer; margin-top:2px; }
.check-btn svg { width:14px; height:14px; opacity:0; }
.assignment-card.completed .check-btn { background:#fff; color:#101512; border-color:#fff; }
.assignment-card.completed .check-btn svg { opacity:1; }
.assignment-copy { flex:1; min-width:0; }
.assignment-copy h3 { margin:0; font-size:15px; line-height:1.35; font-weight:600; }
.assignment-copy p { margin:6px 0 0; color:var(--muted); line-height:1.55; font-size:13px; }
.assignment-card.completed .assignment-copy { opacity:.48; }
.completed-at { margin-top:9px!important; font-size:11px!important; }
.item-menu { flex:0 0 auto; border:0; background:transparent; color:var(--soft); width:28px; height:28px; cursor:pointer; }
.add-row { margin-top:17px; }

/* Notes */
.note-composer { border-radius:23px; padding:18px; margin-bottom:14px; }
.note-composer label { display:block; font-size:15px; font-weight:600; margin-bottom:10px; }
.note-composer textarea { width:100%; min-height:92px; border:0; resize:none; background:transparent; color:#fff; line-height:1.6; font-size:14px; }
.note-composer textarea::placeholder, .field input::placeholder, .field textarea::placeholder { color:rgba(255,255,255,.34); }
.composer-actions { display:flex; gap:10px; margin-top:12px; }
.composer-actions .btn { flex:1; }
.note-list { display:flex; flex-direction:column; gap:12px; }
.note-card { border-radius:18px; padding:15px 16px; cursor:pointer; }
.note-meta { display:flex; justify-content:space-between; gap:10px; align-items:center; font-size:11px; color:var(--soft); margin-bottom:9px; }
.note-tools { display:flex; gap:8px; align-items:center; }
.note-tools button { border:0; background:transparent; color:var(--soft); padding:2px; cursor:pointer; }
.note-body { margin:0; color:rgba(255,255,255,.76); font-size:13px; line-height:1.55; display:-webkit-box; -webkit-line-clamp:3; -webkit-box-orient:vertical; overflow:hidden; }
.audio-row { display:grid; grid-template-columns:34px 1fr auto; gap:10px; align-items:center; }
.audio-play { width:34px; height:34px; border-radius:50%; border:0; background:rgba(255,255,255,.11); color:#fff; display:grid; place-items:center; cursor:pointer; }
.audio-track { height:5px; background:rgba(255,255,255,.11); border-radius:99px; overflow:hidden; cursor:pointer; }
.audio-progress { width:0; height:100%; background:rgba(255,255,255,.55); border-radius:99px; }
.audio-time { font-size:11px; color:var(--soft); min-width:38px; text-align:right; }

/* Profile */
.profile-scroll { padding:0 22px 38px; }
.profile-hero { display:flex; flex-direction:column; align-items:center; margin:5px 0 28px; }
.profile-avatar { width:82px; height:82px; border-radius:50%; display:grid; place-items:center; overflow:hidden; font-size:24px; font-weight:600; margin-bottom:12px; position:relative; }
.profile-avatar-edit { position:absolute; right:-2px; bottom:-2px; width:30px; height:30px; border-radius:50%; background:#fff; color:#101512; display:grid; place-items:center; border:3px solid #122019; cursor:pointer; }
.profile-hero h3 { font-size:24px; font-weight:400; margin:0; }
.profile-hero p { margin:4px 0 0; color:var(--muted); font-size:12px; }
.settings-section { margin-bottom:27px; }
.settings-section h4 { margin:0 0 5px; font-size:11px; letter-spacing:.13em; text-transform:uppercase; color:rgba(255,255,255,.7); }
.settings-help { margin:0 0 13px; font-size:12px; color:var(--soft); line-height:1.5; }
.theme-grid { display:grid; grid-template-columns:1fr 1fr; gap:11px; }
.theme-option { height:102px; border-radius:18px; border:2px solid transparent; overflow:hidden; background-size:cover; background-position:center; position:relative; cursor:pointer; }
.theme-option::after { content:""; position:absolute; inset:0; background:linear-gradient(to top,rgba(0,0,0,.74),transparent 66%); }
.theme-option span { position:absolute; left:11px; bottom:10px; z-index:2; font-size:12px; font-weight:600; }
.theme-option i { position:absolute; top:9px; right:9px; z-index:3; width:22px; height:22px; border-radius:50%; background:#fff; color:#111; display:none; place-items:center; font-style:normal; font-size:12px; }
.theme-option.active { border-color:#fff; }
.theme-option.active i { display:grid; }
.theme-option.wide { grid-column:1 / -1; }
.settings-card { border-radius:18px; overflow:hidden; }
.settings-row { min-height:56px; padding:12px 15px; display:flex; align-items:center; justify-content:space-between; gap:14px; border-bottom:1px solid rgba(255,255,255,.075); }
.settings-row:last-child { border-bottom:0; }
.settings-row label { font-size:13px; color:rgba(255,255,255,.78); }
.settings-row input[type="text"], .settings-row select { width:55%; border:0; background:transparent; color:#fff; text-align:right; outline:none; font-size:13px; }
.settings-row select option { color:#111; }
.range-row { display:block; }
.range-row input { width:100%; margin-top:10px; accent-color:#fff; }
.toggle { width:44px; height:26px; border-radius:99px; background:rgba(255,255,255,.13); border:1px solid rgba(255,255,255,.12); padding:3px; cursor:pointer; transition:.2s ease; }
.toggle::after { content:""; display:block; width:18px; height:18px; border-radius:50%; background:rgba(255,255,255,.72); transition:.2s ease; }
.toggle.on { background:rgba(255,255,255,.92); }
.toggle.on::after { transform:translateX(18px); background:#1b251f; }
.profile-actions { display:grid; gap:10px; }

/* Sheets and dialogs */
.modal-root { position:absolute; inset:0; z-index:100; pointer-events:none; }
.modal-root.open { pointer-events:auto; }
.modal-backdrop { position:absolute; inset:0; background:rgba(0,0,0,.48); opacity:0; transition:.24s ease; backdrop-filter:blur(4px); }
.modal-root.open .modal-backdrop { opacity:1; }
.sheet { position:absolute; left:0; right:0; bottom:0; max-height:89%; overflow:auto; border-radius:32px 32px 0 0; padding:12px 22px calc(28px + env(safe-area-inset-bottom)); background:rgba(13,24,18,.93); border:1px solid rgba(255,255,255,.18); border-bottom:0; backdrop-filter:blur(30px); transform:translateY(104%); transition:transform .42s var(--ease); box-shadow:0 -20px 60px rgba(0,0,0,.38); }
.modal-root.open .sheet { transform:translateY(0); }
.sheet-handle { width:43px; height:4px; border-radius:99px; background:rgba(255,255,255,.24); margin:0 auto 17px; }
.sheet-head { display:flex; align-items:center; justify-content:space-between; margin-bottom:18px; }
.sheet-head h3 { margin:0; font-family:"Playfair Display",Georgia,serif; font-size:24px; font-weight:400; }
.sheet-close { border:0; background:rgba(255,255,255,.08); width:38px; height:38px; border-radius:50%; color:#fff; cursor:pointer; }
.form-grid { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.field { display:block; margin-bottom:13px; }
.field.full { grid-column:1 / -1; }
.field span { display:block; color:rgba(255,255,255,.58); font-size:11px; margin:0 0 7px 3px; }
.field input, .field textarea, .field select {
  width:100%; min-height:51px; border:1px solid rgba(255,255,255,.14); border-radius:16px; background:rgba(255,255,255,.07); color:#fff; padding:0 14px; outline:none;
}
.field textarea { min-height:92px; resize:vertical; padding-top:13px; line-height:1.5; }
.field select option { color:#111; }
.field input:focus, .field textarea:focus, .field select:focus { border-color:rgba(255,255,255,.4); }
.sheet-actions { display:flex; gap:10px; margin-top:7px; }
.sheet-actions .btn { flex:1; }
.menu-list { display:flex; flex-direction:column; gap:6px; }
.menu-action { min-height:49px; border:0; border-radius:15px; background:rgba(255,255,255,.06); color:rgba(255,255,255,.84); display:flex; align-items:center; gap:11px; padding:0 14px; cursor:pointer; text-align:left; }
.menu-action.danger { color:#ffc0c0; background:rgba(231,77,77,.1); }

.dialog { position:absolute; left:22px; right:22px; top:50%; transform:translateY(-44%) scale(.97); opacity:0; border-radius:24px; padding:21px; background:rgba(13,24,18,.96); border:1px solid var(--line); backdrop-filter:blur(28px); transition:.26s var(--ease); }
.modal-root.open .dialog { transform:translateY(-50%) scale(1); opacity:1; }
.dialog h3 { font-family:"Playfair Display",Georgia,serif; margin:0 0 9px; font-size:23px; font-weight:400; }
.dialog p { margin:0 0 18px; color:var(--muted); font-size:13px; line-height:1.55; }
.dialog-actions { display:flex; gap:10px; }
.dialog-actions .btn { flex:1; }

.note-detail-text { color:rgba(255,255,255,.82); font-size:14px; line-height:1.7; white-space:pre-wrap; }
.note-detail-textarea { width:100%; min-height:270px; border:1px solid var(--line-soft); border-radius:18px; background:rgba(255,255,255,.06); color:#fff; padding:15px; resize:vertical; line-height:1.65; outline:none; }

.recorder-wrap { text-align:center; padding:4px 0 7px; }
.recorder-orb { width:116px; height:116px; border-radius:50%; margin:17px auto; display:grid; place-items:center; background:rgba(255,255,255,.12); border:1px solid rgba(255,255,255,.22); box-shadow:0 0 0 0 rgba(255,130,130,.24); }
.recorder-orb.recording { animation:pulse 1.8s ease-in-out infinite; background:rgba(211,75,75,.2); }
.recorder-orb svg { width:44px; height:44px; }
.recorder-time { font-family:"Playfair Display",Georgia,serif; font-size:38px; margin:0; }
.recorder-status { color:var(--muted); font-size:12px; margin:5px 0 18px; }
.recorder-controls { display:flex; gap:10px; }
.recorder-controls .btn { flex:1; }
@keyframes pulse { 0%,100%{box-shadow:0 0 0 0 rgba(255,130,130,.18)} 50%{box-shadow:0 0 0 18px rgba(255,130,130,0)} }

.toast { position:absolute; left:50%; bottom:26px; transform:translate(-50%,18px); opacity:0; z-index:130; border:1px solid var(--line); border-radius:999px; background:rgba(5,10,7,.86); backdrop-filter:blur(18px); padding:10px 15px; font-size:12px; white-space:nowrap; pointer-events:none; transition:.28s ease; }
.toast.show { opacity:1; transform:translate(-50%,0); }

.context-menu { position:absolute; z-index:110; min-width:164px; padding:7px; border-radius:17px; background:rgba(7,13,10,.94); border:1px solid var(--line); backdrop-filter:blur(20px); box-shadow:0 16px 42px rgba(0,0,0,.4); }
.context-menu button { width:100%; min-height:40px; border:0; border-radius:11px; background:transparent; color:rgba(255,255,255,.82); text-align:left; padding:0 11px; cursor:pointer; }
.context-menu button:hover { background:rgba(255,255,255,.07); }
.context-menu button.danger { color:#ffb9b9; }

.no-upcoming { padding:22px; border-radius:var(--radius-lg); margin:20px 0 30px; }
.no-upcoming h3 { margin:0 0 6px; font-size:18px; }
.no-upcoming p { margin:0 0 16px; font-size:13px; color:var(--muted); }

@media (max-width: 360px) {
  .dashboard-scroll, .session-content, .profile-scroll { padding-left:17px; padding-right:17px; }
  .tabs { padding-left:17px; padding-right:17px; }
  .dashboard-head h1 { font-size:30px; }
  .next-focus { font-size:17px; }
  .card-actions { flex-direction:column; }
  .form-grid { grid-template-columns:1fr; }
  .field.full { grid-column:auto; }
}

/* Reduced motion is controlled only by the in-app setting, which defaults to off. */
body.reduce-motion *, body.reduce-motion *::before, body.reduce-motion *::after { animation-duration:.01ms!important; animation-iteration-count:1!important; transition-duration:.01ms!important; }

/* ============================================================
   v2.1 responsive application shell and dashboard refinements
   ============================================================ */
html, body { height: 100%; min-height: 100%; }
.app-shell { min-height: 100dvh; height: 100dvh; }
.device {
  width: 100%;
  height: 100dvh;
  max-width: none;
  max-height: none;
  border-radius: 0;
  box-shadow: none;
}

/* The browser or installed PWA already provides its own status chrome. */
.statusbar { display: none !important; }

.dashboard-scroll {
  width: min(100%, 1180px);
  margin: 0 auto;
  padding: calc(28px + env(safe-area-inset-top)) clamp(18px, 4vw, 54px) calc(42px + env(safe-area-inset-bottom));
}
.dashboard-head { margin: 0 0 12px; }
.dashboard-title-group { min-width: 0; }
.dashboard-footer { text-align:center; padding:38px 0 8px; color:rgba(255,255,255,.64); }
.dashboard-footer p { font-size:12px; margin:8px 0 0; }

.topbar {
  width: min(100%, 900px);
  margin: 0 auto;
  padding: calc(22px + env(safe-area-inset-top)) clamp(18px, 3vw, 28px) 13px;
}
.tabs {
  width: min(100%, 900px);
  margin: 0 auto;
  padding-left: clamp(18px, 3vw, 28px);
  padding-right: clamp(18px, 3vw, 28px);
}
.session-content {
  width: min(100%, 900px);
  margin: 0 auto;
  padding-left: clamp(18px, 3vw, 28px);
  padding-right: clamp(18px, 3vw, 28px);
  padding-bottom: calc(38px + env(safe-area-inset-bottom));
}
.profile-scroll {
  width: min(100%, 920px);
  margin: 0 auto;
  padding-left: clamp(18px, 3vw, 30px);
  padding-right: clamp(18px, 3vw, 30px);
  padding-bottom: calc(40px + env(safe-area-inset-bottom));
}

/* Dashboard entrance: a restrained stagger with fade, lift and blur. */
.dashboard-reveal {
  opacity: 0;
  transform: translate3d(0, 18px, 0) scale(.988);
  filter: blur(7px);
  animation: dashboardReveal .68s var(--ease) forwards;
  animation-delay: var(--reveal-delay, 0ms);
  will-change: opacity, transform, filter;
}
@keyframes dashboardReveal {
  0% { opacity:0; transform:translate3d(0,18px,0) scale(.988); filter:blur(7px); }
  58% { filter:blur(1px); }
  100% { opacity:1; transform:translate3d(0,0,0) scale(1); filter:blur(0); }
}

/* Avatars should always fill the circular crop. */
.avatar-btn { position:relative; overflow:hidden; padding:0; flex:0 0 auto; }
.avatar-btn img,
.profile-avatar img {
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
  display:block;
  object-fit:cover;
  object-position:center;
}
.avatar-btn span, .profile-avatar span { position:relative; z-index:1; }

/* Simplified session cards: one focus line plus useful activity counts. */
.session-card { padding:18px; }
.session-focus { margin:11px 0 15px; font-size:15px; line-height:1.42; }
.session-card-footer { display:flex; align-items:center; gap:9px; min-width:0; }
.session-stat {
  min-height:30px;
  padding:0 10px;
  border-radius:999px;
  display:inline-flex;
  align-items:center;
  gap:6px;
  border:1px solid rgba(255,255,255,.08);
  background:rgba(255,255,255,.065);
  color:rgba(255,255,255,.68);
  font-size:11px;
  white-space:nowrap;
}
.session-stat svg { width:14px; height:14px; }
.session-stat.assignments { color:rgba(255,255,255,.8); }
.session-card-arrow { margin-left:auto; display:grid; place-items:center; color:rgba(255,255,255,.7); }
.session-card-arrow svg { width:18px; height:18px; }

/* Avatar crop editor */
.avatar-crop-copy { margin:-7px 0 15px; color:var(--muted); font-size:12px; line-height:1.5; }
.avatar-crop-stage {
  width:min(292px, 78vw);
  aspect-ratio:1;
  position:relative;
  margin:0 auto 18px;
  overflow:hidden;
  border-radius:50%;
  background:rgba(0,0,0,.35);
  border:1px solid rgba(255,255,255,.28);
  box-shadow:0 18px 50px rgba(0,0,0,.3);
  touch-action:none;
  cursor:grab;
  user-select:none;
}
.avatar-crop-stage.dragging { cursor:grabbing; }
.avatar-crop-stage img { position:absolute; max-width:none; pointer-events:none; user-select:none; -webkit-user-drag:none; }
.avatar-crop-stage::after {
  content:"";
  position:absolute;
  inset:0;
  border-radius:50%;
  box-shadow:inset 0 0 0 2px rgba(255,255,255,.52), inset 0 0 35px rgba(0,0,0,.2);
  pointer-events:none;
}
.avatar-crop-controls { margin:0 auto 18px; max-width:360px; }
.avatar-crop-controls label { display:flex; justify-content:space-between; gap:14px; font-size:12px; color:var(--muted); margin-bottom:8px; }
.avatar-crop-controls input { width:100%; accent-color:#fff; }

@media (min-width: 860px) {
  .dashboard-scroll {
    display:grid;
    grid-template-columns:minmax(320px, .86fr) minmax(430px, 1.14fr);
    grid-template-areas:
      "head head"
      "upcoming recent-title"
      "upcoming list"
      "footer footer";
    column-gap:clamp(24px, 4vw, 50px);
    row-gap:0;
    align-content:start;
  }
  .dashboard-head { grid-area:head; margin-bottom:24px; }
  #upcoming-wrap { grid-area:upcoming; align-self:start; }
  .section-title { grid-area:recent-title; margin-top:20px; }
  .session-list { grid-area:list; }
  .dashboard-footer { grid-area:footer; padding-top:46px; }
  .next-card, .no-upcoming { margin-top:20px; margin-bottom:0; }
  .dashboard-head h1 { font-size:clamp(36px, 4vw, 50px); }
  .dashboard-head p { font-size:clamp(19px, 2vw, 23px); }
  .next-focus { max-width:330px; font-size:20px; }
  .session-card { padding:20px 21px; }
  .profile-scroll { display:grid; grid-template-columns:minmax(230px, .72fr) minmax(420px, 1.28fr); column-gap:34px; align-content:start; }
  .profile-hero { grid-row:1 / span 4; position:sticky; top:24px; align-self:start; padding:28px 20px; border-radius:26px; background:rgba(255,255,255,.055); border:1px solid rgba(255,255,255,.1); backdrop-filter:blur(18px); }
  .theme-grid { grid-template-columns:repeat(3,1fr); }
  .theme-option.wide { grid-column:auto; }
  .assignment-list { display:grid; grid-template-columns:1fr 1fr; }
  .swipe-wrap { min-width:0; }
  .sheet { left:50%; right:auto; width:min(680px, calc(100% - 42px)); border-radius:32px 32px 0 0; transform:translate(-50%, 104%); }
  .modal-root.open .sheet { transform:translate(-50%, 0); }
  .dialog { left:50%; right:auto; width:min(470px, calc(100% - 44px)); }
}

@media (min-width: 1240px) {
  .dashboard-scroll { padding-left:0; padding-right:0; }
}

@media (max-width: 620px) {
  .dashboard-scroll { padding-top:calc(20px + env(safe-area-inset-top)); }
  .dashboard-head h1 { font-size:32px; }
  .dashboard-head p { font-size:18px; }
  .head-actions { gap:7px; }
  .icon-btn { width:42px; height:42px; }
  .session-card-footer { gap:7px; }
  .session-stat { padding:0 9px; }
}

@media (max-width: 380px) {
  .session-stat { padding:0 8px; gap:4px; }
  .session-card { padding:16px; }
}

/* ============================================================
   v2.2 nature imagery, motion, custom controls and settings tabs
   ============================================================ */
:root {
  --glass-soft-alpha: .087;
  --glass-strong-alpha: .80;
  --glass-border-alpha: .19;
  --glass-blur: 25px;
}

/* Real photographic background with a lower-page progressive blur. */
.theme-scene {
  filter: saturate(.94) brightness(.72) contrast(1.02);
  transform: scale(1.015);
}
.theme-blur {
  filter: blur(27px) saturate(.88) brightness(.62);
  transform: scale(1.12);
  opacity: .96;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, transparent 18%, rgba(0,0,0,.15) 31%, rgba(0,0,0,.72) 55%, #000 76%, #000 100%);
  mask-image: linear-gradient(to bottom, transparent 0%, transparent 18%, rgba(0,0,0,.15) 31%, rgba(0,0,0,.72) 55%, #000 76%, #000 100%);
}
.theme-scrim {
  background:
    linear-gradient(to bottom, rgba(3,8,6,.16) 0%, rgba(3,8,6,.08) 19%, rgba(3,8,6,.28) 48%, rgba(3,8,6,.89) 88%, rgba(3,8,6,.97) 100%),
    radial-gradient(circle at 52% 18%, transparent 0%, rgba(0,0,0,.05) 48%, rgba(0,0,0,.43) 100%);
}

/* Make the appearance control visibly affect every glass surface. */
.glass {
  background: rgba(255,255,255,var(--glass-alpha));
  border-color: rgba(255,255,255,var(--glass-border-alpha));
  backdrop-filter: blur(var(--glass-blur)) saturate(1.12);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(1.12);
}
.glass-soft,
.settings-card,
.note-composer,
.assignment-card,
.session-card {
  background: rgba(255,255,255,var(--glass-soft-alpha));
  border-color: rgba(255,255,255,var(--glass-border-soft));
  backdrop-filter: blur(var(--glass-blur-soft)) saturate(1.06);
  -webkit-backdrop-filter: blur(var(--glass-blur-soft)) saturate(1.06);
}
.icon-btn,
.btn-glass,
.menu-action,
.field input,
.field textarea,
.field-trigger,
.status-choice,
.picker-nav,
.time-choice,
.period-control,
.calendar-day,
.profile-tabs {
  background-color: rgba(255,255,255,var(--glass-soft-alpha));
  border-color: rgba(255,255,255,var(--glass-border-soft));
  backdrop-filter: blur(var(--glass-blur-soft));
  -webkit-backdrop-filter: blur(var(--glass-blur-soft));
}
.sheet,
.dialog {
  background: rgba(9,18,13,var(--glass-strong-alpha));
  border-color: rgba(255,255,255,var(--glass-border-alpha));
  backdrop-filter: blur(var(--glass-blur-strong)) saturate(1.08);
  -webkit-backdrop-filter: blur(var(--glass-blur-strong)) saturate(1.08);
}

/* Calmer intro: the selected landscape moves slowly from far to near. */
.intro-screen { background:#06100c; }
.intro-image {
  inset:-8%;
  filter:brightness(.64) saturate(.9) blur(2.5px);
  transform:scale(.9);
  will-change:transform,filter;
}
.intro-screen.playing .intro-image { animation:introNatureApproach 3.45s cubic-bezier(.18,.72,.22,1) forwards; }
.intro-overlay { background:linear-gradient(to bottom,rgba(3,8,6,.12),rgba(3,8,6,.13) 48%,rgba(3,8,6,.82)); }
.intro-content { margin-bottom:clamp(64px,10vh,110px); }
.intro-screen.playing .intro-content { animation:introMessage 2.65s .38s cubic-bezier(.2,.72,.25,1) forwards; }
@keyframes introNatureApproach {
  0% { transform:scale(.9); filter:brightness(.58) saturate(.82) blur(4px); }
  42% { filter:brightness(.69) saturate(.9) blur(1.5px); }
  100% { transform:scale(1.075); filter:brightness(.73) saturate(.94) blur(0); }
}
@keyframes introMessage {
  0% { opacity:0; transform:translate3d(0,18px,0); filter:blur(6px); }
  32%,75% { opacity:1; transform:translate3d(0,0,0); filter:blur(0); }
  100% { opacity:0; transform:translate3d(0,-7px,0); filter:blur(3px); }
}

/* Profile tabs */
.profile-scroll { display:block !important; width:min(100%,1040px); }
.profile-tabs {
  position:sticky;
  top:8px;
  z-index:20;
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:5px;
  margin:3px auto 24px;
  padding:5px;
  border:1px solid rgba(255,255,255,var(--glass-border-soft));
  border-radius:999px;
  max-width:620px;
}
.profile-tab {
  border:0;
  border-radius:999px;
  min-height:42px;
  padding:0 12px;
  background:transparent;
  color:rgba(255,255,255,.55);
  font-size:12px;
  font-weight:600;
  cursor:pointer;
  transition:background .25s ease,color .25s ease,transform .2s ease;
}
.profile-tab.active { background:rgba(255,255,255,.17); color:#fff; box-shadow:inset 0 0 0 1px rgba(255,255,255,.12); }
.profile-tab:active { transform:scale(.98); }
.profile-pane { width:100%; }
.profile-pane.hidden { display:none !important; }
.profile-layout { display:grid; grid-template-columns:1fr; gap:24px; }
.profile-hero { grid-row:auto !important; align-self:start; margin:0; padding:24px 18px; border-radius:26px; background:rgba(255,255,255,var(--glass-soft-alpha)); border:1px solid rgba(255,255,255,var(--glass-border-soft)); backdrop-filter:blur(var(--glass-blur-soft)); }
.profile-fields { margin:0; }
.profile-pane .settings-section:last-child { margin-bottom:8px; }
.glass-preview { min-height:112px; border-radius:23px; margin:0 0 13px; padding:20px; display:flex; flex-direction:column; justify-content:flex-end; }
.glass-preview span { color:var(--muted); font-size:11px; margin-bottom:5px; }
.glass-preview strong { font-family:"Playfair Display",Georgia,serif; font-size:20px; font-weight:400; }
.privacy-intro { display:flex; gap:16px; align-items:flex-start; padding:20px; margin-bottom:26px; border-radius:22px; }
.privacy-intro > svg { flex:0 0 auto; margin-top:2px; }
.privacy-intro h3 { margin:0 0 6px; font-size:22px; font-weight:400; }
.privacy-intro p { margin:0; color:var(--muted); font-size:13px; line-height:1.55; }
.danger-zone { padding-top:5px; }

/* Styled range control */
.range-row label { display:flex; align-items:center; justify-content:space-between; }
.range-row output { color:rgba(255,255,255,.9); font-variant-numeric:tabular-nums; }
input[type="range"] { appearance:none; -webkit-appearance:none; height:28px; background:transparent; cursor:pointer; }
input[type="range"]::-webkit-slider-runnable-track { height:5px; border-radius:999px; background:linear-gradient(90deg,rgba(255,255,255,.72),rgba(255,255,255,.15)); }
input[type="range"]::-webkit-slider-thumb { appearance:none; -webkit-appearance:none; width:21px; height:21px; margin-top:-8px; border-radius:50%; background:#fff; border:3px solid rgba(17,28,22,.8); box-shadow:0 4px 14px rgba(0,0,0,.35); }
input[type="range"]::-moz-range-track { height:5px; border-radius:999px; background:rgba(255,255,255,.2); }
input[type="range"]::-moz-range-thumb { width:18px; height:18px; border-radius:50%; background:#fff; border:3px solid rgba(17,28,22,.8); }

/* Custom form controls replace native date/time/select pickers. */
.field-trigger {
  width:100%; min-height:54px; border:1px solid rgba(255,255,255,var(--glass-border-soft)); border-radius:17px;
  color:#fff; padding:0 13px; display:flex; align-items:center; gap:10px; cursor:pointer; text-align:left;
}
.field-trigger > svg { color:rgba(255,255,255,.72); flex:0 0 auto; }
.field-trigger strong { font-weight:500; font-size:14px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.field-trigger .trigger-arrow { margin-left:auto; opacity:.48; transform:rotate(90deg); display:grid; }
.field-trigger:hover { background-color:rgba(255,255,255,var(--glass-hover-alpha)); }
.status-choice { display:grid; grid-template-columns:repeat(3,1fr); gap:4px; padding:4px; min-height:54px; border:1px solid rgba(255,255,255,var(--glass-border-soft)); border-radius:17px; }
.status-choice button { border:0; border-radius:13px; background:transparent; color:rgba(255,255,255,.53); font-size:11px; cursor:pointer; transition:.2s ease; }
.status-choice button.selected { background:rgba(255,255,255,.18); color:#fff; box-shadow:inset 0 0 0 1px rgba(255,255,255,.13); }
.field input:not([type="hidden"]), .field textarea { border-color:rgba(255,255,255,var(--glass-border-soft)); }

/* Themed calendar and time picker */
.dialog:has(.custom-picker) { width:min(460px,calc(100% - 28px)); padding:16px; border-radius:27px; }
.custom-picker { width:100%; }
.picker-head { display:grid; grid-template-columns:42px 1fr 42px; align-items:center; gap:9px; margin-bottom:17px; }
.picker-head > div { text-align:center; }
.picker-head span,.time-picker-title span { display:block; color:var(--soft); font-size:10px; text-transform:uppercase; letter-spacing:.12em; margin-bottom:4px; }
.picker-head strong,.time-picker-title strong { font-family:"Playfair Display",Georgia,serif; font-size:21px; font-weight:400; }
.picker-nav { width:42px; height:42px; border:1px solid rgba(255,255,255,var(--glass-border-soft)); border-radius:50%; color:#fff; display:grid; place-items:center; cursor:pointer; }
.picker-nav.next svg { transform:none; }
.calendar-weekdays,.calendar-grid { display:grid; grid-template-columns:repeat(7,1fr); gap:4px; }
.calendar-weekdays { margin-bottom:5px; }
.calendar-weekdays span { text-align:center; color:var(--soft); font-size:10px; padding:4px 0; }
.calendar-day { aspect-ratio:1; border:1px solid transparent; border-radius:12px; color:rgba(255,255,255,.82); cursor:pointer; font-size:12px; }
.calendar-day.outside { color:rgba(255,255,255,.25); background-color:transparent; }
.calendar-day.today { border-color:rgba(255,255,255,.35); }
.calendar-day.selected { color:#102019; background:#fff; border-color:#fff; font-weight:700; box-shadow:0 7px 18px rgba(0,0,0,.24); }
.picker-footer { display:flex; gap:10px; margin-top:17px; }
.picker-footer .btn { flex:1; }
.time-picker-title { text-align:center; margin:3px 0 18px; }
.time-picker-title strong { font-size:31px; }
.picker-label { margin:13px 0 8px; color:var(--soft); font-size:10px; text-transform:uppercase; letter-spacing:.12em; }
.time-grid { display:grid; gap:6px; }
.time-grid.hours { grid-template-columns:repeat(6,1fr); }
.time-grid.minutes { grid-template-columns:repeat(5,1fr); }
.time-choice { min-height:42px; border:1px solid rgba(255,255,255,var(--glass-border-soft)); border-radius:13px; color:rgba(255,255,255,.7); cursor:pointer; font-size:12px; }
.time-choice.selected { background:#fff; color:#102019; border-color:#fff; font-weight:700; }
.period-control { display:grid; grid-template-columns:1fr 1fr; gap:5px; padding:5px; margin-top:13px; border:1px solid rgba(255,255,255,var(--glass-border-soft)); border-radius:15px; }
.period-control button { min-height:41px; border:0; border-radius:11px; background:transparent; color:rgba(255,255,255,.55); cursor:pointer; }
.period-control button.selected { background:rgba(255,255,255,.18); color:#fff; }

/* Theme thumbnails use the supplied full photographic scenes. */
.theme-option { height:126px; background-color:#07100c; }
.theme-option::after { background:linear-gradient(to top,rgba(0,0,0,.78),rgba(0,0,0,.03) 72%); }

@media (min-width:760px) {
  .profile-layout { grid-template-columns:minmax(240px,.7fr) minmax(360px,1.3fr); align-items:start; gap:32px; }
  .profile-hero { position:sticky; top:82px; }
  .profile-tabs { margin-bottom:30px; }
  .theme-grid { grid-template-columns:repeat(3,1fr); }
  .theme-option.wide { grid-column:auto; }
}
@media (max-width:620px) {
  .profile-tabs { top:4px; margin-bottom:19px; }
  .profile-tab { padding:0 7px; font-size:10.5px; }
  .theme-option { height:112px; }
  .time-grid.hours { grid-template-columns:repeat(4,1fr); }
  .dialog:has(.custom-picker) { left:14px; right:14px; width:auto; }
}
@media (max-width:390px) {
  .calendar-grid,.calendar-weekdays { gap:2px; }
  .calendar-day { border-radius:10px; }
  .status-choice button { font-size:10px; }
}

/* v2.3: Unlock now opens directly into one fast dashboard reveal. */
#screen-intro { display:none !important; }

/* ============================================================
   v2.4 motion stability, adaptive modals and appearance controls
   ============================================================ */
:root {
  --background-blur-px: 24px;
  --background-blur-opacity: .72;
  --overlay-top-alpha: .136;
  --overlay-mid-alpha: .292;
  --overlay-bottom-alpha: .711;
  --vignette-alpha: .26;
  --scrim-rgb: 3, 8, 6;
  --scene-brightness: .72;
  --blur-brightness: .62;
}

/* Keep every scrollable screen mounted and composited so glass never appears a beat late. */
.dashboard-scroll,
.session-content,
.profile-scroll {
  flex: 1 1 auto;
  min-height: 0;
}
.screen { backface-visibility: hidden; }
.glass,
.glass-soft,
.settings-card,
.note-composer,
.assignment-card,
.session-card,
.icon-btn,
.btn-glass,
.sheet,
.dialog {
  -webkit-font-smoothing: antialiased;
}

/* User-controlled background treatment. */
.theme-scene {
  filter: saturate(.94) brightness(var(--scene-brightness)) contrast(1.02);
}
.theme-blur {
  filter: blur(var(--background-blur-px)) saturate(.88) brightness(var(--blur-brightness));
  opacity: var(--background-blur-opacity);
}
.theme-scrim {
  background:
    linear-gradient(
      to bottom,
      rgba(var(--scrim-rgb), var(--overlay-top-alpha)) 0%,
      rgba(var(--scrim-rgb), calc(var(--overlay-top-alpha) * .54)) 19%,
      rgba(var(--scrim-rgb), var(--overlay-mid-alpha)) 52%,
      rgba(var(--scrim-rgb), var(--overlay-bottom-alpha)) 100%
    ),
    radial-gradient(circle at 52% 18%, transparent 0%, transparent 47%, rgba(0,0,0,var(--vignette-alpha)) 100%);
  transition: background .28s ease;
}

/* Stable in-place tab transitions. */
.tab-stage,
.profile-pane-stage {
  position: relative;
  width: 100%;
}
.profile-pane-stage { min-height: 180px; }

/* Segmented interface-mode control. */
.mode-choice {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  padding: 5px;
  border-radius: 18px;
}
.mode-choice button {
  min-height: 43px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background .22s ease, color .22s ease, transform .18s ease;
}
.mode-choice button:active { transform: scale(.985); }
.mode-choice button.selected {
  background: rgba(255,255,255,.18);
  color: var(--text);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.13);
}

/* Desktop and tablet modals share one true viewport-centered layout.
   Phones retain the existing ergonomic bottom-sheet behavior. */
@media (min-width: 700px) {
  .modal-root {
    display: grid;
    place-items: center;
  }
  .sheet,
  .dialog {
    position: relative;
    inset: auto;
    left: auto;
    right: auto;
    top: auto;
    bottom: auto;
    margin: 0;
  }
  .sheet {
    width: min(690px, calc(100% - 56px));
    max-height: min(82dvh, 780px);
    padding: 22px 24px 24px;
    border-radius: 28px;
    border: 1px solid rgba(255,255,255,var(--glass-border-alpha));
    transform: translate3d(0,22px,0) scale(.985);
    opacity: 0;
    transition: transform .34s cubic-bezier(.45,0,.2,1), opacity .22s ease;
    box-shadow: 0 30px 90px rgba(0,0,0,.42);
  }
  .dialog {
    width: min(470px, calc(100% - 44px));
  }
  .modal-root.open .sheet {
    transform: translate3d(0,0,0) scale(1);
    opacity: 1;
  }
  .sheet-handle { display: none; }
  .sheet-head { margin-top: 0; }
}

/* A true brighter interface option while preserving the photographic scene. */
body.mode-light {
  --bg: #eef2ed;
  --text: rgba(18,27,22,.96);
  --muted: rgba(18,27,22,.63);
  --soft: rgba(18,27,22,.43);
  --line: rgba(255,255,255,.62);
  --line-soft: rgba(255,255,255,.46);
  --shadow: 0 20px 60px rgba(25,38,30,.18);
  --scrim-rgb: 237, 242, 235;
  --scene-brightness: .96;
  --blur-brightness: .91;
}
body.mode-light .background-stack { background: #dfe8df; }
body.mode-light .theme-scrim {
  background:
    linear-gradient(
      to bottom,
      rgba(var(--scrim-rgb), calc(var(--overlay-top-alpha) * .42)) 0%,
      rgba(var(--scrim-rgb), calc(var(--overlay-top-alpha) * .25)) 19%,
      rgba(var(--scrim-rgb), calc(var(--overlay-mid-alpha) * .78)) 54%,
      rgba(var(--scrim-rgb), var(--overlay-bottom-alpha)) 100%
    ),
    radial-gradient(circle at 52% 18%, transparent 0%, transparent 50%, rgba(30,42,35,calc(var(--vignette-alpha) * .52)) 100%);
}
body.mode-light .screen,
body.mode-light .screen button,
body.mode-light .screen input,
body.mode-light .screen textarea,
body.mode-light .screen select { color: var(--text); }
body.mode-light .dashboard-head p,
body.mode-light .next-label,
body.mode-light .next-date,
body.mode-light .session-date,
body.mode-light .progress-copy,
body.mode-light .session-stat,
body.mode-light .topbar-center p,
body.mode-light .settings-help,
body.mode-light .profile-hero p,
body.mode-light .note-meta,
body.mode-light .audio-time,
body.mode-light .avatar-crop-copy,
body.mode-light .privacy-intro p,
body.mode-light .glass-preview span { color: var(--muted); }
body.mode-light .settings-section h4,
body.mode-light .settings-row label,
body.mode-light .note-body,
body.mode-light .assignment-copy p { color: rgba(18,27,22,.72); }
body.mode-light .glass,
body.mode-light .glass-soft,
body.mode-light .settings-card,
body.mode-light .note-composer,
body.mode-light .assignment-card,
body.mode-light .session-card,
body.mode-light .profile-hero,
body.mode-light .profile-tabs,
body.mode-light .icon-btn,
body.mode-light .btn-glass,
body.mode-light .field-trigger,
body.mode-light .status-choice,
body.mode-light .picker-nav,
body.mode-light .time-choice,
body.mode-light .period-control,
body.mode-light .calendar-day,
body.mode-light .mode-choice {
  background-color: rgba(255,255,255,.54);
  border-color: rgba(255,255,255,.66);
}
body.mode-light .sheet,
body.mode-light .dialog {
  background: rgba(244,248,243,.90);
  border-color: rgba(255,255,255,.82);
  box-shadow: 0 30px 90px rgba(24,35,29,.22);
}
body.mode-light .btn-primary {
  background: rgba(18,28,23,.92);
  color: #fff;
}
body.mode-light .tab { color: rgba(18,27,22,.58); background: rgba(255,255,255,.42); border-color: rgba(255,255,255,.55); }
body.mode-light .tab.active,
body.mode-light .profile-tab.active,
body.mode-light .mode-choice button.selected,
body.mode-light .status-choice button.selected,
body.mode-light .period-control button.selected {
  background: rgba(255,255,255,.82);
  color: rgba(18,27,22,.96);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.86), 0 6px 18px rgba(29,43,35,.08);
}
body.mode-light .field input,
body.mode-light .field textarea,
body.mode-light .note-composer textarea,
body.mode-light .settings-row input[type="text"] { color: var(--text); }
body.mode-light .note-composer textarea::placeholder,
body.mode-light .field input::placeholder,
body.mode-light .field textarea::placeholder { color: rgba(18,27,22,.37); }
body.mode-light .therapist-badge,
body.mode-light .audio-play,
body.mode-light .session-stat { background: rgba(255,255,255,.52); border-color: rgba(255,255,255,.62); }
body.mode-light .check-btn { border-color: rgba(18,27,22,.38); }
body.mode-light .assignment-card.completed .check-btn { background: rgba(18,27,22,.92); color:#fff; border-color: transparent; }
body.mode-light .theme-option span { color:#fff; }
body.mode-light .toast,
body.mode-light .context-menu { background: rgba(244,248,243,.94); color: var(--text); border-color: rgba(255,255,255,.72); }

@media (prefers-color-scheme: light) {
  body:not(.mode-dark):not(.mode-light) { color-scheme: light; }
}

/* Light-mode contrast for form labels, picker controls, and live values. */
body.mode-light .field > span,
body.mode-light .picker-head span,
body.mode-light .time-picker-title span,
body.mode-light .picker-label,
body.mode-light .calendar-weekdays span,
body.mode-light .range-row output { color: var(--muted); }
body.mode-light .field-trigger strong,
body.mode-light .time-picker-title strong,
body.mode-light .picker-head strong { color: var(--text); }
body.mode-light .field-trigger > svg,
body.mode-light .trigger-arrow { color: rgba(18,27,22,.58); }
body.mode-light .status-choice button,
body.mode-light .period-control button,
body.mode-light .time-choice,
body.mode-light .calendar-day { color: rgba(18,27,22,.66); }
body.mode-light .sheet-close { background: rgba(255,255,255,.62); color: var(--text); }
body.mode-light .picker-nav { color: var(--text); }
body.mode-light .calendar-day.selected,
body.mode-light .time-choice.selected { background: rgba(18,28,23,.92); border-color: transparent; color:#fff; }

@media (max-width: 520px) {
  .status-field { grid-column: 1 / -1; }
}

/* ============================================================
   v2.5 complete contrast system and premium interaction polish
   ============================================================ */
:root {
  --floating-text: rgba(255,255,255,.98);
  --floating-muted: rgba(255,255,255,.76);
  --floating-soft: rgba(255,255,255,.58);
  --surface-danger: #ffc8c8;
  --modal-spring: cubic-bezier(.16,1,.3,1);
  --press-ease: cubic-bezier(.2,.72,.25,1);
}

body.mode-dark { color-scheme: dark; }
body.mode-light { color-scheme: light; }

/* Text placed directly over photography stays consistently readable. Surface text
   still follows dark/light mode inside cards, sheets, and dialogs. */
.dashboard-head h1,
.dashboard-head p,
.section-title,
.dashboard-footer,
.topbar-center h2,
.topbar-center p {
  color: var(--floating-text);
  text-shadow: 0 1px 2px rgba(0,0,0,.58), 0 8px 30px rgba(0,0,0,.32);
}
.dashboard-head p,
.topbar-center p,
.dashboard-footer { color: var(--floating-muted); }

/* Screen controls that float directly on the scene keep a dependable frosted plate. */
body.mode-light .dashboard-head .icon-btn,
body.mode-light .topbar > .icon-btn {
  color: rgba(18,27,22,.94);
  background: rgba(255,255,255,.72);
  border-color: rgba(255,255,255,.86);
  box-shadow: 0 8px 24px rgba(24,38,29,.13);
}
body.mode-dark .dashboard-head .icon-btn,
body.mode-dark .topbar > .icon-btn {
  color: rgba(255,255,255,.95);
  background: rgba(8,16,12,.34);
  border-color: rgba(255,255,255,.18);
  box-shadow: 0 8px 28px rgba(0,0,0,.22);
}

/* Full lock-screen treatment. The visual mode now reaches the panel, keypad,
   indicators, copy, and buttons rather than changing only the page behind it. */
.lock-panel,
.lock-mark,
.pin-key,
.pin-dot,
.lock-handle {
  transition: color .28s ease, background-color .28s ease, border-color .28s ease, box-shadow .28s ease, transform .2s var(--press-ease);
}
body.mode-dark .lock-panel {
  color: rgba(255,255,255,.97);
  background: rgba(7,15,11,.69);
  border-color: rgba(255,255,255,.18);
  box-shadow: 0 -18px 70px rgba(0,0,0,.28);
}
body.mode-dark .pin-key { color: rgba(255,255,255,.94); background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.14); }
body.mode-dark .pin-key.utility { color: rgba(255,255,255,.62); }
body.mode-dark .pin-dot { border-color: rgba(255,255,255,.48); }
body.mode-dark .pin-dot.filled { background: #fff; border-color: #fff; }

body.mode-light .lock-panel {
  color: rgba(18,27,22,.97);
  background: rgba(245,249,245,.78);
  border-color: rgba(255,255,255,.88);
  box-shadow: 0 -18px 70px rgba(26,40,31,.17);
}
body.mode-light .lock-title { color: rgba(18,27,22,.98); text-shadow: none; }
body.mode-light .lock-copy { color: rgba(18,27,22,.62); }
body.mode-light .lock-handle { background: rgba(18,27,22,.28); }
body.mode-light .lock-mark { color: rgba(18,27,22,.90); background: rgba(255,255,255,.56); border-color: rgba(255,255,255,.84); }
body.mode-light .pin-key {
  color: rgba(18,27,22,.94);
  background: rgba(255,255,255,.58);
  border-color: rgba(255,255,255,.82);
  box-shadow: 0 6px 18px rgba(29,43,35,.055);
}
body.mode-light .pin-key.utility { color: rgba(18,27,22,.58); }
body.mode-light .pin-key:active { background: rgba(255,255,255,.88); }
body.mode-light .pin-dot { border-color: rgba(18,27,22,.45); }
body.mode-light .pin-dot.filled { background: rgba(18,27,22,.92); border-color: rgba(18,27,22,.92); }

@media (min-width: 700px) {
  .lock-screen { align-items:center; justify-content:center; padding:clamp(24px,5vw,64px); }
  .lock-screen .lock-panel {
    width:min(470px,100%);
    margin:0;
    padding:32px clamp(28px,4vw,44px) 34px;
    border:1px solid rgba(255,255,255,var(--glass-border-alpha));
    border-radius:32px;
    backdrop-filter:blur(var(--glass-blur-strong)) saturate(1.06);
    -webkit-backdrop-filter:blur(var(--glass-blur-strong)) saturate(1.06);
  }
  .lock-handle { display:none; }
}

/* Complete light-mode surface contrast. Specific selectors intentionally beat the
   broad inherited button rule that previously darkened primary-button labels. */
body.mode-light .screen .btn-primary,
body.mode-light .dialog .btn-primary,
body.mode-light .sheet .btn-primary {
  color:#fff;
  background:rgba(18,28,23,.94);
  border-color:transparent;
}
body.mode-light .screen .btn-danger,
body.mode-light .dialog .btn-danger,
body.mode-light .sheet .btn-danger {
  color:#8d2525;
  background:rgba(210,63,63,.13);
  border-color:rgba(190,55,55,.24);
}
body.mode-light .screen .btn-primary:disabled { color:rgba(255,255,255,.82); }
body.mode-light .screen .btn-glass,
body.mode-light .dialog .btn-glass,
body.mode-light .sheet .btn-glass { color:rgba(18,27,22,.94); }
body.mode-light .note-body,
body.mode-light .assignment-copy h3,
body.mode-light .note-composer label,
body.mode-light .next-title,
body.mode-light .next-focus,
body.mode-light .session-focus,
body.mode-light .settings-row input,
body.mode-light .settings-row label { color:rgba(18,27,22,.94); }
body.mode-light .next-label,
body.mode-light .next-date,
body.mode-light .session-date,
body.mode-light .note-meta,
body.mode-light .progress-copy,
body.mode-light .assignment-copy p { color:rgba(18,27,22,.64); }
body.mode-light .audio-play { color:rgba(18,27,22,.92); }
body.mode-light .audio-track { background:rgba(18,27,22,.12); }
body.mode-light .audio-progress { background:rgba(18,27,22,.52); }
body.mode-light .note-tools button,
body.mode-light .item-menu { color:rgba(18,27,22,.52); }
body.mode-light .dashboard-head h1,
body.mode-light .dashboard-head p,
body.mode-light .section-title,
body.mode-light .dashboard-footer,
body.mode-light .topbar-center h2,
body.mode-light .topbar-center p {
  color:var(--floating-text);
}
body.mode-light .dashboard-head p,
body.mode-light .dashboard-footer,
body.mode-light .topbar-center p { color:var(--floating-muted); }

/* Consistent surface hierarchy in both modes. */
body.mode-dark .sheet,
body.mode-dark .dialog { color:rgba(255,255,255,.96); }
body.mode-light .sheet,
body.mode-light .dialog { color:rgba(18,27,22,.96); }
body.mode-light .dialog p,
body.mode-light .sheet .settings-help,
body.mode-light .sheet p { color:rgba(18,27,22,.62); }
body.mode-light .dialog h3,
body.mode-light .sheet h3 { color:rgba(18,27,22,.98); }

/* Premium input and control motion. */
button,
.field-trigger,
.status-choice button,
.time-choice,
.calendar-day,
.theme-option,
.mode-choice button,
.profile-tab,
.session-card,
.assignment-card,
.note-card,
.settings-row {
  -webkit-tap-highlight-color:transparent;
}
.icon-btn,
.btn,
.pin-key,
.field-trigger,
.status-choice button,
.time-choice,
.calendar-day,
.theme-option,
.mode-choice button,
.profile-tab,
.session-card,
.assignment-card,
.note-card,
.settings-row,
.audio-play,
.item-menu,
.note-tools button {
  transition:
    transform .22s var(--press-ease),
    opacity .22s ease,
    color .25s ease,
    background-color .28s ease,
    border-color .28s ease,
    box-shadow .28s ease;
}
@media (hover:hover) {
  .session-card:hover,
  .assignment-card:hover,
  .note-card:hover { transform:translate3d(0,-2px,0); box-shadow:0 14px 34px rgba(0,0,0,.13); }
  .icon-btn:hover,
  .btn:hover,
  .field-trigger:hover,
  .time-choice:hover,
  .calendar-day:hover { transform:translate3d(0,-1px,0); }
  .theme-option:hover { transform:translate3d(0,-3px,0) scale(1.006); box-shadow:0 15px 34px rgba(0,0,0,.2); }
}
.icon-btn:active,
.btn:active,
.pin-key:active,
.field-trigger:active,
.time-choice:active,
.calendar-day:active,
.mode-choice button:active,
.profile-tab:active,
.audio-play:active { transform:scale(.965); }
.session-card:active,
.assignment-card:active,
.note-card:active { transform:scale(.992); }
.btn:disabled { opacity:.52; transform:none!important; box-shadow:none; }

/* Pre-composite frosted surfaces so the blur is ready before a page transition. */
.glass,
.glass-soft,
.settings-card,
.note-composer,
.assignment-card,
.session-card,
.profile-hero,
.profile-tabs,
.icon-btn,
.btn-glass,
.field-trigger,
.status-choice,
.sheet,
.dialog {
  backface-visibility:hidden;
  -webkit-backface-visibility:hidden;
  isolation:isolate;
}

/* Modal lifecycle. The modal and its contents move as one connected surface.
   Opening grows from the lower center and settles upward; closing reverses toward
   the same origin before the modal is removed. */
.modal-root { visibility:hidden; }
.modal-root.open,
.modal-root.preparing,
.modal-root.closing { visibility:visible; }
.modal-root.preparing,
.modal-root.closing { pointer-events:none; }
.modal-backdrop {
  background:rgba(3,7,5,.54);
  opacity:0;
  backdrop-filter:blur(0);
  -webkit-backdrop-filter:blur(0);
  transition:opacity .28s ease-in, backdrop-filter .32s ease-in, -webkit-backdrop-filter .32s ease-in;
}
.modal-root.open .modal-backdrop {
  opacity:1;
  backdrop-filter:blur(7px);
  -webkit-backdrop-filter:blur(7px);
  transition:opacity .34s ease-out, backdrop-filter .42s ease-out, -webkit-backdrop-filter .42s ease-out;
}
.dialog {
  opacity:0;
  transform:translate3d(0,calc(-50% + 22px),0) scale(.18);
  transform-origin:center center;
  will-change:transform,opacity;
  transition:transform .30s cubic-bezier(.4,0,.7,1), opacity .24s ease-in;
}
.modal-root.open .dialog {
  opacity:1;
  transform:translate3d(0,-50%,0) scale(1);
  transition:transform .46s var(--modal-spring), opacity .28s ease-out;
}

.sheet {
  will-change:transform,opacity;
  transition:transform .34s cubic-bezier(.4,0,.7,1), opacity .26s ease-in;
}
@media (min-width:700px) {
  .sheet,
  .dialog {
    transform:translate3d(0,22px,0) scale(.18);
    transform-origin:center center;
    opacity:0;
  }
  .modal-root.open .sheet,
  .modal-root.open .dialog {
    transform:translate3d(0,0,0) scale(1);
    opacity:1;
  }
  .modal-root.open .sheet {
    transition:transform .48s var(--modal-spring), opacity .30s ease-out;
  }
}

.dialog-actions .btn { min-height:47px; }
.dialog-actions .btn:first-child { transition-delay:20ms; }
.dialog-actions .btn:last-child { transition-delay:45ms; }
.context-menu { transform-origin:top right; animation:premiumMenuIn .24s var(--modal-spring) both; }
@keyframes premiumMenuIn {
  from { opacity:0; transform:translate3d(0,-5px,0) scale(.96); }
  to { opacity:1; transform:translate3d(0,0,0) scale(1); }
}
.toast.show { animation:premiumToastIn .34s var(--modal-spring) both; }
@keyframes premiumToastIn {
  from { opacity:0; transform:translate(-50%,16px) scale(.96); }
  to { opacity:1; transform:translate(-50%,0) scale(1); }
}

/* Keep tab stages in the normal paint tree so descendant backdrop blur stays
   rendered throughout crossfades instead of being recomposited at the end. */

/* Refined focus treatment follows the selected interface mode. */
body.mode-light button:focus-visible,
body.mode-light input:focus-visible,
body.mode-light textarea:focus-visible { outline-color:rgba(18,27,22,.62); }
body.mode-dark button:focus-visible,
body.mode-dark input:focus-visible,
body.mode-dark textarea:focus-visible { outline-color:rgba(255,255,255,.74); }

