/* Alani on the web. Phone first, works at any size. Dark by default; [data-theme="light"] switches.
   Calm and quick: few animations, big touch targets, colour only where it means something
   (island headers, red = needs you now, green = done, grey = happening now). */

:root {
  --ui-scale: 1; /* the app's scale (uiScale.js): CSS zoom scales screen units too, so every vh/vw here is divided by it */
  color-scheme: dark;
  --bg: #0e0e0e;
  --surface: #1a1a1a;
  --surface-2: #262626;
  --input: #232323;
  --line: #2f2f2f;
  --text: #ffffff;
  --muted: #b3b3b3;
  --island-body: #3a3a3a;
  --orange: #d4773f;
  --music: #c65a15;
  --transport: #b5260f;
  --due: #c40f0f;
  --done: #33d34a;
  --ongoing: #7a7a7a;
  --row-hover: rgba(255, 255, 255, 0.08);
  --nav-active: rgba(255, 255, 255, 0.16);
  --glow: rgba(140, 62, 15, 0.9);
  --radius: 22px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
[data-theme="light"] {
  color-scheme: light;
  --bg: #f3f1ee;
  --surface: #ffffff;
  --surface-2: #ffffff;
  --input: #f1efec;
  --line: #e2ded8;
  --text: #1b1b1b;
  --muted: #666666;
  --island-body: #ffffff;
  --row-hover: rgba(0, 0, 0, 0.05);
  --nav-active: rgba(0, 0, 0, 0.09);
  --glow: rgba(234, 160, 110, 0.75);
  --done: #1f9e33;
  --ongoing: #cfcfcf;
}
/* the colour of each day of the week, when switched on (Settings > Language & time): Monday yellow, Tuesday pink, Wednesday green, Thursday orange, Friday blue, Saturday purple, Sunday red */
:root { --day-1: #ffd23f; --day-2: #ff7eb6; --day-3: #4cd964; --day-4: #ff9a3c; --day-5: #5aa9ff; --day-6: #b98cff; --day-7: #ff5a5a; }
[data-theme="light"] { --day-1: #b58900; --day-2: #d6336c; --day-3: #1f9e33; --day-4: #d9650b; --day-5: #1c6fd6; --day-6: #7d4fd1; --day-7: #c92a2a; }
.wd-1 { color: var(--day-1); } .wd-2 { color: var(--day-2); } .wd-3 { color: var(--day-3); } .wd-4 { color: var(--day-4); } .wd-5 { color: var(--day-5); } .wd-6 { color: var(--day-6); } .wd-7 { color: var(--day-7); }
.item.due .wd, .item.event.ongoing .wd { color: inherit; } /* (those rows have a colour of their own behind them) */
.repeat-mark { display: inline-flex; align-items: center; opacity: 0.75; }

* { box-sizing: border-box; scrollbar-width: thin; scrollbar-color: #555 transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); overscroll-behavior: none; }
html { font-size: calc(16px * var(--text-scale, 1)); }
body { font-size: 1rem; line-height: 1.35; -webkit-tap-highlight-color: transparent; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled, [aria-disabled="true"] { cursor: default; }
:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }
img { display: block; }

.muted { color: var(--muted); }
.small { font-size: 0.82rem; }
.ok { color: var(--done); }
.grow { flex: 1; min-width: 0; }
.push-left { margin-right: auto; }
.empty { color: var(--muted); padding: 10px 14px; margin: 0; font-size: 0.9rem; }
.center { text-align: center; }
p.empty.center { margin-top: calc(20vh / var(--ui-scale, 1)); }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.row.fill > * { flex: 1; }

/* ------------------------------------------------------------------ the frame */
.app { height: calc(100dvh / var(--ui-scale, 1)); display: grid; background: linear-gradient(to top, var(--glow) 0, transparent 120px) var(--bg); overflow: hidden; }
/* Phones and tablets (added to the home screen, the page reaches under the camera and the status bar):
   keep clear of them, with a little extra room at the top. */
.app { padding: calc(env(safe-area-inset-top) + var(--top-room, 0px)) env(safe-area-inset-right) 0 env(safe-area-inset-left); }
.app.layout-h { padding-bottom: env(safe-area-inset-bottom); }
@media (pointer: coarse) { .app { --top-room: 8px; } }
@media (display-mode: standalone) and (pointer: coarse) { .app { --top-room: 14px; } }
.app.layout-h { grid-template-columns: 78px minmax(0, 1fr) min(400px, calc(32vw / var(--ui-scale, 1))); }
.app.layout-h.music-hidden { grid-template-columns: 78px minmax(0, 1fr) 44px; }
.app.layout-h.no-music { grid-template-columns: 78px minmax(0, 1fr); }
.app.layout-v { grid-template-rows: auto minmax(0, 1fr) auto; grid-template-columns: minmax(0, 1fr); }
.app.layout-v.no-music { grid-template-rows: minmax(0, 1fr) auto; } /* Music off: only the page and the bar (else the page took the first, auto row and the bar was pushed off the screen) */
.layout-v .music, .layout-v .stage, .queue-wrap, .q-row { min-width: 0; }

.stage { overflow: auto; padding: 14px; min-height: 0; }
.stage:has(.islands.snap) { scroll-snap-type: y mandatory; }

.nav { display: flex; align-items: center; }
.layout-h .nav { flex-direction: column; gap: 10px; padding: 10px 0 14px; }
.layout-v .nav { justify-content: space-around; align-items: flex-end; gap: 4px; height: 86px; padding: 0 8px env(safe-area-inset-bottom); background: linear-gradient(to top, var(--glow), transparent); }

.nav-btn { position: relative; width: 54px; height: 54px; display: grid; place-items: center; border: 0; border-radius: 16px; background: none; color: var(--text); }
.nav-btn:hover { background: var(--row-hover); }
.nav-btn.active { background: var(--nav-active); }
.nav-btn.rocket, .nav-btn.rocket.active { background: var(--orange); color: #fff; }
.layout-h .rocket { width: 70px; height: 64px; border-radius: 0 30px 30px 0; align-self: flex-start; }
.layout-v .rocket { width: 72px; height: 82px; border-radius: 38px 38px 0 0; }
.rocket .badge { top: 6px; right: 6px; }

.ai-btn { padding: 0; border: 0; display: grid; place-items: center; overflow: hidden; background: linear-gradient(140deg, #2f8fe8, #f07a2a); }
.layout-h .ai-btn { width: 54px; height: 54px; border-radius: 16px; flex: none; } /* (in the rail right under the rocket, the size of the other buttons) */
.layout-h .ai-btn img { width: 50px; height: 50px; }
.layout-v .ai-btn { width: 72px; height: 80px; border-radius: 38px 38px 0 0; }
.ai-btn img { width: 56px; height: 56px; }
.ai-btn.active { box-shadow: 0 0 0 3px var(--nav-active); }

.bell { display: flex; align-items: center; gap: 6px; align-self: flex-start; border: 0; border-radius: 0 14px 14px 0; padding: 6px 12px; background: #3a3a3a; color: #fff; font-weight: 700; }
.bell.alert { background: #d11414; }

.badge { position: absolute; top: -8px; right: -8px; min-width: 24px; height: 24px; padding: 0 6px; border-radius: 999px; background: #e3120f; color: #fff; font-size: 0.8rem; font-weight: 700; display: grid; place-items: center; }

/* ------------------------------------------------------------------ islands */
.islands { display: flex; align-items: flex-start; justify-content: flex-start; }
.layout-v .islands { justify-content: center; }
.island-col { display: flex; flex-direction: column; flex: none; }
.island { position: relative; flex: none; border-radius: var(--radius); background: var(--island-body); scroll-snap-align: start; scroll-margin-top: 14px; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25); }
.island.red { --head: #9b1e0d; }
.island.purple { --head: #7a34ad; }
.island.blue { --head: #2c58a6; }
.island.green { --head: #53902f; }
.island.darkgreen { --head: #2a5a1f; }
.island.yellow { --head: #c79a06; }
.island.weatherblue { --head: #3a6598; background: #2f5688; color: #fff; border: 1px solid rgba(255, 255, 255, 0.28); }
.island.weatherblue .island-body { padding: 0; max-height: none; overflow: hidden; border-radius: var(--radius); }
.island.weatherblue:not(.headless) .island-body { border-radius: 0 0 var(--radius) var(--radius); }
/* the Weather island: a card like a phone's weather widget */
.wx { display: flex; flex-direction: column; gap: 6px; width: 100%; padding: 14px 16px 12px; border: 0; color: #fff; font: inherit; text-align: left; cursor: pointer; user-select: none; -webkit-user-select: none; background: linear-gradient(160deg, #5584bb, #2d5486); }
.wx.night { background: linear-gradient(160deg, #34457a, #141b3a); }
.wx.gray { background: linear-gradient(160deg, #66798f, #37485d); }
.wx:focus-visible { outline: 2px solid #fff; outline-offset: -3px; }
.wx-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.wx-place { display: flex; align-items: center; gap: 5px; min-width: 0; font-size: 1.18rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wx-icon { display: inline-flex; width: 30px; height: 30px; color: #fff; }
.wx-icon svg { width: 100%; height: 100%; }
.wx-icon.big { width: 38px; height: 38px; margin-top: -2px; }
.wx-mid { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; margin-top: -6px; }
.wx-temp { font-size: 3.2rem; font-weight: 300; line-height: 1; letter-spacing: -0.02em; }
.wx-note { margin: 0; text-align: right; font-size: 0.98rem; font-weight: 700; line-height: 1.2; padding-bottom: 6px; }
.wx-hours { display: flex; justify-content: space-between; gap: 4px; margin-top: 8px; }
.wx-hour { display: flex; flex: 1; flex-direction: column; align-items: center; gap: 4px; min-width: 0; font-size: 0.95rem; }
.wx-hour .wx-icon { width: 30px; height: 30px; }
.wx-hour small { font-size: 0.82rem; opacity: 0.92; }
.wx-dots { display: flex; justify-content: center; gap: 8px; margin-top: 4px; }
/* Wind direction: a square compass island (the three colours are set inline as --wind-ring, --wind-needle, --wind-dial; these are the defaults) */
.island[data-island="wind"] { overflow: hidden; }
.island[data-island="wind"] .island-body { height: 100%; }
.wind { display: grid; place-items: center; align-content: center; gap: 4px; width: 100%; height: 100%; padding: 5px; border: 0; background: none; color: #fff; font: inherit; font-size: 0.75rem; cursor: pointer; user-select: none; -webkit-user-select: none; }
.wind svg { display: block; width: 100%; height: 100%; }
.wind .wind-dial { fill: var(--wind-dial, #16233a); }
.wind .wind-track { stroke: var(--wind-ring, #4dc3ff); opacity: 0.22; }
.wind .wind-ring { stroke: var(--wind-ring, #4dc3ff); }
.wind .wind-needle, .wind .wind-n { fill: var(--wind-needle, #ff7a45); }
.wind .wind-tail { fill: #fff; opacity: 0.55; }
.wind .wind-hub { fill: var(--wind-dial, #16233a); stroke: var(--wind-ring, #4dc3ff); stroke-width: 1; }
.wind-colors { display: flex; flex-direction: column; gap: 8px; }
.wind-color { display: flex; align-items: center; gap: 10px; }
.wind-color span { width: 64px; }
.wind-color input[type="color"] { width: 46px; height: 32px; padding: 0; border: 1px solid var(--line); border-radius: 8px; background: none; }
.wx-dots button { width: 9px; height: 9px; padding: 0; border: 0; border-radius: 50%; background: rgba(255, 255, 255, 0.4); }
.wx-dots button.on { background: #fff; }
.wx-empty { align-items: center; justify-content: center; min-height: 130px; text-align: center; }
.wx-places { display: flex; flex-direction: column; gap: 4px; }
.wx-place-row { display: flex; align-items: center; gap: 4px; border-radius: 12px; }
.wx-place-row.on { background: var(--row-hover); }
.wx-place-pick { display: flex; flex: 1; align-items: center; gap: 6px; min-width: 0; padding: 8px 10px; border: 0; background: none; color: inherit; font: inherit; font-weight: 600; text-align: left; }
.wx-search { flex-wrap: nowrap; }
.wx-search input { flex: 1; min-width: 0; }
.wx-results { display: flex; flex-direction: column; }
.wx-result { display: flex; flex-direction: column; gap: 1px; padding: 8px 10px; border: 0; border-radius: 10px; background: none; color: inherit; font: inherit; text-align: left; }
.wx-result:hover { background: var(--row-hover); }
/* Notes: sticky notes; a long one scrolls inside itself */
.stickies { display: flex; flex-direction: column; gap: 8px; padding: 2px 8px 0; }
.sticky { display: flex; flex-direction: column; gap: 2px; max-height: 220px; overflow: auto; padding: 8px 12px; border: 0; border-radius: 4px; background: #7a5d00; color: #fff; font: inherit; text-align: left; white-space: pre-wrap; overflow-wrap: anywhere; cursor: pointer; }
.sticky:hover { background: #866700; }
.sticky-title { font-size: 1.1rem; font-weight: 700; }
:root[data-theme="light"] .sticky { background: #f3d36b; color: #2b2100; }
:root[data-theme="light"] .sticky:hover { background: #efca50; }
.sticky-add { display: grid; place-items: center; width: calc(100% - 16px); height: 38px; margin: 10px 8px 6px; border: 0; border-radius: 12px; background: #7d7878; color: #fff; cursor: pointer; }
.sticky-add:hover { background: #8d8888; }
.sticky-title-input { font-size: 1.1rem; font-weight: 700; }
.note-row .q-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.island-head { display: flex; align-items: center; gap: 4px; min-height: 52px; padding: 6px 8px; border-radius: var(--radius) var(--radius) 0 0; background: var(--head); color: #fff; }
.island.collapsed .island-head { border-radius: var(--radius); }
.island-title { flex: 1; margin: 0; text-align: center; font-size: 1.22rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.island-toggle, .island-lead { display: grid; place-items: center; padding: 6px; border: 0; border-radius: 10px; background: none; color: inherit; }
.island-toggle:hover, .island-lead:hover { background: rgba(255, 255, 255, 0.15); }
.range-pill { display: flex; align-items: center; gap: 2px; padding: 3px 8px 3px 3px; border: 0; border-radius: 999px; background: #262626; color: #fff; }
.range-letter { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; background: #161616; font-weight: 700; }
.island-body { max-height: calc(calc(75dvh / var(--ui-scale, 1)) - 52px); overflow: auto; padding: 6px 0 4px; border-radius: 0 0 var(--radius) var(--radius); }
/* Events: the list can run to the end of the year, so on a tall window it is capped at about the height of Trackers + Reminders + Calories (and scrolls inside, once focused). A height the person set (sized) still wins. */
.island:not(.sized)[data-island="events"] .island-body { max-height: min(530px, calc(calc(75dvh / var(--ui-scale, 1)) - 52px)); }

.items { display: flex; flex-direction: column; }
.items > * { flex-shrink: 0; } /* (a row is never squeezed below its text: in a capped list, a long event name used to spill over the next row) */
.ev-title.long { font-size: 0.9em; }
.ev-title.longer { font-size: 0.82em; }
.item { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 38px; padding: 5px 12px; border: 0; background: none; color: var(--text); text-align: left; }
button.item:hover { background: var(--row-hover); }
.item-text { flex: 1; min-width: 0; padding: 0; border: 0; background: none; color: inherit; text-align: left; overflow-wrap: anywhere; }
.item-meta { flex: none; font-size: 0.78rem; color: var(--muted); white-space: nowrap; }
.item.due { margin: 1px 4px; width: calc(100% - 8px); border-radius: 14px; background: var(--due); color: #fff; font-weight: 700; }
.item.due .item-meta { color: #fff; }
.item.is-done .item-text { color: var(--muted); }
.item.event.ongoing { margin: 1px 4px; width: calc(100% - 8px); border-radius: 14px; background: var(--ongoing); font-weight: 700; }
.item.is-over { opacity: 0.55; }
.tick { flex: none; display: grid; place-items: center; padding: 2px; border: 0; border-radius: 50%; background: none; color: var(--text); }
.tick.done, .count.done, .done-text { color: var(--done); }
.item.due .tick { color: #fff; }
.counter { display: flex; align-items: center; gap: 1px; flex: none; }
.step { display: grid; place-items: center; padding: 3px; border: 0; border-radius: 6px; background: none; color: var(--done); }
.step:disabled { opacity: 0.35; }
.count { margin-left: 4px; font-weight: 700; }
.add-line { display: flex; align-items: center; gap: 6px; padding: 8px 14px; border: 0; background: none; color: var(--muted); font-size: 0.85rem; }
.add-line:hover { color: var(--text); }

/* calories */
.calories { padding: 4px 8px 6px; }
.cal-big { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.cal-num { display: flex; align-items: baseline; justify-content: center; gap: 6px; padding: 2px 10px; border-radius: 999px; color: #fff; font-weight: 800; font-size: clamp(1.4rem, calc(4.5vw / var(--ui-scale, 1)), 2.3rem); }
.cal-num small { font-size: 0.9rem; }
.cal-num.in, .pm.in { background: #2e5c20; }
.cal-num.out, .pm.out { background: #7a0d0d; }
.cal-controls { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 6px; margin-top: 6px; }
.pm { display: flex; border-radius: 999px; }
.pm button { display: grid; place-items: center; padding: 5px 9px; border: 0; background: none; color: #fff; border-radius: 999px; }
.pm button:hover { background: rgba(255, 255, 255, 0.15); }
.daily-out { padding: 0; border: 0; background: none; color: var(--text); font-size: 0.78rem; }
.cal-total { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; margin: 6px 0 2px; padding: 5px 14px; border: 0; border-radius: 999px; background: #8a8a8a; color: #fff; font-weight: 800; font-size: 1.2rem; }
.log-time { min-width: 3.2em; color: var(--muted); }
/* tags on money entries and fixed costs: a chip in the tag's colour with its line icon (custom tags are white) */
.tag-chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px 3px 7px; border: 1px solid var(--tag, #fff); border-radius: 999px; background: color-mix(in srgb, var(--tag, #fff) 22%, transparent); color: var(--tag, #fff); font: inherit; font-size: 0.85rem; font-weight: 600; line-height: 1.2; white-space: nowrap; }
.tag-chip.custom { color: var(--text); background: rgba(255, 255, 255, 0.14); border-color: rgba(255, 255, 255, 0.7); }
:root[data-theme="light"] .tag-chip.custom { --tag: #555; color: #333; background: rgba(0, 0, 0, 0.06); border-color: #999; }
button.tag-chip { cursor: pointer; }
.tag-chip.off { background: none; opacity: 0.6; }
.tag-chip.on { background: var(--tag, #fff); color: #101010; }
.tag-chip.on.custom { background: #fff; color: #111; }
.tag-chip .tag-icon { display: inline-flex; width: 16px; height: 16px; }
.tag-chip .tag-icon svg { width: 100%; height: 100%; }
.tag-chip.compact { padding: 3px; }
.tag-chip.compact.on, .log-tags .tag-chip.on { background: color-mix(in srgb, var(--tag, #fff) 28%, transparent); color: var(--tag, #fff); }
.log-tags { display: inline-flex; gap: 3px; margin-left: 4px; }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-picker { display: flex; flex-direction: column; gap: 8px; }
.tag-picker.shut { display: none; }
.tag-new input { flex: 1; min-width: 0; }
.tag-extra .tag-toggle { align-self: flex-start; }
.tag-summary { display: inline-flex; gap: 2px; margin-left: 4px; }
.tag-filter { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.fixed-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.fixed-row .fixed-main { flex: 1; min-width: 160px; display: flex; flex-direction: column; gap: 2px; }
.fixed-row .fixed-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.log-amount { min-width: 3.6em; font-weight: 700; }

/* ------------------------------------------------------------------ music */
.side { display: flex; flex-direction: column; gap: 10px; min-height: 0; padding: 8px 14px 14px; }
.music { position: relative; display: flex; flex-direction: column; min-height: 0; flex: 1; }
.layout-v .music { padding: 8px 8px 0; max-height: calc(64dvh / var(--ui-scale, 1)); }
.music-hidden .side .clock { display: none; }
.music-hidden .side { padding: 8px 4px; }
.hide-music { position: absolute; top: 0; right: 0; z-index: 2; color: #f0c2a0; }
.layout-v.music-hidden .music { min-height: 40px; }
.where-line { display: flex; align-items: center; gap: 4px; align-self: center; margin: 2px 0 6px; padding: 4px 10px; border: 0; border-radius: 999px; background: none; color: var(--text); }
.where-line:hover { background: var(--row-hover); }
.controller { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 18px 12px; border-radius: 48px; background: var(--music); color: #fff; text-align: center; }
.layout-v .controller { border-radius: 52px; padding: 12px 14px; }
.timeline { display: flex; align-items: center; gap: 8px; width: 100%; font-weight: 700; font-variant-numeric: tabular-nums; font-size: 0.92rem; }
.t-bar { position: relative; flex: 1; height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.35); cursor: pointer; }
.t-fill { display: block; height: 100%; border-radius: 3px; background: #fff; }
.now { display: flex; align-items: flex-start; justify-content: center; gap: 6px; max-width: 100%; font-size: 1.02rem; }
.now > .icon { flex: none; margin-top: 2px; }
.now-name { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; cursor: default; user-select: none; -webkit-user-select: none; touch-action: manipulation; }
.controller .now .icon-btn { flex: none; width: 28px; height: 28px; margin-top: -3px; }
.controller .heart-btn.on { color: #fff; }
/* a double-tapped song: a heart pops up and floats away */
.fly-heart { position: absolute; z-index: 3; color: #fff; pointer-events: none; filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.35)); animation: fly-heart 0.8s ease-out forwards; }
@keyframes fly-heart {
  0% { transform: translate(-50%, -50%) scale(0.3); opacity: 0; }
  20% { transform: translate(-50%, -50%) scale(1.15); opacity: 1; }
  40% { transform: translate(-50%, -60%) scale(1); opacity: 1; }
  100% { transform: translate(-50%, -190%) scale(0.85); opacity: 0; }
}
.reconnecting { display: inline-flex; align-items: center; gap: 6px; padding: 1px 10px; border-radius: 999px; background: rgba(0, 0, 0, 0.22); font-size: 0.78rem; }
.reconnecting .dot { width: 7px; height: 7px; border-radius: 50%; background: #ffd27a; }
.ctl-buttons { display: flex; align-items: center; justify-content: center; gap: 0; flex-wrap: wrap; }
.controller .icon-btn { width: 34px; height: 34px; }
.transport .icon-btn { width: 36px; height: 36px; }
.transport { display: flex; align-items: center; padding: 1px 6px; border-radius: 999px; background: var(--transport); }
.toggle-btn { opacity: 0.55; }
.toggle-btn.on { opacity: 1; background: rgba(255, 255, 255, 0.2); }
.where-pill { display: flex; align-items: center; gap: 2px; padding: 5px 8px; border: 0; border-radius: 999px; background: #2a2a2a; color: #fff; }
/* On account: play the station on this device, or stop just this device */
.here-pill { display: flex; align-items: center; gap: 5px; margin: 0 4px; padding: 5px 10px; border: 0; border-radius: 999px; background: #2a2a2a; color: #fff; font-size: 0.8rem; font-weight: 600; white-space: nowrap; }
.here-pill.stopped { color: #ffcf9e; }
.expand-btn { color: #f0c2a0; }
.volume-pop { display: flex; align-items: center; gap: 8px; padding: 2px 6px; }
.volume-pop input[type="range"] { width: 150px; padding: 0; border: 0; background: none; accent-color: var(--orange); }
.volume-num { min-width: 3em; font-variant-numeric: tabular-nums; color: var(--muted); font-size: 0.85rem; }
.nav-btn.spinning .icon, .pull-refresh.spinning .icon { animation: spin 0.8s linear infinite; }
.pull-refresh { position: fixed; left: 50%; z-index: 40; width: 40px; height: 40px; margin-left: -20px; display: grid; place-items: center; border-radius: 50%; background: var(--surface-2); color: var(--muted); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4); opacity: 0; pointer-events: none; }
.pull-refresh.ready, .pull-refresh.spinning { color: var(--orange); }
@keyframes spin { to { transform: rotate(360deg); } }

.queue-wrap { display: flex; flex-direction: column; min-height: 0; flex: 1; margin-top: 10px; border-radius: 18px; background: var(--surface); }
.layout-v .queue-wrap { max-height: calc(40dvh / var(--ui-scale, 1)); margin-top: 8px; }
.queue { flex: 1; overflow: auto; padding: 4px; }
.q-row { --row-bg: var(--surface); position: relative; overflow: hidden; border-radius: 14px; touch-action: pan-y; transition: transform 0.12s; }
.q-row.current { --row-bg: var(--island-body); }
.q-row.skipped .q-name { text-decoration: line-through; opacity: 0.55; }
.q-row.dragging { --row-bg: #4a4a4a; z-index: 2; overflow: visible; transition: none; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4); }
[data-theme="light"] .q-row.dragging { --row-bg: #e9e5df; }
/* the part that slides when swiped; the round buttons wait behind it */
.q-front { position: relative; z-index: 1; display: flex; align-items: center; border-radius: inherit; background: var(--row-bg); transition: transform 0.18s ease-out; }
.q-name { flex: 1; min-width: 0; padding: 0 10px; margin: 8px 0; border: 0; background: none; color: inherit; text-align: left; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; }
.q-heart { flex: none; color: #ff5c7a; }
.q-handle { display: grid; place-items: center; padding: 6px 10px; color: var(--muted); cursor: grab; touch-action: none; }
.q-actions { position: absolute; inset: 0 0 0 auto; display: flex; align-items: center; gap: 8px; padding: 0 8px; }
.q-actions.left { inset: 0 auto 0 0; }
.q-actions .round { display: grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 50%; background: #5a5a5a; color: #fff; transform: scale(0.4); opacity: 0; transition: transform 0.16s, opacity 0.16s; }
.q-actions .round.danger { background: #c4302b; }
.q-actions.shown .round { transform: none; opacity: 1; }
.queue-foot { display: flex; justify-content: space-around; padding: 4px; border-radius: 0 0 18px 18px; background: var(--surface-2); border-top: 1px solid var(--line); }
.music-notice { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 6px; padding: 8px 12px; border-radius: 12px; background: rgba(255, 180, 0, 0.13); font-size: 0.85rem; }
.clock { display: flex; align-items: baseline; justify-content: center; gap: 14px; padding: 10px 22px; border-radius: 999px; background: var(--music); color: #fff; font-size: 1.4rem; font-weight: 700; }
.clock b { font-size: 2rem; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ pages */
.page { max-width: 1100px; margin: 0 auto; padding: 4px 2px 24px; }
.page.center { display: grid; place-items: center; min-height: calc(70dvh / var(--ui-scale, 1)); }
.page-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 12px; }
.page-head h1 { margin: 0; font-size: 1.8rem; }
.banners { display: flex; flex-direction: column; gap: 8px; }
.banners:not(:empty) { margin-bottom: 12px; }
.banner { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border: 1px solid var(--line); border-left: 4px solid var(--orange); border-radius: 16px; background: linear-gradient(90deg, rgba(212, 119, 63, 0.18), var(--surface) 70%); }
.banner-body { margin: 4px 0 0; white-space: pre-line; color: var(--muted); font-size: 0.92rem; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: 14px; align-items: start; }
/* laid out by layout.js: each card into the shortest column, so short cards leave no gaps */
.cards.masonry { display: flex; align-items: flex-start; }
.cards-col { display: flex; flex-direction: column; gap: 14px; flex: 1; min-width: 0; }
.card { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); }
.card-head { display: flex; align-items: center; gap: 8px; }
.card-head h2 { flex: 1; margin: 0; font-size: 1.15rem; }
.glance { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 14px; }
.stat { display: flex; flex-direction: column; padding: 12px 14px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); }
.stat b { font-size: 1.8rem; }
.stat.alert { background: var(--due); color: #fff; border-color: transparent; }
.tracker-line { display: flex; align-items: center; }
.tracker-line > .item { flex: 1; }
.cal-summary { display: flex; flex-wrap: wrap; gap: 12px; align-items: baseline; }
.cal-summary .in { color: #6fcf4a; font-weight: 700; }
.cal-summary .out { color: #ff6b5e; font-weight: 700; }
.done-list summary { cursor: pointer; color: var(--muted); padding: 4px 0; }
.history-row { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); }
.history-day h4 { margin: 10px 0 2px; }

.profile { flex-direction: row; align-items: center; gap: 14px; }
.profile h2, .profile p { margin: 0 0 2px; }
.avatar { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; flex: none; }
.avatar.blank { display: grid; place-items: center; background: var(--input); }
.plan-tier { padding: 12px; border: 2px solid var(--orange); border-radius: 16px; }
.plan-tier ul { margin: 8px 0 0; padding-left: 18px; }
.pill { padding: 2px 10px; border-radius: 999px; background: var(--orange); color: #fff; font-size: 0.75rem; }
.usage { display: flex; flex-direction: column; gap: 4px; }
.usage-bar { height: 8px; border-radius: 4px; background: var(--input); overflow: hidden; }
.usage-bar span { display: block; height: 100%; background: var(--orange); }
.login-card { align-items: center; max-width: 420px; text-align: center; }
.login-card img { border-radius: 20px; }
.login-card h1 { margin: 4px 0 0; }
.login-card .stack { width: 100%; }
.link { color: var(--orange); }

.setting { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.setting > div:first-child { flex: 1 1 180px; min-width: 0; }
.setting > .segmented { margin-inline: auto; } /* right of the text; in the middle when it wraps to its own line */
.setting:last-child { border-bottom: 0; }
.setting.column { flex-direction: column; align-items: stretch; }
.setting.disabled { opacity: 0.55; }
.setting p { margin: 2px 0 0; }
.island-list { display: flex; flex-direction: column; gap: 2px; }
.island-row { display: flex; align-items: center; gap: 8px; padding: 4px 0; }

/* ------------------------------------------------------------------ controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 16px; border: 1px solid var(--line); border-radius: 999px; background: var(--input); color: var(--text); font-weight: 600; text-decoration: none; }
.btn:hover:not(:disabled) { filter: brightness(1.15); }
.btn:disabled { opacity: 0.45; }
.btn.primary { border-color: transparent; background: var(--orange); color: #fff; }
.btn.danger { border-color: transparent; background: #a3241b; color: #fff; }
.btn.discord { border-color: transparent; background: #5865f2; color: #fff; }
.btn.line { border-color: transparent; background: #06c755; color: #fff; }
/* Log in buttons: near black with the logo of the service in front */
.btn.provider { border-color: #2e2e2e; background: #121212; color: #f4f4f4; }
.btn.provider:hover:not(:disabled) { background: #1d1d1d; border-color: #4a4a4a; filter: none; }
.btn.provider::before { content: ""; flex: 0 0 auto; width: 1.4em; height: 1.4em; margin-right: 6px; background: center / contain no-repeat; }
.btn.provider.google::before { background-image: url(/img/provider-google.svg); }
.btn.provider.discord::before { background-image: url(/img/provider-discord.svg); }
.btn.provider.line::before { background-image: url(/img/provider-line.svg); }
.btn.provider.email::before { background-image: url(/img/provider-email.svg); }
.btn.small { padding: 5px 12px; font-size: 0.85rem; }
.btn.big { width: 100%; padding: 13px 22px; font-size: 1.05rem; }
.btn.soon { opacity: 0.6; }
.icon-btn { display: grid; place-items: center; width: 38px; height: 38px; padding: 0; border: 0; border-radius: 999px; background: none; color: inherit; }
.icon-btn:hover:not(:disabled) { background: var(--row-hover); }
.controller .icon-btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.16); }
.icon-btn:disabled { opacity: 0.35; }
.icon path { fill: currentColor; fill-rule: evenodd; }

.field { display: flex; flex-direction: column; gap: 4px; }
.field-label { font-size: 0.9rem; font-weight: 600; }
input, select, textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--input); }
input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--orange); flex: none; }
textarea { resize: vertical; }

.switch { position: relative; flex: none; width: 48px; height: 28px; padding: 0; border: 0; border-radius: 999px; background: #5a5a5a; }
.switch[aria-checked="true"] { background: #3fb950; }
.switch[aria-checked="mixed"] { background: #7d8f5e; }
.switch[aria-checked="mixed"] .knob { left: 12px; }
.switch:disabled { opacity: 0.45; }
.knob { position: absolute; top: 4px; left: 4px; width: 20px; height: 20px; border-radius: 50%; background: #eef7ef; transition: left 0.15s; }
.switch[aria-checked="true"] .knob { left: 24px; }
.share-items { margin-left: 22px; padding-left: 10px; border-left: 2px solid var(--line); }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
/* a segmented choice never wraps inside itself: when a row is too narrow it moves under its text, whole */
.segmented { display: inline-flex; flex: none; flex-wrap: nowrap; justify-content: center; align-items: center; gap: 2px; padding: 3px; border-radius: 999px; background: var(--input); }
.segmented button { padding: 6px 12px; border: 0; border-radius: 999px; background: none; color: var(--muted); font-size: 0.9rem; white-space: nowrap; }
.library-sort { flex-wrap: wrap; }
.library-sort > .grow { max-width: 100%; overflow-x: auto; scrollbar-width: none; } /* a narrow phone: the sort scrolls, Heart top goes below */
.segmented button.on { background: var(--orange); color: #fff; }
.segmented button:disabled { opacity: 0.4; }

/* ------------------------------------------------------------------ layers */
.overlay { position: fixed; inset: 0; z-index: 50; display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; padding: calc(12px + env(safe-area-inset-top)) 12px calc(12px + env(safe-area-inset-bottom)); background: rgba(0, 0, 0, 0.55); }
.dialog { display: flex; flex-direction: column; min-width: 0; width: min(520px, 100%); max-height: calc(88dvh / var(--ui-scale, 1)); border-radius: 22px; background: var(--surface); color: var(--text); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5); }
.dialog.small { width: min(430px, 100%); }
.dialog.large { width: min(980px, 100%); height: min(calc(88dvh / var(--ui-scale, 1)), 900px); }
.dialog.huge { width: min(1380px, 100%); height: min(calc(88dvh / var(--ui-scale, 1)), 900px); }
/* the look editor: as big as the quick menu outside (+ the window's own frame), never bigger than the screen */
.dialog.fit { width: min(calc(var(--qe-w, 920px) + 76px), 100%); height: min(calc(var(--qe-h, 760px) + 170px), calc(94dvh / var(--ui-scale, 1))); }
.dialog.fit .qe-canvas { flex: 0 1 auto; max-width: 100%; align-self: center; box-sizing: border-box; }
.dialog-head { display: flex; align-items: center; gap: 8px; padding: 12px 12px 4px 20px; }
.dialog-head h2 { flex: 1; margin: 0; font-size: 1.2rem; overflow-wrap: anywhere; }
.dialog-body { flex: 1; overflow: auto; padding: 8px 20px 20px; min-height: 0; }
.popover { position: fixed; z-index: 60; max-width: min(360px, calc(92vw / var(--ui-scale, 1))); max-height: calc(60vh / var(--ui-scale, 1)); overflow: auto; padding: 6px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); color: var(--text); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45); }
.menu { display: flex; flex-direction: column; }
.menu-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 0; border-radius: 10px; background: none; color: var(--text); text-align: left; }
.menu-item:hover:not(:disabled) { background: var(--row-hover); }
.menu-item.danger { color: #ff6b5e; }
.menu-item:disabled { opacity: 0.45; }
/* the range chooser (rangeChooser.js): two rows of round buttons in five columns (normal on top, absolute below), a circled i in the free corner, and the explanation under them */
.range-chooser { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.range-popover { max-width: min(320px, calc(calc(100vw / var(--ui-scale, 1)) - 16px)); max-height: calc(calc(100vh / var(--ui-scale, 1)) - 16px); overflow: auto; }
.range-grid { display: grid; grid-template-columns: repeat(5, 40px); gap: 6px; justify-content: center; }
.range-btn, .range-i, .range-gap { width: 40px; height: 40px; }
.range-btn { border: 0; border-radius: 50%; background: #333; color: #fff; font-weight: 700; font-size: 0.9rem; }
.range-btn.on { background: var(--orange); }
.range-btn:disabled { opacity: 0.35; }
.range-i { border: 0; border-radius: 50%; background: transparent; color: var(--muted); display: grid; place-items: center; padding: 0; }
.range-i:hover, .range-i.on { color: var(--orange); }
.range-info { display: flex; flex-direction: column; gap: 8px; max-height: calc(48vh / var(--ui-scale, 1)); overflow: auto; padding: 8px; border-radius: 12px; background: rgba(127, 127, 127, 0.12); }
.range-info[hidden] { display: none; }
.range-info p { margin: 0; }
.range-how { display: flex; gap: 8px; align-items: flex-start; }
.range-how-code { flex: none; min-width: 30px; height: 30px; padding: 0 4px; box-sizing: border-box; display: grid; place-items: center; border-radius: 15px; background: #333; color: #fff; font-weight: 700; font-size: 0.8rem; }
.range-how.on .range-how-code { background: var(--orange); }
.notifications { display: flex; flex-direction: column; gap: 4px; min-width: 260px; }
.tooltip { position: fixed; z-index: 100; max-width: 260px; padding: 4px 8px; border-radius: 6px; background: #4a4a4a; color: #fff; font-size: 0.75rem; pointer-events: none; opacity: 0; transition: opacity 0.1s; }
.tooltip.show { opacity: 1; }
.toasts { position: fixed; left: 50%; bottom: 100px; z-index: 120; display: flex; flex-direction: column; gap: 8px; transform: translateX(-50%); }
.toast { max-width: calc(90vw / var(--ui-scale, 1)); padding: 10px 16px; border-radius: 12px; background: #b3261e; color: #fff; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4); }
.toast.info { background: #333; }
.radial-overlay { position: fixed; inset: 0; z-index: 70; background: rgba(0, 0, 0, 0.35); }
.radial-btn { position: fixed; width: 52px; height: 52px; display: grid; place-items: center; border: 0; border-radius: 50%; background: var(--orange); color: #fff; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4); animation: pop 0.15s both; }
.radial-btn.hot { transform: scale(1.3); background: #f08a4a; transition: transform 0.08s; }
.nav-btn.rocket { touch-action: none; -webkit-touch-callout: none; user-select: none; -webkit-user-select: none; }
@keyframes pop { from { transform: scale(0.4); opacity: 0; } }

/* songs and reports */
.library { display: flex; flex-direction: column; gap: 10px; height: 100%; }
.song-list { display: flex; flex-direction: column; flex: 1; min-height: 0; overflow: auto; }
.song { display: flex; align-items: center; gap: 4px; padding: 2px 6px; border-radius: 10px; color: var(--text); }
.song:hover { background: var(--row-hover); }
.song-open, .song-pick { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 6px 4px; border: 0; background: none; color: inherit; text-align: left; }
.song-name { flex: 1; min-width: 0; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; }
.song .plays { min-width: 2.6em; text-align: right; }
.heart-btn { flex: none; width: 34px; height: 34px; color: var(--muted); }
.heart-btn.on { color: #ff5c7a; }
.library-sort { flex-wrap: nowrap; }
.heart-top { flex: none; color: var(--muted); }
.heart-top.on { color: var(--text); border-color: #ff5c7a; }
.heart-top.on .icon { color: #ff5c7a; }

/* playlists */
.cover { --cover-size: 120px; display: grid; place-items: center; width: var(--cover-size); height: var(--cover-size); flex: none; border-radius: calc(var(--cover-size) * 0.12); background: var(--cover-bg, #444); color: #fff; overflow: hidden; }
.cover-emoji { font-size: calc(var(--cover-size, 120px) * 0.52); line-height: 1; }
.cover-choice .cover-emoji { font-size: 26px; }
.new-cover { background: var(--surface-2); color: var(--text); border: 1px solid var(--line); }
.playlist-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 18px 14px; }
.playlist-tile { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.tile-cover { padding: 0; border: 0; background: none; border-radius: 14px; }
.tile-cover .cover { width: 100%; height: auto; aspect-ratio: 1; }
.tile-text { display: flex; align-items: center; gap: 2px; min-width: 0; }
.tile-name { flex: 1; min-width: 0; padding: 0; border: 0; background: none; color: var(--text); font-weight: 700; text-align: left; overflow: hidden; }
.tile-menu { width: 30px; height: 30px; }
.playlist { display: flex; flex-direction: column; gap: 12px; }
.playlist-head { display: flex; align-items: center; gap: 16px; }
.playlist-name { font-size: 1.3rem; overflow-wrap: anywhere; }
.stack.tight { gap: 6px; }
.dialog .q-row { --row-bg: var(--surface); }
.pick-list { display: flex; flex-direction: column; gap: 2px; }
.pick-row { display: flex; align-items: center; gap: 12px; padding: 6px; border: 0; border-radius: 12px; background: none; color: var(--text); text-align: left; }
.pick-row:hover { background: var(--row-hover); }
.pick-row .cover { --cover-size: 40px; }
.pick-row .new-cover { width: 40px; height: 40px; }
.cover-button { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 4px; border: 0; background: none; color: inherit; }
.cover-picker { display: flex; flex-direction: column; gap: 12px; height: 100%; }
.cover-preview { flex: none; }
.swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.swatch { width: 28px; height: 28px; border: 2px solid transparent; border-radius: 50%; background: var(--swatch); }
.swatch.on { border-color: var(--text); }
.cover-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(48px, 1fr)); gap: 6px; flex: 1; min-height: 0; overflow: auto; align-content: start; }
.cover-choice { display: grid; place-items: center; height: 48px; border: 1px solid transparent; border-radius: 12px; background: var(--input); color: var(--text); }
.cover-choice.on { border-color: var(--orange); }
.lucide { display: block; }
.group { margin: 12px 0 4px; color: var(--muted); font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.06em; }
.library-actions { padding-top: 8px; border-top: 1px solid var(--line); }
.report { display: flex; flex-direction: column; gap: 2px; }
.report-row { display: grid; grid-template-columns: 130px 1fr auto auto; gap: 10px; align-items: center; padding: 5px 0; border-bottom: 1px solid var(--line); }
.report-bars { display: flex; flex-direction: column; gap: 2px; }
.bar { display: block; height: 7px; border-radius: 4px; }
.bar.in { background: #53902f; }
.bar.out { background: #b3261e; }
.report-nums { color: var(--muted); font-size: 0.82rem; }
.over { color: #ff6b5e; }
.under { color: var(--done); }

/* ------------------------------------------------------------------ narrow islands (two columns on a phone) */
.island { container-type: inline-size; }
@container (max-width: 250px) {
  .island-head { gap: 0; padding: 6px 4px; min-height: 46px; }
  .island-toggle, .island-lead { padding: 3px; }
  .island-title { font-size: 1rem; }
  .range-pill { padding: 2px 4px 2px 2px; }
  .range-letter { width: 24px; height: 24px; font-size: 0.85rem; }
  .range-pill .icon { display: none; }
  .island-lead .icon { width: 18px; height: 18px; }
  .item:not(.log) { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 6px; row-gap: 0; padding: 5px 8px; font-size: 0.9rem; }
  .item:not(.log) > .item-text { grid-column: 2; }
  .item:not(.log) > .item-meta { grid-column: 2; justify-self: start; font-size: 0.72rem; }
  /* an event's marks (colour dot, bell, star): in the free column before its text, one under the other, in the middle of the event's height */
  .item:not(.log) > .ev-marks { grid-column: 1; grid-row: 1 / span 3; align-self: center; flex-direction: column; justify-content: center; gap: 4px; }
  .counter { flex-direction: column; align-items: center; gap: 0; }
  .counter .step { padding: 0 2px; }
  .counter .count { margin: 0; font-size: 0.8rem; }
  .cal-num { font-size: 1.3rem; padding: 2px 6px; gap: 3px; }
  .cal-num small { font-size: 0.7rem; }
  .cal-controls { grid-template-columns: 1fr 1fr; }
  .daily-out { grid-column: 1 / -1; grid-row: 2; }
  .pm button { padding: 4px 6px; }
  .cal-total { font-size: 0.92rem; padding: 4px 8px; white-space: nowrap; }
  .log { padding: 4px 8px; font-size: 0.85rem; gap: 4px; }
}

/* ------------------------------------------------------------------ small screens and motion */
@media (max-width: 560px) {
  .overlay { align-items: end; padding: 0; }
  .dialog, .dialog.small, .dialog.large, .dialog.huge, .dialog.fit { width: 100%; border-radius: 22px 22px 0 0; max-height: calc(92dvh / var(--ui-scale, 1)); }
  /* the sheet reaches the screen's bottom edge: its last row stays above the phone's own navigation bar (0 in a browser) */
  .dialog { padding-bottom: env(safe-area-inset-bottom); }
  .dialog.large, .dialog.huge, .dialog.fit { height: calc(92dvh / var(--ui-scale, 1)); }
  .report-row { grid-template-columns: 90px 1fr auto; }
  .report-nums { display: none; }
  .stage { padding: 10px; }
  .island-title { font-size: 1.05rem; }
  .item { padding: 5px 8px; font-size: 0.92rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Settings > Features */
.ok-note { color: var(--done); font-weight: 600; }
.feature-list { display: flex; flex-direction: column; gap: 4px; }
.feature-list .row { flex-wrap: nowrap; }

/* Alani AI: a small chat in the bottom-left corner, in the button's blue and orange; the app stays usable */
.ai-chat { position: fixed; z-index: 45; /* above the page, under dialogs (50), menus and tips */ left: 92px; bottom: 16px; width: min(360px, calc(calc(100vw / var(--ui-scale, 1)) - 108px)); height: min(480px, calc(70dvh / var(--ui-scale, 1))); display: flex; flex-direction: column; overflow: hidden; border: 2px solid #f07a2a; border-radius: 20px; background: #10213a; color: #fff; box-shadow: 0 14px 40px rgba(0, 0, 0, 0.45); }
body:has(.layout-v) .ai-chat { left: 8px; bottom: 96px; width: calc(calc(100vw / var(--ui-scale, 1)) - 16px); max-width: 380px; height: min(460px, calc(58dvh / var(--ui-scale, 1))); }
/* holding Alani's button: it fills with light while the half second passes */
.ai-btn.holding { animation: ai-hold 0.5s ease-in forwards; }
@keyframes ai-hold { to { transform: scale(1.12); box-shadow: 0 0 0 6px rgba(240, 122, 42, 0.55); } }
/* talking to Alani (public/js/ai/voice.js) */
.ai-voice { position: fixed; z-index: 45; left: 92px; bottom: 16px; width: min(320px, calc(calc(100vw / var(--ui-scale, 1)) - 108px)); display: flex; flex-direction: column; align-items: center; gap: 8px; padding-bottom: 14px; overflow: hidden; border: 2px solid #f07a2a; border-radius: 20px; background: #10213a; color: #fff; box-shadow: 0 14px 40px rgba(0, 0, 0, 0.45); }
body:has(.layout-v) .ai-voice { left: 8px; bottom: 96px; width: calc(calc(100vw / var(--ui-scale, 1)) - 16px); max-width: 360px; }
.ai-voice .ai-head { align-self: stretch; }
.vo-orb { --level: 0; position: relative; display: grid; place-items: center; width: 92px; height: 92px; margin-top: 6px; border-radius: 50%; background: linear-gradient(140deg, #2f8fe8, #f07a2a); box-shadow: 0 0 0 calc(4px + var(--level) * 18px) rgba(240, 122, 42, 0.28); transition: box-shadow 0.08s; }
.vo-orb img { border-radius: 50%; }
:is(.ai-voice, .ai-voicebar)[data-state="thinking"] .vo-orb { animation: vo-spin 1.1s linear infinite; box-shadow: 0 0 0 6px rgba(47, 143, 232, 0.35); }
:is(.ai-voice, .ai-voicebar)[data-state="speaking"] .vo-orb { animation: vo-speak 0.9s ease-in-out infinite; }
:is(.ai-voice, .ai-voicebar)[data-state="error"] .vo-orb, :is(.ai-voice, .ai-voicebar).muted .vo-orb { filter: grayscale(1); opacity: 0.7; }
@keyframes vo-spin { to { transform: rotate(360deg); } }
@keyframes vo-speak { 50% { transform: scale(1.1); box-shadow: 0 0 0 14px rgba(240, 122, 42, 0.25); } }
@media (prefers-reduced-motion: reduce) { :is(.ai-voice, .ai-voicebar) .vo-orb { animation: none !important; } .ai-btn.holding { animation: none; } }
.vo-status { margin: 0; font-weight: 600; text-align: center; padding: 0 12px; }
.vo-lines { align-self: stretch; display: flex; flex-direction: column; gap: 4px; max-height: 150px; overflow-y: auto; padding: 0 14px; font-size: 0.9rem; }
.vo-line { margin: 0; }
.vo-line b { margin-right: 6px; color: #f6b27a; }
.vo-line.me b { color: #8ec5ff; }
.vo-line.error { color: #ff9a9a; }
.vo-controls { align-self: stretch; display: flex; align-items: center; gap: 8px; padding: 0 14px; color: #9db4d4; }
.vo-style { flex: none; max-width: 52%; padding: 4px 6px; border: 1px solid #2a3b58; border-radius: 8px; background: #17294a; color: #fff; font: inherit; font-size: 0.85rem; }
.vo-volume { flex: 1; min-width: 60px; accent-color: #f07a2a; }
.vo-stats .vo-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.vo-stats .vo-table th, .vo-stats .vo-table td { padding: 3px 6px; border-bottom: 1px solid var(--line); text-align: left; }
.vo-error { color: #e07070; }
.vo-timing { margin: 0; padding: 0 12px; text-align: center; color: #9db4d4; }
.ai-head { display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 12px; background: linear-gradient(120deg, #2f8fe8, #f07a2a); }
.ai-head img { border-radius: 8px; background: rgba(255, 255, 255, 0.2); }
.ai-head .icon-btn { width: 32px; height: 32px; color: #fff; }
.ai-log { flex: 1; min-height: 0; overflow: auto; overscroll-behavior-y: contain; display: flex; flex-direction: column; gap: 8px; padding: 12px; }
.ai-msg { max-width: 85%; padding: 8px 12px; border-radius: 16px; line-height: 1.35; white-space: pre-wrap; overflow-wrap: anywhere; }
.ai-msg.me { align-self: flex-end; background: #f07a2a; border-bottom-right-radius: 4px; }
.ai-msg.alani { align-self: flex-start; background: #2a5d9c; border-bottom-left-radius: 4px; }
.ai-msg.pending { padding: 12px 14px; }
.ai-thinking { display: inline-flex; gap: 5px; align-items: center; height: 14px; }
.ai-thinking i { width: 7px; height: 7px; border-radius: 50%; background: #fff; opacity: 0.85; animation: ai-bounce 1s ease-in-out infinite; }
.ai-thinking i:nth-child(2) { animation-delay: 0.15s; }
.ai-thinking i:nth-child(3) { animation-delay: 0.3s; }
@keyframes ai-bounce { 0%, 60%, 100% { transform: translateY(0); opacity: 0.5; } 30% { transform: translateY(-5px); opacity: 1; } }
/* her links and the things she did, as cards: an icon, what it is, where it goes (ai/chatView.js) */
.ai-link { color: #ffe2bd; text-decoration: underline; text-underline-offset: 2px; }
.ai-embeds { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; white-space: normal; }
.ai-card { display: flex; align-items: center; gap: 10px; max-width: 100%; padding: 8px 10px; border: 1px solid rgba(255, 255, 255, 0.2); border-radius: 12px; background: rgba(0, 0, 0, 0.26); color: #fff; text-align: left; font: inherit; text-decoration: none; transition: background 0.15s, transform 0.15s, border-color 0.15s; }
a.ai-card:hover, button.ai-card:hover { background: rgba(0, 0, 0, 0.4); border-color: #f07a2a; transform: translateY(-1px); }
a.ai-card:focus-visible, button.ai-card:focus-visible { outline: 2px solid #f07a2a; outline-offset: 2px; }
button.ai-card { cursor: pointer; }
.ai-card-ico { display: grid; place-items: center; flex: none; width: 34px; height: 34px; border-radius: 10px; background: #f07a2a; color: #1d0f05; }
.ai-card-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ai-card-text b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-card-text small { color: rgba(255, 255, 255, 0.7); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-card.step { align-self: flex-start; max-width: min(85%, 640px); background: rgba(62, 207, 142, 0.12); border-color: rgba(62, 207, 142, 0.5); color: inherit; }
.ai-card.step .ai-card-ico { background: #3ecf8e; }
.ai-card.step .ai-card-text small { color: var(--muted); }
@media (prefers-reduced-motion: reduce) { .ai-thinking i { animation: none; } .ai-card { transition: none; } }
.ai-msg.error { background: #8f2a22; }
.ai-msg.cost { align-self: flex-start; max-width: 100%; padding: 2px 8px; background: none; color: #ffcf9e; font-size: 0.75rem; }
.ai-note { margin: 0; color: #b8cbe6; font-size: 0.85rem; }
.ai-step { display: flex; align-items: center; gap: 6px; color: #9fe0a8; font-size: 0.82rem; }
.ai-songs { display: flex; flex-direction: column; gap: 6px; padding: 8px 10px; border-radius: 12px; background: rgba(255, 255, 255, 0.07); }
.ai-song { display: flex; flex-direction: column; }
.ai-song.low span { color: #ffcf9e; }
.ai-input { display: flex; align-items: flex-end; gap: 6px; padding: 8px; background: #0b1729; }
.ai-input textarea { flex: 1; min-height: 38px; max-height: 120px; resize: none; padding: 8px 12px; border: 1px solid #2a5d9c; border-radius: 14px; background: #10213a; color: #fff; font: inherit; }
.ai-send { display: grid; place-items: center; width: 38px; height: 38px; border: 0; border-radius: 50%; background: #f07a2a; color: #fff; }
.ai-send:disabled { opacity: 0.5; }
.pill.dev { background: linear-gradient(120deg, #2f8fe8, #f07a2a); color: #fff; }
.ai-past { display: flex; align-items: center; gap: 4px; border-radius: 12px; background: rgba(255, 255, 255, 0.06); }
.ai-past.open { outline: 1px solid #f07a2a; }
.ai-past-open { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 8px 10px; border: 0; border-radius: 12px; background: none; color: #fff; font: inherit; text-align: left; cursor: pointer; }
.ai-past-open:hover { background: rgba(255, 255, 255, 0.08); }
.ai-past-open b { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.ai-past-open small { color: #b8cbe6; }
.ai-past .icon-btn { color: #ffcf9e; }

/* ---------------------------------------------------------------- Friends & other */
.island.teal { --head: #1f8a84; }
.island.indigo { --head: #4b4fb8; }
.island.medium .island-body { max-height: min(420px, calc(calc(75dvh / var(--ui-scale, 1)) - 52px)); }
.island.etc .etc-body { display: flex; flex-direction: column; gap: 8px; max-height: min(520px, calc(75dvh / var(--ui-scale, 1))); padding: 12px; border-radius: var(--radius); }
.island.etc .item { padding: 4px 0; }
.island.read-only { box-shadow: none; }
.nav-btn .badge { top: 2px; right: 2px; }
.avatar-sm { flex: none; display: inline-grid; place-items: center; border-radius: 50%; object-fit: cover; background: var(--row-hover); color: var(--text); }
.status-dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: #8a8a8a; }
.status-dot.on { background: #3fbf5f; box-shadow: 0 0 0 2px rgba(63, 191, 95, 0.25); }
.friend-row { width: 100%; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; border-radius: 10px; }
.friend-row:hover { background: var(--row-hover); }
.friend-names { display: flex; flex-direction: column; min-width: 0; }
.friend-names b, .friend-song { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.friend-song { color: var(--muted, #9a9a9a); }
.friend-switch { border-bottom: 1px solid var(--row-hover); }
.item.activity { align-items: flex-start; }
.section-head { margin-top: 6px; }
.row.wrap { flex-wrap: wrap; }
.row.tight { gap: 4px; align-items: center; }
.friend-head h3 { margin: 0; }
.friend-head p { margin: 2px 0; }
.stack.center { align-items: center; text-align: center; }
.subtabs { display: flex; gap: 6px; margin: 0 0 12px; padding: 4px; border-radius: 999px; background: var(--island-body); }
.subtabs button { position: relative; flex: 1; min-height: 40px; border: 0; border-radius: 999px; background: none; color: var(--text); font: inherit; font-weight: 600; cursor: pointer; }
.subtabs button.on { background: var(--nav-active); }
.subtabs .badge { top: -6px; right: 6px; }
.card-lite { padding: 12px; border-radius: 14px; background: var(--row-hover); }
.card-lite h4 { margin: 0; }
.shared-islands { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.version { margin: 18px 0 4px; text-align: center; }

/* ---------------------------------------------------------------- plans */
.plan-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); align-items: start; gap: 18px 14px; padding-top: 6px; }
.plan-choice { display: flex; flex-direction: column; gap: 6px; padding: 16px; border: 2px solid transparent; border-radius: 18px; background: var(--row-hover); }
.plan-choice h3 { margin: 0; }
.plan-choice ul { flex: 1; margin: 4px 0 8px; padding-left: 18px; }
.plan-choice li { margin: 3px 0; }
.plan-choice.selected { border-color: var(--orange); }
.plan-choice.unavailable { opacity: 0.75; }
.plan-price { margin: 0; font-size: 1.3rem; font-weight: 700; }
.plan-choice .btn { justify-content: center; cursor: default; }
.selected-btn { background: var(--orange); color: #fff; }
.unavailable-btn { opacity: 0.7; }
.usage-bar.full span { background: #e3120f; }
.plan-lines { list-style: none; padding-left: 0 !important; }
.plan-lines li { margin: 5px 0; }
.plan-choice { position: relative; }
/* Plus: a rainbow border and a label above it */
.plan-choice.highlight { border: 2px solid transparent; background: linear-gradient(var(--row-hover), var(--row-hover)) padding-box, linear-gradient(var(--surface), var(--surface)) padding-box, linear-gradient(120deg, #ff4d4d, #ffb84d, #f9f871, #5ee07a, #4dc3ff, #8a6cff, #ff6cd9) border-box; }
.plan-choice.highlight.selected { box-shadow: 0 0 0 2px var(--orange); }
.plan-flag { position: absolute; top: -12px; left: 16px; padding: 2px 10px; border-radius: 999px; background: linear-gradient(120deg, #ff8a4d, #ff6cd9 60%, #8a6cff); color: #fff; font-size: 0.8rem; font-weight: 700; }
.more-btn { align-self: flex-start; padding: 0; border: 0; background: none; color: var(--orange); font: inherit; cursor: pointer; }
.plan-specs dl { margin: 6px 0; font-size: 0.85rem; }
.plan-specs dt { font-weight: 700; }
.plan-specs dd { margin: 0 0 6px; }
.plan-specs ul { padding-left: 18px; margin: 4px 0; }
/* "Upgrade for more?" */
.upsell { position: fixed; z-index: 44; right: 16px; bottom: 16px; display: flex; align-items: center; gap: 8px; max-width: min(460px, calc(calc(100vw / var(--ui-scale, 1)) - 32px)); padding: 8px 8px 8px 14px; border: 1px solid var(--orange); border-radius: 999px; background: var(--island-body); color: var(--text); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35); font-size: 0.9rem; }
body:has(.layout-v) .upsell { left: 8px; right: 8px; bottom: 96px; border-radius: 18px; }
.ai-upgrade { align-self: flex-start; }
/* the plan tabs: phones only (the cards are one under another there) */
.plan-tabs { display: none; }
body:has(.layout-v) .plan-tabs { position: sticky; top: -8px; z-index: 1; display: flex; gap: 6px; overflow-x: auto; padding: 6px 0; background: var(--surface); }
.plan-tabs button { flex: none; padding: 6px 12px; border: 1px solid var(--row-hover); border-radius: 999px; background: var(--row-hover); color: var(--text); font: inherit; font-size: 0.85rem; font-weight: 600; }
.plan-tabs button.on { border-color: var(--orange); }
.plan-tabs button.highlight { border-color: transparent; background: linear-gradient(var(--surface), var(--surface)) padding-box, linear-gradient(120deg, #ff4d4d, #ffb84d, #f9f871, #5ee07a, #4dc3ff, #8a6cff, #ff6cd9) border-box; }
.plan-choice { scroll-margin-top: 56px; }
/* the console's announcement, and the maintenance / full screen */
.announce { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; padding: 8px 8px 8px 14px; border-radius: 14px; background: #2a5d9c; color: #fff; }
.announce.warning { background: #9c6a1a; }
.announce .icon-btn { color: #fff; }
.gate { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; min-height: calc(100dvh / var(--ui-scale, 1)); padding: 24px; text-align: center; }
.gate h1 { margin: 0; font-size: 1.4rem; }
/* ticked songs show the order they were ticked in; a playlist's sort */
.pick-order { display: inline-grid; place-items: center; min-width: 20px; height: 20px; margin-right: 4px; border-radius: 999px; font-size: 0.72rem; font-weight: 700; }
.pick-order:not(:empty) { background: var(--orange); color: #fff; }
.sort-select { padding: 4px 8px; border: 1px solid var(--row-hover); border-radius: 10px; background: var(--input, var(--row-hover)); color: var(--text); font: inherit; }

/* ---- a0.3.1: meal photos, uploaded songs, the name parser, Alani AI playlists */
.btn.ai-gradient { border: 0; background: linear-gradient(120deg, #2f8fe8, #f07a2a); color: #fff; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.btn.ai-gradient:hover { filter: brightness(1.08); }
.btn.ai-gradient img { border-radius: 6px; }
.file-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.warn-text { color: #f2a33a; }
.disclaimer { margin: 0; color: var(--muted); font-size: 0.78rem; font-style: italic; }
.loading-line { color: var(--muted); padding: 16px 0; }
/* the first screen, until the app is ready: the logo in a turning ring, and a small "Loading" */
.boot { height: calc(100dvh / var(--ui-scale, 1)); display: grid; place-content: center; justify-items: center; gap: 14px; opacity: 0; animation: boot-in 0s linear 2.5s forwards; }
/* the plain spinner is the BACKUP for the animated loading screen (js/loading.js): it stays out of sight at first so it never flashes before the animation, and shows when
   the animation is switched off or fails (html.boot-plain, set by loading.js at once) or when nothing else has drawn anything after 2.5 s (loading.js itself did not arrive) */
html.boot-plain .boot { opacity: 1; animation: none; }
@keyframes boot-in { to { opacity: 1; } }
.boot-ring { position: relative; width: 104px; height: 104px; display: grid; place-items: center; }
.boot-ring::before { content: ""; position: absolute; inset: 0; border: 3px solid var(--line); border-top-color: var(--orange); border-radius: 50%; animation: spin 0.9s linear infinite; }
.boot-ring img { width: 64px; height: 64px; border-radius: 16px; }
.boot-text { margin: 0; color: var(--muted); font-size: 0.8rem; letter-spacing: 0.06em; }
/* the animated loading screen (js/loading.js) laid over the plain one above; it fades in only when the start takes a moment */
.loader { position: fixed; inset: 0; z-index: 3000; opacity: 0; transition: opacity 0.25s; }
.loader.on { opacity: 1; }
.loader.leaving { pointer-events: none; }
.loader canvas { display: block; width: 100%; height: 100%; }
.progress-ring { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 12px 0; text-align: center; }
.ring-dial { position: relative; width: 112px; height: 112px; }
.ring-dial svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-dial svg circle { fill: none; stroke-width: 7; }
.ring-track { stroke: var(--line); }
.ring-fill { stroke: var(--orange); stroke-linecap: round; transition: stroke-dashoffset 0.4s ease; }
.ring-dial::after { content: ""; position: absolute; inset: -5px; border: 2px solid transparent; border-top-color: var(--orange); border-radius: 50%; opacity: 0.55; animation: spin 1.2s linear infinite; }
.ring-number { position: absolute; inset: 0; display: grid; place-items: center; font-size: 1.5rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.ring-text { margin: 0; max-width: 28em; overflow-wrap: anywhere; }
.meal-name-field { margin: 0; }
.tag { padding: 1px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); font-size: 0.72rem; white-space: nowrap; }
.tag.parsed { background: rgba(47, 143, 232, 0.18); color: #6fb2f0; }
.chip { padding: 4px 12px; border: 1px solid var(--line); border-radius: 999px; background: none; color: var(--muted); font: inherit; font-size: 0.85rem; cursor: pointer; }
.chip.on { border-color: var(--orange); background: rgba(212, 119, 63, 0.16); color: var(--text); }
.pool-chips { gap: 6px; }
.upload-status:empty { display: none; }
.my-song .tag { flex: none; }

/* meals */
.meal-buttons { display: flex; flex-wrap: wrap; gap: 8px; padding: 8px 10px; }
.meal-buttons.home { padding: 8px 0 0; }
.meal-btn { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border: 0; border-radius: 999px; background: var(--orange); color: #fff; font: inherit; font-size: 0.85rem; font-weight: 600; cursor: pointer; }
.meal-btn:hover { filter: brightness(1.08); }
.meal-pick { display: block; cursor: pointer; }
.meal-preview { display: grid; place-items: center; min-height: 180px; border: 2px dashed var(--line); border-radius: 16px; overflow: hidden; color: var(--muted); }
.meal-preview img { width: 100%; max-height: 320px; object-fit: cover; }
.meal-preview.small { flex: none; width: 96px; min-height: 96px; height: 96px; border-style: solid; }
.meal-preview.small img { height: 100%; }
.meal-scan { position: relative; border-radius: 16px; overflow: hidden; background: #000; min-height: 160px; } /* the live camera of the barcode scan, with a red line to line the bars up with */
.meal-scan::after { content: ""; position: absolute; left: 10%; right: 10%; top: 50%; height: 2px; background: #ff4d4f; opacity: 0.75; pointer-events: none; }
.meal-video { display: block; width: 100%; max-height: 300px; object-fit: cover; }
.meal-result { display: flex; gap: 12px; align-items: flex-start; }
.nutrients { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.nutrient { display: flex; flex-direction: column; padding: 6px 8px; border-radius: 10px; background: var(--surface-2); }
.meal-list { display: flex; flex-direction: column; gap: 4px; max-height: calc(50dvh / var(--ui-scale, 1)); overflow: auto; }
.meal-row { display: flex; align-items: center; gap: 10px; padding: 4px 6px; border-radius: 10px; }
.meal-row:hover { background: var(--row-hover); }
.meal-thumb { flex: none; width: 48px; height: 48px; border-radius: 10px; object-fit: cover; background: var(--surface-2); }
.meal-thumb.blank { display: grid; place-items: center; color: var(--muted); }
button.meal-thumb-btn { flex: none; padding: 0; border: 0; border-radius: 10px; background: none; cursor: zoom-in; }
.viewer-stage { display: grid; place-items: center; height: min(calc(56dvh / var(--ui-scale, 1)), 640px); overflow: hidden; border-radius: 12px; background: #000; touch-action: none; cursor: zoom-in; }
.viewer-stage.zoomed { cursor: grab; }
.viewer-controls { justify-content: center; }
.viewer-img { max-width: 100%; max-height: 100%; user-select: none; transition: transform 0.12s ease-out; }
.optional { font-weight: 400; color: var(--muted); font-size: 0.8em; }

/* the name parser */
.parser-rules summary { cursor: pointer; }
.parser p { margin: 0; }
.parser select { width: 100%; }
.parser-results { display: flex; flex-direction: column; max-height: calc(55dvh / var(--ui-scale, 1)); overflow: auto; border: 1px solid var(--line); border-radius: 12px; }
.parser-head, .parser-row { display: grid; grid-template-columns: 28px 1fr 1fr; gap: 8px; align-items: center; padding: 6px 10px; }
.parser-head { position: sticky; top: 0; background: var(--surface); border-bottom: 1px solid var(--line); font-size: 0.85rem; }
.parser-row { border-bottom: 1px solid var(--line); cursor: pointer; overflow-wrap: anywhere; }
.parser-row:last-child { border-bottom: 0; }
.parser-row > span { min-width: 0; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; }
.parser-row.low { background: rgba(242, 163, 58, 0.08); }

/* Alani AI: example requests, and a proposal before and after */
.ai-examples { position: fixed; z-index: 45; width: 240px; display: flex; flex-direction: column; gap: 6px; padding: 10px; border: 2px solid #2f8fe8; border-radius: 16px; background: #10213a; color: #fff; box-shadow: 0 14px 40px rgba(0, 0, 0, 0.45); }
.ai-examples .icon-btn { width: 28px; height: 28px; color: #fff; }
.ai-example { padding: 8px 10px; border: 0; border-radius: 12px; background: #2a5d9c; color: #fff; font: inherit; font-size: 0.85rem; text-align: left; cursor: pointer; }
.ai-example:hover { background: #3570b8; }
.ai-examples.top { left: 8px; right: 8px; top: 8px; width: auto; }
.propose { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.propose-col { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.propose-list { margin: 0; padding: 6px 6px 6px 30px; max-height: calc(45dvh / var(--ui-scale, 1)); overflow: auto; border: 1px solid var(--line); border-radius: 12px; font-size: 0.88rem; }
.propose-list li { padding: 2px 0; overflow-wrap: anywhere; }
.propose-list li.new { color: var(--done); font-weight: 600; }
.propose-list li.out { color: var(--muted); text-decoration: line-through; }
.grow.wide { flex: 1 1 220px; }

/* ---- a0.3.2: the Music page, who sees what (visibility), notices */
.music-page { gap: 14px; }
.vis { display: inline-flex; align-items: center; color: var(--muted); vertical-align: -2px; }
.vis-friends { color: #6fb2f0; }
.vis-public { color: var(--done); }
.vis-btn { flex: none; width: 30px; height: 30px; }
.my-song .song-name { cursor: pointer; }
.my-song.frozen .song-name { color: var(--muted); text-decoration: line-through; }
.tag.frozen { background: rgba(242, 163, 58, 0.18); color: #f2a33a; }
.tile-cover { position: relative; }
.shared-badge { position: absolute; top: 6px; left: 6px; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: rgba(0, 0, 0, 0.55); color: #fff; }
.tile-name { display: flex; align-items: center; gap: 4px; }
.tile-name > span:last-child { min-width: 0; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; }
.hint-bubble { max-width: 280px; padding: 6px; }
.hint-bubble p { margin: 0; }
.item.notice { display: flex; align-items: center; gap: 8px; margin: 1px 4px; padding: 8px 10px; border-radius: 14px; background: rgba(47, 143, 232, 0.16); }
.song-owner { display: inline-flex; align-items: center; gap: 3px; flex: none; max-width: 40%; padding: 1px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* money */
.log-row { --row-bg: var(--island-body); }
.log-row .q-front .item { flex: 1; min-width: 0; }
.money-big, .money-buttons { display: grid; grid-template-columns: 2fr 3fr; gap: 6px; } /* In is narrower (it is rare), Out is the big one */
.money-buttons { margin-top: 6px; }
.money-num { display: flex; align-items: baseline; justify-content: center; gap: 5px; min-width: 0; padding: 2px 8px; border-radius: 999px; color: #fff; font-weight: 800; overflow: hidden; white-space: nowrap; }
.money-num small { font-size: 0.8rem; }
.money-num.in { background: #2e5c20; font-size: clamp(1rem, calc(3.2vw / var(--ui-scale, 1)), 1.5rem); }
.money-num.out { background: #7a0d0d; font-size: clamp(1.4rem, calc(4.5vw / var(--ui-scale, 1)), 2.3rem); }
.money-btn { display: grid; place-items: center; height: 40px; border: 0; border-radius: 999px; color: #fff; }
.money-btn.in { background: #2e5c20; }
.money-btn.out { background: #b3261e; }
.money-btn:hover { filter: brightness(1.12); }
.cal-total.money-total.negative { background: #7a3a2e; }
.budgets { display: flex; flex-direction: column; gap: 6px; margin: 6px 0; }
.island .budgets { padding: 0 12px; }
.budgets:empty { display: none; }
.budget-top { display: flex; justify-content: space-between; align-items: baseline; font-size: 0.72rem; color: var(--muted); }
.budget-kind { text-transform: lowercase; }
.budget-nums b { color: var(--text); font-weight: 700; }
.budget-nums b.over { color: #ff5a4d; }
.budget-track { height: 7px; border-radius: 4px; background: var(--line); overflow: hidden; }
.budget-fill { display: block; height: 100%; border-radius: 4px; background: #3fb950; transition: width 0.3s ease; }
.budget-fill.warn { background: #e0b02a; }
.budget-fill.bad { background: #e5534b; }
.money-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center; }
.money-summary > div { display: flex; flex-direction: column; padding: 6px 4px; border-radius: 12px; background: var(--row-hover); }
.money-summary b { font-size: 1.05rem; }
.money-summary .in b { color: #6fcf4a; }
.money-summary .out b { color: #ff6b5e; }
.money-summary .negative b { color: #ff6b5e; }
.money-chart { width: 100%; height: auto; }
.chart-axis { stroke: var(--line); stroke-width: 1; }
.chart-bar.in { fill: #3fb950; }
.chart-bar.out { fill: #e5534b; }
.chart-net { fill: none; stroke: var(--orange); stroke-width: 2; stroke-linejoin: round; }
.chart-label { fill: var(--muted); font-size: 11px; }
.numpad-box { outline: none; }
.numpad-display { padding: 10px 14px; border-radius: 14px; background: var(--input); font-size: 2rem; font-weight: 800; text-align: right; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.numpad-display.in { color: #6fcf4a; }
.numpad-display.out { color: #ff6b5e; }
.numpad-display.empty { opacity: 0.5; }
.numpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.numpad-key { height: 54px; border: 0; border-radius: 14px; background: var(--input); color: var(--text); font: inherit; font-size: 1.4rem; font-weight: 700; }
.numpad-key:hover:not(:disabled) { filter: brightness(1.15); }
.numpad-key:disabled { opacity: 0.35; }
.numpad-go.in { background: #2e8f3a; }
.numpad-go.out { background: #c4302b; }

/* notifications window */
.notify-device { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px; background: var(--row-hover); }
.notify-device p { margin: 2px 0 0; }
.notify-grid { display: flex; flex-direction: column; }
.notify-row { display: grid; grid-template-columns: minmax(0, 1fr) repeat(5, 56px); align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.notify-row.head { font-size: 0.8rem; color: var(--muted); text-align: center; }
.notify-name { overflow-wrap: anywhere; }
.notify-col { text-align: center; }
.notify-cell { display: grid; place-items: center; height: 36px; cursor: pointer; }
.notify-cell input { width: 20px; height: 20px; accent-color: var(--orange); }
.notify-cell.off { opacity: 0.35; cursor: default; }
@media (max-width: 480px) { .notify-row { grid-template-columns: minmax(0, 1fr) repeat(5, 46px); } }

/* search boxes (Settings, Home) */
.search-hidden { display: none !important; }
.search-box { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; padding: 0 12px; border-radius: 999px; background: var(--input); color: var(--muted); }
.search-input { flex: 1; min-width: 0; padding: 10px 0; border: 0; background: none; color: var(--text); font: inherit; outline: none; }

/* islands with a height of their own, and without their header (the editor sets them: quickmenuEditor.js) */
.island.sized { display: flex; flex-direction: column; }
.island.sized .island-body { flex: 1 1 auto; min-height: 0; max-height: none; }
.island.sized.max .island-body { flex: 0 1 auto; }
.island.headless .island-body { padding-top: 8px; border-radius: var(--radius); }

/* the quick menu editor: a window with a preview of the islands, shaking like icons on a phone's home screen */
.dialog-body:has(> .qe) { overflow: hidden; padding-bottom: 14px; }
.qe { display: flex; flex-direction: column; gap: 10px; height: 100%; min-height: 0; }
.qe-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.qe-hint { margin: 0; }
.qe-canvas { flex: 1; min-height: 0; overflow: auto; padding: 18px 14px 26px; border-radius: 16px; background: var(--bg); user-select: none; -webkit-user-select: none; }
.qe-canvas .islands { justify-content: center; }
.qe-add { display: grid; place-items: center; flex: none; width: 100%; height: 48px; border: 0; border-radius: 14px; background: #7d7878; color: #fff; cursor: pointer; }
.qe-add:hover { background: #8d8888; }
.qe-add.none { opacity: 0.45; }
.qe-save, .qe-presets-btn { display: inline-flex; align-items: center; gap: 2px; }
.qe-save-icon { display: inline-grid; }
.icon.spin { animation: spin 0.8s linear infinite; }
@media (max-width: 480px) { .qe-presets-btn .qe-label { display: none; } .qe-hint { display: none; } }

.island.edit { cursor: grab; touch-action: pan-y; transform-origin: 50% 50%; animation: qe-shake 0.26s ease-in-out infinite alternate; animation-delay: var(--shake, 0ms); }
@keyframes qe-shake { from { rotate: -0.8deg; } to { rotate: 0.8deg; } }
.island.edit.qe-spot { opacity: 0.28; animation: none; }
.island.edit.resizing { animation: none; }

@media (prefers-reduced-motion: reduce) { .island.edit { animation: none; } }
.qe-btn { position: absolute; z-index: 3; display: grid; place-items: center; padding: 0; border: 0; cursor: pointer; }
.qe-minus { top: -9px; left: -9px; width: 26px; height: 26px; border-radius: 50%; background: #d5d5d5; color: #1a1a1a; box-shadow: 0 1px 6px rgba(0, 0, 0, 0.55); }
.qe-more { top: -9px; right: -9px; width: 26px; height: 26px; border-radius: 50%; background: #d5d5d5; color: #1a1a1a; box-shadow: 0 1px 6px rgba(0, 0, 0, 0.55); }
.qe-ceiling { position: absolute; z-index: 2; top: 0; left: 0; right: 0; box-sizing: border-box; border: 2px dashed rgba(255, 255, 255, 0.75); border-radius: var(--radius); pointer-events: none; filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.6)); }
.qe-resize { position: absolute; z-index: 3; right: 3px; bottom: 3px; width: 28px; height: 28px; border-right: 5px solid rgba(255, 255, 255, 0.85); border-bottom: 5px solid rgba(255, 255, 255, 0.85); border-radius: 0 0 var(--radius) 0; cursor: ns-resize; touch-action: none; filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.5)); }
.qe-edge { position: absolute; z-index: 2; left: 40px; right: 40px; bottom: -7px; height: 16px; cursor: ns-resize; touch-action: none; }
.qe-ghost { position: fixed; z-index: 55; margin: 0; pointer-events: none; animation: none; opacity: 0.96; transform: scale(1.03); box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55); }
.qe-ghost .qe-btn, .qe-ghost .qe-resize, .qe-ghost .qe-edge { display: none; }
.qe-ghost.landing { transform: none; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25); transition: left 0.17s ease-out, top 0.17s ease-out, width 0.17s, height 0.17s, transform 0.17s, box-shadow 0.17s; }
.qe-canvas.dragging { cursor: grabbing; }

.qe-presets, .qe-hidden { display: flex; flex-direction: column; gap: 8px; }
.qe-preset, .qe-hidden-row { display: flex; align-items: center; gap: 12px; padding: 10px; border: 2px solid transparent; border-radius: 14px; background: var(--surface-2); color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.qe-preset:hover, .qe-hidden-row:hover { border-color: var(--line); }
.qe-preset.on { border-color: var(--orange); }
.qe-thumb { display: flex; flex: none; gap: 3px; padding: 5px; border-radius: 8px; background: var(--bg); }
.qe-thumb.wide { width: 120px; height: 72px; }
.qe-thumb.tall { width: 64px; height: 96px; }
.qe-thumb-col { display: flex; flex: 1; flex-direction: column; gap: 3px; min-width: 0; }
.thumb-island { display: block; flex: none; width: 100%; min-height: 4px; border-radius: 3px; background: var(--head); box-shadow: none; }
.qe-hidden-row .thumb-island { width: 34px; height: 22px; border-radius: 5px; }
/* the phone's quick menu, top left: the bell (what needs attention), then the pencil; both white like the arrow that hides the player (dark text colour when the player is hidden, so they show on a light page) */
.customize-music, .notify-music { position: absolute; top: 0; left: 0; z-index: 2; color: #fff; }
.notify-music + .customize-music { left: 38px; }
.music-hidden .customize-music, .music-hidden .notify-music { color: var(--text); }
.notify-count { position: absolute; top: 1px; right: 0; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: #d11414; color: #fff; font-size: 0.68rem; line-height: 16px; text-align: center; }
.item.notice .grow { white-space: pre-line; overflow-wrap: anywhere; } /* (a digest has paragraphs) */
.notifications-bar { display: flex; justify-content: flex-end; padding: 2px 4px 6px; }
.notice-body { min-width: 0; }
.item.notice .ai-embeds { margin-top: 6px; }
.item.notice u, .ai-msg u, .digest-card u { text-underline-offset: 2px; }
@media (max-width: 700px) {
  /* a phone: the preview is as wide as the quick menu itself, so it has the same columns */
  .dialog-body:has(> .qe) { padding-left: 0; padding-right: 0; }
  .qe-bar { padding: 0 14px; }
  .qe-canvas { border-radius: 0; }
  .qe-add { width: calc(100% - 28px); align-self: center; }
}

/* line graphs on the islands */
.graph { padding: 4px 12px 10px; }
.graph-title { margin: 4px 0 0; font-weight: 700; text-align: center; }
.line-chart { display: block; width: 100%; height: auto; }
.lc-grid { stroke: var(--line); stroke-width: 1; }
.lc-label { fill: var(--muted); font-size: 9.5px; }
.lc-line { stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
.lc-line.in, .lc-dot.in { stroke: #53a830; }
.lc-line.out, .lc-dot.out { stroke: #e0483c; }
.lc-line.s0, .lc-dot.s0 { stroke: #e0483c; }
.lc-line.s1, .lc-dot.s1 { stroke: #4aa3df; }
.lc-line.s2, .lc-dot.s2 { stroke: #e0b84f; }
.lc-line.s3, .lc-dot.s3 { stroke: #66bb6a; }
.lc-dot { fill: var(--island-body); stroke-width: 2; }
.lc-legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 14px; margin-top: 4px; font-size: 0.85rem; color: var(--muted); }
.lc-key { display: inline-block; width: 10px; height: 10px; margin-right: 5px; border-radius: 50%; background: #888; }
.lc-key.in { background: #53a830; } .lc-key.out { background: #e0483c; }
.lc-key.s0 { background: #e0483c; } .lc-key.s1 { background: #4aa3df; } .lc-key.s2 { background: #e0b84f; } .lc-key.s3 { background: #66bb6a; }

.graph.large { padding: 4px 0 8px; }
.graph.large .line-chart { max-height: calc(55vh / var(--ui-scale, 1)); }

/* the quick menu's islands are placed by quickPack.js (absolute positions); a Showcase may be wider than a column */
.islands.packed { position: relative; display: block; }
.islands.packed > .island { position: absolute; margin: 0; transition: top 0.28s cubic-bezier(0.2, 0.7, 0.2, 1), left 0.28s cubic-bezier(0.2, 0.7, 0.2, 1); }
.islands.packed.still > .island { transition: none; }
.island.black { --head: #000; }

/* the Showcase island: black, pictures and videos that fit (with black bars), a speaker at the top right */
.island.showcase-island { background: #000; color: #fff; }
.island.showcase-island .island-head { background: #000; }
.island.showcase-island .island-body { padding: 0; max-height: none; overflow: hidden; border-radius: var(--radius); }
.island.showcase-island:not(.headless) .island-body { border-radius: 0 0 var(--radius) var(--radius); }
.showcase { position: relative; width: 100%; aspect-ratio: var(--sc-ratio, 1.7778); overflow: hidden; background: #000; cursor: pointer; user-select: none; -webkit-user-select: none; touch-action: pan-y; -webkit-touch-callout: none; }
.island.sized .showcase { aspect-ratio: auto; height: 100%; }
.sc-stage, .sc-layer { position: absolute; inset: 0; }
.sc-layer { background: #000; }
.sc-media { display: block; width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.sc-empty { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 8px; color: #aaa; text-align: center; font-size: 0.9rem; }
.sc-empty[hidden] { display: none; }
.sc-sound { position: absolute; z-index: 3; top: 8px; right: 8px; display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 0; border-radius: 50%; background: rgba(0, 0, 0, 0.55); color: #fff; cursor: pointer; }
.sc-sound[hidden] { display: none; }
.sc-skip { position: absolute; z-index: 3; top: 8px; left: 8px; display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 0; border-radius: 50%; background: rgba(0, 0, 0, 0.55); color: #fff; cursor: pointer; }
.sc-skip[hidden] { display: none; }
/* on a wide layout the two buttons show only while the pointer is on the island (or one has the keyboard); on a tall one they always show */
.showcase[data-layout="h"] .sc-sound, .showcase[data-layout="h"] .sc-skip { opacity: 0; transition: opacity 0.15s; }
.showcase[data-layout="h"]:hover .sc-sound, .showcase[data-layout="h"]:hover .sc-skip, .showcase[data-layout="h"]:focus-within .sc-sound, .showcase[data-layout="h"]:focus-within .sc-skip { opacity: 1; }
@media (hover: none) { .showcase[data-layout="h"] .sc-sound, .showcase[data-layout="h"] .sc-skip { opacity: 1; } }
.sc-pausemark { position: absolute; inset: 0; z-index: 2; display: grid; place-items: center; background: rgba(0, 0, 0, 0.35); color: #fff; opacity: 0; pointer-events: none; transition: opacity 0.15s; }
.sc-pausemark.on { opacity: 1; }

/* a Showcase's settings */
.sc-rows { display: flex; flex-direction: column; }
/* (the gap between rows is a transparent border, so a dragged row moves by exactly one row's height) */
.sc-row { position: relative; padding: 8px; border: 0 solid transparent; border-bottom-width: 8px; border-radius: 14px; background: var(--surface-2); background-clip: padding-box; transition: transform 0.12s; }
.sc-row.dragging { z-index: 2; transition: none; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4); }
.sc-row .q-handle { padding: 6px 4px; }
.sc-row-main { display: flex; align-items: center; gap: 8px; }
.sc-thumb-box { position: relative; flex: none; width: 76px; height: 50px; overflow: hidden; border-radius: 8px; background: #000; }
.sc-thumb { display: block; width: 100%; height: 100%; object-fit: contain; }
.sc-badge { position: absolute; left: 2px; bottom: 2px; padding: 0 4px; border-radius: 4px; background: rgba(0, 0, 0, 0.7); color: #fff; font-size: 0.6rem; }
.sc-row-text { display: flex; flex-direction: column; min-width: 0; }
.sc-row-text input { width: 100%; padding: 2px 0; border: 0; background: transparent; color: inherit; font: inherit; font-weight: 600; text-overflow: ellipsis; }
.sc-sound-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 8px; padding-left: 84px; }
.sc-sound-row input[type="range"] { flex: 1; min-width: 90px; max-width: 220px; accent-color: var(--orange); }
.sc-uploads { display: flex; flex-direction: column; gap: 6px; }
.sc-up { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-radius: 10px; background: var(--surface-2); font-size: 0.9rem; }
.sc-up progress { width: 120px; accent-color: var(--orange); }
@media (max-width: 480px) { .sc-sound-row { padding-left: 0; } }

/* the editor: a Showcase's right edge changes its width */
.qe-side { position: absolute; z-index: 2; top: 40px; bottom: 40px; right: -7px; width: 16px; cursor: ew-resize; touch-action: none; }
.island.edit .qe-side::after { content: ""; position: absolute; top: 50%; right: 7px; width: 4px; height: 36px; margin-top: -18px; border-radius: 2px; background: rgba(255, 255, 255, 0.8); filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.6)); }

.sc-settings h4 { margin: 6px 0 0; }
.sc-settings .stack { gap: 8px; }

/* ---- Alani AI tab (public/js/ai/chat.js): a page with the assistant at the top, the chat in the middle and the message bar always at the bottom */
[hidden] { display: none !important; }
.stage:has(.ai-tab) { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.stage:has(.ai-tab) > .announce { margin: 8px 10px 0; flex: none; }
.ai-tab { position: relative; isolation: isolate; flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; width: 100%; }
/* the blue-orange tint over the theme: it fades out towards every edge, so it never ends in a hard line */
.ai-tab::before { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; background: linear-gradient(155deg, rgba(47, 143, 232, 0.24), rgba(240, 122, 42, 0.2)); -webkit-mask-image: linear-gradient(to right, transparent, #000 22%, #000 78%, transparent), linear-gradient(to bottom, transparent, #000 20%, #000 75%, transparent); -webkit-mask-composite: source-in; mask-image: linear-gradient(to right, transparent, #000 22%, #000 78%, transparent), linear-gradient(to bottom, transparent, #000 20%, #000 75%, transparent); mask-composite: intersect; }
.ai-tab-head { display: flex; align-items: center; gap: 2px; padding: 8px 14px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--surface) 72%, transparent); }
.assistant-pill { display: inline-flex; align-items: center; gap: 8px; max-width: 60%; padding: 4px 12px 4px 4px; border: 1px solid var(--line); border-radius: 999px; background: var(--input); }
.assistant-pill b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.assistant-pill { max-width: 46%; }
/* the other assistants as tabs beside her name, a plus for a new one (only while the plan has room), and the crown on the head assistant */
.assistant-tabs { display: flex; gap: 6px; flex: 0 1 auto; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.assistant-tabs::-webkit-scrollbar { display: none; }
.assistant-tab { flex: none; display: inline-flex; align-items: center; gap: 6px; max-width: 160px; padding: 3px 12px 3px 3px; border: 1px solid transparent; border-radius: 999px; background: transparent; color: var(--muted); font: inherit; cursor: pointer; transition: background 0.15s, color 0.15s, border-color 0.15s; }
.assistant-tab:hover, .assistant-tab:focus-visible { background: var(--input); color: var(--text); border-color: var(--line); }
.assistant-tab .assistant-dot { width: 24px; height: 24px; font-size: 0.78rem; }
.assistant-tab-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.assistant-add { flex: none; border: 1px dashed var(--line); border-radius: 50%; }
.crown { display: inline-grid; place-items: center; color: #ffcf4a; flex: none; }
@media (prefers-reduced-motion: reduce) { .assistant-tab { transition: none; } }
.assistant-dot { flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--dot, #2f8fe8); color: #fff; font-weight: 700; }
.mini-chip.incognito { margin-left: 8px; }
.ai-tab .ai-log { flex: 1; min-height: 0; overflow: auto; padding: 14px max(14px, calc((100% - 860px) / 2)); }
.ai-tab .ai-msg { color: #fff; max-width: min(85%, 640px); }
.ai-tab .ai-note { color: var(--muted); }
.ai-tab .ai-msg.cost { color: var(--muted); }
.ai-tab .ai-songs { background: var(--surface-2); border: 1px solid var(--line); }
.ai-msg-files { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.ai-ask { align-self: stretch; padding: 8px 12px; border: 1px dashed var(--line); border-radius: 12px; white-space: pre-wrap; font-size: 0.9rem; }
.ai-remembered { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 0.85rem; }
.ai-remembered span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.digest-card { align-self: stretch; padding: 12px 14px; border: 1px solid var(--orange); border-radius: 16px; background: var(--surface); }
.digest-card p { margin: 6px 0 0; white-space: pre-wrap; }
.ai-examples-row:empty, .ai-attached:empty { display: none; }
.ai-examples-row, .ai-attached { padding: 6px 14px 0; }
.ai-attached { display: flex; flex-wrap: wrap; gap: 6px; }
/* the message bar floats as one soft, rounded capsule over the page (frosted, no hard band across the width) */
.ai-composer { display: flex; align-items: flex-end; gap: 6px; margin: 0 10px 10px; padding: 6px; border: 1px solid color-mix(in srgb, #fff 10%, transparent); border-radius: 30px; background: color-mix(in srgb, var(--surface) 58%, transparent); -webkit-backdrop-filter: blur(16px) saturate(1.2); backdrop-filter: blur(16px) saturate(1.2); box-shadow: 0 8px 26px rgba(0, 0, 0, 0.28), inset 0 1px 0 color-mix(in srgb, #fff 8%, transparent); }
.ai-composer textarea { flex: 1; min-width: 0; min-height: 44px; max-height: 140px; resize: none; padding: 11px 16px; border: 1px solid color-mix(in srgb, #fff 8%, transparent); border-radius: 22px; background: color-mix(in srgb, var(--input) 70%, transparent); color: var(--text); line-height: 1.25; }
.ai-composer .ai-plus, .ai-composer .ai-mic { flex: none; width: 44px; height: 44px; border: 1px solid color-mix(in srgb, #fff 8%, transparent); background: color-mix(in srgb, var(--input) 70%, transparent); }
.ai-composer textarea:focus-visible { outline: none; border-color: var(--orange); box-shadow: 0 0 0 3px color-mix(in srgb, var(--orange) 28%, transparent); }
.ai-composer .ai-send { flex: none; width: 44px; height: 44px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 50%; background: var(--orange); color: #fff; }
.file-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--input); color: var(--text); font-size: 0.82rem; text-decoration: none; }
.file-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 180px; }
.file-chip small { color: var(--muted); }
.file-chip.loading { opacity: 0.7; }
.ai-tab .ai-msg.me .file-chip { background: rgba(255, 255, 255, 0.2); border-color: transparent; color: #fff; }

.chip-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.chip { padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--input); color: var(--text); font-size: 0.88rem; }
.chip:hover { filter: brightness(1.15); }
.chip.on { border-color: transparent; background: var(--orange); color: #fff; }
.mini-chip { display: inline-block; padding: 1px 8px; border-radius: 999px; background: var(--row-hover); color: var(--muted); font-size: 0.72rem; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { width: 32px; height: 32px; padding: 0; border: 3px solid transparent; border-radius: 50%; background: var(--swatch); }
.swatch.on { border-color: var(--text); }
.plain-list { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }

.starter { min-height: calc(55dvh / var(--ui-scale, 1)); }
.starter-body { flex: 1; display: flex; flex-direction: column; gap: 12px; }
.starter-body h3 { margin: 0; }
.starter-dots { display: flex; justify-content: center; gap: 6px; }
.starter-dots .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.starter-dots .dot.done { background: var(--muted); }
.starter-dots .dot.on { background: var(--orange); width: 22px; border-radius: 6px; }
.starter-nav { margin-top: auto; }
.starter-preview { margin: 0; padding: 10px 14px; border-radius: 14px; background: var(--row-hover); font-style: italic; }
.starter textarea, .ai-settings-body textarea { width: 100%; padding: 10px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--input); resize: vertical; }

.memory-tabs { overflow-x: auto; }
.memory-tabs .segmented { flex-wrap: nowrap; }
.memory-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 8px; }
.memory-stats .stat { display: flex; flex-direction: column; align-items: center; padding: 10px; border: 1px solid var(--line); border-radius: 14px; }
.memory-stats .stat b { font-size: 1.4rem; }
.memory-core { margin: 0; padding: 10px 14px; border-radius: 14px; background: var(--row-hover); white-space: pre-wrap; font: inherit; overflow-wrap: anywhere; }
.meter { height: 8px; border-radius: 999px; background: var(--row-hover); overflow: hidden; }
.meter span { display: block; height: 100%; border-radius: 999px; background: var(--orange); }
.fact-row { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 14px; margin-bottom: 8px; }
.fact-row.pinned { border-color: var(--orange); }
.fact-row.undone { opacity: 0.55; }
.fact-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.fact-text { overflow-wrap: anywhere; }
.fact-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; max-width: 46%; }
.past-row { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 14px; background: none; text-align: left; margin-bottom: 8px; }
@media (max-width: 600px) { .fact-row { flex-direction: column; } .fact-actions { max-width: none; justify-content: flex-start; } }

/* the voice conversation on the Alani AI tab: a long bar above the message box */
.ai-voicebar { display: flex; align-items: center; gap: 12px; margin: 8px 14px 0; padding: 10px 14px; border: 1.5px solid var(--orange); border-radius: 22px; background: color-mix(in srgb, var(--surface) 80%, transparent); }
.ai-voicebar .vo-orb { flex: none; width: 56px; height: 56px; margin: 0; }
.ai-voicebar .vo-orb img { width: 36px; height: 36px; }
.ai-voicebar .vo-mid { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.ai-voicebar .vo-status { text-align: left; padding: 0; }
.ai-voicebar .vo-timing { text-align: left; padding: 0; color: var(--muted); }
.ai-voicebar .vo-controls { padding: 0; color: var(--muted); }
.ai-voicebar .vo-style { background: var(--input); border-color: var(--line); color: var(--text); }
.ai-voicebar > .icon-btn { flex: none; width: 44px; height: 44px; border: 1px solid var(--line); background: var(--input); }
@media (max-width: 600px) { .ai-voicebar { margin-inline: 10px; gap: 8px; padding: 8px 10px; } .ai-voicebar .vo-controls .vo-volume { display: none; } }

/* ---- the bar at the bottom of a phone: "Simple default" (slim, flush to the bottom, like a social app) - the tall one is "Legacy style" (settings: prefs.navStyle) */
.layout-v.nav-simple .nav { height: calc(54px + env(safe-area-inset-bottom)); align-items: center; justify-content: space-around; gap: 2px; padding: 0 6px env(safe-area-inset-bottom); }
.layout-v.nav-simple .nav-btn { width: 54px; height: 42px; border-radius: 21px; }
.layout-v.nav-simple .nav-btn .icon { width: 24px; height: 24px; }
.layout-v.nav-simple .rocket, .layout-v.nav-simple .rocket.active { width: 62px; height: 40px; border-radius: 20px; }
.layout-v.nav-simple .ai-btn { width: 46px; height: 46px; border-radius: 50%; }
.layout-v.nav-simple .ai-btn img { width: 44px; height: 44px; }
.layout-v.nav-simple .nav-btn .badge, .layout-v.nav-simple .rocket .badge { top: -2px; right: 2px; min-width: 18px; height: 18px; font-size: 0.7rem; }

/* ---- the Alani AI board (public/js/ai/board.js): cards, numbers, quick actions and the chat as four parts */
.ai-stage { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.ai-board { position: relative; flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 30%); gap: 10px; padding: 10px; }
.ai-left, .ai-right { min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: 10px; }
.ai-pane { min-width: 0; min-height: 0; border: 1px solid var(--line); border-radius: 16px; background: color-mix(in srgb, var(--surface) 72%, transparent); overflow: hidden; }
.ai-cards, .ai-stats { flex: 1; overflow: auto; padding: 12px; }
.ai-actions { flex: none; display: flex; align-items: stretch; gap: 8px; min-height: 84px; padding: 8px 10px; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x proximity; }
.ai-chatpane { flex: 0 0 40%; min-height: 200px; display: flex; flex-direction: column; }
.ai-chatbar { flex: none; display: flex; align-items: center; gap: 2px; padding: 3px 6px 3px 12px; border-bottom: 1px solid var(--line); }
.ai-chatbody { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.ai-chatbody .ai-log { padding: 10px; }
.ai-empty { min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; text-align: center; padding: 6px; }
.ai-chattoggle { position: absolute; right: 14px; bottom: 14px; z-index: 3; display: none; align-items: center; gap: 6px; padding: 8px 14px; border: 0; border-radius: 999px; background: var(--orange); color: #fff; font-weight: 600; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35); }
.ai-chattoggle .icon { vertical-align: middle; }

/* wide screens: the chat is small, big (over everything) or hidden */
.layout-h .only-tall, .layout-v .only-wide, .layout-v .only-compact, .layout-v .only-full { display: none; }
.layout-h .ai-tab:not([data-chat-h="compact"]) .only-compact, .layout-h .ai-tab:not([data-chat-h="full"]) .only-full { display: none; }
.layout-h .ai-tab[data-chat-h="hidden"] .ai-chatpane { display: none; }
.layout-h .ai-tab[data-chat-h="hidden"] .ai-chattoggle { display: inline-flex; }
.layout-h .ai-tab[data-chat-h="full"] .ai-chatpane { position: absolute; inset: 10px; z-index: 2; background: var(--surface); }
.layout-h .ai-tab[data-chat-h="full"] .ai-chatbody .ai-log { padding: 14px max(14px, calc((100% - 860px) / 2)); }

/* tall screens: quick actions on top, then the numbers and the cards; the chat is a sheet over them that typing (or the triangle) brings up */
.layout-v .ai-board { display: flex; flex-direction: column; gap: 8px; padding: 8px; overflow: hidden; }
.layout-v .ai-left, .layout-v .ai-right { display: contents; }
.layout-v .ai-actions { order: 1; min-height: 72px; }
.layout-v .ai-stats { order: 2; flex: none; max-height: 30%; }
.layout-v .ai-cards { order: 3; }
.layout-v .ai-chatpane { position: absolute; inset: 8px; z-index: 2; display: none; background: var(--surface); }
.layout-v .ai-tab[data-chat-v="open"] .ai-chatpane { display: flex; }
/* the button that opens the chat sheet: it stays at the bottom right of the screen (the stage does not scroll), on the same background as the message field */
.layout-v .ai-tab[data-chat-v="closed"] .ai-chattoggle { display: flex; right: 12px; bottom: 10px; height: 44px; padding: 0 16px 0 12px; gap: 4px; border: 1px solid var(--line); background: var(--input); color: var(--orange); box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3); }
.layout-v .ai-chatpane { box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.25); }

/* ---- the knowledge graph picture (public/js/ai/graphView.js) */
.kg-wrap { position: relative; border: 1px solid var(--line); border-radius: 14px; background: var(--input); overflow: hidden; touch-action: none; }
.kg-canvas { display: block; cursor: grab; touch-action: none; }
.kg-controls { position: absolute; right: 8px; top: 8px; display: flex; flex-direction: column; gap: 6px; }
.kg-controls .icon-btn { width: 34px; height: 34px; border: 1px solid var(--line); background: var(--surface); }
.kg-legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 0.8rem; color: var(--muted); }
.kg-legend span { display: inline-flex; align-items: center; gap: 6px; }
.kg-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.kg-details { min-height: 40px; }
.link-btn { padding: 0; border: 0; background: none; color: var(--orange); text-decoration: underline; font: inherit; }

/* ---- quick actions (public/js/ai/actionsView.js): small cards in a row that scrolls sideways; a tap uses one, holding it changes it */
.qa-card { flex: none; scroll-snap-align: start; min-width: 112px; max-width: 170px; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 2px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--input); color: var(--text); text-align: left; touch-action: manipulation; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.qa-card:hover { filter: brightness(1.1); }
.qa-card.holding { transform: scale(0.96); transition: transform 0.45s ease-in; }
.qa-card:active { background: var(--row-hover); }
.qa-title { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.86rem; font-weight: 600; }
.qa-status { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 1.15rem; font-weight: 700; color: var(--orange); }
.qa-card.add { min-width: 76px; align-items: center; justify-content: center; border-style: dashed; color: var(--muted); background: none; }
.qa-card.add span { font-size: 0.8rem; }
.qa-hint { align-self: center; flex: none; max-width: 240px; }
.layout-v .qa-card { min-width: 104px; padding: 6px 12px; }

/* ---- cards and numbers (public/js/ai/cardsView.js): the pane bar, a grid of cards in locked frames, numbers as lists */
.ai-cards, .ai-stats { padding: 0; display: flex; flex-direction: column; overflow: hidden; }
.ai-bar { flex: none; display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 14px; border-bottom: 1px solid var(--line); }
.ai-bar .chip.small { padding: 2px 10px; font-size: 0.78rem; }
.cd-grid { flex: 1; min-height: 0; overflow: auto; display: grid; grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr)); grid-auto-rows: 100px; grid-auto-flow: dense; gap: 10px; padding: 10px; align-content: start; }
.cd-grid[data-mode="fixed"] { grid-auto-flow: row; }
.cd-grid:empty { display: none; }
.cd { position: relative; grid-column: span var(--w, 3); grid-row: span var(--h, 2); border: 1px solid var(--line); border-radius: 16px; background: var(--input); overflow: hidden; min-height: 0; }
.cd-frame { display: block; width: 100%; height: 100%; border: 0; background: transparent; }
.cd-menu { position: absolute; top: 4px; right: 4px; width: 30px; height: 30px; opacity: 0.55; background: color-mix(in srgb, var(--surface) 70%, transparent); border-radius: 50%; }
.cd:hover .cd-menu, .cd-menu:focus-visible { opacity: 1; }
.cd-stamp { position: absolute; right: 10px; bottom: 6px; max-width: 48%; padding: 1px 8px; border-radius: 999px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; background: color-mix(in srgb, var(--surface) 70%, transparent); color: var(--muted); font-size: 0.68rem; opacity: 0.8; pointer-events: none; }
.cd-note { position: absolute; left: 10px; bottom: 6px; padding: 1px 8px; border-radius: 999px; background: color-mix(in srgb, var(--surface) 80%, transparent); color: var(--muted); font-size: 0.72rem; }
.cd.waiting .cd-frame { opacity: 0.5; }
.st-grid { flex: 1; min-height: 0; overflow: auto; display: grid; grid-template-columns: repeat(var(--cols, 1), minmax(0, 1fr)); grid-auto-flow: dense; gap: 8px; padding: 10px; align-content: start; font-size: calc(1rem * var(--stats-scale, 1)); }
.st-grid:empty { display: none; }
.st { position: relative; grid-column: span var(--w, 1); border: 1px solid var(--line); border-radius: 14px; background: var(--input); padding: 8px 12px 10px; min-width: 0; }
.st.sized { height: var(--tall); overflow: auto; }
.st-stamp { display: block; margin-top: 4px; font-size: 0.75em; }
.st-grid .st small { font-size: 0.8em; }
.st-head { align-items: center; margin-bottom: 4px; }
.st-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 3px 0; font-size: 0.92em; }
.st-row b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.st-list { margin-top: 4px; border-top: 1px solid var(--line); padding-top: 4px; }
.lib-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 12px; }
.icon-btn.pen.on { background: var(--orange); color: #fff; }
.ed-tools { flex: none; display: flex; flex-direction: column; gap: 4px; padding: 6px 10px 8px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--orange) 8%, transparent); }
.ed-tools .row.wrap { flex-wrap: wrap; align-items: center; gap: 8px; }
.ed-shield, .ed-handle { display: none; }
.cd-grid.editing .cd, .st-grid.editing .st { animation: qe-shake 0.26s ease-in-out infinite alternate; animation-delay: var(--shake, 0ms); transform-origin: 50% 50%; }
.cd-grid.editing .cd.dragging, .st-grid.editing .st.dragging, .cd-grid.editing .cd.resizing, .st-grid.editing .st.resizing { animation: none; }
.cd-grid.editing .cd.dragging, .st-grid.editing .st.dragging { z-index: 30; opacity: 0.92; box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45); }
.cd-grid.editing .cd-menu, .cd-grid.editing .cd-stamp, .st-grid.editing .st-head .icon-btn { visibility: hidden; }
.editing .ed-shield { display: block; position: absolute; inset: 0; z-index: 3; cursor: grab; touch-action: pan-y; border-radius: inherit; }
.editing .ed-shield:focus-visible { outline: 2px solid var(--orange); outline-offset: -2px; }
.editing .dragging .ed-shield { cursor: grabbing; }
.editing .ed-handle { display: block; position: absolute; right: 0; bottom: 0; z-index: 4; width: 34px; height: 34px; cursor: nwse-resize; touch-action: none; }
.editing .ed-handle::after { content: ""; position: absolute; right: 7px; bottom: 7px; width: 14px; height: 14px; border-right: 3px solid var(--orange); border-bottom: 3px solid var(--orange); border-bottom-right-radius: 6px; }
.ed-size { position: absolute; right: 30px; bottom: 30px; padding: 2px 8px; border-radius: 999px; background: var(--orange); color: #fff; font-size: 0.75rem; font-weight: 700; white-space: nowrap; pointer-events: none; }
.ed-size:empty { display: none; }
.cd-grid.editing .cd.resizing, .st-grid.editing .st.resizing { outline: 2px solid var(--orange); }
@media (prefers-reduced-motion: reduce) { .cd-grid.editing .cd, .st-grid.editing .st { animation: none; } }
.size-preview { display: grid; grid-template-columns: repeat(12, 1fr); grid-auto-rows: 10px; gap: 3px; padding: 8px; border: 1px dashed var(--line); border-radius: 10px; min-height: 56px; }
.size-box { grid-column: span var(--w, 3); grid-row: span var(--h, 2); border-radius: 6px; background: color-mix(in srgb, var(--orange) 55%, transparent); }
.cd-wait { position: absolute; inset: 0; display: grid; place-items: center; padding: 12px; text-align: center; color: var(--muted); font-size: 0.85rem; pointer-events: none; }

/* ---- Alani AI islands (public/js/islands/cardIsland.js): a card or numbers from the Alani AI tab on the quick menu */
.card-parking { position: fixed; left: -10000px; top: 0; width: 360px; height: 340px; visibility: hidden; pointer-events: none; }
.card-island-body { position: relative; width: 100%; height: 100%; min-height: 60px; }
.card-island-body .cd-frame { display: block; width: 100%; height: 100%; border: 0; }
.card-island-body.stats { height: auto; overflow: auto; }
.card-island-body.stats .st { border: 0; background: none; }
.card-island-body.preview, .card-island-body.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; text-align: center; padding: 8px; }
.qe-kinds { display: flex; justify-content: center; }
.qe-types { display: flex; flex-wrap: wrap; gap: 6px; }
.qe-type { padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-2); color: var(--text); font: inherit; font-size: 0.85rem; cursor: pointer; }
.qe-type small { color: var(--muted); }
.qe-type.on { border-color: var(--orange); background: color-mix(in srgb, var(--orange) 22%, var(--surface-2)); font-weight: 700; }
.qe-type.on small { color: inherit; }

/* ---- resizable parts of the board (public/js/ai/panes.js): bars between the parts (wide), a handle under each part (tall), minimise / maximise from each bar */
.ai-pane { display: flex; flex-direction: column; }
.pane-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.ai-actions { padding: 0; gap: 0; overflow: hidden; min-height: 0; height: var(--actions-h, 118px); flex: none; }
.qa-row { flex: 1; min-height: 0; display: flex; align-items: stretch; gap: 8px; padding: 8px 10px; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x proximity; }
.pane-controls { display: inline-flex; align-items: center; }
.pane-controls .pc { width: 28px; height: 28px; }
.ai-pane .pc-unmin, .ai-pane .pc-unmax { display: none; }
.ai-pane[data-state="min"] .pc-min, .ai-pane[data-state="max"] .pc-min, .ai-pane[data-state="max"] .pc-max { display: none; }
.ai-pane[data-state="min"] .pc-unmin, .ai-pane[data-state="max"] .pc-unmax { display: grid; }
.ai-pane[data-state="min"] { flex: none !important; height: auto !important; min-height: 0 !important; }
.ai-pane[data-state="min"] .pane-body > :not(.ai-bar), .ai-pane[data-state="min"] .ai-grip { display: none; }
.ai-pane[data-state="max"] { position: absolute; inset: 10px; z-index: 2; height: auto !important; background: var(--surface); }
.ai-tab:not([data-pane-max=""]) .ai-chattoggle { display: none !important; }
.ai-split, .ai-grip, .ai-chatgrip { display: none; }
body.ai-resizing { user-select: none; -webkit-user-select: none; }
body.ai-resizing iframe { pointer-events: none; }
.ai-split { flex: none; position: relative; touch-action: none; }
.ai-split::after { content: ""; position: absolute; border-radius: 2px; background: var(--line); opacity: 0.35; transition: opacity 0.15s; }
.ai-split:hover::after, .ai-split.dragging::after, .ai-split:focus-visible::after { opacity: 1; background: var(--orange); }
.ai-split.split-col { cursor: col-resize; }
.ai-split.split-col::after { left: 4px; top: 30%; bottom: 30%; width: 2px; }
.ai-split.split-left, .ai-split.split-right { height: 10px; cursor: row-resize; }
.ai-split.split-left::after, .ai-split.split-right::after { top: 4px; left: 30%; right: 30%; height: 2px; }

/* wide screen */
.layout-h .ai-board { grid-template-columns: minmax(0, 1fr) 10px var(--right-w, 340px); gap: 0; }
.layout-h .ai-left, .layout-h .ai-right { gap: 0; }
.layout-h .ai-split { display: block; }
.layout-h .ai-split.split-col { width: 10px; }
.layout-h .ai-chatpane { flex: 0 0 var(--chat-h, 280px); min-height: 100px; }
.layout-h .ai-tab[data-pane-cards="min"] .ai-actions { flex: 1 1 auto; height: auto; }
.layout-h .ai-tab[data-pane-stats="min"] .ai-chatpane { flex: 1 1 auto; }
.layout-h .ai-tab:not([data-pane-max=""]) .ai-split, .layout-h .ai-tab[data-pane-cards="min"] .split-left, .layout-h .ai-tab[data-pane-actions="min"] .split-left, .layout-h .ai-tab[data-pane-stats="min"] .split-right { display: none; }

/* tall screen: the whole board scrolls; each part is as tall as its content unless a height was chosen */
.layout-v .ai-board { overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.layout-v .ai-pane { flex: none; }
.layout-v .ai-actions { order: 1; height: var(--v-actions, auto); min-height: 92px; }
.layout-v .ai-stats { order: 2; height: var(--v-stats, auto); max-height: none; min-height: 0; }
.layout-v .ai-cards { order: 3; height: var(--v-cards, auto); min-height: 150px; }
.layout-v .ai-pane:not([data-sized="1"]) .pane-body { flex: none; }
.layout-v .cd-grid, .layout-v .st-grid { overflow: visible; flex: none; }
.layout-v .ai-pane[data-sized="1"] { overflow: hidden; }
.layout-v .ai-pane[data-sized="1"] .cd-grid, .layout-v .ai-pane[data-sized="1"] .st-grid { overflow: auto; flex: 1; min-height: 0; }
.layout-v .ai-grip { display: block; flex: none; height: 18px; cursor: row-resize; touch-action: none; position: relative; }
.layout-v .ai-grip::after, .layout-v .ai-chatgrip::after { content: ""; position: absolute; left: 50%; top: 7px; width: 44px; height: 4px; margin-left: -22px; border-radius: 2px; background: var(--line); }
.layout-v .ai-grip:hover::after, .layout-v .ai-grip:focus-visible::after, .layout-v .ai-chatgrip:hover::after { background: var(--orange); }
.layout-v .ai-tab:not([data-pane-max=""]) .ai-board { overflow: hidden; }
.layout-v .ai-tab:not([data-pane-max=""]) .ai-pane:not([data-state="max"]):not(.ai-chatpane) { display: none; }
.layout-v .ai-pane[data-state="max"] { position: static; flex: 1; height: auto !important; min-height: 0; order: 0; }
.layout-v .ai-pane[data-state="max"] .pane-body { flex: 1; }
.layout-v .ai-pane[data-state="max"] .cd-grid, .layout-v .ai-pane[data-state="max"] .st-grid { overflow: auto; flex: 1; min-height: 0; }
.layout-v .ai-chatpane { top: auto; height: var(--v-chat-h, 60%); }
.layout-v .ai-tab[data-chat-vfull="1"] .ai-chatpane { top: 8px; height: auto; }
.layout-v .ai-chatgrip { display: block; flex: none; height: 18px; cursor: ns-resize; touch-action: none; position: relative; }
.layout-v .ai-tab .only-compact { display: grid; }
.layout-v .ai-tab[data-chat-vfull="1"] .only-compact, .layout-v .ai-tab:not([data-chat-vfull="1"]) .only-full { display: none; }
.layout-v .ai-stats:not([data-sized="1"]):not([data-state="max"]) .st-grid { max-height: 300px; overflow: auto; } /* (numbers: a few lines, then they scroll; drag the handle to show more) */

/* ---- connectors (public/js/connectorsWindow.js) */
.cn-card { padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--input); display: flex; flex-direction: column; gap: 8px; }
.cn-card.soon { opacity: 0.6; }
.cn-card.connected { border-color: var(--orange); }
.cn-card p { margin: 0; }
.cn-avatar { border-radius: 50%; object-fit: cover; background: var(--row-hover); }
.cn-state.connected { background: var(--orange); color: #fff; }
.cn-state.expired { background: #b3261e; color: #fff; }

/* ---- text size (public/js/textSize.js): six tiles and a sample that follows the one hovered */
.ts-picker { display: flex; flex-direction: column; gap: 10px; }
.ts-tiles { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; }
.ts-tile { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; min-height: 76px; padding: 6px 2px; border: 1px solid var(--line); border-radius: 12px; background: var(--input); color: var(--text); }
.ts-tile:hover, .ts-tile:focus-visible { border-color: var(--orange); }
.ts-tile.on { border-color: var(--orange); background: color-mix(in srgb, var(--orange) 16%, var(--input)); }
.ts-tile small { font-size: 11px; color: var(--muted); text-align: center; line-height: 1.1; }
.ts-aa { font-size: calc(22px * var(--ts, 1)); font-weight: 700; line-height: 1; }
.ts-preview { padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--input); min-height: 120px; }
.ts-sample { display: flex; flex-direction: column; gap: 0.4em; font-size: calc(16px * var(--ts, 1)); line-height: 1.35; transition: font-size 0.12s; }
.ts-sample .ts-title { font-size: 1.15em; }
.ts-sample .ts-line { margin: 0; }
.ts-sample .ts-row { display: flex; justify-content: space-between; gap: 1em; }
.ts-sample .ts-btn { align-self: flex-start; padding: 0.25em 0.9em; border-radius: 999px; background: var(--orange); color: #fff; font-size: 0.9em; }
.ts-caption { display: block; margin-top: 8px; }
@media (max-width: 520px) { .ts-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* ---- Alani AI settings > Board */
.bd-modes { display: grid; gap: 8px; }
.bd-mode { display: flex; flex-direction: column; gap: 2px; align-items: flex-start; text-align: left; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--input); color: var(--text); }
.bd-mode.on { border-color: var(--orange); background: color-mix(in srgb, var(--orange) 14%, var(--input)); }
.bd-times { display: flex; flex-wrap: wrap; gap: 6px; }
.ed-tools .segmented { flex-wrap: wrap; border-radius: 16px; }
.setting.column > div:first-child { flex: none; }
/* making a card by hand: the Cards guide and the import window */
.cg-actions { flex-wrap: wrap; }
.cg-section h4 { margin: 14px 0 6px; }
.cg-steps, .cg-bullets { margin: 0 0 6px; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; font-size: 0.9rem; }
.cg-code { margin: 0; padding: 10px 12px; max-height: 260px; overflow: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--input); font: 0.78rem/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre; user-select: text; }
.cg-source { border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; display: flex; flex-direction: column; gap: 6px; }
.cg-source summary { cursor: pointer; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.cg-shape { overflow-wrap: anywhere; user-select: text; }
.ci-text { width: 100%; min-height: 180px; resize: vertical; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--input); color: inherit; font: 0.8rem/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.ci-file { display: none; }
.ci-verdict p { margin: 0; font-weight: 600; }
.ci-ok { color: #2e9e5b; }
.ci-bad { color: #d64545; }
.ci-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; font-size: 0.86rem; }
.ci-list li { padding: 8px 10px; border-radius: 10px; border: 1px solid; overflow-wrap: anywhere; user-select: text; }
.ci-problem { border-color: color-mix(in srgb, #d64545 50%, var(--line)); background: color-mix(in srgb, #d64545 10%, var(--input)); }
.ci-warning { border-color: color-mix(in srgb, #d99a1c 55%, var(--line)); background: color-mix(in srgb, #d99a1c 12%, var(--input)); }
.ci-summary { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; }
.ci-preview-box { display: flex; flex-direction: column; gap: 6px; }
.ci-card { grid-column: auto; grid-row: auto; max-width: 100%; }

/* the language choice (public/js/languageCard.js): before the login, and under the login card */
.lang-card h1 { margin: 0; font-size: 1.35rem; }
.lang-card h1 + h1 { margin-top: -6px; font-size: 1.1rem; font-weight: 500; color: var(--muted); }
.lang-card h1 + h1 + h1, .lang-card h1 + h1 + h1 + h1 { margin-top: -10px; }
.lang-card p { margin: 0; }
.lang-globe { display: inline-flex; align-items: center; justify-content: center; width: 52px; height: 52px; border-radius: 50%; background: var(--accent, #d4793f); color: #fff; }
.lang-title { display: inline-flex; align-items: center; gap: 6px; }
.lang-link { display: inline-flex; align-items: center; gap: 4px; }
.lang-choices { display: flex; flex-direction: column; gap: 10px; width: 100%; }
.lang-choices .btn { display: flex; flex-direction: column; align-items: center; gap: 0; padding: 12px; }
.lang-choices .lang-name { font-size: 1.25rem; font-weight: 700; }
.lang-choices small { opacity: 0.75; }
.lang-link { align-self: center; margin-top: 4px; }

/* Settings as categories and sub-tabs (public/js/pages/settings.js, settingsData.js): a list with a tile icon for each category; open one and its sub-tabs are on top.
   Wide screens: the list on the left, the category on the right. Phones: the list is a page, a category opens over it. */
.set-body { display: flex; flex-direction: column; gap: 14px; margin-top: 12px; }
.layout-h .set-body { display: grid; grid-template-columns: minmax(230px, 300px) minmax(0, 1fr); align-items: start; gap: 18px; }
.set-list { display: flex; flex-direction: column; gap: 4px; }
.set-cat { display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 12px; border: 0; border-radius: 16px; background: var(--surface); color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.layout-h .set-cat { background: none; }
.set-cat:hover { background: var(--row-hover); }
.set-cat.on { background: var(--nav-active); }
.set-cat-text { display: flex; flex: 1; flex-direction: column; min-width: 0; gap: 1px; }
.set-cat-text small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.set-chevron { flex: none; color: var(--muted); }
.layout-h .set-chevron { display: none; }
.set-tile { display: grid; place-items: center; flex: none; width: 34px; height: 34px; border-radius: 10px; color: #fff; }
.set-tile.small { width: 22px; height: 22px; border-radius: 7px; }
.set-pane { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.set-pane-head { display: flex; align-items: center; gap: 10px; }
.set-pane-head h2 { margin: 0; font-size: 1.25rem; }
.layout-h .set-back { display: none; }
.set-tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; }
.set-tab { flex: none; padding: 7px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--muted); font: inherit; font-size: 0.88rem; cursor: pointer; }
.set-tab.on { border-color: var(--orange); background: color-mix(in srgb, var(--orange) 20%, var(--surface)); color: var(--text); font-weight: 700; }
.set-rows { display: flex; flex-direction: column; }
.set-results { display: flex; flex-direction: column; gap: 12px; }
.set-path { display: flex; align-items: center; gap: 8px; width: 100%; padding: 2px 0 8px; border: 0; background: none; color: var(--orange); font: inherit; font-weight: 700; text-align: left; cursor: pointer; }
.set-path span:nth-child(2) { flex: 1; }
.settings .lang-choices { flex-direction: row; flex-wrap: wrap; }
.settings .lang-choices .btn { flex: 1 1 40%; }
.lang-beta { font-weight: 700; color: var(--warn, #c77b00); opacity: 1; }
.btn.primary .lang-beta { color: inherit; }
/* a phone: the list or the open category, one at a time */
.layout-v .set-body[data-open="1"] .set-list { display: none; }
.layout-v .set-body:not([data-open="1"]) .set-pane { display: none; }

/* plan lines and the upgrade bubble: the app's own icons instead of emoji */
.plan-line { display: flex; align-items: flex-start; gap: 8px; }
.plan-ico { flex: none; margin-top: 2px; color: var(--orange); }
.plan-flag { display: inline-flex; align-items: center; gap: 5px; }
.upsell .plan-ico { margin-top: 0; align-self: center; }
.set-about { margin: 2px 4px 10px; }
.cn-line { flex-wrap: wrap; row-gap: 6px; }
.cn-line .cn-name { flex: 1 1 100%; }

/* the Calendar island, and the tags of events (islands/calendar.js, eventChips.js) */
.island.slate { --head: #2a2d4f; }
/* the logo in front of a connector (connectorLogo.js): on a light chip so every brand colour shows in both themes */
.cn-title { display: inline-flex; align-items: center; gap: 10px; min-width: 0; }
.cn-logo { display: inline-grid; place-items: center; flex: none; border-radius: 8px; background: #fff; color: #444; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.12); }
.cn-logo img { display: block; }
/* the Sync island (Trakt and MyAnimeList: islands/sync.js, syncWindow.js) */
.island.plum { --head: #5a2d57; }
.crypto { display: flex; flex-direction: column; gap: 4px; padding: 6px 4px; cursor: pointer; text-align: left; } /* the Crypto island: the coin, the range chips, the price, the change (green up, red down) and an optional small graph */
.crypto:focus-visible { outline: 2px solid var(--accent, #ff8a3d); outline-offset: 2px; border-radius: 10px; }
.crypto-top { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.crypto-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.crypto-ranges { display: flex; gap: 2px; margin-left: auto; }
.crypto-ranges button { border: 0; background: rgba(255, 255, 255, 0.08); color: inherit; font-size: 0.72rem; padding: 2px 7px; border-radius: 999px; cursor: pointer; }
.crypto-ranges button.on { background: var(--accent, #ff8a3d); color: #111; font-weight: 700; }
.crypto-price { font-size: 1.7rem; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.crypto-change { font-weight: 700; font-variant-numeric: tabular-nums; }
.crypto .up, .crypto-row-change.up { color: #2dd36f; }
.crypto .down, .crypto-row-change.down { color: #ff5c5c; }
.crypto-graph { width: 100%; height: 46px; margin-top: 2px; }
.crypto-graph path { stroke: currentColor; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.crypto-graph.up { color: #2dd36f; }
.crypto-graph.down { color: #ff5c5c; }
.crypto-graph.none { color: #9aa0a6; }
.crypto-results { display: flex; flex-direction: column; gap: 2px; max-height: 260px; overflow: auto; }
.crypto-row { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: center; text-align: left; padding: 7px 8px; border: 0; border-radius: 10px; background: rgba(255, 255, 255, 0.05); color: inherit; cursor: pointer; }
.crypto-row:hover { background: rgba(255, 255, 255, 0.12); }
.crypto-row-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crypto-row-price, .crypto-row-change { font-variant-numeric: tabular-nums; font-size: 0.9em; }
.otd-note { padding: 6px 2px; } /* the On this day island: a date line, then events (year + what happened), each a link to Wikipedia */
.otd-date { margin: 0 0 4px; }
.otd { display: flex; align-items: flex-start; gap: 10px; text-align: left; text-decoration: none; color: inherit; }
.otd-year { flex: none; min-width: 44px; font-variant-numeric: tabular-nums; color: var(--accent, #ff8a3d); }
.otd-text { min-width: 0; overflow-wrap: anywhere; line-height: 1.35; }
.sync-row { display: flex; align-items: center; gap: 10px; text-align: left; }
.sync-row .item-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.sync-row .item-text b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sync-sub { overflow-wrap: anywhere; }
.sync-poster { flex: none; width: 30px; height: 42px; border-radius: 5px; object-fit: cover; background: rgba(255, 255, 255, 0.08); }
.sync-note { padding: 6px 2px; }
.sync-progress { gap: 4px; padding: 4px 2px; }
.sync-bar { height: 8px; border-radius: 999px; background: rgba(255, 255, 255, 0.14); overflow: hidden; }
.sync-bar > i { display: block; height: 100%; border-radius: 999px; background: var(--orange, #ff8a3d); transition: width 0.4s ease; }
.sync-error { color: #ff8a80; margin: 0; }
.sync-unmatched-line .item-meta { color: var(--accent, #ff8a3d); font-weight: 700; }
.sync-window .sync-setting { gap: 2px; }
.sync-window .sync-unmatched { padding: 8px 10px; border: 1px solid var(--line); border-radius: 12px; }
.sync-window .sync-unmatched input { flex: 1; min-width: 0; }
.calendar { padding: 4px 6px 8px; container-type: inline-size; }
.cal-nav { display: flex; align-items: center; gap: 2px; margin-bottom: 4px; }
.cal-title { flex: 1; min-width: 0; padding: 4px 2px; border: 0; background: none; color: var(--text); font-weight: 700; font-size: 0.92rem; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-head, .cal-weekrow { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; }
.cal-head span { padding: 2px 0; color: var(--muted); font-size: 0.7rem; text-align: center; }
.cal-weekrow { margin-bottom: 2px; }
.cal-cell { display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 44px; padding: 3px 1px 2px; border: 1px solid transparent; border-radius: 8px; background: rgba(255, 255, 255, 0.05); color: var(--text); }
[data-theme="light"] .cal-cell { background: rgba(0, 0, 0, 0.04); }
.cal-cell:hover { background: var(--row-hover); }
.cal-cell.out { opacity: 0.4; }
.cal-cell.today { border-color: var(--orange); }
.cal-cell.open { background: var(--nav-active); border-color: var(--text); }
.cal-day { font-size: 0.72rem; line-height: 1; }
.cal-cell.today .cal-day { font-weight: 800; color: var(--orange); }
.cal-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px; }
.tag-chip { --chip: #8a8a8a; display: inline-grid; place-items: center; min-width: 14px; height: 14px; padding: 0 3px; border-radius: 999px; background: var(--chip); color: #111; font-size: 0.62rem; font-weight: 800; line-height: 1; }
.tag-chip.k-top { --chip: #f5b301; border-radius: 4px; box-shadow: 0 0 0 1px #111 inset; }
.tag-chip.k-remind { background: transparent; color: var(--text); box-shadow: 0 0 0 1.5px var(--text) inset; }
.tag-chip.k-none { --chip: #8a8a8a; opacity: 0.8; }
@container (min-width: 330px) { .cal-cell { min-height: 56px; } .tag-chip { min-width: 18px; height: 18px; font-size: 0.72rem; } .cal-day { font-size: 0.82rem; } }
.cal-week-list { display: flex; flex-direction: column; gap: 2px; }
.cal-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 10px; border: 1px solid transparent; border-radius: 10px; background: rgba(255, 255, 255, 0.05); color: var(--text); text-align: left; }
[data-theme="light"] .cal-row { background: rgba(0, 0, 0, 0.04); }
.cal-row.today { border-color: var(--orange); }
.cal-row-name { font-size: 0.9rem; }
.cal-when { flex: none; min-width: 3.4em; color: var(--muted); font-size: 0.78rem; font-variant-numeric: tabular-nums; }
.item.cal-event { display: flex; align-items: center; gap: 6px; padding: 5px 8px; }
.ev-marks { display: inline-flex; align-items: center; gap: 4px; flex: none; }
.ev-dot { --chip: #8a8a8a; display: inline-block; flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--chip); }
.ev-dot.big { width: 18px; height: 18px; }
/* the window of one event (eventDetail.js) */
.ev-detail { gap: 14px; }
.ev-detail-title { margin: 0; font-size: 1.25rem; overflow-wrap: anywhere; }
.ev-detail-row { display: flex; gap: 12px; align-items: baseline; }
.ev-detail-label { flex: none; min-width: 64px; color: var(--muted); font-size: 0.85rem; }
.ev-detail-value { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; min-width: 0; overflow-wrap: anywhere; }
.ev-detail-tag { display: inline-flex; align-items: center; gap: 6px; }
.ev-detail-note { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.ev-note { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.ev-note a { text-decoration: underline; }
.ev-mark { display: inline-flex; color: var(--muted); }
.ev-mark.top { color: #f5b301; }
.event-filter h4 { margin: 8px 0 2px; }
.filter-label { display: inline-flex; align-items: center; gap: 8px; }
.colour-names { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.colour-name { display: flex; align-items: center; gap: 8px; }
.colour-name input { flex: 1; min-width: 0; }
.cal-link { display: flex; align-items: center; gap: 4px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.event-timing { margin-top: 12px; }

/* Alani AI asks once for a whole list (ai/batchDialog.js) */
.batch-list { display: flex; flex-direction: column; gap: 2px; max-height: calc(50dvh / var(--ui-scale, 1)); overflow: auto; }
.batch-row { display: flex; align-items: flex-start; gap: 10px; padding: 8px 6px; border-radius: 10px; cursor: pointer; }
.batch-row:hover { background: var(--row-hover); }
.batch-row input { flex: none; width: 20px; height: 20px; margin-top: 1px; accent-color: var(--orange); }
.batch-row.off .batch-text { opacity: 0.45; text-decoration: line-through; }
.batch-text { min-width: 0; overflow-wrap: anywhere; font-size: 0.92rem; }

/* the Calendar's list of days (each with its events' titles) and the window of a day over the calendar */
.calendar { position: relative; }
.calendar.has-day { min-height: 300px; }
.cal-row { flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 0; padding: 4px 4px 6px; }
.cal-row-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; padding: 3px 6px; border: 0; border-radius: 8px; background: none; color: var(--text); text-align: left; }
.cal-row-head:hover { background: var(--row-hover); }
.cal-ev-title { display: flex; align-items: center; gap: 6px; width: 100%; padding: 3px 6px 3px 14px; border: 0; border-radius: 8px; background: none; color: var(--text); text-align: left; font-size: 0.86rem; }
.cal-ev-title:hover { background: var(--row-hover); }
.cal-ev-title.more { color: var(--muted); }
.cal-ev-title.is-over { opacity: 0.55; }
.cal-ev-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-scrim { position: absolute; inset: 0; z-index: 2; border-radius: 10px; background: rgba(0, 0, 0, 0.58); animation: cal-fade 0.12s ease-out; }
[data-theme="light"] .cal-scrim { background: rgba(0, 0, 0, 0.35); }
.cal-daywin { position: absolute; inset: 8px; z-index: 3; display: flex; flex-direction: column; gap: 2px; padding: 4px; overflow: auto; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55); outline: none; animation: cal-pop 0.14s ease-out; }
.cal-daywin-head { display: flex; align-items: center; justify-content: space-between; padding: 2px 6px 2px 10px; }
.cal-daywin-head .icon-btn { width: 30px; height: 30px; }
@keyframes cal-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes cal-pop { from { opacity: 0; transform: scale(0.97); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .cal-scrim, .cal-daywin { animation: none; } }
.cn-card.cn-off { opacity: 0.6; }

/* the phone app: a phone calendar's colour in the calendar picker (phone/calendarPicker.js) */
.cal-dot { flex: none; width: 12px; height: 12px; border-radius: 50%; }
.cal-picker select { width: 100%; }

/* the Calls island (islands/calls.js): the call history scrolls after about 5 rows; a missed call is red; the buttons stack on the right */
.island.rose { --head: #b0315f; }
.calls { display: flex; flex-direction: column; gap: 8px; padding: 2px 6px 8px; }
.calls-list { display: flex; flex-direction: column; gap: 2px; } /* (no scroll of its own: the island scrolls, once, when it is focused) */
.calls-row { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 6px 4px; border-radius: 10px; }
.calls-row:hover { background: var(--row-hover); }
.calls-type { display: grid; place-items: center; color: var(--muted); }
.calls-text { display: flex; flex-direction: column; min-width: 0; }
.calls-who { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; overflow-wrap: anywhere; }
.calls-when { color: var(--muted); font-size: 0.8rem; }
.calls-row.missed .calls-type, .calls-row.missed .calls-who { color: #ff5a4f; }
.calls-row.is-new { background: rgba(255, 90, 79, 0.12); }
.calls-actions { display: flex; flex-direction: column; gap: 4px; }
.calls-btn { width: 34px; height: 34px; }
.calls-missed { border-top: 1px solid var(--line); padding-top: 6px; display: flex; flex-direction: column; gap: 2px; }
.calls-part { font-size: 0.8rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.calls-from { display: block; text-align: right; }
.calls-empty { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
/* the Health island (islands/health.js) */
.health-island { display: flex; flex-direction: column; gap: 12px; padding: 6px 14px 10px; }
.hl-part { display: flex; flex-direction: column; gap: 6px; }
.hl-big { font-size: 1.3rem; font-weight: 700; }
.hl-bar { height: 10px; border-radius: 5px; background: var(--input); overflow: hidden; }
.hl-fill { height: 100%; border-radius: 5px; background: #e0457b; }
.hl-graph { width: 100%; height: 90px; }
.hl-line { fill: none; stroke: #e0457b; stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.hl-dot { fill: #e0457b; }
.hl-list { display: flex; flex-direction: column; gap: 4px; max-height: 170px; overflow-y: auto; }
.hl-row { display: flex; flex-direction: column; min-width: 0; }
.hl-row b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hl-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 8px; }
.hl-count { white-space: nowrap; }

/* ---- editing the quick menu or the board: an island or card that is under the mouse, or under a finger or a pressed button, holds still so it is easy to grab (holdStill.js) */
.island.edit.qe-held, .cd-grid.editing .cd.qe-held, .st-grid.editing .st.qe-held { animation: none; }
@media (hover: hover) { .island.edit:hover, .cd-grid.editing .cd:hover, .st-grid.editing .st:hover { animation: none; } }

/* ---- scrolling inside an island or card: only once it is focused by a tap (focusScroll.js). Until then the wheel or a swipe over it scrolls the page, and it shows its top. */
.island:not(.edit):not([data-focus="on"]):not(:focus-within) .island-body { overflow: hidden; }
.st-grid:not(.editing) .st.sized:not([data-focus="on"]):not(:focus-within) { overflow: hidden; }
.cd-frame[data-scrollable="1"] { pointer-events: none; }
.ai-tab[data-layout="pager"] .cd-frame[data-scrollable="1"] { pointer-events: auto; } /* (the pager is the one layout where a card scrolls without a tap first) */
[data-focus="on"] .cd-frame { pointer-events: auto; }
/* A card that scrolls, until it is focused, has a clear sheet over it that belongs to the PAGE: a finger that starts on it scrolls the page itself, smoothly, with its momentum. (A finger that
   starts inside a frame is handed over to the page only after the frame refuses it, and on an iPad that handing over is jerky and loses the momentum.) A tap on it focuses (focusScroll.js). */
.ai-tab:not([data-layout="pager"]) .cd:not([data-focus="on"]):has(> .cd-frame[data-scrollable="1"])::after,
.island:not([data-focus="on"]) .card-island-body:has(> .cd-frame[data-scrollable="1"])::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.cd:not([data-focus="on"]):has(> .cd-frame[data-scrollable="1"]) > .cd-menu { z-index: 2; }
.islands.packed:not(.still) > .island[data-focus="on"] { transition: top 0.28s cubic-bezier(0.2, 0.7, 0.2, 1), left 0.28s cubic-bezier(0.2, 0.7, 0.2, 1), scale 0.18s ease, box-shadow 0.18s ease; }
[data-focus="on"] { z-index: 40; scale: 1.03; box-shadow: 0 16px 44px rgba(0, 0, 0, 0.5); transition: scale 0.18s ease, box-shadow 0.18s ease; }
.focus-dim { position: fixed; inset: 0; z-index: 39; pointer-events: none; background: rgba(0, 0, 0, 0.32); animation: sf-in 0.18s ease-out; } /* (a hole where the focused one is: focusScroll.js holeClip) */
@keyframes sf-in { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { [data-focus="on"] { transition: none; } .focus-dim { animation: none; } }

/* ---- the Alani AI tab waits here, hidden, while another page is shown, so its cards do not load again (keepAlive.js) */
.ai-parking { position: fixed; left: -10000px; top: 0; width: calc(100vw / var(--ui-scale, 1)); height: calc(100dvh / var(--ui-scale, 1)); display: grid; visibility: hidden; pointer-events: none; }

/* the phone layout: the bell, the pencil and the arrow that hides the player sit in their own row above the player, on round dark buttons (they used to lie over the orange player, where they could hardly be seen) */
.layout-v .music { padding-top: 52px; }
.layout-v.music-hidden .music { min-height: 52px; padding-top: 0; }
.layout-v .music .notify-music, .layout-v .music .customize-music, .layout-v .music .hide-music { top: 6px; width: 38px; height: 38px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35); }
.layout-v .music .notify-music { left: 8px; }
.layout-v .music .notify-music + .customize-music { left: 54px; }
.search-music { position: absolute; top: 0; left: 46px; z-index: 2; color: #fff; }
.notify-music + .customize-music + .search-music { left: 92px; }
.music-hidden .search-music { color: var(--text); }
.layout-v .music .search-music { top: 6px; width: 38px; height: 38px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25); }
.layout-v .music .customize-music + .search-music { left: 100px; }
.layout-v .music .notify-music + .customize-music + .search-music { left: 100px; }
.layout-v .music .hide-music { right: 8px; }
.layout-v .music .notify-music.alert { border-color: #d11414; }
.layout-v .music .notify-count { top: -4px; right: -4px; }

/* the Routines tab of the Alani AI settings: a list in groups, each routine a row with its switch; a page for each */
.routine-group { display: flex; flex-direction: column; gap: 8px; }
.routine-group > h4 { margin: 10px 0 0; font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.routine-list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; background: var(--input); }
.routine-row { display: flex; align-items: center; gap: 10px; padding: 4px 14px 4px 4px; border-bottom: 1px solid var(--line); }
.routine-row:last-child { border-bottom: 0; }
.routine-open { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 10px; border: 0; background: none; color: inherit; text-align: left; font: inherit; cursor: pointer; border-radius: 12px; }
.routine-open:hover { background: var(--row-hover); }
.routine-ico { flex: none; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: rgba(212, 119, 63, 0.18); color: var(--orange); }
.routine-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.routine-text b, .routine-text small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.routine-go { flex: none; color: var(--muted); }
.routine-repeat .segmented { flex-wrap: wrap; }
.routine-result { padding: 10px 12px; border: 1px dashed var(--line); border-radius: 12px; }
.routine-result p { margin: 4px 0 0; white-space: pre-line; overflow-wrap: anywhere; }

/* choosing a model: a list from the smartest to the fastest, each with its company and a small tag */
.model-list { display: flex; flex-direction: column; gap: 6px; }
.model-row { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--input); color: inherit; font: inherit; text-align: left; cursor: pointer; }
.model-row:hover { border-color: var(--orange); }
.model-row.on { border-color: var(--orange); background: rgba(212, 119, 63, 0.16); }
.model-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.model-tag { flex: none; padding: 2px 9px; border-radius: 999px; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.02em; }
.model-tag.default { background: rgba(255, 255, 255, 0.14); color: var(--text); }
.model-tag.smarter { background: rgba(139, 140, 255, 0.28); color: #d8d9ff; }
.model-tag.faster { background: rgba(62, 207, 142, 0.26); color: #c5f5df; }
.model-check { flex: none; color: var(--orange); }
.vo-model { white-space: nowrap; }

/* small icon switches: a tap lights one (its own colour, a tick) or puts it out; for lists that are long but whose words are short (js/ui.js iconToggle) */
.itog-row { display: flex; flex-wrap: wrap; gap: 6px 8px; }
.feature-list.itog-row { flex-direction: row; justify-content: center; }
.itog { --c: var(--orange); display: flex; flex-direction: column; align-items: center; gap: 5px; width: 78px; padding: 6px 2px 4px; border: 0; border-radius: 16px; background: transparent; color: var(--muted); font: inherit; cursor: pointer; transition: transform 0.15s; }
.itog:hover { transform: translateY(-2px); } .itog:disabled { opacity: 0.4; cursor: default; }
.itog-ico { position: relative; display: grid; place-items: center; width: 48px; height: 48px; border: 2px solid var(--line); border-radius: 16px; background: var(--input); transition: background 0.2s, color 0.2s, border-color 0.2s, box-shadow 0.2s; }
.itog-tick { position: absolute; top: -6px; right: -6px; display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: var(--c); color: #fff; transform: scale(0); transition: transform 0.18s; }
.itog.on { color: var(--text); } .itog.on .itog-tick { transform: scale(1); }
.itog.on .itog-ico { border-color: var(--c); background: color-mix(in srgb, var(--c) 22%, var(--input)); color: var(--c); box-shadow: 0 4px 14px color-mix(in srgb, var(--c) 35%, transparent); }
.itog.on .itog-ico svg:first-child { animation: su-pop 0.3s; }
.itog-label { max-width: 100%; font-size: 0.74rem; line-height: 1.15; text-align: center; overflow-wrap: anywhere; }
@media (prefers-reduced-motion: reduce) { .itog.on .itog-ico svg:first-child { animation: none; } }

/* the Scale setting (scalePicker.js): a slider over a small picture of this screen */
.sc-picker { display: flex; flex-direction: column; gap: 10px; width: 100%; max-width: 460px; }
.sc-preview { position: relative; align-self: center; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); background: var(--bg); }
.sc-screen { position: relative; overflow: hidden; }
.sc-screen > div { position: absolute; }
.sc-nav { background: color-mix(in srgb, var(--surface) 80%, var(--line)); }
.sc-aside { background: color-mix(in srgb, var(--surface) 60%, transparent); }
.sc-island { border-radius: 5px; background: color-mix(in srgb, var(--surface) 82%, var(--text, #fff) 18%); border: 1px solid color-mix(in srgb, var(--line) 60%, var(--text, #fff) 40%); box-sizing: border-box; overflow: hidden; transition: all 0.12s; }
.sc-island i { display: block; border-radius: 3px; background: var(--c, var(--orange)); }
.sc-island i.line { background: color-mix(in srgb, var(--text, #fff) 30%, transparent); }
.sc-over { position: absolute; left: 8px; right: 8px; bottom: 8px; display: flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; background: color-mix(in srgb, var(--bg) 78%, transparent); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); border: 1px solid var(--line); }
.sc-slider { flex: 1; min-width: 0; accent-color: var(--orange); }
.sc-small { font-size: 12px; font-weight: 700; }
.sc-big { font-size: 20px; font-weight: 700; }
.sc-row { align-items: center; gap: 10px; flex-wrap: wrap; }
.sc-caption { flex: 1; min-width: 140px; }

/* Settings > This computer (desktopSettings.js) */
.dk-level { align-items: center; gap: 10px; min-width: 220px; }
.dk-level input[type="range"] { flex: 1; accent-color: var(--orange); }
.dk-pct { min-width: 3.2em; text-align: right; }
.dk-device select, .dk-sound select { max-width: 260px; }
.dk-stack, .dk-sound { display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.setting.column .dk-sound { align-items: stretch; max-width: 460px; }
.dk-mic { align-items: center; gap: 10px; }
.dk-meter { position: relative; width: 140px; height: 8px; border-radius: 99px; background: var(--line); overflow: hidden; }
.dk-meter-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0%; border-radius: inherit; background: var(--orange); transition: width 0.05s linear; }
.dk-path { word-break: break-all; }

/* the Home page's long lists: the Events card shows about six rows, the rest scrolls inside it */
.items.capped { max-height: calc(var(--cap-rows, 6) * 2.4rem); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.cap-note { margin: 4px 2px 0; }

/* the phone's calendars, folded to one line */
.cal-expand > summary { display: flex; align-items: center; gap: 6px; padding: 6px 0; cursor: pointer; list-style: none; }
.cal-expand > summary::-webkit-details-marker { display: none; }
.cal-expand > summary .chev { flex: none; transition: transform 0.15s; }
.cal-expand[open] > summary .chev { transform: rotate(90deg); }
.cal-expand-body { padding: 4px 0 2px; }

/* the habit heatmap in a tracker's history */
.heat { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border-radius: 14px; background: var(--row-hover); }
.heat-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.heat-legend { display: flex; align-items: center; gap: 3px; }
.heat-scroll { overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.heat-months { display: grid; grid-template-columns: repeat(var(--weeks, 53), 13px); gap: 3px; height: 16px; font-size: 0.68rem; color: var(--muted); }
.heat-months span { white-space: nowrap; }
.heat-grid { display: grid; grid-template-columns: repeat(var(--weeks, 53), 13px); gap: 3px; }
.heat-col { display: grid; grid-template-rows: repeat(7, 13px); gap: 3px; }
.heat-cell { display: block; width: 13px; height: 13px; border-radius: 3px; background: color-mix(in srgb, var(--text) 9%, transparent); }
.heat-cell.l1 { background: color-mix(in srgb, var(--orange) 28%, transparent); }
.heat-cell.l2 { background: color-mix(in srgb, var(--orange) 50%, transparent); }
.heat-cell.l3 { background: color-mix(in srgb, var(--orange) 74%, transparent); }
.heat-cell.l4 { background: var(--orange); }
.heat-cell.future { background: transparent; }
.heat-legend .heat-cell { width: 11px; height: 11px; }

/* the public holidays layer of the Calendar: a small flag on the day, the name in the list and in the day's window */
.cal-hol { display: inline-flex; margin-left: 3px; color: var(--orange); vertical-align: -1px; }
.cal-cell.holiday .cal-day { color: var(--orange); }
.cal-hol-line { display: flex; align-items: center; gap: 6px; padding: 2px 6px 2px 14px; font-size: 0.78rem; color: var(--orange); }
.cal-hol-line.big { padding: 6px 4px; font-size: 0.86rem; }
.hol-chip { display: inline-flex; align-items: center; gap: 2px; }
.hol-chip .icon-btn.tiny { padding: 0 2px; min-width: 0; min-height: 0; }

/* search across everything (search.js) and the command palette (palette.js) */
.search-window { min-width: 0; }
.search-window .search-box { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 12px; background: var(--row-hover); }
.search-window .search-input { flex: 1; min-width: 0; border: 0; background: none; color: inherit; font: inherit; outline: none; }
.search-results { display: flex; flex-direction: column; gap: 10px; max-height: calc(60vh / var(--ui-scale, 1)); overflow-y: auto; overscroll-behavior: contain; }
.search-head { display: flex; align-items: center; gap: 6px; margin: 0 0 4px; font-size: 0.82rem; text-transform: none; }
.search-head .muted { margin-left: auto; }
.search-item { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 10px; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.search-item:hover, .search-item:focus-visible { background: var(--row-hover); }
.search-title { min-width: 0; overflow-wrap: anywhere; }
.search-note { flex: none; max-width: 50%; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-more { align-self: flex-start; margin-top: 2px; }
.palette-window { min-width: 0; }
.palette-input { width: 100%; box-sizing: border-box; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--row-hover); color: inherit; font: inherit; outline: none; }
.palette-input:focus { border-color: var(--orange); }
.palette-list { display: flex; flex-direction: column; gap: 2px; max-height: calc(50vh / var(--ui-scale, 1)); overflow-y: auto; overscroll-behavior: contain; }
.palette-group { margin: 8px 6px 2px; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.palette-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; border-radius: 10px; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.palette-item.active { background: var(--nav-active); }
.palette-foot { text-align: center; }

/* Undo in a message, and Settings > Trash */
.toast-action { margin-left: 12px; padding: 2px 10px; border: 1px solid currentColor; border-radius: 999px; background: none; color: inherit; font: inherit; font-weight: 700; cursor: pointer; }
.trash-list { display: flex; flex-direction: column; gap: 6px; }
.trash-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; background: var(--row-hover); }
.trash-label { overflow-wrap: anywhere; }

/* My files (filesBrowser.js): the path bar, the folder tiles, the choices */
.files-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.crumb { padding: 4px 8px; border: 0; border-radius: 8px; background: none; color: inherit; font: inherit; cursor: pointer; }
.crumb:hover { background: var(--row-hover); }
.crumb.here { font-weight: 700; cursor: default; }
.folder-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.folder-tile { display: flex; align-items: center; gap: 4px; padding: 6px 8px; border-radius: 12px; background: var(--row-hover); }
.folder-tile.new { justify-content: center; gap: 6px; border: 1px dashed var(--line); background: none; color: var(--muted); font: inherit; cursor: pointer; padding: 12px 8px; }
.folder-open { display: flex; flex: 1; min-width: 0; flex-direction: column; align-items: flex-start; gap: 2px; padding: 4px; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.folder-name { overflow-wrap: anywhere; font-weight: 600; }
.folder-lock { color: var(--muted); flex: none; }
.folder-choices { display: flex; flex-direction: column; gap: 2px; max-height: calc(50vh / var(--ui-scale, 1)); overflow-y: auto; }
.folder-choice { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 12px; border: 0; border-radius: 10px; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.folder-choice:hover { background: var(--row-hover); }
.file-row { align-items: center; }
.file-thumb { position: relative; flex: none; width: 100%; aspect-ratio: 1; overflow: hidden; border-radius: 10px; background: #000; }
.file-thumb.small { width: 44px; height: 34px; aspect-ratio: auto; border-radius: 6px; }
.file-thumb .sc-thumb { width: 100%; height: 100%; object-fit: cover; }
.file-thumb.small .sc-thumb { object-fit: contain; }
.files-list { display: flex; flex-direction: column; gap: 4px; }
.files-list .sc-row { padding: 4px 8px; border-bottom-width: 0; }
.files-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.files-grid.large { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.file-tile { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.file-cap { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.78rem; color: var(--muted); }
.file-tick { position: absolute; top: 4px; left: 4px; padding: 2px; border-radius: 6px; background: rgba(0, 0, 0, 0.5); line-height: 0; }
.files-fold > summary { cursor: pointer; padding: 6px 2px; }
.files-fold[open] > summary { margin-bottom: 6px; }
.file-name { min-width: 0; width: 100%; border: 0; background: none; color: inherit; font: inherit; overflow-wrap: anywhere; }

/* pictures and GIFs Alani sends (chatView.js imageElement), and in a routine's result */
.ai-image { margin: 6px 0; max-width: 100%; }
.ai-image img { display: block; max-width: min(100%, 420px); max-height: 360px; border-radius: 14px; background: var(--row-hover); }
.ai-image figcaption { margin-top: 4px; }
.routine-text { overflow-wrap: anywhere; }

/* Accounts on this device (accountsCard.js) */
.account-list { display: flex; flex-direction: column; gap: 6px; }
.account-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; background: var(--row-hover); }
.account-row.current { outline: 1px solid var(--orange); }
.account-text { min-width: 0; display: flex; flex-direction: column; overflow-wrap: anywhere; }
.avatar.small { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex: none; }
.avatar.blank.small { display: grid; place-items: center; background: var(--surface-2); }

/* the phone's Settings | Automation title (shell.js settingsHead): two big words, the open one bright */
.page-head.head-switch { gap: 18px; align-items: baseline; }
.head-switch button { padding: 0; border: 0; background: none; color: var(--muted); font: inherit; font-size: 1.9rem; font-weight: 800; line-height: 1.2; cursor: pointer; }
.head-switch button.on { color: var(--text); }
.head-switch button:not(.on) { font-size: 1.35rem; }

/* the Automation page (pages/automation.js) */
.auto-tabs { display: flex; align-items: center; gap: 8px; margin: 4px 0 14px; }
.auto-tab { border: 1px solid var(--line); background: var(--input); color: var(--text); border-radius: 999px; padding: 8px 16px; font-weight: 700; cursor: pointer; }
.auto-tab.small { padding: 4px 10px; font-size: 0.8rem; font-weight: 600; color: var(--muted); }
.auto-tab.on { background: var(--orange); border-color: var(--orange); color: #fff; }
.auto-rows { display: flex; flex-direction: column; gap: 6px; }
.auto-row { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--input); color: var(--text); text-align: left; cursor: pointer; }
.auto-row.off { opacity: 0.6; }
.auto-main { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.auto-main b, .auto-main small { overflow-wrap: anywhere; }
.auto-meta { flex: none; max-width: 40%; text-align: right; }
.auto-section > p.muted { margin: 0 0 10px; }
.auto-depth { font-size: 0.85rem; }
.auto-depth h2 { font-size: 1rem; margin: 18px 0 6px; }
.auto-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.auto-table th, .auto-table td { padding: 4px 8px 4px 0; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; overflow-wrap: anywhere; }
.auto-table th { color: var(--muted); font-weight: 600; }
.auto-table tr.off td { opacity: 0.55; }
.auto-table code { font-size: 0.8rem; }
.auto-err { color: #e05a5a; }

/* Settings > Devices (deviceSettings.js) */
.dev-list { display: flex; flex-direction: column; gap: 6px; width: 100%; }
.dev-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 14px; background: var(--input); }
.dev-row.idle { opacity: 0.7; }
.dev-icon { flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 12px; background: var(--surface-2); }
.dev-main { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.dev-main b, .dev-main small { overflow-wrap: anywhere; }
.dev-tag { margin-left: 8px; padding: 1px 8px; border-radius: 999px; background: var(--orange); color: #fff; font-size: 0.72rem; font-weight: 700; vertical-align: middle; }

/* the automation builder, as a sentence (automationBuilder.js) */
.ab-top { gap: 10px; align-items: center; margin-bottom: 6px; }
.ab-name { flex: 1; min-width: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--input); color: var(--text); font: inherit; font-weight: 700; }
.ab-lines { display: flex; flex-direction: column; }
.ab-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 0; border-top: 1px dashed var(--line); font-size: 1.05rem; }
.ab-line:first-child { border-top: 0; }
.ab-lead { display: inline-grid; place-items: center; min-width: 70px; padding: 3px 10px; border-radius: 10px; color: #fff; font-weight: 800; font-size: 0.8rem; letter-spacing: 0.05em; }
.l-when { background: #e8833a; } .l-if { background: #4f8ff7; } .l-do, .l-also { background: #3fbf7f; } .l-else { background: #e05a6a; }
.l-also { min-width: 0; }
.ab-blank { display: inline-flex; align-items: center; gap: 4px; padding: 4px 12px; border: 2px solid var(--line); border-radius: 999px; background: var(--input); color: var(--text); font: inherit; font-size: 0.95rem; font-weight: 700; cursor: pointer; overflow-wrap: anywhere; max-width: 100%; }
.ab-blank:hover, .ab-blank.on { border-color: var(--orange); }
.ab-blank.on { background: color-mix(in srgb, var(--orange) 16%, var(--input)); }
.ab-blank.empty { border-style: dashed; color: var(--muted); }
.ab-join { display: inline-flex; border: 2px solid #8a5cd6; border-radius: 999px; overflow: hidden; }
.ab-join button { border: 0; background: none; color: var(--text); padding: 3px 9px; font: inherit; font-size: 0.78rem; font-weight: 800; cursor: pointer; }
.ab-join button.on { background: #8a5cd6; color: #fff; }
.ab-remove { margin-left: auto; }
.ab-not { padding: 3px 9px; border: 2px dashed #8a5cd6; border-radius: 999px; background: none; color: var(--muted); font: inherit; font-size: 0.78rem; font-weight: 800; cursor: pointer; }
.ab-not.on { border-style: solid; background: #8a5cd6; color: #fff; }
.ab-choices { margin: 2px 0 10px; padding: 12px; border-radius: 16px; background: var(--surface-2); }
.ab-choices input[type="text"], .ab-choices input[type="time"] { padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--input); color: var(--text); font: inherit; }
.ab-choices input[type="text"] { width: 100%; }
.ab-adds { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 12px; }
.ab-add { padding: 6px 12px; border: 1px dashed var(--line); border-radius: 999px; background: none; color: var(--muted); font: inherit; font-size: 0.9rem; cursor: pointer; }
.ab-add:hover { color: var(--text); border-color: var(--orange); }
.ab-lines > .ab-adds { margin: 2px 0 8px; align-items: center; }
.ab-add.j-if { border: 2px dashed #4f8ff7; color: var(--text); font-weight: 700; }
.ab-add.j-join { border: 2px solid #8a5cd6; color: var(--text); font-weight: 800; font-size: 0.82rem; }
.ab-add.j-join:hover { background: #8a5cd6; color: #fff; }
.ab-add.j-then { border: 2px dashed #3fbf7f; color: var(--text); font-weight: 700; }
.ab-add.j-else { border: 2px dashed #e05a6a; color: var(--text); font-weight: 700; }
.ab-legend { flex-basis: 100%; margin: 0; }
.ab-box { padding: 12px 14px; border-radius: 14px; background: var(--input); }
.ab-summary { margin: 4px 0 0; overflow-wrap: anywhere; }
.ab-foot { gap: 8px; align-items: center; margin-top: 12px; flex-wrap: wrap; }
.ab-hint { color: #e0a35a; }

/* the place picker (placeMap.js): OpenStreetMap tiles, the pin in the middle, the ring for the size */
.pm { display: flex; flex-direction: column; gap: 8px; }
.pm-search input { flex: 1; min-width: 0; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--input); color: var(--text); font: inherit; }
.pm-results { display: flex; flex-wrap: wrap; gap: 6px; }
.pm-map { position: relative; height: min(300px, calc(45dvh / var(--ui-scale, 1))); border-radius: 14px; overflow: hidden; background: #2b3a2f; touch-action: none; cursor: grab; outline: none; }
.pm-map.dragging { cursor: grabbing; }
.pm-map:focus-visible { box-shadow: 0 0 0 2px var(--orange); }
.pm-tiles { position: absolute; inset: 0; }
.pm-tile { position: absolute; width: 256px; height: 256px; user-select: none; -webkit-user-drag: none; pointer-events: none; }
.pm-ring { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); border: 2px solid var(--orange); border-radius: 50%; background: color-mix(in srgb, var(--orange) 18%, transparent); pointer-events: none; }
.pm-pin { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -100%); color: var(--orange); filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.6)); pointer-events: none; }
.pm-zoom { position: absolute; right: 8px; top: 8px; display: flex; flex-direction: column; gap: 4px; }
.pm-zoom .icon-btn { background: var(--surface); }
.pm-attr { position: absolute; right: 6px; bottom: 4px; padding: 1px 6px; border-radius: 6px; background: rgba(0, 0, 0, 0.55); color: #e8e8e8; font-size: 0.68rem; pointer-events: none; }
.pm-row { gap: 10px; align-items: center; }
.pm-row input[type="range"] { flex: 1; accent-color: var(--orange); }
.pm-row input[type="text"] { flex: 1; min-width: 0; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--input); color: var(--text); font: inherit; }
.pm-ring.rect { border-radius: 4px; }

/* A counter's history window (ai/counterHistoryWindow.js) */
.counter-graph { width: 100%; height: auto; display: block; }
.counter-graph .axis { stroke: var(--line); stroke-width: 1; }
.counter-graph .goal { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 4 4; }
.counter-graph .line { fill: none; stroke: var(--orange); stroke-width: 2; stroke-linejoin: round; }
.counter-graph .dot { fill: var(--text); }
.counter-graph .dot.now { fill: var(--orange); }
.counter-history .report-row { grid-template-columns: 150px 1fr auto; }
.counter-history .report-row.now { font-weight: 600; }
.counter-history .chip { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; border-radius: 12px; cursor: default; padding: 6px 12px; }
.counter-history .chip b { color: var(--text); font-size: 1rem; }

/* The automation page with the helper chat on its right (automationBuilder.js, automationHelper.js) */
.dialog-body:has(> .ab-split) { overflow: hidden; padding-bottom: 14px; }
.ab-split { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 18px; height: 100%; min-height: 0; }
.ab-main { min-width: 0; overflow: auto; padding-right: 4px; }
.ab-helper-toggle, .hp-back { display: none; }
.ab-helper { display: flex; flex-direction: column; gap: 8px; min-height: 0; padding: 12px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface-2); }
.hp-head { display: flex; align-items: center; gap: 8px; }
.hp-model { max-width: 190px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--input); color: var(--text); font: inherit; font-size: 0.85rem; }
.hp-log { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: 10px; padding: 2px; }
.hp-empty { display: flex; flex-direction: column; gap: 8px; }
.hp-examples { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.hp-examples .chip { text-align: left; border-radius: 14px; }
.hp-msg { display: flex; flex-direction: column; gap: 6px; max-width: 100%; }
.hp-msg.user { align-items: flex-end; }
.hp-bubble { padding: 8px 12px; border-radius: 14px; background: var(--input); white-space: pre-wrap; overflow-wrap: anywhere; font-size: 0.95rem; }
.hp-msg.user .hp-bubble { background: color-mix(in srgb, var(--orange) 22%, var(--input)); }
.hp-plan { display: flex; flex-direction: column; gap: 6px; padding: 10px; border: 1px dashed var(--line); border-radius: 14px; background: var(--surface); }
.hp-plan-head { display: flex; align-items: center; gap: 6px; }
.hp-item { display: flex; align-items: flex-start; gap: 8px; padding: 6px 0; border-top: 1px solid var(--line); font-size: 0.9rem; }
.hp-item:first-of-type { border-top: 0; }
.hp-item .grow { display: flex; flex-direction: column; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
.hp-error { color: #e05a6a; }
.hp-foot { display: flex; gap: 8px; align-items: flex-end; }
.hp-input { flex: 1; min-width: 0; resize: none; padding: 8px 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--input); color: var(--text); font: inherit; }
.hp-note { text-align: center; }
@media (max-width: 1100px) {
  .ab-split { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
  .ab-helper { display: none; }
  .ab-split.helper-open .ab-main { display: none; }
  .ab-split.helper-open .ab-helper { display: flex; }
  .ab-helper-toggle { display: inline-flex; align-items: center; gap: 4px; }
  .hp-back { display: inline-flex; }
}

.notify-row.group { display: flex; align-items: baseline; gap: 8px; margin-top: 10px; }
.ai-resend { align-self: flex-start; margin: 4px 0 8px; display: inline-flex; align-items: center; gap: 4px; }

.notifications-bar { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; margin-bottom: 6px; }
.notice-history { display: flex; flex-direction: column; gap: 6px; }
.notice-history .item.read { opacity: 0.7; }
.notice-history .notice-body { display: flex; flex-direction: column; gap: 4px; }

.off-row { display: flex; flex-direction: column; gap: 6px; padding: 4px 6px; }
.off-list { display: flex; flex-direction: column; gap: 4px; }
.off-item { display: flex; align-items: center; gap: 8px; justify-content: space-between; opacity: 0.8; }

.ai-auto { display: flex; flex-direction: column; gap: 2px; }
.ai-auto-tag { color: var(--muted); font-size: 0.72rem; letter-spacing: 0.04em; padding-left: 4px; }

/* modes: the bar (tall layout: top row, right in the middle; wide layout: the small one under the refresh button) and the list that opens from it */
.mode-bar { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 38px; padding: 0 14px; border: 0; border-radius: 19px; background: var(--mode, #2f8f5b); color: #fff; font-weight: 700; font-size: 0.82rem; cursor: pointer; transition: background 0.3s; }
.mode-bar.auto { box-shadow: 0 0 0 2px color-mix(in srgb, var(--mode) 40%, transparent); }
.layout-v .music .mode-bar { position: absolute; top: 6px; left: 50%; transform: translateX(-50%); z-index: 2; }
.mode-bar.compact { width: 44px; height: 44px; padding: 0; border-radius: 14px; margin-top: 8px; }
.mode-dot { display: inline-grid; place-items: center; width: 30px; height: 30px; flex: none; border-radius: 50%; background: var(--mode, #888); color: #fff; }
.mode-list { display: flex; flex-direction: column; gap: 4px; min-width: 260px; }
.mode-row, .mode-edit-row { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 12px; border: 1px solid transparent; background: transparent; color: inherit; text-align: left; }
.mode-row { cursor: pointer; }
.mode-row:hover, .mode-row.on { background: var(--hover, rgba(127, 127, 127, 0.14)); }
.mode-text { display: flex; flex-direction: column; min-width: 0; }
.mode-text small { line-height: 1.25; }
.mode-note { margin: 4px 6px; }
.mode-swatch { width: 22px; height: 22px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.5); cursor: pointer; }

.auto-row-wrap { display: flex; align-items: stretch; gap: 4px; }
.auto-row-wrap > .auto-row { flex: 1; min-width: 0; }
.auto-order { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; }
/* a short window: the rail's buttons sit a little closer so the mode button under the refresh button still fits */
@media (max-height: 900px) {
  .layout-h .nav { gap: 6px; padding-top: 8px; padding-bottom: 10px; }
  .layout-h .nav .mode-bar.compact { width: 38px; height: 38px; margin-top: 0; }
}

/* a button that is doing something slow: a little spinner in itself (a switch: near the side it is going to) */
.is-busy { position: relative; pointer-events: none; }
/* Settings > Log: the place log, one text to copy */
.place-log { width: 100%; min-height: 320px; font: 12px/1.45 ui-monospace, Consolas, monospace; white-space: pre; overflow: auto; resize: vertical; padding: 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); box-sizing: border-box; }
.place-log-custom { gap: 10px; flex-wrap: wrap; }
.place-log-range { min-width: 0; max-width: 100%; }
.place-log-range .segmented { display: flex; flex-wrap: wrap; flex: initial; justify-content: flex-start; border-radius: 16px; }
.place-log-custom input { margin-left: 4px; }
.is-busy > * { opacity: 0.35; }
.is-busy::after { content: ""; position: absolute; top: 50%; left: 50%; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin 0.7s linear infinite; }
.switch.is-busy > * { opacity: 1; }
.switch.is-busy::after { left: auto; right: 7px; margin: -7px 0 0 0; border-color: #fff; border-right-color: transparent; }
.switch.is-busy[data-to="off"]::after { right: auto; left: 7px; }
.itog.is-busy .itog-ico { opacity: 0.35; }

/* Typing to Alani on a phone: only the message bar sits on the keyboard (the bottom bar stays behind it: keyboard.js), and a long message
   grows up over what is above it instead of squeezing it (--lift = how much taller than one line: chat.js). */
html.kb-typing .app.layout-v > .nav { display: none; }
html.kb-covered .app.layout-v { height: var(--kb-view); }
.layout-v .ai-stage { margin-bottom: calc(-1 * var(--lift, 0px)); }
.layout-v .ai-attached, .layout-v .ai-composer { position: relative; z-index: 8; }
.layout-v .ai-attached:not(:empty) { margin-bottom: 4px; }
.layout-v .ai-tab[data-lifted="1"] .ai-composer { background: var(--surface); }
.ai-composer textarea { overscroll-behavior: contain; }
