/* The Calm Space — an immersive focus page. The destination artwork is the background; the
   controls sit lightly on top with restrained transparency. All motion is gentle and stops
   for reduced-motion users, in Quiet mode, and while the tab is hidden. */
html, body { height: 100%; }
body.cs-body { margin: 0; overflow: hidden; background: #1a222b; color: #fff; font-family: var(--font-ui); }
.cs-root { position: fixed; inset: 0; display: flex; flex-direction: column; }
.cs-scene { position: absolute; inset: 0; z-index: 0; }
.cs-scene .cs-svg { width: 100%; height: 100%; display: block; }
.cs-scene::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,.18), rgba(0,0,0,0) 22%, rgba(0,0,0,0) 70%, rgba(0,0,0,.25)); pointer-events: none; }

/* Gentle scene motion */
.cs-sway { transform-box: fill-box; transform-origin: 50% 100%; animation: cs-sway 9s ease-in-out infinite alternate; }
.cs-sway-slow { animation-duration: 13s; }
@keyframes cs-sway { from { transform: rotate(-0.25deg); } to { transform: rotate(0.25deg); } }
.cs-rays { animation: cs-rays 16s ease-in-out infinite alternate; }
@keyframes cs-rays { from { opacity: .55; } to { opacity: 1; } }
.cs-glow { animation: cs-glow 7s ease-in-out infinite alternate; }
@keyframes cs-glow { from { opacity: .18; } to { opacity: .32; } }
.cs-leaf { animation: cs-fall linear infinite; }
@keyframes cs-fall { from { transform: translate(0, -40px) rotate(0deg); opacity: 0; } 8% { opacity: 1; } to { transform: translate(160px, 900px) rotate(540deg); opacity: .9; } }
.cs-mote { animation: cs-mote 12s ease-in-out infinite; }
@keyframes cs-mote { 0%, 100% { transform: translate(0, 0); opacity: .15; } 50% { transform: translate(24px, -30px); opacity: .7; } }
.cs-steam { animation: cs-steam 4s ease-in-out infinite; }
@keyframes cs-steam { 0%, 100% { opacity: .1; transform: translateY(4px); } 50% { opacity: .6; transform: translateY(-4px); } }
.cs-root.still .cs-scene *, .cs-root.paused .cs-scene * { animation-play-state: paused !important; }
.cs-root.still .cs-leaf, .cs-root.still .cs-mote { display: none; }
@media (prefers-reduced-motion: reduce) { .cs-scene * { animation: none !important; } .cs-leaf, .cs-mote { display: none; } }
html.a11y-reduce-motion .cs-scene * { animation: none !important; }
html.a11y-reduce-motion .cs-leaf, html.a11y-reduce-motion .cs-mote { display: none; }

/* Top bar */
.cs-top { position: relative; z-index: 2; flex: none; display: flex; align-items: center; gap: 10px; padding: 14px 18px; }
.cs-top > :not(.cs-brand) { flex: none; }
.cs-brand { display: flex; align-items: center; gap: 10px; min-width: 0; white-space: nowrap; min-height: 40px; padding: 2px 14px 2px 4px; border-radius: 999px; background: rgba(18, 22, 18, .62); margin-right: auto; }
.cs-brand b { font-size: 17px; }
.cs-adt { display: inline-flex; align-items: center; gap: 7px; color: inherit; font-weight: 800; font-size: 15px; padding: 4px 10px 4px 4px; border-radius: 999px; align-self: center; }
.cs-adt:hover { background: rgba(0,0,0,.3); }
.cs-adt:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
@media (max-width: 700px) { .cs-adt-n { display: none; } .cs-adt { padding: 4px; } }
.cs-cats { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.cs-cat { font: inherit; font-size: 13px; font-weight: 700; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--color-border); background: var(--color-surface); color: var(--color-text); cursor: pointer; }
.cs-cat[aria-pressed="true"] { background: var(--color-navy-900); border-color: var(--color-navy-900); color: #fff; }
.cs-cat:focus-visible { outline: 2px solid var(--color-info); outline-offset: 2px; }
.cs-brand span { font-size: 13px; opacity: .9; }
.cs-brand #cs-env-name { overflow: hidden; text-overflow: ellipsis; }
/* The top bar always keeps to one row: the place name, then the labels, then the title step aside. */
@media (max-width: 1000px) { .cs-brand #cs-env-name, .cs-adt-n { display: none; } }
@media (max-width: 800px) { .cs-top .cs-btn .lbl { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; } }
@media (max-width: 380px) { #cs-presets .u { display: none; } #cs-presets .cs-chip { min-width: 44px; } }
@media (max-width: 460px) { .cs-brand b { display: none; } .cs-brand { padding: 2px 4px; } }
.cs-btn { font: inherit; display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 8px 12px; border-radius: 10px; border: 1px solid rgba(255,255,255,.22); background: rgba(18, 22, 18, .66); color: #fff; font-size: 13.5px; font-weight: 600; cursor: pointer; text-decoration: none; }
.cs-btn:hover { background: rgba(18, 22, 18, .82); }
.cs-btn:focus-visible, .cs-chip:focus-visible, .cs-tool:focus-visible { outline: 2px solid #F5A623; outline-offset: 2px; }
.cs-btn[aria-pressed="true"] { background: rgba(245, 166, 35, .9); color: #1C1611; border-color: transparent; }
.cs-btn svg { flex: none; }
.cs-btn.on, .cs-tool.on { border-color: #F5A623; }
.cs-caret { opacity: .8; margin-left: -1px; }
/* Sound and its mute button, joined */
.cs-seg { display: flex; }
.cs-seg .cs-btn:first-child { border-radius: 10px 0 0 10px; }
.cs-seg .cs-btn + .cs-btn { border-radius: 0 10px 10px 0; border-left: none; }
.cs-seg .cs-btn[hidden] { display: none; }
.cs-seg .cs-btn:focus-visible { position: relative; z-index: 1; }

/* Small menus (Focus mode, the timer's ⋯, Plan and Notes). Placed by togglePop in calm-space.js. */
.cs-pop { position: fixed; z-index: 4; min-width: 210px; max-width: calc(100vw - 16px); max-height: calc(100vh - 16px); overflow-y: auto; padding: 6px; border-radius: 14px; background: #2B1F1A; color: #FBF3E6; border: 1px solid rgba(255,255,255,.18); box-shadow: 0 14px 36px rgba(0,0,0,.4); text-align: left; }
.cs-pop[hidden] { display: none; }
.cs-pop-i { font: inherit; font-size: 14px; width: 100%; min-height: 44px; display: flex; align-items: center; gap: 12px; padding: 8px 12px; border: none; border-radius: 10px; background: none; color: inherit; text-align: left; cursor: pointer; }
.cs-pop-i:hover, .cs-pop-i[aria-expanded="true"] { background: rgba(255,255,255,.1); }
.cs-pop-i:focus-visible { outline: 2px solid #F5A623; outline-offset: -2px; }
.cs-pop-i svg { flex: none; color: #F5C67A; }
.cs-pop-i .tx { flex: 1; min-width: 0; }
.cs-pop-i b { display: block; font-weight: 600; }
.cs-pop-i small { display: block; font-size: 12px; color: #D9C9B4; }
.cs-pop-i[aria-pressed="true"]::after { content: ""; flex: none; width: 6px; height: 11px; margin: -4px 4px 0 0; border: solid #F5A623; border-width: 0 2.5px 2.5px 0; transform: rotate(45deg); }
.badge-n { font-size: 11px; font-weight: 700; background: #F5A623; color: #1C1611; border-radius: 999px; padding: 0 6px; }
.badge-n:empty, .cs-shuf-note:empty { display: none; }
.cs-shuf-note { margin: -4px 0 8px; }

/* Centre timer */
.cs-center { position: relative; z-index: 1; flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 10px 16px; }
.cs-timer { width: min(440px, 100%); text-align: center; background: linear-gradient(rgba(20, 14, 12, .3), rgba(20, 14, 12, .3)), var(--cs-tint, rgba(30, 38, 28, .55)); /* the extra shade keeps text readable over pale scenes */ border: 1px solid rgba(255,255,255,.14); border-radius: 22px; padding: 22px 24px 20px; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  /* A column whose only flexible child is the ring: on a short window the ring shrinks so the card
     fits between the top bar and the toolbar. Scrolling inside the card is a last-resort safety net. */
  display: flex; flex-direction: column; max-height: 100%; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.cs-timer > * { flex-shrink: 0; }
.cs-timer input.cs-label[type=text] { width: 100%; border-radius: 0; background: transparent; border: none; border-bottom: 1px solid rgba(255,255,255,.25); color: #fff; font: inherit; font-size: 15px; text-align: center; padding: 6px 4px; margin-bottom: 10px; }
.cs-timer input.cs-label::placeholder { color: rgba(255,255,255,.85); opacity: 1; }
.cs-timer input.cs-label:focus { outline: none; border-bottom-color: #F5A623; }
.cs-ring { position: relative; --cs-ring: 230px; flex: 0 1 var(--cs-ring); height: var(--cs-ring); min-height: 112px; width: auto; aspect-ratio: 1; align-self: center; margin: 6px auto 8px; container-type: size; }
.cs-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.cs-time { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.cs-time .t { font-size: 58px; font-size: clamp(26px, 25cqmin, 58px); line-height: 1.15; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.cs-time .t.long { font-size: 42px; font-size: clamp(20px, 17cqmin, 42px); }
.cs-time .p { font-size: 13px; font-size: clamp(10px, 5.6cqmin, 13px); letter-spacing: .12em; text-transform: uppercase; opacity: .85; }
.cs-time.hidden-num .t { visibility: hidden; }
.cs-controls { display: flex; gap: 10px; justify-content: center; margin-bottom: 14px; }
.cs-main { min-width: 120px; justify-content: center; background: #F5A623; color: #1C1611; border-color: transparent; font-weight: 700; }
.cs-main:hover { background: #ffb840; }
.cs-chips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-bottom: 10px; }
.cs-chip { font: inherit; font-size: 13px; font-weight: 600; padding: 6px 11px; min-height: 34px; border-radius: 999px; border: 1px solid rgba(255,255,255,.25); background: transparent; color: #fff; cursor: pointer; }
.cs-chip[aria-pressed="true"] { background: #fff; color: #1C1611; }
.cs-more-btn { width: 40px; padding: 8px; justify-content: center; }
/* While focusing, the length chips step out of the way (they come back when paused). */
.cs-root.running #cs-presets { display: none; }

/* Bottom toolbar */
.cs-tools { position: relative; z-index: 2; flex: none; display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; padding: 12px 16px 18px; }
.cs-tool { font: inherit; display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 92px; min-height: 56px; padding: 8px 10px; border-radius: 12px; border: 1px solid rgba(255,255,255,.18); background: rgba(18, 22, 18, .66); color: #fff; font-size: 12px; font-weight: 600; cursor: pointer; }
.cs-tool:hover, .cs-tool[aria-expanded="true"] { background: rgba(18, 22, 18, .82); }
.cs-tool-t { display: inline-flex; align-items: center; gap: 5px; }

/* Side drawer for tools (desktop) / bottom sheet (mobile) */
.cs-drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(380px, 100%); z-index: 5; background: var(--color-surface); color: var(--color-text); box-shadow: -12px 0 40px rgba(0,0,0,.3); transform: translateX(105%); transition: transform .25s ease; display: flex; flex-direction: column; }
.cs-drawer.open { transform: none; }
.cs-drawer[hidden] { display: none; }
html.a11y-reduce-motion .cs-drawer { transition: none; }
.cs-drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 10px; border-bottom: 1px solid var(--color-border); }
.cs-drawer-head h2 { font-size: 18px; }
.cs-drawer-head p { font-size: 12.5px; color: var(--color-text-muted); }
.cs-drawer-head p:empty { display: none; }
.cs-dtabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 12px 18px 0; }
.cs-dtabs[hidden] { display: none; }
.cs-dtab { font: inherit; font-size: 13px; font-weight: 600; min-height: 36px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--color-border-strong); background: none; color: var(--color-text); cursor: pointer; }
.cs-dtab:hover { background: var(--color-hover); }
.cs-dtab[aria-pressed="true"] { background: var(--color-text); color: var(--color-surface); border-color: var(--color-text); cursor: default; }
.cs-dtab:focus-visible { outline: 2px solid var(--color-info); outline-offset: 2px; }
.cs-drawer-body { flex: 1; overflow-y: auto; padding: 16px 18px 24px; }
.cs-x { background: none; border: none; font-size: 24px; line-height: 1; color: var(--color-text-muted); cursor: pointer; padding: 6px; }
.cs-row { display: flex; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--color-border); font-size: 14px; }
.cs-row:last-child { border-bottom: none; }
.cs-grip { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 40px; margin-left: -6px; border: 0; border-radius: 8px; background: none; color: var(--color-text-muted); cursor: grab; touch-action: none; }
.cs-grip:hover, .cs-grip:focus-visible { background: var(--color-hover); color: var(--color-text); }
.cs-row.dragging { position: relative; z-index: 2; background: var(--color-surface); box-shadow: 0 8px 22px rgba(0,0,0,.28); border-radius: 10px; }
.cs-row.dragging .cs-grip { cursor: grabbing; }
.cs-row input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--color-economics); flex: none; }
.cs-row .grow { flex: 1; min-width: 0; }
.cs-row.done .grow { text-decoration: line-through; color: var(--color-text-muted); }
.cs-mini { font: inherit; font-size: 12px; font-weight: 600; background: none; border: 1px solid var(--color-border); border-radius: 8px; padding: 4px 8px; color: var(--color-text); cursor: pointer; min-height: 30px; }
.cs-mini:hover { background: var(--color-hover); }
.cs-add { display: flex; gap: 8px; margin-top: 10px; }
.cs-add input[type=text] { padding: 9px 11px; font-size: 14px; }
.cs-note { font-size: 12.5px; color: var(--color-text-muted); line-height: 1.5; margin-top: 10px; }
.cs-textarea { width: 100%; min-height: 260px; font: inherit; font-size: 15px; line-height: 1.6; padding: 12px; border-radius: 10px; border: 1px solid var(--color-border-strong); background: var(--color-surface); color: var(--color-text); resize: vertical; }
.cs-stickies { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.cs-sticky { border-radius: 10px; padding: 10px; min-height: 110px; display: flex; flex-direction: column; gap: 6px; color: #2b2420; }
.cs-sticky textarea { flex: 1; border: none; background: transparent; font: inherit; font-size: 13.5px; resize: none; color: inherit; min-height: 70px; }
.cs-sticky textarea:focus { outline: 2px solid rgba(0,0,0,.25); border-radius: 6px; }
.cs-sticky-bar { display: flex; gap: 4px; align-items: center; }
.cs-sticky-bar button { width: 18px; height: 18px; border-radius: 50%; border: 1px solid rgba(0,0,0,.2); cursor: pointer; padding: 0; }
.cs-sticky-bar .del { margin-left: auto; width: auto; height: auto; border: none; background: none; font-size: 12px; font-weight: 700; color: #5a3e2b; border-radius: 0; }

/* Destination picker */
.cs-env-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.cs-env { font: inherit; text-align: left; border: 2px solid transparent; border-radius: 12px; overflow: hidden; background: var(--color-hover); color: var(--color-text); cursor: pointer; padding: 0; position: relative; }
.cs-env.on { border-color: var(--color-accent-orange); }
.cs-env .thumb { aspect-ratio: 16 / 9; overflow: hidden; background: #2f3a2c; }
.cs-env .thumb svg { width: 100%; height: 100%; display: block; }
.cs-env .thumb .soon { display: flex; align-items: center; justify-content: center; height: 100%; font-size: 12px; font-weight: 700; color: #EFE4D2; letter-spacing: .04em; }
.cs-env .nm { font-size: 13px; font-weight: 700; padding: 8px 10px 2px; }
.cs-env .md { font-size: 11.5px; color: var(--color-text-muted); padding: 0 10px 8px; }
.cs-env[disabled] { cursor: default; opacity: .7; }
.cs-fav { position: absolute; top: 6px; right: 6px; width: 30px; height: 30px; border-radius: 50%; border: none; background: rgba(0,0,0,.45); color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.cs-fav[aria-pressed="true"] { color: #F5A623; }
.cs-coll { font-size: 12px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--color-text-muted); margin: 16px 0 8px; }

/* Session summary + ritual overlay */
.cs-overlay { position: fixed; inset: 0; z-index: 6; display: none; align-items: center; justify-content: center; background: rgba(10, 14, 10, .55); padding: 16px; }
.cs-overlay.show { display: flex; }
.cs-dialog { background: var(--color-surface); color: var(--color-text); border-radius: 18px; padding: 26px; width: min(440px, 100%); text-align: center; }
.cs-dialog h2 { font-family: var(--font-ui); font-size: 26px; margin-bottom: 8px; }
.cs-dialog p { font-size: 15px; color: var(--color-text-muted); line-height: 1.6; margin-bottom: 6px; }
.cs-dialog .acts { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 16px; }
.cs-dialog textarea { width: 100%; margin-top: 10px; }

/* Distraction-free (class name kept as focus-only): the timer, the scene, Sound, and a clear way out */
.cs-root.focus-only .cs-tools, .cs-root.focus-only .cs-top .cs-hide-fo, .cs-root.focus-only #cs-presets, .cs-root.focus-only .cs-more-btn, .cs-root.focus-only .cs-modes, .cs-root.focus-only .cs-applies, .cs-root.focus-only .cs-label:placeholder-shown { display: none; }
.cs-root.focus-only .cs-timer { background: transparent; border-color: transparent; backdrop-filter: none; -webkit-backdrop-filter: none; text-shadow: 0 2px 14px rgba(0,0,0,.45); }
.cs-exit-fo { display: none; align-self: center; font: inherit; margin: 12px auto 0; font-size: 13px; font-weight: 600; color: #fff; background: rgba(18,22,18,.45); border: 1px solid rgba(255,255,255,.3); border-radius: 999px; padding: 7px 14px; min-height: 36px; cursor: pointer; }
.cs-root.focus-only .cs-exit-fo { display: inline-block; }
.cs-exit-fo:focus-visible, .cs-mode:focus-visible, .cs-linkbtn:focus-visible { outline: 2px solid #F5A623; outline-offset: 2px; }

/* Mode switcher */
.cs-modes { display: inline-flex; align-self: center; gap: 2px; padding: 3px; border-radius: 999px; background: rgba(0,0,0,.25); border: 1px solid rgba(255,255,255,.16); margin-bottom: 10px; }
.cs-mode { font: inherit; font-size: 13px; font-weight: 600; color: #fff; background: transparent; border: none; border-radius: 999px; padding: 6px 12px; min-height: 32px; cursor: pointer; }
.cs-mode[aria-pressed="true"] { background: #fff; color: #1C1611; }

/* Cycle info line under the ring */
.cs-cycle { display: flex; flex-wrap: wrap; gap: 6px 14px; justify-content: center; align-items: center; font-size: 13px; opacity: .92; margin: -2px 0 12px; min-height: 18px; }
.cs-cycle:empty { display: none; }
.cs-cycle .dots { display: inline-flex; gap: 5px; }
.cs-cycle .dot { width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid rgba(255,255,255,.75); }
.cs-cycle .dot.on { background: #F5A623; border-color: #F5A623; }
.cs-applies { font-size: 12.5px; opacity: .85; margin: -4px 0 10px; }
.cs-timer [hidden] { display: none !important; }

/* Gentle break experience: less on screen, the break time and a few optional ideas */
.cs-breakbox { margin: 0 0 6px; }
.cs-break-acts { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; margin-bottom: 10px; }
.cs-chips-lbl { font-size: 12.5px; opacity: .85; align-self: center; margin-right: 2px; }
.cs-suggest { list-style: none; margin: 8px 0 0; padding: 12px 14px; border-radius: 14px; background: rgba(0,0,0,.18); text-align: left; font-size: 14px; line-height: 1.5; }
.cs-suggest li { padding: 2px 0; }
.cs-suggest li:not(:last-child)::before { content: "·"; margin-right: 8px; opacity: .7; }
.cs-linkbtn { font: inherit; background: none; border: none; color: #FFD27A; text-decoration: underline; cursor: pointer; padding: 4px 0; font-size: 13.5px; }
/* Buddies stay through breaks (28 Nov 2026): hiding them made them vanish mid-session, which
   read as a bug. Buddies follow only the student's own choice in the Buddies picker. */
.cs-root.on-break .cs-hide-calm, .cs-root.on-break .cs-tools { display: none; }
.cs-root.focus-only .cs-suggest { display: none; }

/* Settings drawer */
.cs-set { margin-bottom: 14px; }
.cs-set .field { display: block; font-size: 13px; font-weight: 700; margin-bottom: 6px; text-transform: none; letter-spacing: 0; color: var(--color-text); }
.cs-set input[type=number], .cs-set select { width: 100%; max-width: 220px; padding: 8px 10px; font: inherit; font-size: 14px; border: 1px solid var(--color-border-strong); border-radius: 8px; background: var(--color-surface); color: var(--color-text); }
.cs-chiprow { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.cs-chiprow .cs-mini[aria-pressed="true"], .cs-worries .cs-mini[aria-pressed="true"] { background: var(--color-text); color: var(--color-surface); border-color: var(--color-text); }
.cs-num { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; color: var(--color-text-muted); }
.cs-num input { width: 64px; padding: 5px 6px; font: inherit; font-size: 13px; border: 1px solid var(--color-border-strong); border-radius: 8px; background: var(--color-surface); color: var(--color-text); }

/* Focus stats drawer */
.cs-stat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.cs-stat { border: 1px solid var(--color-border); border-radius: 12px; padding: 10px; text-align: center; }
.cs-stat b { display: block; font-size: 17px; }
.cs-stat span { font-size: 11.5px; color: var(--color-text-muted); }
.cs-hist { list-style: none; margin: 0; padding: 0; }
.cs-hist li { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--color-border); font-size: 14px; }
.cs-hist li:last-child { border-bottom: none; }
.cs-hist .grow { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.cs-hist small { display: block; font-size: 12px; color: var(--color-text-muted); }
.cs-bar { display: grid; grid-template-columns: minmax(0, 1fr) 90px auto; gap: 8px; align-items: center; font-size: 13px; padding: 4px 0; }
.cs-bar .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cs-bar .track { height: 8px; border-radius: 999px; background: var(--color-hover); overflow: hidden; }
.cs-bar .track span { display: block; height: 100%; background: var(--color-accent-orange); border-radius: 999px; }
.cs-bar .v { color: var(--color-text-muted); font-size: 12.5px; }

/* Unwind drawer */
.cs-list { margin: 0; padding-left: 20px; list-style: disc; font-size: 14px; line-height: 1.55; }
.cs-list li { margin-bottom: 3px; }
.cs-breath { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 8px 0 12px; }
.cs-breath-circle { width: 120px; height: 120px; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #cfe9dc, #7fb59a); transform: scale(.6); transition: transform 1s ease-in-out; }
.cs-breath-circle.in, .cs-breath-circle.hold { transform: scale(1); }
.cs-breath-circle.out { transform: scale(.6); }
.cs-breath-label { font-size: 15px; font-weight: 700; min-height: 22px; }
.cs-breath-text p { font-size: 14px; margin-bottom: 4px; }
.cs-worries { display: flex; flex-direction: column; gap: 6px; }
.cs-worries .cs-mini { text-align: left; font-size: 13.5px; padding: 8px 10px; }
.cs-talk { margin-top: 12px; padding: 12px; border-radius: 10px; background: var(--color-hover); font-size: 14px; line-height: 1.55; }
.cs-talk p { margin-bottom: 8px; }
/* Wellbeing safety note: its own calm box, set apart from the study tips and worry answers. */
.cs-safe { margin-top: 22px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--color-border-strong); border-left: 4px solid var(--color-info); background: var(--color-hover); font-size: 13px; line-height: 1.55; }
.cs-safe-h { margin: 0 0 4px; font-size: 13.5px; font-weight: 700; }
.cs-safe p { margin: 0; }
.ov-goal, .ov-next { font-size: 14px !important; }
@media (prefers-reduced-motion: reduce) { .cs-breath-circle { transition: none !important; } }
html.a11y-reduce-motion .cs-breath-circle { transition: none !important; }

@media (max-width: 640px) {
  .cs-brand span { display: none; }
  .cs-btn .lbl { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .cs-ring { --cs-ring: 190px; }
  .cs-timer { padding: 16px; }
  .cs-tools { gap: 6px; padding: 8px 10px 12px; }
  .cs-tools { flex-wrap: nowrap; }
  .cs-tools > * { flex: 1 1 0; min-width: 0; }
  .cs-tool { width: 100%; min-width: 0; min-height: 52px; padding: 6px 2px; font-size: 12px; }
  .cs-caret { display: none; }
  .cs-top { gap: 8px; padding: 12px 10px; }
  .cs-brand b { font-size: 15px; }
  .cs-mode { padding: 6px 10px; }
  .cs-ring { margin: 2px auto 6px; }
  .cs-stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .cs-stat b { font-size: 15px; }
  .cs-drawer { top: auto; height: 78vh; width: 100%; border-radius: 18px 18px 0 0; transform: translateY(105%); }
  .cs-drawer.open { transform: none; }
  .cs-stickies, .cs-env-grid { grid-template-columns: 1fr 1fr; }
}

/* Study buddies: drawn in an SVG overlay that uses the scene's viewBox and slice, so they stay on
   the furniture at any screen size (see BUDDY_SPOTS in calm-space.js). */
.cs-buddy { position: absolute; inset: 0; z-index: 1; pointer-events: none; overflow: hidden; }
/* Time-of-day light (28 Nov 2026): sunrise, golden hour and sunset tint the day artwork, dusk
   lifts the night artwork. One layer per phase over the scene and the buddies (never the
   tools), cross-fading over 2.5s, so changes are gradual. --lk is the strength for the kind of
   place (outdoors 1, rooms lit through a window .55); underwater places use their own colours.
   Separate from the site's light/dark theme, which only changes the interface. */
.cs-light { position: absolute; inset: 0; z-index: 1; pointer-events: none; --lk: 1; mix-blend-mode: multiply; }
.cs-light[data-phase="dusk"] { mix-blend-mode: screen; } /* dusk lifts the night art; the others tint */
.cs-light > i { position: absolute; inset: 0; opacity: 0; transition: opacity 2.5s ease; }
.cs-light .p-sunrise { background: linear-gradient(180deg, rgba(255, 196, 200, .5), rgba(255, 222, 205, .28) 55%, rgba(255, 236, 220, .12)); }
.cs-light .p-golden { background: linear-gradient(180deg, rgba(255, 206, 120, .55), rgba(255, 196, 110, .38) 60%, rgba(255, 188, 120, .26)); }
.cs-light .p-sunset { background: linear-gradient(180deg, rgba(255, 150, 104, .62), rgba(226, 128, 136, .5) 50%, rgba(150, 96, 128, .45)); }
.cs-light.k-room { --lk: .7; }
.cs-light .p-dusk { background: linear-gradient(180deg, rgba(150, 120, 200, .3), rgba(120, 96, 170, .18) 60%, rgba(90, 70, 130, .1)); }
.cs-light.k-sea .p-sunrise { background: linear-gradient(180deg, rgba(190, 240, 230, .34), rgba(150, 220, 210, .12)); }
.cs-light.k-sea .p-golden { background: linear-gradient(180deg, rgba(220, 230, 160, .34), rgba(120, 200, 190, .14)); }
.cs-light.k-sea .p-sunset { background: linear-gradient(180deg, rgba(230, 170, 150, .3), rgba(40, 80, 110, .3)); }
.cs-light.k-sea .p-dusk { background: linear-gradient(180deg, rgba(110, 170, 200, .24), rgba(60, 110, 150, .1)); }
.cs-light[data-phase="sunrise"] .p-sunrise, .cs-light[data-phase="golden"] .p-golden,
.cs-light[data-phase="sunset"] .p-sunset, .cs-light[data-phase="dusk"] .p-dusk { opacity: var(--lk); }
@media (prefers-reduced-motion: reduce) { .cs-light > i { transition: none; } }
html.a11y-reduce-motion .cs-light > i { transition: none; }
.cs-bud-layer { position: absolute; inset: 0; width: 100%; height: 100%; display: block; overflow: hidden; transition: opacity .9s ease; }
@media (prefers-reduced-motion: reduce) { .cs-bud-layer { transition: none; } }
html.a11y-reduce-motion .cs-bud-layer { transition: none; }
.cs-bud-shadow { fill: #000; opacity: .28; }
.cs-bud { transform-origin: 50px 96px; animation: cs-bob 7s ease-in-out infinite; }
/* Each buddy moves in their own way: Pip breathes slowly, Hazel bounces lightly, Bramble sways,
   Fenn tilts their head as if thinking. */
.cs-bud-pip { animation: cs-breathe 6s ease-in-out infinite; }
.cs-bud-hazel { animation: cs-hop 4.6s ease-in-out infinite; }
.cs-bud-bramble { animation: cs-sway-b 8s ease-in-out infinite; }
.cs-bud-fenn { animation: cs-nod 6.5s ease-in-out infinite; }
@keyframes cs-breathe { 0%, 100% { transform: scale(1, 1); } 50% { transform: scale(1.015, 1.03); } }
@keyframes cs-hop { 0%, 55%, 100% { transform: translateY(0); } 65% { transform: translateY(-3.5px); } 75% { transform: translateY(0); } 82% { transform: translateY(-1.5px); } 90% { transform: translateY(0); } }
@keyframes cs-sway-b { 0%, 100% { transform: rotate(-1.4deg); } 50% { transform: rotate(1.4deg); } }
@keyframes cs-nod { 0%, 40%, 100% { transform: rotate(0deg); } 55% { transform: rotate(-3deg); } 70% { transform: rotate(1.5deg); } 85% { transform: rotate(0deg); } }
.cs-buddy.night .cs-bud { filter: brightness(.84) saturate(.92); }
.cs-buddy.night .cs-bud-shadow { opacity: .38; }
@keyframes cs-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-2.5px); } }
.cs-bud-prop .ba-page, .cs-bud-prop .ba-nut, .cs-bud-prop .ba-pencil, .cs-bud-prop .ba-stick, .cs-bud-prop .ba-type, .cs-bud-prop .ba-sip, .cs-bud-prop .ba-glow, .cs-bud-prop .ba-sway, .cs-bud-prop .ba-wave, .cs-bud-prop .ba-bobber { animation-delay: var(--bd, 0s); }
.ba-sip { transform-origin: 69px 97px; animation: ba-sip 7s ease-in-out infinite; }
@keyframes ba-sip { 0%, 62%, 100% { transform: rotate(0deg); } 70%, 80% { transform: translate(-10px, -12px) rotate(-38deg); } 88% { transform: rotate(0deg); } }
.ba-glow { animation: ba-glow 3.4s ease-in-out infinite; }
@keyframes ba-glow { 0%, 100% { opacity: 1; } 20% { opacity: .78; } 35% { opacity: .95; } 60% { opacity: .82; } 80% { opacity: 1; } }
.ba-knit { transform-origin: 50px 90px; animation: ba-knit 1.8s ease-in-out infinite; }
.ba-knit2 { animation-delay: -.9s; }
@keyframes ba-knit { 0%, 100% { transform: rotate(0deg); } 50% { transform: rotate(7deg); } }
.ba-sway { transform-box: fill-box; transform-origin: 40% 100%; animation: ba-sway 6.5s ease-in-out infinite; }
@keyframes ba-sway { 0%, 100% { transform: rotate(-2.5deg); } 50% { transform: rotate(2.5deg); } }
.ba-bobber { animation: ba-bobber 3s ease-in-out infinite; }
@keyframes ba-bobber { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(2px); } }
.ba-wave { transform-origin: 19px 95px; animation: ba-wave 7s ease-in-out infinite; }
@keyframes ba-wave { 0%, 100% { transform: rotate(0deg); } 50% { transform: rotate(-5deg); } }
/* Page turn (28 Nov 2026): the turning page is drawn identical to the right-hand page, so at
   rest it is invisible against it. Every 9s it lifts, turns over the spine (right to left,
   never back), lands exactly on the left-hand page (its lines mirror onto the left page's
   lines) and is then hidden; the jump back to the right happens while hidden, so the reader
   only ever sees forward page turns. Static (reduced motion) it simply looks like the book. */
.ba-page { transform-origin: 50px 92px; animation: ba-page 9s infinite; }
@keyframes ba-page {
  0%, 66% { transform: scaleX(1); opacity: 1; animation-timing-function: ease-in; }
  73% { transform: scaleX(.25) translateY(-1.2px); animation-timing-function: linear; }
  77% { transform: scaleX(-.3) translateY(-1px); animation-timing-function: ease-out; }
  84% { transform: scaleX(-1); opacity: 1; }
  84.01%, 99.99% { transform: scaleX(-1); opacity: 0; }
  100% { transform: scaleX(1); opacity: 0; }
}
.ba-nut { transform-origin: 50px 86px; animation: ba-nibble 5s ease-in-out infinite; }
@keyframes ba-nibble { 0%, 60%, 100% { transform: translateY(0); } 68% { transform: translateY(-5px) rotate(-6deg); } 76% { transform: translateY(0); } 84% { transform: translateY(-5px) rotate(6deg); } }
.ba-steam path { animation: ba-steam 4.5s ease-in-out infinite; }
.ba-steam path + path { animation-delay: 1.6s; }
@keyframes ba-steam { 0% { opacity: 0; transform: translateY(6px); } 40% { opacity: .8; } 100% { opacity: 0; transform: translateY(-8px); } }
.ba-pencil { animation: ba-write 3.2s ease-in-out infinite; }
@keyframes ba-write { 0%, 100% { transform: translate(0, 0); } 25% { transform: translate(-6px, 1px); } 50% { transform: translate(-12px, 0); } 75% { transform: translate(-6px, 1px); } }
.ba-stick { transform-origin: 26px 99px; animation: ba-stick 6s ease-in-out infinite; }
@keyframes ba-stick { 0%, 100% { transform: rotate(0deg); } 50% { transform: rotate(5deg); } }
.ba-type { animation: ba-type 2.6s steps(2, end) infinite; }
@keyframes ba-type { 0%, 100% { opacity: .4; } 50% { opacity: 1; } }
.cs-root.still .cs-bud, .cs-root.still .cs-bud *, .cs-root.focus-only .cs-bud, .cs-root.focus-only .cs-bud * { animation: none !important; }
/* Buddies blink only in the scene (buddies.js leaves them still everywhere else). Just a blink:
   the eyes never look around. Each buddy has its own rhythm. */
.cs-bud .bud-blink { transform-box: fill-box; transform-origin: 50% 50%; animation: cs-blink 11s linear infinite; }
.cs-bud-hazel .bud-blink { animation-duration: 9s; animation-delay: -3s; }
.cs-bud-bramble .bud-blink { animation-duration: 15s; animation-delay: -7s; }
.cs-bud-fenn .bud-blink { animation-duration: 12s; animation-delay: -5s; }
@keyframes cs-blink { 0%, 96%, 100% { transform: none; } 97%, 98% { transform: scaleY(.12); } }
.cs-root.bud-still .cs-bud, .cs-root.bud-still .cs-bud *, .cs-root.paused .cs-bud, .cs-root.paused .cs-bud * { animation: none !important; }
html.a11y-reduce-motion .cs-bud, html.a11y-reduce-motion .cs-bud * { animation: none !important; }
@media (prefers-reduced-motion: reduce) { .cs-bud, .cs-bud * { animation: none !important; } }

/* ---------- Ambient scene life (calm-environments.js) ----------
   Only the full-screen scene animates; picker thumbnails stay still. Every element brings its
   own timing as custom properties (--d duration, --dl delay, plus distances), set at random
   when the scene is drawn, so loops never line up. Transform and opacity only. */
.cs-scene .cs-a { animation-duration: var(--d, 10s); animation-delay: var(--dl, 0s); animation-iteration-count: infinite; animation-timing-function: ease-in-out; }
.cs-scene .cs-a-fall { animation-name: csa-fall; animation-timing-function: linear; transform-box: fill-box; transform-origin: 50% 50%; opacity: 0; }
@keyframes csa-fall {
  0% { transform: translate(0, -40px) rotate(0deg); opacity: 0; }
  6% { opacity: 1; }
  25% { transform: translate(var(--sw, 40px), 200px) rotate(calc(var(--rot, 300deg) * .25)); }
  50% { transform: translate(calc(var(--sx, 60px) * .5 - var(--sw, 40px)), 450px) rotate(calc(var(--rot, 300deg) * .5)); }
  75% { transform: translate(calc(var(--sx, 60px) * .8 + var(--sw, 40px)), 700px) rotate(calc(var(--rot, 300deg) * .75)); opacity: .9; }
  100% { transform: translate(var(--sx, 60px), 960px) rotate(var(--rot, 300deg)); opacity: 0; }
}
.cs-scene .cs-a-float { animation-name: csa-float; }
@keyframes csa-float {
  0%, 100% { transform: translate(0, 0); opacity: calc(var(--o, .7) * .25); }
  30% { transform: translate(calc(var(--fx, 20px) * .6), calc(var(--fy, -20px) * .3)); opacity: var(--o, .7); }
  55% { transform: translate(var(--fx, 20px), var(--fy, -20px)); opacity: calc(var(--o, .7) * .6); }
  80% { transform: translate(calc(var(--fx, 20px) * .3), calc(var(--fy, -20px) * .8)); opacity: var(--o, .7); }
}
.cs-scene .cs-a-twinkle { animation-name: csa-twinkle; }
@keyframes csa-twinkle { 0%, 100% { opacity: 1; } 18% { opacity: var(--lo, .4); } 34% { opacity: .9; } 58% { opacity: calc(var(--lo, .4) + .2); } 76% { opacity: 1; } 88% { opacity: var(--lo, .4); } }
.cs-scene .cs-a-flick { animation-name: csa-flick; }
@keyframes csa-flick { 0%, 100% { opacity: 1; } 13% { opacity: var(--lo, .75); } 22% { opacity: .95; } 41% { opacity: calc(var(--lo, .75) + .1); } 60% { opacity: 1; } 71% { opacity: var(--lo, .75); } 83% { opacity: .92; } }
.cs-scene .cs-a-flame { animation-name: csa-flame; transform-box: fill-box; transform-origin: 50% 100%; }
@keyframes csa-flame { 0%, 100% { transform: rotate(0deg) scale(1, 1); } 20% { transform: rotate(var(--amp, 3deg)) scale(.96, 1.06); } 45% { transform: rotate(calc(var(--amp, 3deg) * -.6)) scale(1.03, .95); } 70% { transform: rotate(calc(var(--amp, 3deg) * .4)) scale(.98, 1.04); } }
.cs-scene .cs-a-ray { animation-name: csa-ray; transform-box: fill-box; transform-origin: 50% 0; }
@keyframes csa-ray { 0%, 100% { transform: rotate(0deg); opacity: .65; } 35% { transform: rotate(var(--amp, 1deg)); opacity: 1; } 70% { transform: rotate(calc(var(--amp, 1deg) * -.7)); opacity: .8; } }
/* Jellyfish bell: a slow, soft pulse (transform only, so the bell keeps its own opacity). */
.cs-scene .cs-a-jelly { animation-name: csa-jelly; transform-box: fill-box; transform-origin: 50% 100%; }
@keyframes csa-jelly { 0%, 100% { transform: scale(1, 1); } 40% { transform: scale(.9, 1.08); } 60% { transform: scale(1.04, .95); } }
.cs-scene .cs-a-shimmer { animation-name: csa-shimmer; }
@keyframes csa-shimmer { 0%, 100% { transform: translateX(0); opacity: .5; } 40% { transform: translateX(var(--amp, 10px)); opacity: 1; } 70% { transform: translateX(calc(var(--amp, 10px) * -.5)); opacity: .7; } }
.cs-scene .cs-a-sway { animation-name: csa-sway; transform-box: fill-box; transform-origin: 50% 100%; }
.cs-scene .cs-a-hang { animation-name: csa-sway; transform-box: fill-box; transform-origin: 50% 0; }
@keyframes csa-sway { 0%, 100% { transform: rotate(0deg); } 30% { transform: rotate(var(--amp, 2deg)); } 65% { transform: rotate(calc(var(--amp, 2deg) * -.8)); } }
.cs-scene .cs-a-rise { animation-name: csa-rise; animation-timing-function: ease-out; opacity: 0; }
.cs-scene .cs-a-puff { transform-box: fill-box; transform-origin: 50% 50%; }
@keyframes csa-rise {
  0% { transform: translate(0, 0) scale(.8); opacity: 0; }
  15% { opacity: var(--o, .6); }
  50% { transform: translate(calc(var(--rx, 10px) * .5), calc(var(--ry, -30px) * .5)) scale(1.3); }
  100% { transform: translate(var(--rx, 10px), var(--ry, -30px)) scale(1.9); opacity: 0; }
}
.cs-scene .cs-a-drip { animation-name: csa-drip; animation-timing-function: ease-in; }
@keyframes csa-drip { 0%, 55% { transform: translateY(0); opacity: .9; } 62% { transform: translateY(calc(var(--dy, 80px) * .12)); } 92% { transform: translateY(var(--dy, 80px)); opacity: .6; } 100% { transform: translateY(var(--dy, 80px)); opacity: 0; } }
.cs-scene .cs-a-swim { animation-name: csa-swim; animation-timing-function: linear; }
@keyframes csa-swim { 0% { transform: translate(0, 0); opacity: 0; } 8% { opacity: var(--o, .7); } 50% { transform: translate(calc(var(--dx, 1600px) * .5), var(--dy, 20px)); } 92% { opacity: var(--o, .7); } 100% { transform: translate(var(--dx, 1600px), 0); opacity: 0; } }
.cs-scene .cs-a-pass { animation-name: csa-pass; animation-timing-function: linear; }
@keyframes csa-pass { from { transform: translateX(0); } to { transform: translateX(var(--dx, -1200px)); } }
.cs-scene .cs-a-bob { animation-name: csa-bob; }
@keyframes csa-bob { 0%, 100% { transform: translate(0, 0); } 35% { transform: translate(calc(var(--amp, 4px) * .5), var(--amp, 4px)); } 70% { transform: translate(calc(var(--amp, 4px) * -.4), calc(var(--amp, 4px) * -.5)); } }
/* One-off events, played now and then by calm-space.js (adds .go) */
.cs-ev, .cs-a-fall, .cs-a-rise { opacity: 0; }
.cs-scene .cs-ev.go { animation-duration: var(--d, 18s); animation-iteration-count: 1; animation-fill-mode: both; }
.cs-scene .cs-ev-fly.go { animation-name: csa-fly; animation-timing-function: linear; }
@keyframes csa-fly { 0% { transform: translate(0, 0); opacity: 0; } 5% { opacity: 1; } 30% { transform: translate(calc(var(--dx, 1800px) * .3), calc(var(--dy, 0px) * .5 - 12px)); } 60% { transform: translate(calc(var(--dx, 1800px) * .6), calc(var(--dy, 0px) * .8 + 8px)); } 95% { opacity: 1; } 100% { transform: translate(var(--dx, 1800px), var(--dy, 0px)); opacity: 0; } }
.cs-scene .cs-ev.go .cs-flap { transform-box: fill-box; transform-origin: center; animation: csa-flap .32s ease-in-out infinite alternate; }
@keyframes csa-flap { from { transform: scaleY(1); } to { transform: scaleY(.35); } }
.cs-scene .cs-ev.go .cs-tumble { transform-box: fill-box; transform-origin: center; animation: csa-tumble 3.2s ease-in-out infinite alternate; }
@keyframes csa-tumble { from { transform: rotate(-50deg); } to { transform: rotate(70deg); } }
.cs-scene .cs-ev-shoot.go { animation-name: csa-shoot; animation-timing-function: ease-in; }
@keyframes csa-shoot { 0% { transform: translateX(0); opacity: 0; } 15% { opacity: 1; } 100% { transform: translateX(420px); opacity: 0; } }
.cs-scene .cs-ev-swim.go { animation-name: csa-swim; animation-timing-function: linear; }
/* Calm when asked: paused in Distraction-free (Quiet mode and hidden tabs are paused above);
   no motion at all for reduced motion, and the drifting particles hide rather than freeze. */
.cs-root.focus-only .cs-scene * { animation-play-state: paused !important; }
.cs-root.still .cs-a-fall, .cs-root.still .cs-a-rise, .cs-root.still .cs-a-drip, .cs-root.still .cs-a-swim, .cs-root.still .cs-ev { display: none; }
@media (prefers-reduced-motion: reduce) { .cs-scene .cs-a-fall, .cs-scene .cs-a-rise, .cs-scene .cs-a-drip, .cs-scene .cs-a-swim, .cs-scene .cs-ev { display: none; } }
html.a11y-reduce-motion .cs-scene .cs-a-fall, html.a11y-reduce-motion .cs-scene .cs-a-rise, html.a11y-reduce-motion .cs-scene .cs-a-drip, html.a11y-reduce-motion .cs-scene .cs-a-swim, html.a11y-reduce-motion .cs-scene .cs-ev { display: none; }
/* Day / night crossfade between scene layers */
.cs-scene .cs-layer { position: absolute; inset: 0; transition: opacity .9s ease; }
@media (prefers-reduced-motion: reduce) { .cs-scene .cs-layer { transition: none; } }
html.a11y-reduce-motion .cs-scene .cs-layer { transition: none; }

/* Day/Night button beside the scene name */
/* Destinations drawer: time of day + study buddy sections at the top */
.cs-pick-sec { padding-bottom: 6px; margin-bottom: 4px; border-bottom: 1px solid var(--color-border); }
.cs-pick-sec .cs-coll { margin-top: 4px; }
.cs-buds { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 4px 0 10px; }
.cs-bud-pick { font: inherit; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px 6px; border-radius: 12px; border: 2px solid var(--color-border); background: var(--color-surface); color: var(--color-text); cursor: pointer; }
.cs-bud-pick[aria-pressed="true"] { border-color: var(--color-accent-orange); background: var(--color-hover); }
.cs-bud-pick .nm { font-size: 12px; font-weight: 700; }
.cs-bud-pick svg { width: 52px; height: 52px; }
.cs-bud-pick:focus-visible { outline: 2px solid var(--color-info); outline-offset: 2px; }
/* Spotify player strip in the Sound drawer */
.cs-spotify { padding: 12px 18px 4px; border-bottom: 1px solid var(--color-border); }

/* Auto day/night timings (Destinations drawer) */
.cs-auto { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: 2px 0 8px; font-size: 13px; }
.cs-auto label { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.cs-auto input[type="time"] { font: inherit; font-size: 13px; padding: 4px 6px; border-radius: 8px; border: 1px solid var(--color-border, rgba(127,127,127,.4)); background: var(--color-hover, transparent); color: var(--color-text, inherit); min-height: 32px; }
.cs-auto-err { margin: 0 0 6px; color: #e8a08a; }
.cs-auto-err:empty { display: none; }
.cs-bud-pick[aria-pressed="false"] svg { opacity: .55; }
/* Voice typing button (voice-notes.js) inside the Calm Space notes */
.cs-sticky .vn-wrap { flex: 1; display: flex; flex-direction: column; }
.cs-sticky .vn-wrap textarea { flex: 1; min-height: 96px; }
.cs-sticky .vn-btn { right: 2px; bottom: 2px; padding: 3px 8px; font-size: 11px; }
.vn-wrap > .cs-textarea, .vn-wrap > textarea { width: 100%; box-sizing: border-box; display: block; }
/* Wide screens: blurred, dimmed copy of the scene behind the real one (see fitSvg/prepBleed). */
.cs-layer { position: absolute; inset: 0; }
.cs-backdrop { position: absolute; inset: -60px; overflow: hidden; pointer-events: none; z-index: 0; filter: blur(26px) brightness(.72) saturate(1.05); transform: translateZ(0); }
.cs-backdrop > svg { width: 100%; height: 100%; display: block; }
.cs-backdrop * { animation: none !important; }
.cs-layer > svg { position: relative; z-index: 1; }

/* ---------- Short windows (a laptop browser minus its toolbars) ----------
   The ring flexes (see .cs-timer); these rules take out spare spacing and fold the chip rows to
   one line each, so the card and the full toolbar fit on screen without scrolling. */
/* Length chips: one row that scrolls sideways if it ever runs out of room (auto margins centre it
   when it fits, without making the start unreachable when it doesn't). */
@media (max-height: 800px), (max-width: 640px) {
  #cs-presets, #cs-breaklens { flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; scrollbar-width: none; padding: 3px; margin: -3px -3px 7px; gap: 5px; }
  #cs-presets::-webkit-scrollbar, #cs-breaklens::-webkit-scrollbar { display: none; }
  #cs-presets > :first-child, #cs-breaklens > :first-child { margin-left: auto; }
  #cs-presets > :last-child, #cs-breaklens > :last-child { margin-right: auto; }
  .cs-chip, .cs-chips-lbl { flex: none; }
}
@media (max-height: 800px) {
  .cs-top { padding: 10px 18px; }
  .cs-center { padding: 6px 16px; }
  .cs-timer { padding: 14px 20px 12px; width: min(500px, 100%); }
  .cs-modes { margin-bottom: 8px; }
  .cs-timer input.cs-label[type=text] { padding: 4px; margin-bottom: 6px; }
  .cs-ring { margin: 4px auto 6px; }
  .cs-cycle { margin: 0 0 8px; }
  .cs-controls { margin-bottom: 10px; }
  .cs-chip { padding: 6px 9px; }
  .cs-tools { padding: 8px 16px 12px; }
  .cs-tool { min-height: 52px; padding: 6px 10px; gap: 3px; }
  .cs-suggest { padding: 8px 12px; font-size: 13.5px; line-height: 1.45; }
}
@media (max-height: 660px) {
  .cs-top { padding: 8px 16px; }
  .cs-btn { min-height: 36px; padding: 6px 11px; }
  .cs-center { padding: 4px 16px; }
  .cs-timer { padding: 12px 18px 10px; }
  .cs-mode { min-height: 30px; padding: 5px 12px; }
  .cs-modes { margin-bottom: 6px; }
  .cs-ring { margin: 2px auto 4px; }
  .cs-cycle { margin-bottom: 6px; }
  .cs-controls { margin-bottom: 8px; }
  .cs-chip { min-height: 32px; padding: 5px 9px; }
  /* Toolbar: icon beside the label, one slim row */
  .cs-tools { padding: 6px 12px 10px; gap: 6px; }
  .cs-tool { flex-direction: row; min-height: 40px; min-width: 0; padding: 6px 10px; gap: 6px; }
  /* Break ideas read as one flowing line instead of a list */
  .cs-suggest { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px 12px; text-align: center; }
  .cs-suggest li:not(:last-child)::before { content: none; }
}

/* Phones turned sideways (and other very short windows): the card on the left with the ring
   beside its controls, the tools in a compact grid on the right. DOM order (and so the focus
   order) is unchanged: top bar, timer, tools. */
@media (max-height: 559px) and (min-width: 600px) {
  .cs-root { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto minmax(0, 1fr); }
  .cs-top { grid-column: 1 / -1; padding: 6px 12px; gap: 6px; flex-wrap: nowrap; }
  .cs-brand { min-width: 0; overflow: hidden; white-space: nowrap; }
  .cs-brand span:not(.cs-adt-n) { display: none; }
  .cs-btn { padding: 6px 9px; }
  .cs-btn .lbl { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .cs-center { grid-column: 1; grid-row: 2; padding: 2px 8px 8px 12px; }
  .cs-timer { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 16px; align-items: center; align-content: center; width: min(640px, 100%); padding: 10px 16px; }
  .cs-timer > * { grid-column: 2; }
  .cs-ring { grid-column: 1; grid-row: 1 / span 12; align-self: center; --cs-ring: clamp(112px, calc(100vh - 150px), 170px); width: var(--cs-ring); height: var(--cs-ring); margin: 0; }
  .cs-modes { justify-self: center; margin-bottom: 6px; }
  .cs-timer input.cs-label[type=text] { margin-bottom: 6px; }
  .cs-cycle { margin: 0 0 6px; }
  .cs-controls { margin-bottom: 8px; }
  .cs-exit-fo { justify-self: center; margin-top: 8px; }
  .cs-tools { grid-column: 2; grid-row: 2; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-content: center; gap: 6px; padding: 2px 12px 8px 0; }
  .cs-tool { width: 100%; min-width: 84px; min-height: 44px; padding: 4px 6px; gap: 2px; font-size: 12px; flex-direction: column; }
  .cs-tool svg { width: 16px; height: 16px; }
  .cs-suggest { padding: 4px 10px; margin-top: 4px; font-size: 12.5px; }
  .cs-break-acts { margin-bottom: 6px; }
  #cs-breaklens { margin-bottom: 0; }
  .cs-root.on-break .cs-timer { padding-top: 4px; padding-bottom: 4px; }
}

/* Touch screens: every control is at least 44px tall to tap. */
@media (pointer: coarse) {
  .cs-btn, .cs-chip, .cs-mode, .cs-tool, .cs-exit-fo { min-height: 44px; }
  .cs-btn { min-width: 44px; justify-content: center; }
  .cs-linkbtn { min-height: 44px; }
  .cs-dtab { min-height: 44px; }
}

/* A tool drawer open on a wide screen: keep the timer and toolbar clear of it. */
@media (min-width: 1000px) {
  .cs-root:has(~ .cs-drawer.open) .cs-center, .cs-root:has(~ .cs-drawer.open) .cs-tools { margin-right: min(380px, 100%); }
}
/* Short and not very wide: icon-only top buttons (names stay for screen readers) so the bar keeps to one row. */
@media (max-height: 660px) and (max-width: 1180px) {
  .cs-btn .lbl { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}

/* Scene brightness slider (Destinations drawer) */
.cs-bright { display: flex; justify-content: space-between; font-size: 13.5px; font-weight: 600; margin-top: 12px; }
.cs-bright output { font-weight: 500; color: var(--color-text-muted); }
.cs-bright-r { width: 100%; min-height: 32px; accent-color: var(--color-accent-orange); }

/* Lighter animation detail (calm-space.js applyDetail): scenery and buddies stay; the costly
   moving extras pause. (The blurred backdrop stays: it is static and fills the sides on wide screens.) */
.cs-root.lite .cs-scene .cs-a-fall, .cs-root.lite .cs-scene .cs-a-float, .cs-root.lite .cs-scene .cs-a-rise, .cs-root.lite .cs-scene .cs-a-swim { display: none; }
.cs-root.lite .cs-scene .cs-a-ray, .cs-root.lite .cs-scene .cs-a-shimmer, .cs-root.lite .cs-scene .cs-a-twinkle { animation: none !important; }

/* ---------- Seasonal touches (Spec 2 §18) ----------
   Extra particles only; they hide with Quiet mode, Lighter detail and reduced motion.
   Winter snow comes and goes: a slow fade over six minutes. */
.cs-root.still .cs-season, .cs-root.lite .cs-season { display: none; }
@media (prefers-reduced-motion: reduce) { .cs-scene .cs-season { display: none; } }
html.a11y-reduce-motion .cs-scene .cs-season { display: none; }
.cs-scene .cs-season-occ { animation: csa-season-occ 360s linear -20s infinite; }
@keyframes csa-season-occ { 0% { opacity: 0; } 6% { opacity: 1; } 55% { opacity: 1; } 62% { opacity: 0; } 100% { opacity: 0; } }

/* ---------- Saved study setups (Spec 2 §16) ---------- */
.cs-su { border: 1px solid var(--color-border); border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; background: var(--color-surface); }
.cs-su.open { border-color: var(--color-accent-orange); }
.cs-su-top { display: flex; gap: 8px; align-items: center; }
.cs-su-top .grow { flex: 1; min-width: 0; }
.cs-su-name { font-weight: 700; font-size: 14.5px; overflow-wrap: anywhere; }
.cs-su-sum { font-size: 12.5px; color: var(--color-text-muted); line-height: 1.45; margin-top: 2px; }
.cs-su-go { font: inherit; font-size: 13px; font-weight: 700; border: none; border-radius: 999px; padding: 7px 14px; min-height: 34px; background: var(--color-accent-orange); color: #fff; cursor: pointer; flex: none; }
.cs-su-go:hover { filter: brightness(1.05); }
.cs-su-go:focus-visible, .cs-su .cs-mini:focus-visible { outline: 3px solid var(--color-accent-orange); outline-offset: 2px; }
.cs-su-edit { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--color-border); display: flex; flex-direction: column; gap: 10px; }
.cs-su-field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 700; }
.cs-su-field input, .cs-su-field select { font: inherit; font-size: 14px; font-weight: 400; padding: 8px 10px; border: 1px solid var(--color-border-strong); border-radius: 8px; background: var(--color-surface); color: var(--color-text); width: 100%; min-width: 0; }
.cs-su-line { display: flex; gap: 8px; align-items: center; }
.cs-su-line > input { flex: 1; min-width: 0; }
.cs-su-acts { display: flex; flex-wrap: wrap; gap: 6px; }
.cs-su-acts .warn { color: var(--color-danger, #B3261E); }
.cs-su-idea { display: flex; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--color-border); }
.cs-su-idea:last-child { border-bottom: none; }
.cs-su-idea .grow { flex: 1; min-width: 0; }
.cs-su-msg { font-size: 12.5px; color: var(--color-danger, #B3261E); min-height: 0; }
/* Keep the timer readable over busy scenes (e.g. when the panel is hidden): a soft dark disc
   inside the ring plus a gentle shadow on the numbers. */
.cs-ring::before { content: ""; position: absolute; inset: 7%; border-radius: 50%; background: radial-gradient(circle, rgba(16,12,20,.62) 0%, rgba(16,12,20,.5) 62%, rgba(16,12,20,0) 100%); pointer-events: none; }
.cs-time .t, .cs-time .p { text-shadow: 0 2px 10px rgba(0,0,0,.55); }
.cs-ring svg { position: relative; }

/* Phones: five equal toolbar buttons with the icon above the label, at any height. */
@media (max-width: 599px), (max-width: 640px) and (min-height: 560px) {
  .cs-tools { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .cs-tool { flex-direction: column; min-height: 48px; padding: 6px 2px; gap: 3px; }
}
@media (max-width: 380px) {
  .cs-timer { padding: 12px; }
  .cs-mode { font-size: 12.5px; padding: 6px 8px; }
  .cs-center { padding-left: 10px; padding-right: 10px; }
  .cs-cycle { column-gap: 8px; font-size: 12px; }
}
/* Distraction-free has no card, so text gets its own dark backing. */
.cs-root.focus-only .cs-cycle { align-self: center; justify-self: center; padding: 4px 14px; border-radius: 999px; background: rgba(18, 22, 18, .72); opacity: 1; }
.cs-root.focus-only .cs-chip:not([aria-pressed="true"]), .cs-root.focus-only .cs-exit-fo, .cs-root.focus-only .cs-chips-lbl, .cs-root.focus-only .cs-applies { background: rgba(18, 22, 18, .72); }
.cs-root.focus-only .cs-chips-lbl, .cs-root.focus-only .cs-applies { padding: 4px 10px; border-radius: 999px; opacity: 1; }
.cs-root.focus-only .cs-timer input.cs-label[type=text] { background: rgba(18, 22, 18, .72); border-radius: 10px; }
