/* Layout: a guided flow with hard-edged blocks. Device, then firmware as a release timeline, then a docked download bar that stays in reach. */
:root {
  --bg: #dce4f3;
  --surface: #ffffff;
  --sunken: #edf1f9;
  --fg: #11151b;
  --edge: #11151b;
  --shadow: #11151b;
  --muted: #465163;
  --accent: #e0805c;
  --on-accent: #11151b;
  --blue: #3c67f2;
  --on-blue: #ffffff;
  --ok: #17895c;
  --warn: #8a5300;
  --warn-bg: #ffe9b8;
  --err: #a3262a;
  --err-bg: #ffd9da;
  --info: #3c67f2;
  --info-bg: #d9e4ff;
  --btn-bg: #11151b;
  --btn-fg: #ffffff;
  --pick-bg: #f6d9ca;
  --pick-fg: #3a1a0c;
  --kc-bw: 2px;
  --kc-radius: 6px;
  --kc-radius-sm: 4px;
  --kc-shadow: 4px 4px 0 var(--shadow);
  --font-ui: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "DM Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #10141b;
    --surface: #1a202b;
    --sunken: #232b38;
    --fg: #eef2f8;
    --edge: #d5dcea;
    --shadow: #000000;
    --muted: #a2afc2;
    --accent: #ea8d69;
    --on-accent: #1a0d07;
    --blue: #7a9bff;
    --on-blue: #0a1330;
    --ok: #4fd3a4;
    --warn: #f0b94d;
    --warn-bg: #3a2c0e;
    --err: #ff8d8f;
    --err-bg: #3d1618;
    --info: #7a9bff;
    --info-bg: #16224a;
    --btn-bg: #ea8d69;
    --btn-fg: #1a0d07;
    --pick-bg: #43271b;
    --pick-fg: #fbe3d6;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #10141b;
  --surface: #1a202b;
  --sunken: #232b38;
  --fg: #eef2f8;
  --edge: #d5dcea;
  --shadow: #000000;
  --muted: #a2afc2;
  --accent: #ea8d69;
  --on-accent: #1a0d07;
  --blue: #7a9bff;
  --on-blue: #0a1330;
  --ok: #4fd3a4;
  --warn: #f0b94d;
  --warn-bg: #3a2c0e;
  --err: #ff8d8f;
  --err-bg: #3d1618;
  --info: #7a9bff;
  --info-bg: #16224a;
  --btn-bg: #ea8d69;
  --btn-fg: #1a0d07;
  --pick-bg: #43271b;
  --pick-fg: #fbe3d6;
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #dce4f3;
  --surface: #ffffff;
  --sunken: #edf1f9;
  --fg: #11151b;
  --edge: #11151b;
  --shadow: #11151b;
  --muted: #465163;
  --accent: #e0805c;
  --on-accent: #11151b;
  --blue: #3c67f2;
  --on-blue: #ffffff;
  --ok: #17895c;
  --warn: #8a5300;
  --warn-bg: #ffe9b8;
  --err: #a3262a;
  --err-bg: #ffd9da;
  --info: #3c67f2;
  --info-bg: #d9e4ff;
  --btn-bg: #11151b;
  --btn-fg: #ffffff;
  --pick-bg: #f6d9ca;
  --pick-fg: #3a1a0c;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: radial-gradient(ellipse 80% 50% at 50% -10%, rgba(224, 128, 92, 0.12), transparent 70%),
              radial-gradient(ellipse 60% 40% at 90% 15%, rgba(60, 103, 242, 0.08), transparent 60%),
              var(--bg);
  background-attachment: fixed;
  color: var(--fg);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.5;
  font-weight: 500;
  padding-block: 0;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  position: relative;
  min-height: 100vh;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) body {
    background: radial-gradient(ellipse 80% 50% at 50% -10%, rgba(234, 141, 105, 0.14), transparent 70%),
                radial-gradient(ellipse 60% 40% at 90% 15%, rgba(122, 155, 255, 0.08), transparent 60%),
                var(--bg);
    background-attachment: fixed;
  }
}

:root[data-theme="dark"] body {
  background: radial-gradient(ellipse 80% 50% at 50% -10%, rgba(234, 141, 105, 0.14), transparent 70%),
              radial-gradient(ellipse 60% 40% at 90% 15%, rgba(122, 155, 255, 0.08), transparent 60%),
              var(--bg);
  background-attachment: fixed;
}

/* Dynamic Ambient Spotlight Aura following pointer */
.spotlight-ambient {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 0;
  background: radial-gradient(
    700px circle at var(--cursor-x, 50vw) var(--cursor-y, 30vh),
    rgba(224, 128, 92, 0.08),
    transparent 65%
  );
  opacity: 1;
}

:root[data-theme="dark"] .spotlight-ambient {
  background: radial-gradient(
    700px circle at var(--cursor-x, 50vw) var(--cursor-y, 30vh),
    rgba(234, 141, 105, 0.10),
    transparent 65%
  );
}

.wrap {
  position: relative;
  z-index: 1;
  max-width: 880px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding-bottom: 24px;
}

button, input {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
}

.mono {
  font-family: var(--font-mono);
}

.num {
  font-variant-numeric: tabular-nums;
}

/* Steps Navigation Sidebar */
.steps-sidebar {
  position: fixed;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 20px;
  z-index: 40;
}

.steps-sidebar-track {
  position: absolute;
  left: 19px;
  top: 15px;
  bottom: 15px;
  width: 2px;
  background: var(--edge);
  z-index: 1;
}

.step-node {
  position: relative;
  display: flex;
  align-items: center;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-decoration: none;
}

.step-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid var(--edge);
  background: var(--surface);
  color: var(--fg);
  font-weight: 900;
  font-size: 0.95rem;
  display: inline-grid;
  place-items: center;
  box-shadow: 3px 3px 0 var(--shadow);
  transition: transform 0.18s ease, background 0.18s ease, color 0.18s ease;
  position: relative;
  z-index: 2;
}

.step-node:hover .step-circle {
  transform: translate(1px, 1px);
  background: var(--pick-bg);
  color: var(--pick-fg);
}

.step-node.done .step-circle {
  background: var(--ok);
  color: #ffffff;
  border-color: var(--edge);
}

.step-node.active .step-circle {
  background: var(--accent);
  color: var(--on-accent);
  border-color: var(--edge);
  animation: step-breathe 2.8s ease-in-out infinite;
}

@keyframes step-breathe {
  0%, 100% {
    box-shadow: 3px 3px 0 var(--shadow);
  }
  50% {
    box-shadow: 3px 3px 0 var(--shadow), 0 0 16px rgba(224, 128, 92, 0.55);
  }
}

.step-label {
  position: absolute;
  left: 50px;
  white-space: nowrap;
  background: var(--surface);
  border: 2px solid var(--edge);
  color: var(--fg);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 800;
  box-shadow: 3px 3px 0 var(--shadow);
  opacity: 0;
  transform: translateX(-8px);
  pointer-events: none;
  transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1), transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 10;
}

.step-node:hover .step-label {
  opacity: 1;
  transform: translateX(0);
}

.step-node .step-label::before {
  content: "";
  position: absolute;
  left: -6px;
  top: 50%;
  transform: translateY(-50%) rotate(45deg);
  width: 8px;
  height: 8px;
  background: var(--surface);
  border-left: 2px solid var(--edge);
  border-bottom: 2px solid var(--edge);
}

/* Header */
.top {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 10px 20px;
  padding-top: 22px;
}

.top h1 {
  margin: 0;
  font-weight: 900;
  font-size: clamp(2rem, 7vw, 3.1rem);
  letter-spacing: -0.04em;
  line-height: 0.95;
}

.top h1 span {
  background: var(--accent);
  color: var(--on-accent);
  padding: 0 8px;
  margin-left: 2px;
}

.top p {
  margin: 6px 0 0;
  color: var(--muted);
}

.tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tl {
  border: 2px solid var(--edge);
  background: var(--surface);
  border-radius: 6px;
  padding: 5px 12px;
  font-weight: 600;
  font-size: 0.84rem;
  cursor: pointer;
  text-decoration: none;
  color: var(--fg);
  box-shadow: 3px 3px 0 var(--shadow);
}

.tl:hover {
  transform: translate(1px, 1px);
  box-shadow: 2px 2px 0 var(--shadow);
}

.tl i {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--ok);
  margin-right: 7px;
  border: 1.5px solid var(--edge);
  position: relative;
}

.tl i::after {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 1.5px solid var(--ok);
  opacity: 0.6;
  animation: live-pulse 2.4s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
}

@keyframes live-pulse {
  0% {
    transform: scale(0.7);
    opacity: 0.9;
  }
  60%, 100% {
    transform: scale(2.2);
    opacity: 0;
  }
}

.modes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 2px solid var(--edge);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface);
  box-shadow: 4px 4px 0 var(--shadow);
}

.modes button {
  border: 0;
  background: none;
  padding: 12px;
  font-weight: 800;
  cursor: pointer;
  font-size: 1rem;
}

.modes button + button {
  border-left: 2px solid var(--edge);
}

.modes button[aria-pressed="true"] {
  background: var(--pick-bg);
  color: var(--pick-fg);
  box-shadow: inset 0 -4px 0 var(--accent);
}

.step {
  background: var(--surface);
  border: 2px solid var(--edge);
  border-radius: 8px;
  padding: 18px 20px 20px;
  box-shadow: 4px 4px 0 var(--shadow);
}

.step h2 {
  margin: 0 0 14px;
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 12px;
}

.step h2 b {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 2px solid var(--edge);
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 0.95rem;
}

/* Category Tiles & Cursor-Following Glider */
.tiles {
  position: relative;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.tile {
  position: relative;
  z-index: 1;
  border: 2px solid var(--edge);
  background: var(--sunken);
  border-radius: 6px;
  padding: 10px 10px 8px;
  cursor: pointer;
  text-align: left;
  display: flex;
  flex-direction: column;
  transition: transform 0.15s ease;
}

/* NO individual tile darkening on hover - tint is smoothly handled by glider */
.tile:hover {
  background: var(--sunken);
}

.tile b {
  font-weight: 800;
  font-size: 0.95rem;
  line-height: 1.15;
}

.tile span {
  font-size: 0.78rem;
  color: var(--muted);
}

.tile[aria-pressed="true"] {
  background: var(--accent);
  color: var(--on-accent);
}

.tile[aria-pressed="true"] span {
  color: inherit;
}

/* Universal Morphing Tile Glider */
.tile-glider-global {
  position: fixed;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 35;
  opacity: 0;
  box-sizing: border-box;
  will-change: transform, width, height, border-radius, opacity;
  border: 2px solid var(--accent);
  background: linear-gradient(135deg, rgba(224, 128, 92, 0.16) 0%, rgba(224, 128, 92, 0.07) 100%);
  box-shadow: 0 4px 20px -2px rgba(224, 128, 92, 0.35);
  backdrop-filter: blur(0.5px);
  -webkit-backdrop-filter: blur(0.5px);
  transition: transform 0.26s cubic-bezier(0.2, 0.9, 0.3, 1),
              width 0.26s cubic-bezier(0.2, 0.9, 0.3, 1),
              height 0.26s cubic-bezier(0.2, 0.9, 0.3, 1),
              border-radius 0.26s cubic-bezier(0.2, 0.9, 0.3, 1),
              opacity 0.2s cubic-bezier(0.2, 0.9, 0.3, 1);
}

:root[data-theme="dark"] .tile-glider-global {
  background: linear-gradient(135deg, rgba(234, 141, 105, 0.18) 0%, rgba(234, 141, 105, 0.08) 100%);
  box-shadow: 0 4px 24px -2px rgba(234, 141, 105, 0.45);
}

.tile-glider {
  display: none !important;
}

.inp {
  width: 100%;
  border: 2px solid var(--edge);
  background: var(--surface);
  border-radius: 6px;
  padding: 10px 12px;
  min-height: 44px;
}

.inp:focus {
  outline: 3px solid var(--blue);
  outline-offset: 0;
}

.chips {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 8px;
  margin-top: 12px;
  max-height: 270px;
  overflow-y: auto;
  padding: 2px;
  scrollbar-width: thin;
  scrollbar-color: var(--muted) var(--sunken);
}

.chips::-webkit-scrollbar {
  width: 6px;
}
.chips::-webkit-scrollbar-track {
  background: var(--sunken);
  border-radius: 4px;
}
.chips::-webkit-scrollbar-thumb {
  background: var(--muted);
  border-radius: 4px;
}
.chips::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

.chip {
  position: relative;
  border: 2px solid var(--edge);
  background: var(--surface);
  border-radius: 6px;
  padding: 8px 12px;
  cursor: pointer;
  text-align: left;
  min-width: 0;
  transition: transform 0.12s ease;
}

.chip:hover {
  background: var(--surface);
}

.chip b {
  display: block;
  font-weight: 700;
  font-size: 0.92rem;
}

.chip span {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--muted);
}

.chip[aria-pressed="true"] {
  background: var(--pick-bg);
  color: var(--pick-fg);
  box-shadow: inset 0 0 0 2px var(--accent);
}

.chip[aria-pressed="true"] span {
  color: inherit;
  opacity: 0.75;
}

.hint {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.btn {
  border: 2px solid var(--edge);
  background: var(--btn-bg);
  color: var(--btn-fg);
  border-radius: 6px;
  padding: 10px 18px;
  font-weight: 800;
  cursor: pointer;
  min-height: 44px;
  box-shadow: 3px 3px 0 var(--shadow);
}

.btn.ghost {
  background: var(--surface);
  color: var(--fg);
}

.btn:hover {
  transform: translate(1px, 1px);
  box-shadow: 2px 2px 0 var(--shadow);
}

.urlrow {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.urlrow .inp {
  flex: 1 1 280px;
  min-width: 0;
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

/* Step 2: Firmware Filters & Search Controls */
.fw-controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
}

.fw-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.fw-pill {
  border: 2px solid var(--edge);
  background: var(--surface);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 2px 2px 0 var(--shadow);
  transition: transform 0.15s ease;
}

.fw-pill:hover {
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0 var(--shadow);
}

.fw-pill[aria-pressed="true"] {
  background: var(--pick-bg);
  color: var(--pick-fg);
  box-shadow: inset 0 0 0 2px var(--accent);
}

.fw-pill:disabled,
.fw-pill[aria-disabled="true"] {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
  transform: none !important;
  box-shadow: none !important;
}

.fw-search {
  width: 100%;
  border: 2px solid var(--edge);
  background: var(--surface);
  border-radius: 6px;
  padding: 9px 12px;
  font-size: 0.88rem;
}

.expand-btn {
  width: 100%;
  margin-top: 10px;
  font-size: 0.88rem;
  font-weight: 800;
  border: 2px solid var(--edge);
  background: var(--surface);
  color: var(--fg);
  border-radius: 6px;
  padding: 10px 14px;
  cursor: pointer;
  box-shadow: 3px 3px 0 var(--shadow);
}

.expand-btn:hover {
  background: var(--sunken);
  transform: translate(1px, 1px);
  box-shadow: 2px 2px 0 var(--shadow);
}

/* Release Timeline */
.tline {
  list-style: none;
  margin: 0;
  padding: 0 0 0 18px;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tline::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  background: var(--edge);
}

.rel {
  position: relative;
}

.rel::before {
  content: "";
  position: absolute;
  left: -18px;
  top: 18px;
  width: 15px;
  height: 15px;
  border: 3px solid var(--edge);
  border-radius: 50%;
  background: var(--surface);
}

.rel[data-on="true"]::before {
  background: var(--accent);
}

.relbtn {
  position: relative;
  width: 100%;
  border: 2px solid var(--edge);
  background: var(--surface);
  border-radius: 6px;
  padding: 10px 14px;
  cursor: pointer;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 16px;
  text-align: left;
  transition: transform 0.12s ease;
}

.relbtn:hover {
  background: var(--surface);
}

.relbtn[aria-pressed="true"] {
  background: var(--pick-bg);
  color: var(--pick-fg);
  box-shadow: inset 0 0 0 2px var(--accent);
}

.relbtn .v {
  font-weight: 800;
  font-size: 1.1rem;
  min-width: 110px;
}

.relbtn .m {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  opacity: 0.8;
}

.relbtn .tags-group {
  margin-left: auto;
  display: flex;
  gap: 6px;
  align-items: center;
}

.relbtn .tag {
  border: 2px solid currentColor;
  border-radius: 4px;
  padding: 1px 8px;
  font-size: 0.74rem;
  font-weight: 800;
  white-space: nowrap;
  letter-spacing: 0.02em;
}

.relbtn .tag.ok {
  color: var(--ok);
  background: rgba(23, 137, 92, 0.12);
  border-color: var(--ok);
}

.relbtn .tag.beta {
  color: var(--accent);
  background: rgba(224, 128, 92, 0.14);
  border-color: var(--accent);
  box-shadow: 0 0 6px rgba(224, 128, 92, 0.25);
}

.relbtn .tag.internal {
  color: var(--err);
  background: var(--err-bg);
  border-color: var(--err);
  box-shadow: 0 0 6px rgba(163, 38, 42, 0.3);
}

.relbtn[aria-pressed="true"] .tag.ok {
  color: var(--pick-fg);
}

/* Range Meter */
.meter {
  border: 2px solid var(--edge);
  border-radius: 6px;
  background: var(--sunken);
  height: 40px;
  position: relative;
  overflow: hidden;
}

.meter i {
  position: absolute;
  top: 0;
  bottom: 0;
  min-width: 4px;
  background: var(--accent);
  border-left: 2px solid var(--edge);
  border-right: 2px solid var(--edge);
  overflow: hidden;
}

.meter i::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.5), transparent);
  animation: meter-sheen 2.4s infinite;
}

@keyframes meter-sheen {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(200%);
  }
}

.meter i.t {
  background: var(--blue);
  border-right: 0;
}

.ml {
  position: relative;
  height: 42px;
  font-size: 0.8rem;
  margin-top: 6px;
}

.ml div {
  position: absolute;
  white-space: nowrap;
}

.ml .t {
  text-align: right;
}

.mt {
  margin: 6px 0 16px;
  font-weight: 600;
}

.mt b {
  font-weight: 900;
}

.vrow {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.vopt {
  position: relative;
  border: 2px solid var(--edge);
  background: var(--surface);
  border-radius: 6px;
  padding: 10px 14px;
  cursor: pointer;
  text-align: left;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 0 10px;
  transition: transform 0.12s ease;
}

.vopt:hover {
  background: var(--surface);
}

.vopt .r {
  width: 16px;
  height: 16px;
  border: 2px solid var(--edge);
  border-radius: 50%;
  margin-top: 3px;
}

.vopt[aria-pressed="true"] {
  background: var(--sunken);
  box-shadow: inset 0 0 0 2px var(--edge);
}

.vopt[aria-pressed="true"] .r {
  background: radial-gradient(var(--accent) 50%, var(--surface) 55%);
}

.vopt b {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 500;
  word-break: break-all;
}

.vopt span.d {
  grid-column: 2;
  font-size: 0.8rem;
  color: var(--muted);
}

.code {
  border: 2px solid var(--edge);
  border-radius: 6px;
  overflow: hidden;
  margin-top: 10px;
}

.code .hd {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 10px;
  background: var(--sunken);
  border-bottom: 2px solid var(--edge);
  font-weight: 700;
  font-size: 0.86rem;
  flex-wrap: wrap;
  gap: 6px;
}

.small {
  border: 2px solid var(--edge);
  background: var(--surface);
  border-radius: 4px;
  padding: 1px 10px;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.78rem;
}

.small[aria-pressed="true"] {
  background: var(--pick-bg);
  color: var(--pick-fg);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.hd .rt {
  display: flex;
  gap: 6px;
}

pre {
  margin: 0;
  padding: 12px 14px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  line-height: 1.65;
  background: var(--surface);
}

/* Docked bottom download bar */
.dock {
  position: sticky;
  bottom: 0;
  z-index: 30;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  margin-top: 6px;
}

.dockin {
  background: var(--surface);
  border: 2px solid var(--edge);
  border-radius: 8px;
  padding: 10px;
  box-shadow: 4px 4px 0 var(--shadow);
}

.dbtns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.dl {
  border: 2px solid var(--edge);
  border-radius: 6px;
  padding: 10px 14px;
  cursor: pointer;
  text-align: left;
  display: flex;
  flex-direction: column;
  min-height: 66px;
}

.dl b {
  font-weight: 800;
  font-size: 1.02rem;
  display: flex;
  gap: 8px;
  align-items: center;
}

.dl span {
  font-size: 0.78rem;
  opacity: 0.9;
}

.dl.raw {
  background: var(--accent);
  color: var(--on-accent);
}

.dl.macho {
  background: var(--blue);
  color: var(--on-blue);
}

.dl:hover:not(:disabled) {
  transform: translate(1px, 1px);
}

.dl:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.dl.busy b::after {
  content: "";
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.dstat {
  margin: 8px 2px 0;
  font-size: 0.84rem;
  color: var(--muted);
  display: flex;
  align-items: center;
}

.dstat b {
  color: var(--fg);
  font-weight: 700;
  margin-left: 4px;
}

.dstat-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ok);
  margin-right: 8px;
  box-shadow: 0 0 6px var(--ok);
  flex-shrink: 0;
}

.dstat-dot.busy {
  background: var(--warn);
  box-shadow: 0 0 8px var(--warn);
  animation: dstat-dot-pulse 0.9s ease-in-out infinite alternate;
}

@keyframes dstat-dot-pulse {
  from {
    opacity: 0.45;
    transform: scale(0.85);
  }
  to {
    opacity: 1;
    transform: scale(1.2);
  }
}

.skel {
  height: 60px;
  border: 2px solid var(--edge);
  border-radius: 6px;
  background: linear-gradient(90deg, var(--sunken), var(--bg), var(--sunken));
  background-size: 200% 100%;
  animation: sh 1.2s linear infinite;
}

@keyframes sh {
  to {
    background-position: -200% 0;
  }
}

.foot {
  color: var(--muted);
  font-size: 0.82rem;
  margin: 0;
  text-align: center;
}

/* Floating Toasts */
.kc-toasts {
  position: fixed;
  z-index: 100;
  top: calc(12px + env(safe-area-inset-top, 0px));
  right: max(12px, env(safe-area-inset-right, 0px));
  width: min(380px, calc(100vw - 24px));
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.kc-toast {
  border-radius: var(--kc-radius, 6px);
  padding: 12px 14px;
  border: var(--kc-bw, 2px) solid var(--edge);
  box-shadow: var(--kc-shadow, 4px 4px 0 var(--shadow));
  font: 14px/1.45 var(--font-ui, system-ui, sans-serif);
  color: var(--fg);
}

.kc-toast.warn {
  background: var(--warn-bg);
  border-color: var(--warn);
}

.kc-toast.info {
  background: var(--info-bg);
  border-color: var(--info);
}

.kc-toast.error {
  background: var(--err-bg);
  border-color: var(--err);
}

.kc-toast .th {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-weight: 700;
}

.kc-toast .th button {
  border: 0;
  background: none;
  color: inherit;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0 2px;
}

.kc-toast p {
  margin: 4px 0 0;
}

.kc-toast .bar {
  height: 6px;
  border-radius: 3px;
  background: var(--sunken);
  margin-top: 10px;
  overflow: hidden;
}

.kc-toast .bar i {
  display: block;
  height: 100%;
  background: var(--warn);
  transition: width 1s linear;
}

.kc-toast.info .bar i {
  background: var(--info);
}

.kc-toast .act {
  margin-top: 10px;
  border: 2px solid var(--edge);
  background: var(--btn-bg, var(--fg));
  color: var(--btn-fg, var(--bg));
  border-radius: var(--kc-radius-sm, 4px);
  padding: 6px 12px;
  font: inherit;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  box-shadow: 2px 2px 0 var(--shadow);
}

/* Responsive Breakpoints */
@media (max-width: 1060px) {
  .steps-sidebar {
    position: static;
    transform: none;
    flex-direction: row;
    justify-content: center;
    gap: 14px;
    margin-bottom: 4px;
    padding-top: 14px;
  }

  .steps-sidebar-track {
    display: none;
  }

  .step-label {
    left: 50%;
    top: 48px;
    transform: translateX(-50%) translateY(-6px);
  }

  .step-node:hover .step-label {
    transform: translateX(-50%) translateY(0);
  }

  .step-node .step-label::before {
    left: 50%;
    top: -5px;
    transform: translateX(-50%) rotate(45deg);
    border-left: none;
    border-bottom: none;
    border-top: 2px solid var(--edge);
    border-left: 2px solid var(--edge);
  }
}

@media (max-width: 700px) {
  .tiles {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .dbtns {
    grid-template-columns: minmax(0, 1fr);
  }
  .dl {
    min-height: 56px;
  }
  .ml {
    height: 60px;
  }
  .step {
    padding: 16px;
  }
}

/* Tactile Micro-Press Feedback on Click */
.tile:active,
.chip:active,
.relbtn:active,
.vopt:active,
.fw-pill:active,
.modes button:active,
.step-node:active .step-circle,
.btn:active,
.small:active,
.tl:active,
.expand-btn:active,
.dl:active:not(:disabled) {
  transform: scale(0.982) translate(1px, 1px);
  transition: transform 0.08s ease;
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
  .tile-glider-global,
  .spotlight-ambient {
    display: none !important;
  }
}
