
/* SDK badge chips (js/widget-sdk/sdk-badges.js) — size them to the pill's density. The row
   itself is an island segment, so its divider/padding come from .island-seg
   below; only the chips need resizing. Base look (flat, no fill) is in
   CustomWidget.css — it needs no padding to unset here. */
body.topbar-minimal .topbar-mini .sdk-badge { font-size: 12px; }

body.topbar-minimal .topbar-mini .pager-dots:empty { display: none; }

/* ── Flattened island segments — order · dividers · visibility ──
   Each direct pill child is one reorderable segment; js/topbar/topbar-minimal.js sets
   its CSS `order` and these classes from the user's list. A slim hairline sits
   before every segment except the first VISIBLE one (island-seg-lead — computed
   in JS because flex `order` is invisible to DOM :first-child). island-seg-hidden
   removes a segment the user turned off. */
body.topbar-minimal:not([data-panel]) .topbar-mini > .island-seg {
  position: relative;
  padding-left: 15px;
}
body.topbar-minimal:not([data-panel]) .topbar-mini > .island-seg::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 1px;
  height: 16px;
  transform: translateY(-50%);
  background: var(--floating-ui-border);
}
body.topbar-minimal:not([data-panel]) .topbar-mini > .island-seg-lead { padding-left: 0; }
body.topbar-minimal:not([data-panel]) .topbar-mini > .island-seg-lead::before { display: none; }
body.topbar-minimal .topbar-mini > .island-seg-hidden { display: none !important; }
/* A vertical screen scaled up (an Edge at 150-200%) is narrower than the
   island's ~540px: the date goes first, then the weather, rather than the
   page dots and markers running off the edge. Both stay one tap away in the
   weather modal and the calendar. */
@media (max-width: 600px) {
  .is-portrait body.topbar-minimal:not([data-panel]) .topbar-mini > .clock-date { display: none; }
}
@media (max-width: 420px) {
  .is-portrait body.topbar-minimal:not([data-panel]) .topbar-mini > .clock-weather { display: none; }
}

/* ── Notification island ──────────────────────────────────────
   A heads-up notification takes the clock island's place (Apple Dynamic-Island).
   js/alerts/toast-island.js first fades the pill's contents (.mini-yield), then puts a
   glass of the pill's exact box and look in its place and grows it into the card;
   the pill steps aside in that same frame (body.xtoast-island, rule below) and
   comes back in the frame the glass has shrunk onto it again. The glass and the
   card live in Toast.css. The stack keeps the pill's spot for the rare case a
   card is already up in it when the chrome turns minimal. */
body.topbar-minimal:not([data-panel]) .xtoast-stack { top: 9px; }
body.topbar-minimal:not([data-panel]) .topbar-mini.mini-yield > * { opacity: 0; }

.topbar-mini {
  transition:
    opacity 0.3s ease,
    transform 0.34s cubic-bezier(0.22, 1.15, 0.36, 1);
}

/* ── Island morph (js/topbar/topbar-minimal.js morphIsland) ──────────────────────────
   Structural swaps — today the music takeover starting or ending on play/pause —
   fade the capsule's contents out, exchange them while they are invisible, then
   glide the box between its old and new size as they fade back in. Widths are
   pinned inline for the duration only; nothing here sizes the pill on its own.
   The durations must stay in step with MORPH_DIM_MS / MORPH_BOX_MS there. */
body.topbar-minimal:not([data-panel]) .topbar-mini > * { transition: opacity 0.16s ease; }
body.topbar-minimal:not([data-panel]) .topbar-mini.mini-morph-dim > * { opacity: 0; }
body.topbar-minimal:not([data-panel]) .topbar-mini.mini-morphing {
  /* The pinned box is briefly smaller than what it holds; clip rather than let
     the old contents spill past the capsule's rounded edge. */
  overflow: hidden;
  transition:
    width 0.34s cubic-bezier(0.22, 1, 0.36, 1),
    height 0.34s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.3s ease,
    transform 0.34s cubic-bezier(0.22, 1.15, 0.36, 1);
}

@media (prefers-reduced-motion: reduce) {
  body.topbar-minimal:not([data-panel]) .topbar-mini > * { transition: none; }
}
body.topbar-minimal.xisland-live:not([data-panel]) .topbar-mini {
  opacity: 0;
  transform: translateX(var(--mini-tx)) translateY(-6px) scale(0.82);
  pointer-events: none;
}
/* Instant both ways, never faded: the notification's glass is standing exactly
   where the pill is, so any fade would show two of them. */
body.topbar-minimal.xtoast-island:not([data-panel]) .topbar-mini {
  visibility: hidden;
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  .topbar-mini { transition: opacity 0.2s ease; }
  body.topbar-minimal.xisland-live:not([data-panel]) .topbar-mini { transform: translateX(var(--mini-tx)); }
}

/* ── SDK island — widget text projection ──────────────────────
   A granted SDK widget's text (js/widget-sdk/sdk-island.js) takes the pill's spot exactly
   like a notification does: body.xisland-live recedes the pill (rule above)
   and this capsule morphs in at the same anchor, expanding into a small card
   when the line wraps — current line bright, optional follow-up line dimmed
   (NotchPrompter-style). Text is host-rendered (textContent) — this file only
   ever styles it. A SYSTEM TOAST ALWAYS WINS: while body.xtoast-island is set
   the capsule recedes with the pill (rule below the show rule, so it takes
   precedence at equal specificity). */
.sdk-island { display: none; }

/* Full and Minimal share one Dynamic Island surface. In Full the centre clock
   recedes inside the glass bar; in Minimal the floating capsule recedes through
   the existing rule above. Style None carries topbar-noisland and is excluded. */
.clock { transition: opacity 0.25s ease, transform 0.3s cubic-bezier(0.22, 1, 0.36, 1); }
body.xisland-live:not(.topbar-minimal):not(.topbar-hidden):not(.topbar-noisland):not([data-panel]) .clock {
  opacity: 0;
  transform: translateY(-5px) scale(0.86);
  pointer-events: none;
}

body.xisland-live:not(.topbar-hidden):not(.topbar-noisland):not([data-panel]) .sdk-island {
  position: fixed;
  top: 9px;
  --mini-tx: -50%;
  left: 50%;
  transform: translateX(var(--mini-tx));
  z-index: 57; /* same band as the pill: above tiles, below modals/toasts */
  display: flex;
  align-items: stretch;
  gap: 12px;
  width: max-content; /* hug a short line; the cap below bounds a long one */
  max-width: min(520px, 66vw); /* fixed cap: never widens under a tile → no reflow bobbing */
  padding: 10px 16px;
  border-radius: 18px;
  border: 1px solid var(--floating-ui-border);
  background: var(--floating-ui-bg);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,var(--panel-highlight-alpha)), var(--shadow-lg);
  overflow: hidden;
  will-change: transform, opacity;
  --island-accent: var(--accent);
}
/* Same edge anchors as the pill, so the capsule lands where the pill was. */
body.topbar-minimal.xisland-live:not([data-panel])[data-topbar-align="left"] .sdk-island {
  left: 12px;
  --mini-tx: 0%;
}
body.topbar-minimal.xisland-live:not([data-panel])[data-topbar-align="right"] .sdk-island {
  left: auto;
  right: 12px;
  --mini-tx: 0%;
}
/* Capsule-squash entrance, mirroring the toast morph (transform/opacity only). */
@keyframes sdk-island-in {
  from { opacity: 0; transform: translateX(var(--mini-tx)) translateY(-4px) scaleX(0.6) scaleY(0.4); }
  to   { opacity: 1; transform: translateX(var(--mini-tx)); }
}
.sdk-island.enter-morph { animation: sdk-island-in 0.34s cubic-bezier(0.22, 1.15, 0.36, 1); }
@keyframes sdk-island-slide-in {
  from { opacity: 0; transform: translateX(var(--mini-tx)) translateY(-14px); }
  to { opacity: 1; transform: translateX(var(--mini-tx)); }
}
.sdk-island.enter-slide { animation: sdk-island-slide-in 0.32s cubic-bezier(0.22, 1, 0.36, 1); }
@keyframes sdk-island-pop-in {
  from { opacity: 0; transform: translateX(var(--mini-tx)) scale(0.72); }
  to { opacity: 1; transform: translateX(var(--mini-tx)); }
}
.sdk-island.enter-pop { animation: sdk-island-pop-in 0.28s cubic-bezier(0.2, 1.3, 0.3, 1); }
@keyframes sdk-island-fade-in { from { opacity: 0; } to { opacity: 1; } }
.sdk-island.enter-fade { animation: sdk-island-fade-in 0.24s ease; }

.sdk-island.is-leaving { animation: none; transition: opacity 0.2s ease, transform 0.22s ease; }
.sdk-island.is-leaving.exit-morph { opacity: 0; transform: translateX(var(--mini-tx)) translateY(-5px) scale(0.78); }
.sdk-island.is-leaving.exit-slide { opacity: 0; transform: translateX(var(--mini-tx)) translateY(-14px); }
.sdk-island.is-leaving.exit-fade { opacity: 0; }
/* System toast wins: the capsule steps aside exactly like the pill while a
   notification's glass holds its place (instant, for the same reason). */
body.xtoast-island:not([data-panel]) .sdk-island {
  visibility: hidden;
  pointer-events: none;
}

/* Text flows as stacked sentence rows (js/widget-sdk/sdk-island.js): dimmed past row,
   bright current (never clamped — it wraps in full), dimmed upcoming. On a
   prompter advance the block slides up one row (transform, its own layer)
   while the card height tweens — a karaoke glide, not a snap. */
.sdk-island-flow {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  will-change: transform;
  transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}
.sdk-island-row {
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.1px;
  line-height: 1.4;
  color: var(--text);
  opacity: 0.5;
  transition: opacity 0.45s ease;
  animation: xe-isl-row-in 0.4s ease;
}
.sdk-island-row.is-cur { opacity: 1; }
/* The line just spoken: one dim ellipsized row, so history never stacks up. */
.sdk-island-row.is-past,
.sdk-island-row:not(.is-cur) { font-size: 12px; font-weight: 500; }
.sdk-island-row.is-past {
  opacity: 0.32;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
@keyframes xe-isl-row-in { from { opacity: 0; } }
/* Multi-row flow pins the card width so per-sentence reflow can't wobble. */
body.xisland-live:not(.topbar-hidden):not(.topbar-noisland):not([data-panel]) .sdk-island.is-flow {
  width: min(520px, 66vw);
}
/* Live meta column (speed on top, time left below) — right-aligned, split off
   by a hairline like an iOS Live Activity, so numbers never touch the prose. */
.sdk-island-meta {
  display: none;
  flex: 0 0 auto;
  flex-direction: column;
  justify-content: center;
  align-items: flex-end;
  gap: 2px;
  padding-left: 12px;
  border-left: 1px solid var(--floating-ui-border);
}
.sdk-island.has-badge .sdk-island-meta { display: flex; }
.sdk-island-m1 {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.2px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--accent);
}
.sdk-island-m2 {
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--text);
  opacity: 0.55;
}
.sdk-island-m2:empty { display: none; }

/* ── Structured Live Activities (SDK islandDynamic) ────────────────
   Every node is built by Xenon from sdk-island-schema.js. Widget strings are
   textContent; the CSS is fixed host chrome and cannot be supplied by a guest. */
.sdk-island.is-structured { align-items: center; padding: 9px 12px; }
.sdk-island.is-structured.is-expanded { max-width: min(680px, 82vw); padding: 12px 16px; }
