/* =====================================================================
   Car Hub — base styles
   1 tokens & themes · 2 reset · 3 shell (rail, switches) · 4 stage (panes, dividers)
   5 compact mode · 6 shared components · 7 toast · 8 utilities
   Pane modules (youtube / maps / hub) add only their own prefixed classes
   in their own css files and rely on the tokens + components below.
   ===================================================================== */

/* ---------- 1 · tokens & themes ---------- */
:root {
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;

  /* sizes scale with the SHORT side of the screen (vmin) so both orientations feel alike */
  --fs: clamp(15px, 2.3vmin, 19px);
  --fit: calc((100vh - 138px) / 10);
  --btn: min(clamp(40px, 6.6vmin, 58px), max(30px, var(--fit)));   /* one half of a rail switch; shrinks only when the dock would not fit */
  --sw-pad: 4px;
  --rail-w: calc(var(--btn) + 24px + var(--gap) * 2);
  --gap: clamp(6px, 1.1vmin, 12px);
  --radius: clamp(14px, 2.4vmin, 24px);
  --divider: clamp(20px, 3.2vmin, 30px);
  --hdr: clamp(54px, 8.6vmin, 70px);          /* pane header height */
  --tap: clamp(44px, 6.8vmin, 56px);          /* standard touch target */
  --field-h: clamp(44px, 6.8vmin, 54px);
  --ease: cubic-bezier(.3, .9, .3, 1);

  /* dark palette (default) */
  color-scheme: dark;
  --bg: #070a10;
  --rail: #0d121b;
  --surface: #121823;
  --surface-2: #1a2231;
  --surface-3: #243047;
  --border: rgba(255, 255, 255, .09);
  --text: #eef2fa;
  --text-2: #b9c4d8;
  --muted: #8d9ab2;
  --accent: #4d8dff;
  --accent-strong: #2f6fe8;                   /* filled buttons with white text (>= 4.5:1) */
  --accent-2: #8a63ff;
  --accent-soft: rgba(77, 141, 255, .18);
  --accent-text: #7aa8ff;                     /* accent as TEXT on --accent-soft (>= 4.5:1) */
  --accent-glow: rgba(77, 141, 255, .45);
  --danger: #ff7a88;
  --ok: #3ddc97;
  --warn: #ffb547;
  --focus: #8dbbff;
  --switch-bg: #080b11;
  --grip: rgba(255, 255, 255, .5);
  --shadow: 0 12px 32px rgba(0, 0, 0, .45);
  --toast-bg: #f1f5fd;
  --toast-fg: #0d1320;
  --pin-hole: #121823;
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #dfe5f0;
  --rail: #f6f8fc;
  --surface: #ffffff;
  --surface-2: #eef2f9;
  --surface-3: #e0e7f3;
  --border: rgba(15, 23, 41, .11);
  --text: #0e1626;
  --text-2: #36435b;
  --muted: #5a6882;
  --accent: #2d6cf0;
  --accent-strong: #2f6fe8;
  --accent-2: #6b4de6;
  --accent-soft: rgba(45, 108, 240, .12);
  --accent-text: #1d58d6;
  --accent-glow: rgba(45, 108, 240, .35);
  --danger: #c4182f;
  --ok: #138a5b;
  --warn: #b26a00;
  --focus: #1f5fe0;
  --switch-bg: #e3e9f4;
  --grip: rgba(15, 23, 41, .6);
  --shadow: 0 10px 28px rgba(15, 23, 41, .13);
  --toast-bg: #101828;
  --toast-fg: #f3f6fc;
  --pin-hole: #ffffff;
}

/* ---------- 2 · reset ---------- */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font: 400 var(--fs) / 1.4 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
}

body {
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
h1, h2, h3, p { margin: 0; }
iframe { display: block; border: 0; }
input, textarea { -webkit-user-select: text; user-select: text; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }

/* thin scrollbars everywhere */
* { scrollbar-width: thin; scrollbar-color: var(--surface-3) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- 3 · shell: rail + switches ---------- */
.app {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  display: flex;
  flex-direction: row;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
html[data-orient="portrait"] { --fit: calc((100vw - 138px) / 10); }
html[data-orient="portrait"] .app { flex-direction: column; }

/* The rail only hosts one floating dock: the APP button + the four switches, packed together. */
.rail {
  position: relative;
  z-index: 4;
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: var(--rail-w);
  padding: var(--gap);
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: none;
}
.rail::-webkit-scrollbar { display: none; }

.dock {
  flex: none;
  margin: auto;                                       /* centred, but top-aligned if the screen is too short */
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: calc(var(--btn) * .78 + 6px);
  background: var(--rail);
  box-shadow: var(--shadow);
}
.dock__switches { display: flex; flex-direction: column; align-items: center; gap: 8px; }

html[data-orient="portrait"] .rail { flex-direction: row; width: auto; height: var(--rail-w); overflow-x: auto; overflow-y: hidden; }
html[data-orient="portrait"] .dock,
html[data-orient="portrait"] .dock__switches { flex-direction: row; }

.dock__app {
  flex: none;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 1px;
  width: calc(var(--btn) + 10px);
  height: calc(var(--btn) + 10px);
  padding: 0;
  border: 0;
  border-radius: 32%;
  color: #fff;
  background: linear-gradient(145deg, var(--accent-strong), #6f4be8);
  box-shadow: 0 6px 16px var(--accent-glow);
  transition: transform .12s var(--ease), box-shadow .2s, filter .2s;
}
.dock__app .icon { --icon: calc(var(--btn) * .5); }
.dock__app-label { font-size: clamp(10px, calc(var(--btn) * .24), 13px); font-weight: 800; letter-spacing: .06em; line-height: 1; }
.dock__app:active { transform: scale(.94); }
.dock__app[aria-expanded="true"] { box-shadow: 0 0 0 3px var(--accent-soft), 0 0 22px var(--accent-glow); filter: brightness(1.12); }

/* A two-option switch. The thumb slides to the option that is currently active. */
.switch {
  position: relative;
  flex: none;
  display: grid;
  grid-template-columns: var(--btn);
  grid-template-rows: repeat(2, var(--btn));
  padding: var(--sw-pad);
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--switch-bg);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, .25);
  color: var(--muted);
  -webkit-appearance: none;
  appearance: none;
  transition: transform .12s var(--ease);
}
html[data-orient="portrait"] .switch {
  grid-template-columns: repeat(2, var(--btn));
  grid-template-rows: var(--btn);
}
.switch:active { transform: scale(.95); }
.switch:focus-visible { outline-offset: 3px; }

.switch__thumb {
  position: absolute;
  top: var(--sw-pad);
  left: var(--sw-pad);
  width: var(--btn);
  height: var(--btn);
  border-radius: 50%;
  background: linear-gradient(145deg, var(--accent), var(--accent-2));
  box-shadow: 0 4px 14px var(--accent-glow);
  transform: translate(0, calc(var(--i, 0) * var(--btn)));
  transition: transform .24s var(--ease);
}
html[data-orient="portrait"] .switch__thumb { transform: translate(calc(var(--i, 0) * var(--btn)), 0); }

.switch__opt {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  transition: color .2s;
}
.switch__opt .icon { --icon: calc(var(--btn) * .5); }
.switch__opt.is-on { color: #fff; }

/* ---------- 4 · stage: slots, panes, dividers ---------- */
.stage {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: row;
  padding: var(--gap);
}
html[data-split="col"] .stage { flex-direction: column; }

/* A slot only reserves space; the pane inside never changes parent (iframes never reload). */
.slot {
  flex: 1000 1 0px;
  min-width: 0;
  min-height: 0;
  display: flex;
}
.slot.is-covered { opacity: 0; pointer-events: none; }
.slot.is-off,
html[data-count="2"] .divider[data-i="1"] { display: none; }

.pane {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  isolation: isolate;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
/* Maximised pane covers the whole stage; the other slots keep their size (nothing re-flows). */
.pane.is-max {
  position: absolute;
  top: var(--gap); right: var(--gap); bottom: var(--gap); left: var(--gap);
  z-index: 10;
  animation: pane-in .2s var(--ease);
}
@keyframes pane-in { from { opacity: .35; transform: scale(.985); } to { opacity: 1; transform: none; } }

.pane__header {
  flex: none;
  display: flex;
  align-items: center;
  gap: clamp(6px, 1vmin, 10px);
  min-height: var(--hdr);
  padding: 0 clamp(8px, 1.4vmin, 14px);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.pane__badge {
  flex: none;
  display: grid;
  place-items: center;
  width: calc(var(--hdr) * .62);
  height: calc(var(--hdr) * .62);
  border-radius: 32%;
  color: #fff;
  background: var(--badge-bg, linear-gradient(145deg, var(--accent), var(--accent-2)));
  box-shadow: 0 4px 12px rgba(0, 0, 0, .25);
}
.pane__badge .icon { --icon: 56%; }
.pane__badge { position: relative; cursor: grab; touch-action: none; -webkit-user-select: none; user-select: none; }
.pane__badge::before { content: ""; position: absolute; top: -6px; right: -6px; bottom: -6px; left: -6px; }   /* bigger grab area */
.pane__badge:active { cursor: grabbing; }
.pane__tools {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: clamp(4px, .8vmin, 8px);
}
.pane__body {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: var(--surface);
}

.divider {
  position: relative;
  z-index: 2;
  flex: 0 0 var(--divider);
  display: grid;
  place-items: center;
  cursor: col-resize;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}
.divider::before {                                  /* generous invisible hit area */
  content: "";
  position: absolute;
  top: 0; bottom: 0; left: -12px; right: -12px;
}
html[data-split="col"] .divider { cursor: row-resize; }
html[data-split="col"] .divider::before { top: -12px; bottom: -12px; left: 0; right: 0; }
.divider:focus-visible { outline: none; }

.divider__grip {
  width: 6px;
  height: clamp(44px, 12vmin, 96px);
  border-radius: 99px;
  background: var(--grip);
  transition: background-color .15s, width .15s, height .15s, box-shadow .15s;
}
html[data-split="col"] .divider__grip { width: clamp(44px, 12vmin, 96px); height: 6px; }
@media (hover: hover) { .divider:hover .divider__grip { background: var(--accent); } }
.divider:focus-visible .divider__grip { background: var(--accent); }
.divider.is-active .divider__grip { background: var(--accent); box-shadow: 0 0 0 6px var(--accent-soft), 0 0 18px var(--accent-glow); }
html[data-split="row"] .divider.is-active .divider__grip { width: 8px; }
html[data-split="col"] .divider.is-active .divider__grip { width: clamp(44px, 12vmin, 96px); height: 8px; }
.divider.is-snap .divider__grip { background: var(--ok); }

/* while dragging: iframes must not swallow pointer events */
/* one full-screen shield instead of `html.is-dragging *` (which restyles every element when a drag starts/ends) */
.drag-shield { display: none; position: fixed; z-index: 9999; top: 0; right: 0; bottom: 0; left: 0; cursor: col-resize; }
html[data-split="col"] .drag-shield { cursor: row-resize; }
html.is-dragging .drag-shield { display: block; }
html.is-dragging { -webkit-user-select: none; user-select: none; }

/* ---------- 5 · compact mode (fallback when the Fullscreen API is unavailable) ---------- */
html[data-compact] .rail { display: none; }
.compact-exit {
  position: fixed;
  z-index: 60;
  top: calc(var(--gap) + (var(--hdr) - var(--tap)) / 2 + env(safe-area-inset-top));
  left: calc(var(--gap) + 1px + env(safe-area-inset-left));
  display: none;
  place-items: center;
  width: var(--tap);
  height: var(--tap);
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(145deg, var(--accent), var(--accent-2));
  box-shadow: 0 6px 18px var(--accent-glow);
}
.compact-exit .icon { --icon: 55%; }
html[data-compact] .compact-exit { display: grid; }

/* ---------- 6 · shared components ---------- */
.icon { width: var(--icon, 1.5em); height: var(--icon, 1.5em); flex: none; display: block; }

.icon-btn {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: var(--tap);
  height: var(--tap);
  padding: 0;
  border: 0;
  border-radius: calc(var(--tap) * .34);
  background: transparent;
  color: var(--text-2);
  transition: background-color .15s, color .15s, transform .1s;
}
.icon-btn .icon { --icon: 26px; }
@media (hover: hover) { .icon-btn:hover { background: var(--surface-2); color: var(--text); } }
.icon-btn:active { transform: scale(.93); background: var(--surface-3); }
.icon-btn[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-text); }
.icon-btn:disabled { opacity: .4; pointer-events: none; }
.icon-btn--solid { background: var(--accent-strong); color: #fff; }
.icon-btn--solid:hover { background: var(--accent-strong); color: #fff; filter: brightness(1.1); }

.btn {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: var(--tap);
  padding: 0 clamp(14px, 2.4vmin, 22px);
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text);
  font-weight: 600;
  white-space: nowrap;
  transition: background-color .15s, transform .1s, filter .15s;
}
.btn .icon { --icon: 22px; }
.btn:hover { background: var(--surface-3); }
.btn:active { transform: scale(.96); }
.btn:disabled { opacity: .45; pointer-events: none; }
.btn--primary { background: var(--accent-strong); border-color: transparent; color: #fff; }
.btn--primary:hover { background: var(--accent-strong); filter: brightness(1.1); }
.btn--ghost { background: transparent; }
.btn--danger { color: var(--danger); }

.field {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  height: var(--field-h);
  padding: 0 6px 0 clamp(12px, 2vmin, 16px);
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  transition: border-color .15s, box-shadow .15s;
}
.field:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); color: var(--text-2); }
.field .icon { --icon: 22px; }
.field__input {
  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: max(16px, 1em);
  text-overflow: ellipsis;
}
.field__input::placeholder { color: var(--muted); opacity: 1; }
.field__input::-webkit-search-cancel-button { display: none; }
.field .icon-btn { position: relative; width: calc(var(--field-h) - 8px); height: calc(var(--field-h) - 8px); }
.field .icon-btn::after { content: ""; position: absolute; top: -4px; right: -4px; bottom: -4px; left: -4px; }   /* >= 44px hit area, same look */

.chips {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: var(--tap);
  padding: 0 clamp(12px, 2vmin, 18px);
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-2);
  font-weight: 600;
  white-space: nowrap;
  scroll-snap-align: start;
  transition: background-color .15s, color .15s, border-color .15s, transform .1s;
}
.chip .icon { --icon: 20px; }
.chip:hover { background: var(--surface-3); color: var(--text); }
.chip:active { transform: scale(.96); }
.chip[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-text); }
.chip:disabled { opacity: .45; pointer-events: none; }

/* segmented control: <div class="seg"><button class="seg__opt" aria-pressed="true">…</button>…</div> */
.seg {
  flex: none;
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--switch-bg);
}
.seg__opt {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: var(--tap);
  padding: 0 clamp(12px, 2vmin, 18px);
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
  transition: background-color .2s, color .2s;
}
.seg__opt .icon { --icon: 20px; }
.seg__opt[aria-pressed="true"] { background: linear-gradient(145deg, var(--accent-strong), #6f4be8); color: #fff; }

.card {
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) * .75);
  background: var(--surface-2);
}

.notice {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--text-2);
}
.notice .icon { --icon: 22px; margin-top: 1px; color: var(--accent); }
.notice--warn { border-left-color: var(--warn); }
.notice--warn .icon { color: var(--warn); }
.notice--error { border-left-color: var(--danger); }
.notice--error .icon { color: var(--danger); }
.notice--ok { border-left-color: var(--ok); }
.notice--ok .icon { color: var(--ok); }

/* full-bleed layer inside .pane__body (search results, settings…) */
.overlay {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  z-index: 5;
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  background: var(--surface);
}

.empty-state {
  height: 100%;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 12px;
  padding: 24px;
  text-align: center;
  color: var(--text-2);
}
.empty-state .icon { --icon: 48px; color: var(--muted); }
.empty-state h3 { color: var(--text); font-size: 1.25em; }

.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--surface-3);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.section-title { margin: 0 0 8px; color: var(--muted); font-size: .85em; font-weight: 700; letter-spacing: .02em; }
.muted { color: var(--muted); }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- 7 · toast ---------- */
.toast {
  position: fixed;
  z-index: 100;
  left: 50%;
  bottom: calc(var(--gap) * 2 + env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: calc(100vw - 32px);
  padding: 12px 22px;
  border-radius: 999px;
  background: var(--toast-bg);
  color: var(--toast-fg);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .4);
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 14px);
  transition: opacity .2s, transform .2s var(--ease);
}
.toast .icon { --icon: 22px; }
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 8 · utilities ---------- */
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.boot-error {
  height: 100%;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 14px;
  padding: 24px;
  text-align: center;
  color: var(--text-2);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}


/* ---------- 9 · APP popup, pane re-ordering ---------- */
.popup-backdrop { position: fixed; z-index: 70; top: 0; right: 0; bottom: 0; left: 0; background: rgba(0, 0, 0, .32); animation: fade-in .15s ease-out; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.app-popup {
  position: fixed;
  z-index: 80;
  left: var(--px, 12px);
  top: var(--py, 12px);
  width: min(calc(100vw - 24px), 404px);
  border: 1px solid var(--border);
  border-radius: 26px;
  background: var(--surface);
  box-shadow: 0 28px 70px rgba(0, 0, 0, .55);
  transform-origin: var(--ox, 0) var(--oy, 0);
  animation: pop-in .18s var(--ease);
}
@keyframes pop-in { from { opacity: 0; transform: scale(.9); } to { opacity: 1; transform: none; } }
.app-popup::before {                                   /* little arrow pointing at the APP button */
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  left: -9px;
  top: calc(var(--ay, 40px) - 8px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 0;
  border-right: 0;
  transform: rotate(45deg);
}
html[data-orient="portrait"] .app-popup::before {
  left: calc(var(--ax, 40px) - 8px);
  top: -9px;
  border: 1px solid var(--border);
  border-bottom: 0;
  border-right: 0;
}
.app-popup__inner { max-height: calc(100vh - 24px); overflow-y: auto; padding: 18px; border-radius: inherit; }
.app-popup__title { margin: 0 0 12px 4px; font-size: 1.15em; }
.app-popup__grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.app-popup__hint { margin: 14px 4px 0; color: var(--text-2); font-size: .88em; line-height: 1.45; }

.app-tile {
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 6px;
  min-height: 112px;
  padding: 12px 6px 10px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface-2);
  color: var(--text);
  text-align: center;
  transition: background-color .15s, border-color .15s, transform .1s;
}
.app-tile:active { transform: scale(.95); }
.app-tile__icon { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 30%; color: #fff; background: var(--badge-bg); box-shadow: 0 6px 16px rgba(0, 0, 0, .28); }
.app-tile__icon .icon { --icon: 56%; }
.app-tile__name { font-weight: 700; font-size: .95em; line-height: 1.2; }
.app-tile__state { color: var(--text-2); font-size: .82em; }
.app-tile.is-open { border-color: var(--accent); background: var(--accent-soft); }
.app-tile.is-open .app-tile__state { color: var(--accent-text, var(--accent)); font-weight: 700; }
@media (hover: hover) { .app-tile:hover { border-color: var(--accent); } }

.drag-ghost {
  position: fixed;
  z-index: 9998;
  top: 0;
  left: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 18px 6px 6px;
  border: 2px solid var(--accent);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: 0 14px 34px rgba(0, 0, 0, .45);
  font-weight: 700;
  pointer-events: none;
  will-change: transform;
}
.drag-ghost .pane__badge { box-shadow: none; cursor: grabbing; }
html.is-reordering .drag-shield { cursor: grabbing; }
.pane.is-lifting { opacity: .5; transform: scale(.985); transition: opacity .15s, transform .15s; }
.pane.is-drop::after {
  content: attr(data-drop-label);
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  z-index: 9;
  display: grid;
  place-items: center;
  padding: 16px;
  border: 3px solid var(--accent);
  border-radius: inherit;
  background: var(--accent-soft);
  color: var(--text);
  font-size: 1.2em;
  font-weight: 800;
  text-align: center;
  pointer-events: none;
}
.pane.is-landed { animation: pane-in .26s var(--ease); }
.pane.is-flash { animation: pane-flash .9s ease-out; }
@keyframes pane-flash { 0%, 100% { box-shadow: var(--shadow); } 30% { box-shadow: 0 0 0 4px var(--accent), 0 0 34px var(--accent-glow); } }


/* ---------- 10 · feedback button (bottom of the rail / right end of the top bar) + popup tweaks ---------- */
.rail__feedback {
  flex: none;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 1px;
  width: calc(var(--btn) + 10px);
  height: calc(var(--btn) + 10px);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 32%;
  background: var(--rail);
  color: var(--text-2);
  box-shadow: var(--shadow);
  transition: transform .12s var(--ease), color .2s, border-color .2s;
}
.rail__feedback .icon { --icon: calc(var(--btn) * .46); }
.rail__feedback-label { font-size: clamp(10px, calc(var(--btn) * .22), 12px); font-weight: 700; line-height: 1; }
.rail__feedback:active { transform: scale(.94); }
.rail__feedback[aria-expanded="true"] { color: var(--accent-text, var(--accent)); border-color: var(--accent); }
@media (hover: hover) { .rail__feedback:hover { color: var(--text); border-color: var(--accent); } }

.feedback-popup { width: min(calc(100vw - 24px), 440px); }
.app-popup.is-typing { top: 12px; }
.app-popup.is-typing::before { display: none; }
