/* Brink panel. The panel is a <liquid-glass> scene: its backdrop is the wallpaper behind the
   panel, and every [glass] element is a ray-traced slab bending it. Without WebGL the same
   elements fall back to frosted CSS (the rules outside `.lg`). */
:root {
  --text: #18191b;
  --sub: rgba(30, 32, 36, 0.62);
  --faint: rgba(30, 32, 36, 0.3);
  --glass-bg: rgba(255, 255, 255, 0.42);
  --line: rgba(40, 40, 60, 0.1);
  --warm: linear-gradient(0deg, #ff9a1f, #ffd36b);
  --cool: linear-gradient(0deg, #13a89e, #8ff0e2);
  --signal: linear-gradient(160deg, #ff8a3d, #ff4f12);
  --accent: #ff5a1a;
  --ok: #30d158;
  --warn: #ff9f0a;
  --menu: rgba(250, 250, 252, 0.94);
  --shade: rgba(255, 255, 255, 0.5);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --text: #f5f5f7;
  --sub: rgba(235, 235, 245, 0.66);
  --faint: rgba(235, 235, 245, 0.3);
  --glass-bg: rgba(40, 40, 50, 0.5);
  --line: rgba(255, 255, 255, 0.1);
  --menu: rgba(40, 40, 46, 0.95);
  --shade: rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { background: transparent; }
body {
  font: 13px/1.3 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
  cursor: default;
  overflow: hidden;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: default; }
svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- the scene ---------- */
liquid-glass.panel {
  width: 320px;
  padding: 12px;
  border-radius: 20px;
  color: var(--text);
  background: #d9d7d2;
  min-height: 0;
}
:root[data-theme="dark"] liquid-glass.panel { background: #1d1e20; }

/* Default glass look for every pane in the panel. */
/* Solid, still glass: thick slabs with strong refraction and colour split, no bulge toward the
   pointer, no swell on press. Text-bearing panes add a little frost and tint (below). */
[glass] {
  --glass-depth: 1.5;
  --glass-dome: 1.6;
  --glass-ior: 1.5;
  --glass-frost: 0;
  --glass-tint: rgba(255, 255, 255, 0.06);
  --glass-shadow: 0.6;
  --glass-chroma: 0.022;
  --glass-pull: 0;
  --glass-press: 1;
}
:root[data-theme="dark"] [glass] { --glass-tint: rgba(10, 10, 14, 0.12); }
/* Panes that carry text: flatter faces so what's under the words is what's behind them. */
.chip[glass], .strip[glass], .cc-slider[glass], .list[glass] { --glass-dome: 0.6; --glass-frost: 0.14; --glass-tint: rgba(255, 255, 255, 0.22); }
:root[data-theme="dark"] .chip[glass], :root[data-theme="dark"] .strip[glass], :root[data-theme="dark"] .cc-slider[glass], :root[data-theme="dark"] .list[glass] { --glass-tint: rgba(12, 12, 16, 0.34); }

/* Fallback surfaces (no WebGL yet / at all). Cleared once the glass renders. */
[data-g] { background: var(--glass-bg); box-shadow: inset 0 0.5px 0 rgba(255, 255, 255, 0.7), 0 1px 3px rgba(0, 0, 0, 0.06); }
liquid-glass[data-renderer="webgl"][data-ready] [glass] { background: transparent; box-shadow: none; }

.view[hidden] { display: none; }

/* ---------- header ---------- */
.top { display: flex; align-items: center; gap: 8px; padding: 0 2px 10px; min-height: 30px; }
.word { display: flex; align-items: center; gap: 7px; font-size: 15px; font-weight: 700; letter-spacing: -0.02em; flex: 1; text-shadow: 0 1px 6px var(--shade); }
.logo { width: 20px; height: 20px; border-radius: 6px; background: url("icon.png") center / 128% no-repeat; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15); }
.chip { display: flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 600; color: var(--sub); padding: 5px 10px; border-radius: 99px; }
.chip i { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 6px var(--ok); }
.chip.warn i { background: var(--warn); box-shadow: 0 0 6px var(--warn); }
.chip.off i { background: var(--faint); box-shadow: none; }
.title { flex: 1; font-size: 15px; font-weight: 700; letter-spacing: -0.02em; text-shadow: 0 1px 6px var(--shade); }
.ver { font-size: 11px; color: var(--sub); text-shadow: 0 1px 6px var(--shade); }

/* ---------- trackpad mirror ---------- */
.mirror {
  position: relative; display: flex; gap: 8px; height: 172px; padding: 9px; margin-bottom: 12px; border-radius: 24px;
  /* A soft plate, not a slab: the capsules on it are the glass. */
  background: rgba(255, 255, 255, 0.16);
  box-shadow: inset 0 0.5px 0 rgba(255, 255, 255, 0.55), inset 0 0 0 0.5px rgba(255, 255, 255, 0.18);
}
:root[data-theme="dark"] .mirror { background: rgba(255, 255, 255, 0.05); box-shadow: inset 0 0.5px 0 rgba(255, 255, 255, 0.16); }
.cap { position: relative; flex: none; width: 46px; border-radius: 23px; overflow: hidden; --glass-depth: 1.3; }

.cap .fill { position: absolute; inset: auto 0 0 0; height: 50%; opacity: 0.82; transition: height 0.16s ease-out; }
.cap .fill::after { content: ""; position: absolute; inset: 0 0 auto; height: 12px; background: linear-gradient(rgba(255, 255, 255, 0.6), transparent); border-radius: 6px 6px 0 0; }
.cap.warm .fill { background: var(--warm); }
.cap.cool .fill { background: var(--cool); }
.cap.muted .fill { opacity: 0.3; filter: grayscale(1); }
.cap .pct { position: absolute; top: 10px; left: 0; right: 0; text-align: center; font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--sub); }
.cap .glyph { position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%); color: #fff; display: grid; }
.cap .glyph svg { width: 18px; height: 18px; filter: drop-shadow(0 1px 1.5px rgba(0, 0, 0, 0.25)); }
.cap.pct-on-fill .pct { color: rgba(20, 20, 22, 0.78); }
.cap.glyph-on-glass .glyph { color: var(--sub); }
.cap.glyph-on-glass .glyph svg { filter: none; }

.finger {
  position: absolute; width: 28px; height: 28px; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle at 40% 35%, #fff, rgba(255, 255, 255, 0.5) 55%, rgba(255, 255, 255, 0) 72%);
  box-shadow: 0 0 16px rgba(255, 255, 255, 0.8);
  opacity: 0; transform: scale(0.5); transition: opacity 0.18s, transform 0.25s cubic-bezier(0.3, 1.5, 0.5, 1);
}
.cap .finger { left: 50%; top: 50%; margin: -14px 0 0 -14px; }
.strip .finger { top: 50%; left: 50%; margin: -14px 0 0 -14px; }
.live > .finger { opacity: 1; transform: scale(1); }

.mid { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: space-between; }
.strip {
  position: relative; height: 32px; border-radius: 16px; display: flex; align-items: center; justify-content: center; gap: 14px;
  color: var(--sub); font-size: 11px; font-weight: 600; --glass-depth: 0.9;
  transition: opacity 0.25s;
}
#strip-top { justify-content: flex-start; padding: 0 12px; gap: 7px; }
.strip svg { width: 15px; height: 15px; }
#strip-media svg { width: 13px; height: 13px; stroke-width: 1.4; }
.strip.off { opacity: 0.35; }
.strip.live { color: var(--text); }
.corner { position: absolute; right: 9px; top: 50%; margin-top: -4.5px; width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid var(--faint); transition: all 0.3s; }
.corner.flash { background: #ff453a; border-color: #ff453a; box-shadow: 0 0 10px #ff453a; }
.corner[hidden] { display: none; }
.readout { text-align: center; text-shadow: 0 1px 8px var(--shade); }
.readout b { display: block; font-size: 32px; font-weight: 300; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; line-height: 1; }
.readout b:empty { display: none; }
.readout span { display: block; font-size: 11.5px; font-weight: 500; color: var(--sub); margin-top: 5px; }

/* ---------- tiles ---------- */
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-bottom: 12px; }
.tile { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.disc { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; margin-bottom: 6px; }
.disc svg { width: 20px; height: 20px; }
/* Clear glass discs. On: the icon at full strength with a warm glow under it. Off: dimmed. */
.disc { color: var(--sub); --glass-depth: 1.6; --glass-dome: 2; }
.disc svg { transition: color 0.2s, filter 0.2s; }
/* On: a warm light inside the glass (drawn over the slab, under the icon) plus an orange tint in
   the glass itself, so the state reads at a glance over any backdrop. */
.tile.on .disc { color: #fff; --glass-tint: rgba(255, 96, 28, 0.42); }
liquid-glass .tile.on .disc[glass], .tile.on .disc {
  background: radial-gradient(circle at 50% 55%, rgba(255, 140, 60, 0.75), rgba(255, 90, 26, 0.38) 45%, rgba(255, 90, 26, 0) 72%);
  box-shadow: 0 0 18px rgba(255, 100, 30, 0.45);
}
.tile.on .disc svg { stroke-width: 2.1; filter: drop-shadow(0 1px 2px rgba(80, 20, 0, 0.5)); }
.tile.on small { color: var(--accent); }
:root[data-theme="dark"] .tile.on small { color: #ff8a4c; }

.tile b { font-size: 11px; font-weight: 650; text-shadow: 0 1px 6px var(--shade); }
.tile small { font-size: 10px; color: var(--sub); text-shadow: 0 1px 6px var(--shade); }

/* ---------- capsule sliders ---------- */
.sliders { display: grid; gap: 8px; }
.cc-slider {
  position: relative; height: 36px; border-radius: 18px; overflow: hidden; display: flex; align-items: center; gap: 8px; padding: 0 14px;
  touch-action: none; --glass-depth: 1.1;
}
.cc-fill {
  position: absolute; inset: 0 auto 0 0; width: 50%; border-radius: 18px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: inset 0 0.5px 0 #fff, 2px 0 10px rgba(0, 0, 0, 0.08);
  transition: width 0.08s linear;
}
:root[data-theme="dark"] .cc-fill { background: rgba(255, 255, 255, 0.24); box-shadow: inset 0 0.5px 0 rgba(255, 255, 255, 0.35); }
.cc-slider.dragging .cc-fill { transition: none; }
.cc-slider > svg, .cc-slider b, .cc-val { position: relative; z-index: 1; }
.cc-slider > svg { color: var(--sub); }
.cc-slider b { flex: 1; font-size: 12.5px; font-weight: 600; }
.cc-val { font-size: 12px; font-variant-numeric: tabular-nums; color: var(--sub); }

/* ---------- footer ---------- */
.foot { display: flex; align-items: center; gap: 8px; padding: 12px 2px 0; }
.spacer { flex: 1; }
.round { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; color: var(--text); }
.round svg { width: 15px; height: 15px; }
.update { font-size: 11px; font-weight: 600; color: #fff; background: var(--signal); padding: 5px 11px; border-radius: 99px; }
.update[hidden] { display: none; }

/* ---------- settings ---------- */
h6 { font-size: 11px; font-weight: 700; color: var(--sub); padding: 10px 10px 5px; text-shadow: 0 1px 6px var(--shade); }
.list { border-radius: 18px; padding: 2px 0; --glass-depth: 0.6; }
.item { display: flex; align-items: center; gap: 10px; padding: 8px 13px; min-height: 44px; }
.item + .item { border-top: 0.5px solid var(--line); }
.item .txt { flex: 1; min-width: 0; }
.item b { display: block; font-weight: 550; font-size: 13px; }
.item .txt span { display: block; font-size: 11px; color: var(--sub); margin-top: 1px; }

/* macOS 26 switch: capsule knob that swells into glass while pressed. */
.switch { -webkit-appearance: none; appearance: none; flex: none; position: relative; width: 38px; height: 22px; border-radius: 11px; background: rgba(120, 120, 128, 0.24); transition: background 0.25s; }
.switch::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 24px; height: 18px; border-radius: 9px;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.22);
  transition: transform 0.35s cubic-bezier(0.3, 1.4, 0.5, 1), background 0.2s;
}
.switch:checked { background: var(--accent); }
.switch:checked::after { transform: translateX(10px); }
.switch:active::after { background: rgba(255, 255, 255, 0.6); box-shadow: inset 0 1px 1px #fff, inset 0 -1px 2px rgba(0, 0, 0, 0.1), 0 2px 8px rgba(0, 0, 0, 0.18); transform: scale(1.25); }
.switch:checked:active::after { transform: translateX(10px) scale(1.25); }
.select { position: relative; flex: none; }
.select select {
  -webkit-appearance: none; appearance: none; font: inherit; font-size: 12px; color: var(--text);
  background: rgba(255, 255, 255, 0.55); border: 0; border-radius: 99px; padding: 4px 24px 4px 11px; outline: none;
  box-shadow: inset 0 0.5px 0 #fff, 0 1px 2px rgba(0, 0, 0, 0.08);
}
:root[data-theme="dark"] .select select { background: rgba(255, 255, 255, 0.12); box-shadow: none; }
.select::after {
  content: ""; position: absolute; right: 8px; top: 50%; width: 8px; height: 10px; transform: translateY(-50%); pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 10'%3E%3Cpath d='M1.5 3.5 4 1l2.5 2.5M1.5 6.5 4 9l2.5-2.5' fill='none' stroke='%23888' stroke-width='1.3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
}
.seg { display: flex; padding: 2px; border-radius: 99px; background: rgba(120, 120, 128, 0.2); }
.seg button { font-size: 11.5px; padding: 3px 11px; border-radius: 99px; color: var(--sub); transition: all 0.2s; }
.seg button.on { background: #fff; color: #1c1c1e; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15); }

/* ---------- setup guide ---------- */
.guide { padding: 4px 14px; margin-bottom: 12px; border-radius: 20px; background: var(--glass-bg); }
.guide[hidden] { display: none; }
.step { display: flex; gap: 10px; padding: 11px 0; }
.step + .step { border-top: 0.5px solid var(--line); }
.num { flex: none; width: 22px; height: 22px; border-radius: 50%; background: var(--signal); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.step.done .num { background: var(--ok); font-size: 0; }
.step.done .num::before { content: "✓"; font-size: 12px; }
.step .txt b { display: block; font-weight: 650; }
.step .txt span { display: block; color: var(--sub); font-size: 11.5px; margin-top: 2px; }
.step.done .pill-btn { display: none; }
.step.waiting { opacity: 0.45; }
.pill-btn { margin-top: 8px; background: var(--signal); color: #fff; font-size: 12px; font-weight: 600; padding: 6px 13px; border-radius: 99px; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 3px 10px rgba(255, 90, 26, 0.3); }

/* ---------- menu / toast ---------- */
.menu {
  position: absolute; right: 12px; bottom: 52px; min-width: 190px; padding: 5px; border-radius: 12px; z-index: 10;
  background: var(--menu); color: var(--text); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25), 0 0 0 0.5px var(--line);
}
.menu[hidden] { display: none; }
.menu button { display: block; width: 100%; text-align: left; padding: 6px 10px; border-radius: 7px; font-size: 13px; }
.menu button:hover { background: var(--accent); color: #fff; }
.menu hr { border: 0; border-top: 0.5px solid var(--line); margin: 4px 8px; }
.toast { position: absolute; left: 50%; bottom: 56px; transform: translateX(-50%); white-space: nowrap; z-index: 11; background: var(--menu); color: var(--text); font-size: 12px; padding: 7px 13px; border-radius: 99px; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2); }
.toast[hidden] { display: none; }
