/* MetalSharp 1.1.0 browser demo: a recreation of the GPUI app's library
   screen. Sizes follow app-gpui/src/library_layout.rs (scaled by --s, set
   from the viewport in demo.js); colors and strings follow ui.rs. */

@font-face { font-family: "Rethink Sans"; src: url("fonts/RethinkSans-Regular.ttf") format("truetype"); font-weight: 400; }
@font-face { font-family: "Rethink Sans"; src: url("fonts/RethinkSans-SemiBold.ttf") format("truetype"); font-weight: 600 800; }

:root {
  --s: 1;
  --pad: 24px;
  --hdr: 64px;
  --ftr: 64px;
  --ctl: 40px;
  --card-w: 130px;
  --card-h: 227px;
  --hero-block: 381px;
  --backdrop-h: 540px;
  --dock-top: 22px;
  --dock-bottom: 30px;

  /* Dark theme; demo.js swaps these for the other themes */
  --accent: #e8d6b7;
  --glow: #2aa1ff;
  --control-bg: #080a0d;
  --control-hover: #171a1e;
  --control-text: #ffffff;
  --border: #515456;
  --control-border: #ffffff38;
  --menu-bg: #080a0d;
  --menu-hover: #171a1e;
  --page-bg: #111416;
  --page-raised: #1a1d20;
  --hero-title: #efcf9d;
  --sp0: #5fe1ff;
  --sp1: #3d7bff;
  --sp2: #9b7bff;
  --ink-light: #0d1018;
  --ink-deep: #07080d;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
body {
  background: var(--page-bg);
  color: #f2efe6;
  font-family: "Rethink Sans", -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-font-smoothing: antialiased;
  user-select: none;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input { font: inherit; color: inherit; }

.ic {
  display: inline-block;
  flex: none;
  width: var(--sz, 20px);
  height: var(--sz, 20px);
  background: currentColor;
  -webkit-mask: var(--i) center / contain no-repeat;
  mask: var(--i) center / contain no-repeat;
}

.app { position: relative; display: flex; height: 100%; }
.main { position: relative; flex: 1; min-width: 0; display: flex; flex-direction: column; height: 100%; overflow: hidden; }

/* ── Header ─────────────────────────────────────────────── */
.header {
  position: absolute;
  inset: 0 0 auto;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: calc(10px * var(--s));
  height: var(--hdr);
  padding-inline: var(--pad);
}
.brand { display: flex; align-items: center; gap: calc(9px * var(--s)); }
.brand img { width: calc(27px * var(--s)); height: calc(27px * var(--s)); }
.brand span { font-size: calc(15px * var(--s)); font-weight: 600; color: #e9edf7; }
.compact .brand span { display: none; }

.icon-btn {
  display: grid;
  place-items: center;
  width: var(--ctl);
  height: var(--ctl);
  border-radius: calc(8px * var(--s));
  color: #fff;
}
.icon-btn:hover { background: #ffffff1f; }

.launcher { position: relative; display: flex; }
.launcher-main, .launcher-gear {
  display: flex;
  align-items: center;
  height: var(--ctl);
  border: 1px solid #e7eaec4d;
  background: #0c0f10b8;
  color: #fff;
}
.launcher-main:hover, .launcher-gear:hover { background: #1a1e22d0; }
.launcher-main {
  gap: calc(8px * var(--s));
  padding-inline: calc(15px * var(--s));
  border-radius: calc(8px * var(--s)) 0 0 calc(8px * var(--s));
  font-size: calc(13px * var(--s));
  font-weight: 600;
  white-space: nowrap;
}
.launcher-main.icon-only { padding-inline: calc(11px * var(--s)); }
.launcher-main.icon-only .label { display: none; }
.launcher-main.solo { border-radius: calc(8px * var(--s)); }
.launcher-main.busy { opacity: 0.7; }
.launcher-gear { justify-content: center; width: var(--ctl); border-left: 0; border-radius: 0 calc(8px * var(--s)) calc(8px * var(--s)) 0; }

.search {
  flex: 1;
  max-width: calc(720px * var(--s));
  display: flex;
  align-items: center;
  gap: calc(11px * var(--s));
  height: var(--ctl);
  margin-inline: calc(10px * var(--s));
  padding-inline: calc(12px * var(--s));
  border: 1px solid #e7eaec40;
  border-radius: calc(8px * var(--s));
  background: #0c0f10a6;
  color: #aab4c4;
}
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: #fff; font-size: calc(14px * var(--s)); caret-color: #fff; }
.search input::placeholder { color: #aaaaaa; }
.search input::selection { background: #74d2c84d; }
.spacer { flex: 1; }

.runtime {
  display: flex;
  gap: 2px;
  height: var(--ctl);
  padding: 3px;
  border: 1px solid #e7eaec4d;
  border-radius: calc(8px * var(--s));
  background: #0c0f10b8;
}
.runtime button {
  padding-inline: calc(14px * var(--s));
  border-radius: calc(6px * var(--s));
  color: #aab4c4;
  font-size: calc(12.5px * var(--s));
  font-weight: 600;
}
.runtime button[aria-pressed="true"] { color: #fff; background: #ffffff26; }

/* ── Menus ──────────────────────────────────────────────── */
.menu {
  position: absolute;
  z-index: 60;
  display: grid;
  gap: 2px;
  padding: 6px;
  border: 1px solid var(--control-border);
  border-radius: calc(8px * var(--s));
  background: var(--menu-bg);
  box-shadow: 0 10px 15px -3px #0000001a, 0 4px 6px -4px #0000001a, 0 20px 40px #00000066;
}
.menu[hidden] { display: none; }
.menu button {
  display: flex;
  align-items: center;
  gap: calc(8px * var(--s));
  min-height: calc(29px * var(--s));
  padding-inline: calc(8px * var(--s));
  border-radius: 5px;
  color: var(--control-text);
  font-size: calc(11px * var(--s));
  text-align: left;
}
.menu button:hover, .menu button.on { background: var(--menu-hover); }
.menu button:disabled { opacity: 0.5; cursor: default; }
.theme-menu { top: calc(var(--ctl) + 6px * var(--s)); right: 0; width: calc(160px * var(--s)); }
.theme-menu .glyph { display: grid; place-items: center; width: calc(17px * var(--s)); font-size: calc(15px * var(--s)); }
.launcher-menu { top: calc(var(--ctl) + 6px * var(--s)); left: 0; min-width: calc(178px * var(--s)); padding: 5px; }
.launcher-menu button { min-height: 30px; padding-inline: calc(10px * var(--s)); font-size: calc(12.5px * var(--s)); }
.route-menu { top: 50px; right: 0; width: 166px; gap: 3px; border-color: var(--accent); }
.route-menu button { justify-content: space-between; min-height: 32px; padding-inline: 9px; font-size: 12px; }

/* ── Hero ───────────────────────────────────────────────── */
.backdrop {
  position: absolute;
  inset: 0 0 auto;
  height: var(--backdrop-h);
  background: #242629 var(--hero) center / cover no-repeat;
  transition: background-image 0.25s;
}
.backdrop::after {
  content: "";
  position: absolute;
  inset: 55% 0 0;
  background: linear-gradient(180deg, transparent, var(--page-bg));
}
.hero {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  height: var(--hero-block);
  padding: var(--hdr) var(--pad) 0;
  flex: none;
}
.hero::before, .hero::after { content: ""; position: absolute; pointer-events: none; }
.hero::before { inset: 0; background: linear-gradient(90deg, #060809e8, #06080900 72%); }
.hero::after { inset: 0 0 auto; height: calc(var(--hdr) + 24px * var(--s)); background: linear-gradient(180deg, #0608098c, transparent); }
.hero-copy { position: relative; z-index: 1; }
.eyebrow { margin-bottom: calc(12px * var(--s)); color: #c3cbd8; font-size: calc(11px * var(--s)); font-weight: 600; letter-spacing: 0.04em; }
.title {
  max-width: calc(680px * var(--s));
  margin-bottom: calc(12px * var(--s));
  color: #f7f8fc;
  font-size: calc(var(--title, 48px) * var(--s));
  line-height: 1.125;
  font-weight: 600;
  letter-spacing: -0.01em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.compact .title { --title: 40px; }
.chip {
  display: inline-block;
  padding: 3px calc(9px * var(--s));
  border: 1px solid #e7eaec4d;
  border-radius: 5px;
  background: #0c0f10b8;
  color: #f0f0ee;
  font-size: calc(11px * var(--s));
  font-weight: 600;
}
.actions { display: flex; align-items: center; gap: calc(14px * var(--s)); margin-top: calc(22px * var(--s)); }
.play {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: calc(10px * var(--s));
  width: calc(var(--play-w, 210px) * var(--s));
  height: calc(48px * var(--s));
  border: 1px solid var(--accent);
  border-radius: calc(8px * var(--s));
  background: var(--accent);
  color: #101318;
  font-size: calc(15px * var(--s));
  font-weight: 700;
}
.play:hover { opacity: 0.92; }
.play.launching { opacity: 0.6; }
.play.running { background: #a52d2d; border-color: #a52d2d; color: #fff; }
.play.running:hover { background: #bb3c3c; opacity: 1; }
.play .stop-sq { width: calc(13px * var(--s)); height: calc(13px * var(--s)); border-radius: 2px; background: #fff; }
.secondary { position: relative; display: flex; gap: calc(9px * var(--s)); }
.sq, .route {
  display: flex;
  align-items: center;
  justify-content: center;
  height: calc(42px * var(--s));
  border: 1px solid #e7eaec4d;
  border-radius: calc(8px * var(--s));
  background: #0c0f10b8;
  color: #f0f0ee;
}
.sq { width: calc(42px * var(--s)); }
.sq:hover, .route:hover { background: #1a1e22d0; }
.route { gap: calc(9px * var(--s)); padding-inline: calc(13px * var(--s)); font-size: calc(12px * var(--s)); white-space: nowrap; }

/* ── Dock ───────────────────────────────────────────────── */
.dock { position: relative; z-index: 3; flex: none; padding: calc(var(--dock-pt, 12px) * var(--s)) var(--pad) 0; }
.compact .dock { --dock-pt: 8px; }
.dock-head { display: flex; align-items: center; justify-content: space-between; height: calc(var(--dock-hh, 32px) * var(--s)); }
.compact .dock-head { --dock-hh: 28px; }
.dock-head h2 { display: flex; align-items: baseline; gap: 10px; color: #f0f3f8; font-size: calc(17px * var(--s)); font-weight: 600; }
.dock-head h2 small { color: #96a1b2; font-size: calc(12px * var(--s)); font-weight: 400; }
.dock-head button { color: #bfc8d7; font-size: calc(13px * var(--s)); white-space: pre; }
.dock-head button:hover { color: #fff; }
.dock-row { display: flex; align-items: center; justify-content: center; gap: calc(10px * var(--s)); }
.arrow {
  display: grid;
  place-items: center;
  flex: none;
  width: calc(38px * var(--s));
  height: calc(66px * var(--s));
  border: 1px solid var(--accent);
  border-radius: calc(8px * var(--s));
  background: #292d2f;
  color: #fff;
}
.arrow:disabled { opacity: 0.28; cursor: default; }
.cards {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: calc(16px * var(--s));
  padding: var(--dock-top) calc(10px * var(--s)) var(--dock-bottom);
}
.card { position: relative; width: var(--card-w); height: var(--card-h); flex: none; text-align: center; transition: transform 0.25s cubic-bezier(.2, .8, .2, 1); }
.card .glow {
  position: absolute;
  inset: calc(14px * var(--s)) calc(6px * var(--s)) calc(20px * var(--s) + 52px * var(--s)) calc(6px * var(--s));
  border-radius: calc(7px * var(--s));
  box-shadow: 0 calc(16px * var(--s)) calc(38px * var(--s)) calc(9px * var(--s)) color-mix(in srgb, var(--glow) 6%, transparent);
  transition: box-shadow 0.25s;
}
.card.sel .glow { box-shadow: 0 calc(16px * var(--s)) calc(38px * var(--s)) calc(9px * var(--s)) color-mix(in srgb, var(--glow) 44%, transparent); }
.card .art {
  position: absolute;
  inset: 0 0 calc(52px * var(--s));
  border-radius: calc(7px * var(--s));
  background: #242729 var(--cover) center / cover no-repeat;
  box-shadow: 0 10px 15px -3px #00000066, 0 4px 6px -4px #00000066;
  overflow: hidden;
  transform: rotate(var(--ang, 0deg));
  transition: transform 0.25s cubic-bezier(.2, .8, .2, 1);
}
.card .art::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent, #00000066); }
.card.flat .art { border: 1px solid #54595b; }
.card.flat.sel .art { border-color: var(--accent); }
.card .name {
  position: absolute;
  inset: auto 0 calc(20px * var(--s));
  overflow: hidden;
  color: #adb6c5;
  font-size: calc(13px * var(--s));
  white-space: nowrap;
  text-overflow: ellipsis;
}
.card.sel .name { color: #f4f6fa; font-weight: 600; }
.card .bar { position: absolute; left: 50%; bottom: calc(10px * var(--s)); width: calc(30px * var(--s)); height: calc(3px * var(--s)); border-radius: 9px; background: var(--accent); transform: translateX(-50%); opacity: 0; }
.card.sel .bar { opacity: 1; }
.card .pill {
  position: absolute;
  left: 50%;
  bottom: calc(52px * var(--s) + 16px * var(--s));
  z-index: 2;
  height: calc(34px * var(--s));
  padding-inline: calc(12px * var(--s));
  border: 1px solid #ffffff80;
  border-radius: calc(6px * var(--s));
  background: #eee5d6;
  color: #171819;
  font-size: calc(12px * var(--s));
  font-weight: 700;
  white-space: nowrap;
  transform: translateX(-50%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
}
.card:hover .pill, .card.running .pill { opacity: 1; pointer-events: auto; }
.card.running .pill { background: #a52d2d; color: #fff; }

/* ── Footer ─────────────────────────────────────────────── */
.footer {
  position: absolute;
  inset: auto 0 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: calc(22px * var(--s));
  height: var(--ftr);
  padding-inline: var(--pad);
  color: #d8dad9;
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--sp1) 9%, transparent), transparent 45%),
    linear-gradient(270deg, color-mix(in srgb, var(--sp2) 6%, transparent), transparent 35%),
    linear-gradient(180deg, var(--ink-deep), var(--ink-light));
}
.footer::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  opacity: 0.55;
  background: linear-gradient(90deg, transparent, var(--sp0) 12%, var(--sp1) 50%, var(--sp2) 88%, transparent);
}
.status { display: flex; align-items: center; gap: calc(10px * var(--s)); min-width: 0; }
.status .tick { display: grid; place-items: center; width: calc(25px * var(--s)); color: #74d28a; font-size: calc(20px * var(--s)); }
.status strong { display: block; color: #e2e4e3; font-size: calc(13px * var(--s)); font-weight: 600; }
.status span { display: block; margin-top: calc(3px * var(--s)); color: #969b9a; font-size: calc(11px * var(--s)); white-space: nowrap; }
.stream {
  display: flex;
  align-items: center;
  gap: calc(10px * var(--s));
  padding: calc(7px * var(--s)) calc(14px * var(--s));
  border: 1px solid #aabeff1f;
  border-radius: calc(10px * var(--s));
  background: #ffffff08;
  text-align: left;
}
.stream:hover { border-color: color-mix(in srgb, var(--sp0) 45%, transparent); background: color-mix(in srgb, var(--sp0) 6%, transparent); }
.stream .tv { position: relative; color: var(--sp0); }
.stream .wifi { position: absolute; right: -5px; bottom: -3px; display: grid; place-items: center; width: calc(14px * var(--s)); height: calc(14px * var(--s)); border-radius: 50%; background: var(--sp0); color: #0f1214; }
.stream strong { display: block; font-size: calc(12.5px * var(--s)); font-weight: 600; }
.stream span { display: block; color: #8b9290; font-size: calc(10.5px * var(--s)); }
.update { display: flex; align-items: center; gap: calc(10px * var(--s)); }
.update .dl { display: grid; place-items: center; width: calc(30px * var(--s)); height: calc(30px * var(--s)); border: 1px solid #aabeff2e; border-radius: 50%; background: #282c2d; color: #8e99aa; }

/* ── Sidebar ────────────────────────────────────────────── */
.sidebar {
  position: absolute;
  inset: 0 auto 0 0;
  z-index: 25;
  display: flex;
  flex-direction: column;
  gap: calc(3px * var(--s));
  width: calc(184px * var(--s));
  padding: calc(var(--hdr) + 8px * var(--s)) calc(10px * var(--s)) calc(12px * var(--s));
  background: #0d1018f0;
  box-shadow: 0 10px 15px -3px #00000066, 0 4px 6px -4px #00000066;
  transform: translateX(-100%);
  transition: transform 0.2s cubic-bezier(.33, 1, .68, 1);
}
.sidebar.open { transform: none; }
.sidebar.docked { position: relative; transform: none; box-shadow: none; flex: none; }
.side-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: calc(11px * var(--s));
  height: calc(38px * var(--s));
  padding-inline: calc(12px * var(--s));
  border-radius: calc(8px * var(--s));
  color: #c3cbd8;
  font-size: calc(13.5px * var(--s));
  text-align: left;
}
.side-item:hover { background: #ffffff14; }
.side-item.on { color: #fff; font-weight: 600; background: color-mix(in srgb, var(--accent) 18%, transparent); }
.side-item.on::before { content: ""; position: absolute; left: 0; top: calc(9px * var(--s)); bottom: calc(9px * var(--s)); width: 3px; border-radius: 2px; background: var(--accent); }
.side-fill { flex: 1; }

/* ── Empty launcher page ───────────────────────────────── */
.empty {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  height: calc(var(--empty-h) + var(--hdr));
  padding-top: var(--hdr);
  background: linear-gradient(180deg, var(--page-raised), var(--page-bg));
  text-align: center;
}
.empty > div { display: grid; justify-items: center; gap: 12px; max-width: 560px; padding-inline: var(--pad); }
.empty .page-icon { color: #9aa09e; }
.empty .kicker { color: #b9b0a1; font-size: 11px; font-weight: 700; letter-spacing: 0.06em; }
.empty h2 { color: var(--hero-title); font: 400 39px/1.1 Georgia, serif; }
.empty p { color: #aeb3b2; font-size: 14px; line-height: 21px; }
.empty .cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: calc(264px * var(--s));
  height: calc(48px * var(--s));
  border: 1px solid var(--border);
  border-radius: calc(8px * var(--s));
  background: var(--control-bg);
  color: var(--control-text);
  font-size: calc(15px * var(--s));
  font-weight: 700;
}
.empty .cta:hover { background: var(--control-hover); }

/* ── Collection ────────────────────────────────────────── */
.collection { position: absolute; inset: 0; z-index: 10; overflow-y: auto; padding: calc(var(--hdr) + 36px * var(--s)) var(--pad) calc(60px * var(--s) + var(--ftr)); background: var(--page-bg); }
.collection-head { position: relative; margin-bottom: calc(30px * var(--s)); padding-right: calc(160px * var(--s)); }
.collection-head .kicker { color: #b9b0a1; font-size: calc(11px * var(--s)); letter-spacing: 0.06em; }
.collection-head h2 { margin-top: 6px; color: #eee9dd; font-size: calc(42px * var(--s)); line-height: 1.14; font-weight: 600; }
.collection-head p { margin-top: 6px; color: #aeb3b2; font-size: calc(14px * var(--s)); }
.back {
  position: absolute;
  top: calc(-2px * var(--s));
  right: 0;
  height: calc(38px * var(--s));
  padding-inline: calc(14px * var(--s));
  border: 1px solid #e7eaec3b;
  border-radius: calc(8px * var(--s));
  background: #292d2f;
  color: #e1e3e2;
  font-size: calc(13px * var(--s));
  white-space: pre;
}
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(calc(150px * var(--s)), 1fr)); gap: calc(18px * var(--s)); }
.tile { position: relative; aspect-ratio: 1 / 1.36; overflow: hidden; border: 1px solid #e0e2e03b; border-radius: calc(8px * var(--s)); background: #242729 var(--cover) center / cover; }
.tile::before { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 34%, #050708e6); }
.tile > div { position: absolute; inset: auto calc(12px * var(--s)) calc(12px * var(--s)); display: grid; gap: calc(7px * var(--s)); text-align: left; }
.tile strong { color: #f0f0ed; font-size: calc(14px * var(--s)); font-weight: 700; line-height: 1.2; }
.tile .row { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.tile .rchip { overflow: hidden; height: calc(24px * var(--s)); padding-inline: calc(7px * var(--s)); border: 1px solid var(--border); border-radius: calc(5px * var(--s)); background: color-mix(in srgb, var(--control-bg) 85%, transparent); font-size: calc(10.5px * var(--s)); font-weight: 600; white-space: pre; text-overflow: ellipsis; }
.tile .pchip { flex: none; height: calc(28px * var(--s)); padding-inline: calc(11px * var(--s)); border-radius: calc(6px * var(--s)); background: var(--accent); color: var(--control-bg); font-size: calc(11px * var(--s)); font-weight: 700; }

/* ── Logs ───────────────────────────────────────────────── */
.logs { position: absolute; inset: 0; z-index: 10; overflow-y: auto; padding: calc(var(--hdr) + 12px) var(--pad) calc(var(--ftr) + 24px); background: linear-gradient(180deg, #171a1d, #111416); }
.logs::before { content: ""; position: absolute; inset: var(--hdr) 15% auto; height: 1px; background: linear-gradient(90deg, transparent, var(--accent), transparent); opacity: 0.5; }
.logs-head { padding: 22px 0 16px; }
.logs-head .kicker { color: #f0efe799; font: 10px Georgia, serif; letter-spacing: 0.32em; }
.logs-head h2 { margin-top: 8px; color: #eee9dd; font: 500 clamp(34px, 3.6vw, 54px) Georgia, serif; }
.logs-head p { margin-top: 6px; color: #aeb3b2; font-size: 13.5px; }
.logs-tools { display: flex; justify-content: space-between; gap: 8px; margin: 10px 0 14px; }
.logs-tools div { display: flex; gap: 6px; }
.logs-tools button { height: 30px; padding-inline: 12px; border: 1px solid var(--control-border); border-radius: 7px; color: #d8dad9; font-size: 12px; }
.logs-tools button.on { border-color: var(--accent); color: var(--accent); }
.drawer { margin-bottom: 10px; border: 1px solid #ffffff14; border-radius: 12px; background: #ffffff06; }
.drawer.live { border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.drawer summary { display: flex; justify-content: space-between; padding: 13px 16px; color: #eee; font-size: 13px; font-weight: 700; list-style: none; cursor: pointer; }
.drawer summary::-webkit-details-marker { display: none; }
.drawer summary em { color: var(--accent); font-style: normal; }
.drawer pre { height: 230px; overflow: auto; margin: 0 12px 12px; padding: 10px 12px; border-radius: 8px; background: #0c0f11; color: #c9ceca; font: 12px/21px Menlo, ui-monospace, monospace; user-select: text; }
.l-launch { color: #7cbf6a; } .l-stop { color: #ffb84d; } .l-fail { color: #ff5c5c; } .l-eng { color: var(--accent); }

/* ── Modals ─────────────────────────────────────────────── */
.backdrop-modal { position: absolute; inset: 0; z-index: 80; display: grid; place-items: center; padding: 16px; background: #000000a0; }
.backdrop-modal[hidden] { display: none; }
.dialog { width: min(calc(460px * var(--s)), 100%); padding: calc(22px * var(--s)); border-radius: calc(12px * var(--s)); background: var(--menu-bg); border: 1px solid #ffffff1a; }
.dialog h3 { color: #fff; font-size: calc(18px * var(--s)); font-weight: 600; }
.dialog p { margin-top: 10px; color: #aeb3b2; font-size: calc(12.5px * var(--s)); line-height: 1.44; }
.dialog .btns { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.dialog .btns button { height: 34px; padding-inline: 14px; border-radius: 8px; font-size: 13px; font-weight: 600; }
.dialog .cancel { border: 1px solid #ffffff2e; color: #e1e3e2; }
.dialog .primary { background: #2f6fdf; color: #fff; }
.dialog .primary:hover { background: #3d7ef0; }
.dialog .working { margin-top: 16px; color: #aeb3b2; font-size: 12.5px; }

.gs { width: min(var(--gs-w, 380px), 100%); display: grid; gap: 12px; padding: 14px; border: 1px solid var(--accent); border-radius: 10px; background: var(--menu-bg); font-size: 12px; }
.gs.wide { --gs-w: 600px; }
.gs-head { display: flex; justify-content: space-between; align-items: flex-start; }
.gs-head small { display: block; color: #939a9b; font-size: 10px; letter-spacing: 0.06em; }
.gs-head strong { display: block; margin-top: 2px; color: #fff; font-size: 14px; font-weight: 600; }
.gs-rows { display: grid; gap: 10px; }
.gs.wide .gs-rows { grid-template-columns: 1fr 1px 1fr; column-gap: 16px; }
.gs.wide .gs-rows .div { background: var(--border); }
.gs-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 28px; }
.gs-row > span { color: #e1e3e2; }
.gs-row > span small { display: block; color: #939a9b; font-size: 10.5px; }
.chips { display: flex; gap: 4px; }
.chips button { padding: 6px 8px; border: 1px solid #515456; border-radius: 5px; background: var(--menu-bg); color: #e1e3e2; font-size: 11.5px; }
.chips button.on { border-color: var(--accent); background: var(--menu-hover); color: #fff; }

/* settings */
.settings-wrap { position: absolute; inset: 0; z-index: 85; padding: clamp(16px, 4.5vh, 56px) var(--gut, 24px) 16px; background: #06080a94; }
.settings-wrap[hidden] { display: none; }
.settings { display: flex; flex-direction: column; max-width: 1180px; height: 100%; margin-inline: auto; overflow: hidden; border: 1px solid #f2efe624; border-radius: 18px; background: var(--control-bg); box-shadow: 0 22px 55px #0000008c; }
.settings-head { display: flex; align-items: center; justify-content: space-between; padding: 22px 26px 20px; border-bottom: 1px solid #ffffff14; background: color-mix(in srgb, var(--control-hover) 40%, transparent); }
.settings-head small { color: #f2efe699; font-size: 10px; font-weight: 600; letter-spacing: 0.12em; }
.settings-head h2 { font-size: 26px; line-height: 30px; font-weight: 600; }
.settings-body { display: flex; flex: 1; min-height: 0; }
.settings nav { display: grid; align-content: start; gap: 5px; width: 196px; flex: none; padding: 12px; border-right: 1px solid #ffffff10; }
.settings nav button { height: 42px; padding-inline: 13px; border: 1px solid transparent; border-radius: 9px; color: #cfd3d2; font-size: 14px; text-align: left; }
.settings nav button.on { border-color: color-mix(in srgb, var(--accent) 27%, transparent); background: color-mix(in srgb, var(--accent) 10%, transparent); color: var(--accent); font-weight: 600; }
.settings-content { flex: 1; overflow-y: auto; padding: 24px; }
.settings-content > div { display: grid; gap: 18px; max-width: 800px; }
.settings-content h3 { font-size: 24px; font-weight: 600; }
.settings-content .desc { margin-top: -10px; color: #f2efe6ad; font-size: 13px; line-height: 20px; }
.s-card { padding: 18px 20px 4px; border: 1px solid #ffffff14; border-radius: 14px; background: #ffffff05; }
.s-card.danger { border-color: #ff70703d; }
.s-card.danger h4 { color: #ff8585; }
.s-card h4 { font-size: 16px; font-weight: 600; }
.s-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-block: 16px; border-top: 1px solid #ffffff0d; }
.s-card h4 + .s-row { border-top: 0; }
.s-row strong { display: block; font-size: 14px; font-weight: 600; }
.s-row span { display: block; margin-top: 2px; color: #f2efe6ad; font-size: 13px; line-height: 20px; }
.s-ctl { display: flex; flex: none; align-items: center; gap: 8px; }
.s-btn { height: 38px; padding-inline: 13px; border: 1px solid var(--control-border); border-radius: 8px; color: #e8e6df; font-size: 14px; font-weight: 600; white-space: nowrap; }
.s-btn.primary { border-color: var(--accent); background: var(--accent); color: #101416; }
.s-btn.red { border-color: #ff5c5c8c; background: #ff5c5c1f; color: #ff8585; }
.s-seg { display: flex; gap: 4px; }
.s-seg button { height: 32px; padding-inline: 10px; border: 1px solid var(--control-border); border-radius: 7px; color: #cfd3d2; font-size: 12.5px; }
.s-seg button.on { border-color: var(--accent); color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.badge { height: 22px; padding-inline: 8px; border-radius: 4px; font-size: 11px; font-weight: 700; line-height: 22px; }
.badge.green { background: #6bbf7a24; color: #6bbf7a; }
.badge.amber { background: #d8a84b24; color: #d8a84b; }
.toggle { position: relative; width: 40px; height: 24px; border: 1px solid #ffffff38; border-radius: 12px; background: #ffffff12; }
.toggle::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #f2efe6; transition: transform 0.15s; }
.toggle.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 30%, transparent); }
.toggle.on::after { transform: translateX(16px); }
.s-input { width: 210px; height: 38px; padding-inline: 12px; border: 1px solid var(--control-border); border-radius: 8px; background: #0000004d; outline: 0; font-size: 13px; }

/* toasts + now playing */
.toasts { position: absolute; right: 20px; bottom: calc(var(--ftr) + 20px); z-index: 95; display: grid; gap: 8px; justify-items: end; pointer-events: none; }
.toast { max-width: 360px; padding: 10px 18px; border-radius: 6px; font-size: 13px; line-height: 17.5px; font-weight: 500; box-shadow: 0 10px 15px -3px #00000066; animation: toast-in 0.2s ease-out; }
.toast.ok { background: #6bbf7a; color: #fff; }
.toast.err { background: #d66a6a; color: #fff; }
.toast.info { border: 1px solid #ffffff24; background: #1d2124; color: #f2efe6; }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } }
.now {
  position: absolute;
  right: 28px;
  top: 50%;
  z-index: 90;
  width: min(460px, calc(100% - 56px));
  padding: 16px 22px;
  border: 1px solid #efcf9d47;
  border-radius: 16px;
  background: #0a0c0ed1;
  backdrop-filter: blur(10px);
  transform: translateY(-50%);
  animation: toast-in 0.25s ease-out;
  pointer-events: none;
}
.now small { color: #aeb3b2e6; font-size: 10px; font-weight: 700; letter-spacing: 0.08em; }
.now strong { display: block; margin: 4px 0 8px; color: #f1efe9; font-size: 14px; font-weight: 700; }
.now p { display: flex; align-items: center; gap: 5px; color: #e8e2d4; font-size: 13px; }
.now kbd { min-width: 22px; padding: 2px 7px; border: 1px solid #efcf9d66; border-radius: 6px; background: #efcf9d1f; color: #efcf9d; font: 700 12px "Rethink Sans", sans-serif; text-align: center; }

.hidden { display: none !important; }
:focus-visible { outline: 2px solid var(--sp0); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
#theme-btn { position: relative; }
#theme-btn:not([data-glyph=""])::after { content: attr(data-glyph); position: absolute; inset: 0; display: grid; place-items: center; font-size: calc(18px * var(--s)); }
