:root {
  color-scheme: light;
  --bg: #eef0f3;
  --sidebar: #f8f9fb;
  --surface: #ffffff;
  --surface-soft: #f1f3f6;
  --surface-muted: #e5e8ec;
  --line: #d8dde4;
  --text: #17191d;
  --muted: #6f7782;
  --accent: #2b74f7;
  --accent-soft: #e8f0ff;
  --accent-text: #ffffff;
  --warning: #9a7b30;
  --shadow: rgba(20,25,35,.09);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #090a0c;
  --sidebar: #111317;
  --surface: #15181d;
  --surface-soft: #1d2127;
  --surface-muted: #2a3038;
  --line: #303640;
  --text: #f4f5f7;
  --muted: #9098a3;
  --accent: #2f7cff;
  --accent-soft: #17294a;
  --accent-text: #ffffff;
  --warning: #d0ad59;
  --shadow: rgba(0,0,0,.28);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
}

button, input { font: inherit; }

button {
  border: 0;
  cursor: pointer;
  color: inherit;
}

.app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 220px 1fr;
}

.sidebar {
  background: var(--sidebar);
  border-right: 1px solid var(--line);
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 5px 9px 28px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  display: grid;
  place-items: center;
  box-shadow: 0 8px 20px color-mix(in srgb, var(--accent) 24%, transparent);
}

.brand-copy {
  min-width: 0;
}

.brand-title {
  display: flex;
  align-items: baseline;
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -.025em;
  text-transform: lowercase;
}

.brand-subtitle {
  color: var(--muted);
  font-size: 11px;
  margin-top: 3px;
  letter-spacing: .03em;
}

.nav {
  display: grid;
  gap: 6px;
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 13px 14px 13px 17px;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  font-weight: 620;
  transition: background .16s ease, color .16s ease, transform .16s ease;
}

.nav-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 4px;
  border-radius: 0 6px 6px 0;
  background: transparent;
  transition: background .16s ease, box-shadow .16s ease;
}

.nav-item:hover {
  background: var(--surface-soft);
  color: var(--text);
}

.nav-item.active {
  background: var(--surface-muted);
  color: var(--text);
}

.nav-item.active::before {
  background: var(--accent);
  box-shadow: 0 0 12px color-mix(in srgb, var(--accent) 55%, transparent);
}

.nav-icon {
  width: 24px;
  text-align: center;
}

.sidebar-footer {
  margin-top: auto;
  display: grid;
  gap: 10px;
  padding: 12px 8px 0;
  color: var(--muted);
}

.status-pill {
  width: fit-content;
  padding: 8px 11px;
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.status-pill.live {
  background: #173b25;
  color: #68df95;
}

.content {
  padding: 28px;
  max-width: 1450px;
  width: 100%;
  margin: 0 auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

h1, h2 {
  margin: 0;
  font-weight: 600;
  letter-spacing: -.02em;
}

h1 {
  font-size: clamp(30px, 4vw, 48px);
}

h2 {
  font-size: 22px;
}

.eyebrow {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .15em;
  color: var(--muted);
  margin-bottom: 7px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ui-scale-control {
  display: inline-flex;
  align-items: center;
  height: 44px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.ui-scale-control .icon-button {
  width: 38px;
  height: 42px;
  border: 0;
  border-radius: 0;
  background: transparent;
  font-size: 20px;
}

.ui-scale-control output {
  display: grid;
  width: 48px;
  place-items: center;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.ui-scale-control button:disabled {
  cursor: default;
  opacity: .35;
}

.icon-button,
.primary-button,
.secondary-button {
  height: 44px;
  border-radius: 12px;
  padding: 0 18px;
  font-weight: 720;
}

.icon-button {
  width: 44px;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--line);
}

.primary-button {
  background: var(--accent);
  color: white;
}

.secondary-button {
  background: var(--surface-muted);
  color: var(--muted);
}

button:disabled {
  opacity: .42;
  cursor: not-allowed;
}

.drive-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(340px, .75fr);
  gap: 18px;
}

.speed-card,
.control-card,
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: 0 12px 30px var(--shadow);
}

.speed-card {
  position: relative;
  overflow: hidden;
  padding: 28px 28px 28px 42px;
  min-height: 420px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.speed-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 760;
  letter-spacing: .13em;
}

.speed-line {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  margin: 18px 0 30px;
}

#speedValue {
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  font-size: clamp(105px, 15vw, 190px);
  line-height: .82;
  letter-spacing: -.065em;
  font-weight: 500;
}

.speed-unit {
  color: var(--muted);
  font-size: 24px;
  padding-bottom: 12px;
}

.drive-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.stat {
  background: var(--surface-soft);
  border-radius: 14px;
  padding: 15px;
}

.stat span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 760;
  letter-spacing: .09em;
  margin-bottom: 7px;
}

.stat strong {
  font-size: 21px;
  font-weight: 600;
}

.speed-level-track {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 8px;
  overflow: hidden;
  background: var(--surface-muted);
}

.speed-level-fill {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 8%;
  background: #31d76b;
  transition: height .12s linear;
}

.control-card {
  padding: 24px;
}

.section-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.setting-row,
.setting-heading {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
}

.setting-row {
  padding: 18px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.setting-row strong,
.setting-heading strong {
  display: block;
  font-size: 15px;
  font-weight: 650;
}

.setting-row span,
.setting-heading span {
  color: var(--muted);
  font-size: 12px;
  display: block;
  margin-top: 4px;
}

.toggle-button {
  min-width: 66px;
  height: 36px;
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.toggle-button.active {
  background: var(--accent);
  color: white;
}

.setting-block {
  padding-top: 22px;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
  background: var(--surface-soft);
  padding: 5px;
  border-radius: 13px;
  margin-top: 12px;
}

.segmented button {
  padding: 10px 7px;
  border-radius: 9px;
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.segmented button.active {
  background: var(--accent);
  color: white;
  box-shadow: 0 2px 8px color-mix(in srgb, var(--accent) 28%, transparent);
}

input[type=range] {
  width: 100%;
  accent-color: var(--accent);
  margin-top: 15px;
}

.range-scale,
.demo-speed-line {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 10px;
  margin-top: 4px;
}

.demo-speed-line {
  font-size: 12px;
  margin-top: 18px;
}

.demo-box {
  margin-top: 8px;
  padding: 18px;
  border-radius: 15px;
  background: var(--surface-soft);
}

.panel {
  margin-top: 18px;
  padding: 24px;
}

.sound-title {
  font-size: 29px;
  font-weight: 620;
}

.profile-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.profile-card {
  min-height: 150px;
  border-radius: 16px;
  background: var(--surface-soft);
  border: 2px solid transparent;
  text-align: left;
  padding: 20px;
  position: relative;
  transition: .18s ease;
}

.profile-card:hover {
  transform: translateY(-2px);
  border-color: var(--line);
}

.profile-card.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
  box-shadow: 0 8px 24px color-mix(in srgb, var(--accent) 28%, transparent);
}

.profile-card .name {
  font-weight: 650;
  font-size: 20px;
  line-height: 1.15;
  padding-right: 26px;
}

.profile-card .type {
  margin-top: 9px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.profile-card.active .type {
  color: rgba(255,255,255,.78);
}

.profile-card .dot {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--profile-color);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--profile-color) 25%, transparent);
}

.profile-card.active .dot {
  background: white;
  box-shadow: none;
}

.compact-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.status-text {
  font-weight: 620;
}

.note {
  color: var(--warning);
  font-size: 12px;
  text-align: right;
}

@media (max-width: 1100px) {
  .app { grid-template-columns: 86px 1fr; }
  .brand-copy,
  .nav-item span:last-child,
  .sidebar-footer small { display: none; }
  .brand { justify-content: center; }
  .nav-item { justify-content: center; }
  .sidebar-footer { align-items: center; }
  .drive-grid { grid-template-columns: 1fr; }
  .profile-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 760px) {
  .app { display: block; }
  .sidebar { display: none; }
  .content { padding: 14px; }
  .topbar { align-items: flex-end; }
  .top-actions { flex-wrap: wrap; justify-content: flex-end; }
  .drive-stats { grid-template-columns: repeat(2, 1fr); }
  .profile-grid { grid-template-columns: repeat(2, 1fr); }
  .compact-panel { display: grid; }
  .note { text-align: left; }
}

@media (max-width: 480px) {
  .topbar { display: grid; }
  .top-actions { justify-content: flex-start; }
  .speed-card, .control-card, .panel { border-radius: 17px; }
  .profile-grid { grid-template-columns: 1fr 1fr; }
  .segmented { grid-template-columns: repeat(2, 1fr); }
  .profile-card .name { font-size: 17px; }
}


.phone-link-nav {
  margin-top: 12px;
}

.phone-link-title {
  font-size: 29px;
}

.phone-link-description {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.phone-status-badge {
  padding: 9px 13px;
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.phone-status-badge.connected {
  background: var(--accent);
  color: white;
}

.phone-link-grid {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 12px;
}

.phone-link-card,
.phone-code-card {
  min-height: 120px;
  border-radius: 16px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  padding: 18px;
}

.phone-link-card {
  display: grid;
  grid-template-columns: 38px 1fr auto;
  align-items: center;
  gap: 14px;
}

.phone-link-card strong,
.phone-link-card span {
  display: block;
}

.phone-link-card > div > span {
  color: var(--muted);
  font-size: 12px;
  margin-top: 5px;
  line-height: 1.4;
}

.phone-step {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid !important;
  place-items: center;
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.phone-code-card {
  text-align: center;
  display: grid;
  place-content: center;
}

.pairing-code {
  font-size: 42px;
  letter-spacing: .18em;
  font-weight: 650;
  color: var(--accent);
  margin: 7px 0;
}

.session-timer {
  color: var(--muted);
  font-size: 11px;
}

.phone-action {
  white-space: nowrap;
  text-decoration: none;
  display: inline-grid;
  place-items: center;
}

.link-button {
  height: 44px;
  border-radius: 12px;
  padding: 0 16px;
}

.phone-link-metrics {
  display: grid;
  grid-template-columns: repeat(3,1fr);
  gap: 10px;
  margin-top: 14px;
}

.phone-link-metrics div {
  background: var(--surface-soft);
  border-radius: 14px;
  padding: 15px;
}

.phone-link-metrics span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: .09em;
  margin-bottom: 7px;
}

.phone-link-metrics strong {
  font-size: 17px;
}

.phone-link-notice {
  margin-top: 14px;
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--muted);
  padding: 14px 16px;
  font-size: 12px;
  line-height: 1.55;
}

.phone-link-notice code {
  color: var(--text);
}

.debug-mode-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

#mp3ModeButton {
  min-width: 112px;
}

@media (max-width: 900px) {
  .phone-link-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .phone-link-card {
    grid-template-columns: 38px 1fr;
  }

  .phone-link-card .phone-action {
    grid-column: 1 / -1;
  }

  .phone-link-metrics {
    grid-template-columns: 1fr;
  }
}


.brand-wheel-icon {
  width: 29px;
  height: 29px;
  fill: none;
  stroke: currentColor;
  stroke-width: 5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.brand-title .brand-one {
  color: var(--accent);
  font-weight: 800;
}


.drive-status-stack {
  display: grid;
  gap: 8px;
  margin: -6px 0 24px;
}

.current-sound-label {
  color: var(--accent);
  font-size: 22px;
  font-weight: 650;
  letter-spacing: -.02em;
}

.gps-inline-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .04em;
  transition: color .18s ease;
}

.gps-inline-status.on {
  color: #37d77a;
}

.gps-inline-status.off {
  color: var(--muted);
}

.gps-inline-icon {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}


.speed-card {
  position: relative;
  overflow: hidden;
}

.speed-system-status {
  position: absolute;
  top: 24px;
  right: 28px;
  max-width: 38%;
  text-align: right;
  color: var(--muted);
  z-index: 3;
}

.speed-system-status span {
  display: block;
  margin-bottom: 5px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .14em;
}

.speed-system-status strong {
  display: block;
  font-size: 12px;
  line-height: 1.4;
  font-weight: 500;
  color: var(--muted);
}

.content {
  min-width: 0;
}

.topbar,
.drive-grid,
.panel {
  width: 100%;
}


@media (max-width: 760px) {
  .speed-system-status {
    position: static;
    max-width: none;
    text-align: left;
    margin-bottom: 18px;
  }
}




/* v26: sidebar-free layout */
.app {
  min-height: 100vh;
  display: block;
}

.content {
  width: 100%;
  min-width: 0;
  max-width: 1450px;
  margin: 0 auto;
  padding: 28px;
}

.top-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.top-brand-mark {
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--accent);
  color: white;
  display: grid;
  place-items: center;
}

.top-brand-wheel {
  width: 31px;
  height: 31px;
  fill: none;
  stroke: currentColor;
  stroke-width: 5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.top-brand-copy {
  min-width: 0;
}

.top-brand-name {
  display: flex;
  align-items: baseline;
  margin: 0;
  font-size: clamp(30px, 4vw, 48px);
  font-weight: 600;
  letter-spacing: -.035em;
  text-transform: lowercase;
}

.top-brand-one {
  color: var(--accent);
  font-weight: 760;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

@media (max-width: 760px) {
  .content {
    padding: 14px;
  }

  .top-brand-mark {
    flex-basis: 42px;
    width: 42px;
    height: 42px;
    border-radius: 12px;
  }

  .top-brand-wheel {
    width: 27px;
    height: 27px;
  }
}


/* v27: compact aligned brand block */
.top-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  height: 48px;
}

.top-brand-mark {
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--accent);
  color: white;
  display: grid;
  place-items: center;
}

.top-brand-copy {
  height: 48px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1px;
}

.top-brand-copy .eyebrow {
  margin: 0;
  font-size: 8px;
  line-height: 1;
  letter-spacing: .14em;
}

.top-brand-name {
  display: flex;
  align-items: baseline;
  margin: 0;
  font-size: 34px;
  line-height: .94;
  font-weight: 600;
  letter-spacing: -.035em;
  text-transform: lowercase;
}

@media (max-width: 760px) {
  .top-brand {
    height: 42px;
  }

  .top-brand-copy {
    height: 42px;
  }

  .top-brand-name {
    font-size: 29px;
  }

  .top-brand-copy .eyebrow {
    font-size: 7px;
  }
}


.drive-state-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.dynamics-panel {
  margin-top: 18px;
}

.dynamics-bars {
  display: grid;
  gap: 14px;
}

.dynamic-bar-row {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr) 54px;
  align-items: center;
  gap: 14px;
  font-size: 12px;
}

.dynamic-bar-row > span {
  color: var(--muted);
}

.dynamic-bar-row > strong {
  text-align: right;
  font-size: 13px;
}

.dynamic-track {
  position: relative;
  height: 8px;
  overflow: hidden;
  background: var(--surface-muted);
}

.dynamic-track.centered::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--line);
}

.dynamic-fill {
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width .10s linear, left .10s linear;
}

.acceleration-fill {
  position: absolute;
  left: 50%;
  background: #37d77a;
}

.load-fill {
  background: #37d77a;
}

.trip-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 20px;
}

.trip-stats > div {
  padding: 15px;
  border-top: 1px solid var(--line);
}

.trip-stats span,
.trip-stats small {
  color: var(--muted);
  font-size: 9px;
  letter-spacing: .10em;
}

.trip-stats strong {
  display: inline-block;
  margin: 7px 5px 0 0;
  font-size: 22px;
  font-weight: 580;
}

.curve-segmented button {
  min-width: 0;
}

@media (max-width: 760px) {
  .dynamic-bar-row {
    grid-template-columns: 86px minmax(0, 1fr) 42px;
    gap: 9px;
  }

  .trip-stats {
    grid-template-columns: repeat(2, 1fr);
  }
}


/* v29: inline GPS quality replaces GPS ON/OFF */
.gps-inline-status {
  transition: color .18s ease;
}

.gps-inline-status.gps-excellent {
  color: #37d77a;
}

.gps-inline-status.gps-good {
  color: #e5b83c;
}

.gps-inline-status.gps-weak {
  color: #ef5b5b;
}

.gps-inline-status.gps-lost,
.gps-inline-status.gps-off {
  color: var(--muted);
}

/* Keep the speed/settings composition balanced after removing two stat cards. */
.stats-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.stats-grid .stat {
  min-height: 74px;
}

@media (max-width: 760px) {
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}


/* v33: speed hierarchy and Tesla-style vertical workspace navigation */
.drive-grid {
  grid-template-columns: minmax(360px, .72fr) minmax(570px, 1.28fr);
  align-items: stretch;
}

.speed-card {
  min-height: 590px;
  display: grid;
  grid-template-rows: auto auto auto minmax(20px, 1fr) auto;
  align-content: start;
  justify-content: stretch;
  padding: 28px 28px 24px 42px;
}

.speed-label {
  align-self: start;
}

.speed-line {
  align-self: start;
  margin: 34px 0 12px;
}

#speedValue {
  font-size: clamp(104px, 11vw, 168px);
}

.drive-status-stack {
  align-self: start;
  gap: 5px;
  margin: 0;
}

.current-sound-label {
  font-size: 21px;
  line-height: 1.12;
}

.drive-state-label {
  line-height: 1.2;
}

.gps-inline-status {
  margin-top: 3px;
}

.drive-stats {
  align-self: end;
  margin-top: 20px;
}

.workspace-card {
  display: grid;
  grid-template-columns: 168px minmax(0, 1fr);
  padding: 0;
  min-height: 590px;
  overflow: hidden;
}

.workspace-nav {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 24px 12px;
  background: var(--surface-soft);
  border-right: 1px solid var(--line);
}

.workspace-nav-header {
  display: grid;
  gap: 4px;
  padding: 0 14px 20px;
}

.workspace-nav-header strong {
  font-size: 17px;
  font-weight: 650;
}

.workspace-nav-kicker {
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .14em;
}

.workspace-nav-item {
  position: relative;
  width: 100%;
  min-height: 52px;
  border: 0;
  border-radius: 14px;
  padding: 0 14px 0 17px;
  background: transparent;
  color: var(--muted);
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: center;
  column-gap: 11px;
  text-align: left;
  font: inherit;
  font-size: 14px;
  font-weight: 620;
  cursor: pointer;
  transition: background .18s ease, color .18s ease;
}

.workspace-nav-item:hover {
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  color: var(--text);
}

.workspace-nav-item.active {
  background: var(--surface);
  color: var(--text);
}

.workspace-nav-indicator {
  position: absolute;
  left: 0;
  top: 11px;
  bottom: 11px;
  width: 3px;
  border-radius: 0;
  background: transparent;
}

.workspace-nav-item.active .workspace-nav-indicator {
  background: var(--accent);
}

.workspace-nav-icon {
  width: 20px;
  text-align: center;
  font-size: 16px;
}

.workspace-main {
  min-width: 0;
  overflow: hidden;
}

.workspace-panel {
  display: none;
  height: 100%;
  padding: 24px 26px;
  overflow-y: auto;
}

.workspace-panel.active {
  display: block;
}

.workspace-sound-heading {
  margin-bottom: 18px;
}

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

.workspace-profile-grid .profile-card {
  min-height: 90px;
}

@media (max-width: 1150px) {
  .drive-grid {
    grid-template-columns: minmax(330px, .78fr) minmax(480px, 1.22fr);
  }

  .workspace-card {
    grid-template-columns: 148px minmax(0, 1fr);
  }
}

@media (max-width: 900px) {
  .drive-grid {
    grid-template-columns: 1fr;
  }

  .speed-card {
    min-height: 520px;
  }

  .workspace-card {
    min-height: 560px;
  }
}

@media (max-width: 620px) {
  .workspace-card {
    grid-template-columns: 84px minmax(0, 1fr);
  }

  .workspace-nav {
    padding: 18px 8px;
  }

  .workspace-nav-header {
    display: none;
  }

  .workspace-nav-item {
    grid-template-columns: 1fr;
    justify-items: center;
    padding: 0 8px;
    font-size: 10px;
    row-gap: 3px;
  }

  .workspace-nav-icon {
    font-size: 18px;
  }

  .workspace-panel {
    padding: 20px 16px;
  }

  .workspace-profile-grid {
    grid-template-columns: 1fr;
  }
}


/* v34: independent left navigation */
.global-mode-nav {
  position: fixed;
  left: 0;
  top: 68px;
  bottom: 0;
  width: 170px;
  padding: 28px 14px;
  background: var(--surface-soft);
  border-right: 1px solid var(--line);
  z-index: 20;
}

.content {
  padding-left: 198px;
}

.global-mode-nav-head {
  display: grid;
  gap: 4px;
  padding: 0 14px 22px;
}

.global-mode-nav-head span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .14em;
}

.global-mode-nav-head strong {
  font-size: 18px;
  font-weight: 650;
}

.global-mode-item {
  position: relative;
  width: 100%;
  min-height: 52px;
  border: 0;
  border-radius: 14px;
  padding: 0 14px 0 18px;
  background: transparent;
  color: var(--muted);
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: center;
  column-gap: 11px;
  text-align: left;
  font: inherit;
  font-size: 14px;
  font-weight: 620;
  cursor: pointer;
}

.global-mode-item.active {
  background: var(--surface);
  color: var(--text);
}

.global-mode-line {
  position: absolute;
  left: 0;
  top: 11px;
  bottom: 11px;
  width: 3px;
  background: transparent;
}

.global-mode-item.active .global-mode-line {
  background: var(--accent);
}

.global-mode-icon {
  text-align: center;
  font-size: 16px;
}

.drive-grid {
  grid-template-columns: minmax(350px, .80fr) minmax(600px, 1.20fr);
}

.content-workspace {
  display: block;
  padding: 0;
  overflow: hidden;
  min-height: 590px;
}

.content-panel {
  display: none;
  height: 100%;
  padding: 24px 28px;
  overflow-y: auto;
}

.content-panel.active {
  display: block;
}

/* Test and feature indicators under speed */
.speed-mode-icons {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 8px;
}

.speed-mode-status,
.speed-feature-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 25px;
}

.speed-mode-status {
  gap: 7px;
  font-size: 11px;
  font-weight: 750;
  letter-spacing: .04em;
}

.speed-mode-symbol,
.speed-feature-icon {
  width: 25px;
  height: 25px;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 800;
}

.test-status {
  color: #e5b83c;
}

.speed-feature-icon {
  color: var(--muted);
}

.speed-feature-icon.active {
  color: #37d77a;
}

.hidden {
  display: none !important;
}

.speed-test-control {
  margin-top: 24px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-soft);
}

.speed-test-control.hidden {
  display: none;
}

.speed-test-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.speed-test-head span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .12em;
}

.speed-test-head strong {
  font-size: 13px;
}

.speed-test-control input[type="range"] {
  width: 100%;
}

@media (max-width: 1050px) {
  .global-mode-nav {
    width: 92px;
  }

  .content {
    padding-left: 112px;
  }

  .global-mode-nav-head {
    display: none;
  }

  .global-mode-item {
    grid-template-columns: 1fr;
    justify-items: center;
    padding: 0 8px;
    font-size: 10px;
    row-gap: 3px;
  }
}

@media (max-width: 760px) {
  .global-mode-nav {
    position: static;
    width: auto;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    padding: 8px 14px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .content {
    padding-left: 14px;
  }

  .global-mode-nav-head {
    display: none;
  }

  .global-mode-item {
    grid-template-columns: 20px 1fr;
    justify-items: start;
    font-size: 13px;
  }
}


/* v36: unified vertical speed indicators */
.speed-indicator-stack {
  display: grid;
  gap: 7px;
  width: fit-content;
  margin-top: 8px;
}

.speed-indicator-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  min-height: 24px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
}

.speed-indicator-icon,
.speed-indicator-row .gps-inline-icon {
  width: 23px;
  height: 23px;
  flex: 0 0 23px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* GPS uses a 64x64 viewBox while the feature icons use 24x24. Give it a
   proportional stroke so all status symbols have the same visible weight. */
.speed-indicator-row .gps-inline-icon {
  stroke-width: 4.8;
}

.launchStatusIcon .speed-indicator-icon,
#launchStatusIcon .speed-indicator-icon {
  fill: none;
}

.test-indicator {
  color: #e5b83c;
}

.feature-indicator {
  color: var(--muted);
}

.feature-indicator.active {
  color: #37d77a;
}

.gps-indicator.gps-excellent {
  color: #37d77a;
}

.gps-indicator.gps-good {
  color: #e5b83c;
}

.gps-indicator.gps-weak {
  color: #ef5b5b;
}

.gps-indicator.gps-lost,
.gps-indicator.gps-off {
  color: var(--muted);
}

/* Settings remains the same size as Current Speed. */
.speed-card,
.content-workspace {
  height: 590px;
  min-height: 590px;
  max-height: 590px;
}

.content-workspace {
  overflow: hidden;
}

.content-workspace .content-panel {
  height: 100%;
  overflow-y: auto;
}

/* Sounds is restored as a separate third block below. */
.restored-sound-panel {
  margin-top: 18px;
}

.restored-profile-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

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

@media (max-width: 900px) {
  .speed-card,
  .content-workspace {
    height: auto;
    min-height: 560px;
    max-height: none;
  }

  .restored-profile-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .restored-profile-grid {
    grid-template-columns: 1fr;
  }
}


/* v37: full settings panel and compact indicator spacing */
.speed-indicator-stack {
  gap: 3px;
}

/* Test Mode is last, so hiding it never shifts GPS/Gears/Launch. */
#testModeIndicator {
  order: 4;
}

#gpsInlineStatus {
  order: 1;
}

#gearsStatusIcon {
  order: 2;
}

#launchStatusIcon {
  order: 3;
}

/* Restore full Settings display without inner scrolling. */
.speed-card,
.content-workspace {
  height: auto;
  min-height: 590px;
  max-height: none;
}

.content-workspace {
  overflow: visible;
}

.content-workspace .content-panel,
#settingsPanel {
  height: auto;
  max-height: none;
  overflow: visible;
}

#settingsPanel {
  display: block;
}


/* v38: compact non-stretching indicator list */
.speed-indicator-stack {
  display: flex !important;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  align-self: start;
  place-self: start;
  width: fit-content;
  height: auto;
  min-height: 0;
  max-height: none;
  gap: 2px !important;
  margin: 6px 0 0;
  padding: 0;
}

.speed-indicator-row {
  position: static;
  display: inline-flex !important;
  flex: 0 0 auto;
  align-items: center;
  justify-content: flex-start;
  align-self: flex-start;
  width: fit-content;
  height: 23px;
  min-height: 23px;
  max-height: 23px;
  margin: 0 !important;
  padding: 0 !important;
  line-height: 1;
}

.speed-indicator-icon,
.speed-indicator-row .gps-inline-icon {
  display: block;
  flex: 0 0 23px;
  width: 23px;
  height: 23px;
  margin: 0;
}

.speed-indicator-text,
.speed-indicator-row > span {
  line-height: 23px;
}

/* Remove obsolete wrappers from layout even if they remain in cached markup. */
.speed-feature-stack,
.speed-mode-icons {
  display: contents;
}

/* The test row remains last and collapses completely when hidden. */
#testModeIndicator.hidden {
  display: none !important;
  height: 0 !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
}


/* v39: anchor sound state and indicators to the speed hierarchy */
.speed-card {
  display: grid;
  grid-template-rows:
    auto
    auto
    auto
    minmax(84px, auto)
    minmax(0, 1fr)
    auto;
  align-content: start;
}

.speed-line {
  margin-bottom: 10px;
}

.speed-status-anchor {
  align-self: start;
  justify-self: start;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: fit-content;
  min-height: 112px;
  margin: 0;
  padding: 0;
}

.speed-status-anchor .drive-status-stack {
  margin: 0;
  padding: 0;
  gap: 4px;
}

.speed-status-anchor .speed-indicator-stack {
  position: static;
  align-self: flex-start;
  margin: 7px 0 0;
  padding: 0;
  gap: 2px !important;
}

/* The slider lives in its own reserved row and cannot push the speed/status block. */
.speed-test-slot {
  align-self: start;
  width: 100%;
  min-height: 0;
  margin: 0;
  padding: 0;
}

.speed-test-slot:has(#speedTestControl:not(.hidden)) {
  min-height: 86px;
}

.speed-test-slot #speedTestControl {
  width: 100%;
  box-sizing: border-box;
  margin: 8px 0 0;
}

.speed-test-slot #speedTestControl.hidden {
  display: none !important;
  margin: 0 !important;
}

/* Keep telemetry fixed at the bottom regardless of Test Mode. */
.drive-stats,
.stats-grid {
  align-self: end;
}

/* Explicitly prevent older layout rules from redistributing status rows. */
.speed-status-anchor,
.speed-status-anchor > *,
.speed-indicator-stack,
.speed-indicator-row {
  flex-shrink: 0;
}

@media (max-width: 900px) {
  .speed-card {
    grid-template-rows:
      auto
      auto
      auto
      minmax(84px, auto)
      auto
      auto;
  }
}


/* v40: more breathing room between indicators */
.speed-status-anchor .speed-indicator-stack,
.speed-indicator-stack {
  gap: 13px !important;
}

/* Keep every indicator row compact and independent */
.speed-indicator-row {
  flex: 0 0 auto;
  align-self: flex-start;
  margin: 0 !important;
}

/* Pin the Test Speed panel to the bottom telemetry zone */
.speed-card {
  position: relative;
  display: grid;
  grid-template-rows:
    auto
    auto
    auto
    minmax(112px, auto)
    minmax(0, 1fr)
    auto
    auto;
  align-content: stretch;
}

.speed-status-anchor {
  grid-row: 4;
  align-self: start;
}

.speed-test-slot {
  grid-row: 6;
  align-self: end;
  width: 100%;
  margin: 0 0 14px;
  padding: 0;
  min-height: 0;
}

.speed-test-slot:has(#speedTestControl:not(.hidden)) {
  min-height: 82px;
}

.speed-test-slot #speedTestControl {
  width: 100%;
  margin: 0;
  box-sizing: border-box;
}

.speed-test-slot #speedTestControl.hidden {
  display: none !important;
  margin: 0 !important;
}

/* Telemetry tiles stay fixed at the very bottom */
.drive-stats,
.stats-grid {
  grid-row: 7;
  align-self: end;
  margin-top: 0;
}

/* Reserve a small clean gap above RPM/GEAR/INPUT/LOAD */
.speed-test-slot + .drive-stats,
.speed-test-slot + .stats-grid {
  margin-top: 0;
}

@media (max-width: 900px) {
  .speed-card {
    grid-template-rows:
      auto
      auto
      auto
      minmax(112px, auto)
      auto
      auto
      auto;
  }

  .speed-test-slot {
    margin-bottom: 12px;
  }
}


/* v41: mobile-first usability overhaul */
@media (max-width: 760px) {
  html,
  body {
    width: 100%;
    overflow-x: hidden;
  }

  body {
    background: var(--bg);
  }

  .app {
    display: block !important;
    min-width: 0;
  }

  .content {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 10px 12px 96px !important;
    box-sizing: border-box;
  }

  .global-mode-nav {
    position: sticky !important;
    top: 0;
    z-index: 50;
    width: calc(100% + 24px) !important;
    margin: 0 -12px 10px;
    padding: 8px 12px !important;
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    background: color-mix(in srgb, var(--bg) 92%, transparent);
    backdrop-filter: blur(14px);
    border-right: 0 !important;
    border-bottom: 1px solid var(--line);
    box-sizing: border-box;
  }

  .global-mode-nav-head {
    display: none !important;
  }

  .global-mode-item {
    min-height: 44px;
    border-radius: 12px;
    padding: 0 12px !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 13px;
  }

  .global-mode-line {
    display: none;
  }

  .global-mode-item.active {
    background: var(--surface);
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
  }

  .topbar {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    align-items: start;
    margin-bottom: 12px;
  }

  .top-brand {
    width: 100%;
  }

  .top-actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 8px;
  }

  .top-actions button {
    min-height: 42px;
  }

  .drive-grid {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 12px;
  }

  .speed-card,
  .content-workspace,
  .restored-sound-panel {
    width: 100%;
    min-width: 0;
    max-width: none;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    box-sizing: border-box;
  }

  .speed-card {
    padding: 20px 18px 18px !important;
    border-radius: 18px;
    grid-template-rows: auto auto auto auto auto auto auto !important;
  }

  .speed-system-status {
    position: static !important;
    max-width: none !important;
    text-align: left !important;
    margin-bottom: 22px;
    order: -1;
  }

  .speed-line {
    margin: 20px 0 8px !important;
  }

  #speedValue {
    font-size: clamp(88px, 28vw, 132px) !important;
  }

  .speed-unit {
    font-size: 18px;
  }

  .speed-status-anchor {
    min-height: 0 !important;
    width: 100%;
  }

  .speed-indicator-stack {
    gap: 10px !important;
    margin-top: 12px !important;
  }

  .speed-test-slot {
    margin: 22px 0 14px !important;
  }

  .speed-test-control {
    padding: 15px 14px !important;
    border-radius: 14px;
  }

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

  .stat {
    min-width: 0;
    min-height: 84px;
    padding: 14px !important;
    box-sizing: border-box;
  }

  .content-workspace {
    border-radius: 18px;
    overflow: visible !important;
  }

  .content-panel,
  #settingsPanel {
    display: block !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    padding: 20px 16px !important;
  }

  .setting-row {
    align-items: center;
    gap: 12px;
    padding: 16px 0;
  }

  .setting-row > div:first-child {
    min-width: 0;
  }

  .setting-row strong {
    font-size: 14px;
  }

  .setting-row span {
    font-size: 11px;
    line-height: 1.35;
  }

  .toggle-button {
    flex: 0 0 auto;
  }

  .segmented {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 6px;
  }

  .segmented button {
    min-height: 42px;
    padding: 8px 6px;
  }

  .setting-block {
    padding: 16px 0;
  }

  .restored-sound-panel {
    margin-top: 12px;
    padding: 20px 16px !important;
    border-radius: 18px;
  }

  .restored-profile-grid,
  .profile-grid {
    grid-template-columns: 1fr !important;
    gap: 10px;
  }

  .profile-card {
    min-height: 94px;
  }

  input[type="range"] {
    min-height: 30px;
  }
}

@media (max-width: 420px) {
  .content {
    padding-left: 8px !important;
    padding-right: 8px !important;
  }

  .global-mode-nav {
    width: calc(100% + 16px) !important;
    margin-left: -8px;
    margin-right: -8px;
    padding-left: 8px !important;
    padding-right: 8px !important;
  }

  .top-brand-name {
    font-size: 28px !important;
  }

  .top-brand-mark {
    width: 40px !important;
    height: 40px !important;
    flex-basis: 40px !important;
  }

  .speed-card,
  .content-workspace,
  .restored-sound-panel {
    border-radius: 16px;
  }

  .speed-card {
    padding: 18px 14px 16px !important;
  }

  .content-panel,
  #settingsPanel,
  .restored-sound-panel {
    padding-left: 14px !important;
    padding-right: 14px !important;
  }
}


/* v42: smooth speed animation */
#speedValue {
  transition: color .18s ease, text-shadow .18s ease;
  will-change: transform;
}

#speedValue.speed-pulse {
  animation: speedValuePulse .16s ease-out;
}

@keyframes speedValuePulse {
  from { transform: translateY(1px) scale(.992); opacity: .88; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

/* Microanimations */
button,
.toggle-button,
.segmented button,
.profile-card,
.speed-indicator-row,
.gps-inline-status {
  transition:
    background-color .18s ease,
    color .18s ease,
    border-color .18s ease,
    box-shadow .18s ease,
    transform .16s ease,
    opacity .16s ease;
}

button:active,
.toggle-button:active,
.segmented button:active {
  transform: scale(.975);
}

.toggle-button.active,
.segmented button.active {
  box-shadow: 0 5px 14px color-mix(in srgb, var(--accent) 22%, transparent);
}

.status-pop {
  animation: statusPop .22s ease-out;
}

@keyframes statusPop {
  0% { transform: scale(.86); opacity: .45; }
  70% { transform: scale(1.07); opacity: 1; }
  100% { transform: scale(1); }
}

/* Unified status colors */
.state-positive { color: #28bd68 !important; }
.state-warning { color: #d9a51d !important; }
.state-danger { color: #e45454 !important; }
.state-muted { color: var(--muted) !important; }
.state-active { color: var(--accent) !important; }

.gps-excellent,
.feature-indicator.active {
  color: #28bd68 !important;
}

.gps-good,
.test-indicator,
.test-status {
  color: #d9a51d !important;
}

.gps-weak {
  color: #e45454 !important;
}

.gps-lost,
.gps-off,
.feature-indicator:not(.active) {
  color: var(--muted) !important;
}

/* Character-rich sound cards */
.profile-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 7px;
  overflow: hidden;
  min-height: 132px;
  padding: 16px;
}

.profile-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(20, 30, 50, .08);
}

.profile-card.active {
  box-shadow: 0 10px 26px color-mix(in srgb, var(--accent) 18%, transparent);
}

.profile-card-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.profile-category {
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .12em;
}

.profile-active-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: transparent;
  box-shadow: 0 0 0 1px var(--line);
}

.profile-card.active .profile-active-dot {
  background: currentColor;
  box-shadow: 0 0 0 4px color-mix(in srgb, currentColor 16%, transparent);
}

.profile-name {
  font-size: 18px;
  line-height: 1.1;
}

.profile-description {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.profile-meta {
  display: grid;
  gap: 4px;
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid color-mix(in srgb, var(--line) 75%, transparent);
}

.profile-meta span {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.3;
}

.profile-meta span:first-child {
  color: var(--text);
  font-weight: 650;
}

@media (max-width: 760px) {
  .profile-card {
    min-height: 126px;
  }

  .profile-card:hover {
    transform: none;
  }
}

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


/* v43: subtle individual card atmosphere */
.profile-card {
  isolation: isolate;
  background:
    linear-gradient(
      145deg,
      color-mix(in srgb, var(--card-gradient-a, #edf2ff) 38%, var(--surface)),
      color-mix(in srgb, var(--card-gradient-b, #f4efff) 24%, var(--surface)) 72%,
      var(--surface)
    );
}

.profile-card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(
      circle at 88% 82%,
      color-mix(in srgb, var(--profile-color) 8%, transparent),
      transparent 46%
    );
  opacity: .9;
}

.profile-card > *:not(.profile-ghost-emoji) {
  position: relative;
  z-index: 2;
}

.profile-ghost-emoji {
  position: absolute;
  right: 10px;
  bottom: 0;
  z-index: 1;
  font-size: 68px;
  line-height: .9;
  opacity: .065;
  filter: grayscale(.18) saturate(.75);
  transform: rotate(-7deg) translateY(8px);
  pointer-events: none;
  user-select: none;
  transition:
    opacity .22s ease,
    transform .22s ease;
}

.profile-card:hover .profile-ghost-emoji {
  opacity: .09;
  transform: rotate(-4deg) translateY(5px) scale(1.025);
}

.profile-card.active .profile-ghost-emoji {
  opacity: .085;
}

html[data-theme="dark"] .profile-card {
  background:
    linear-gradient(
      145deg,
      color-mix(in srgb, var(--card-gradient-a, #edf2ff) 7%, var(--surface)),
      color-mix(in srgb, var(--card-gradient-b, #f4efff) 5%, var(--surface)) 72%,
      var(--surface)
    );
}

html[data-theme="dark"] .profile-ghost-emoji {
  opacity: .045;
  filter: grayscale(.35) saturate(.55);
}

html[data-theme="dark"] .profile-card:hover .profile-ghost-emoji,
html[data-theme="dark"] .profile-card.active .profile-ghost-emoji {
  opacity: .065;
}

@media (max-width: 760px) {
  .profile-ghost-emoji {
    right: 8px;
    font-size: 62px;
    opacity: .055;
  }

  .profile-card:hover .profile-ghost-emoji {
    opacity: .055;
    transform: rotate(-7deg) translateY(8px);
  }
}


/* v44: cleaner and more minimal sound cards */
.profile-card {
  min-height: 116px;
  gap: 9px;
  padding: 18px;
  background:
    linear-gradient(
      145deg,
      color-mix(in srgb, var(--card-gradient-a, #edf2ff) 58%, var(--surface)),
      color-mix(in srgb, var(--card-gradient-b, #f4efff) 42%, var(--surface)) 70%,
      var(--surface)
    );
}

.profile-card::before {
  background:
    radial-gradient(
      circle at 88% 84%,
      color-mix(in srgb, var(--profile-color) 13%, transparent),
      transparent 48%
    );
}

.profile-card-topline,
.profile-category {
  display: none !important;
}

.profile-title-row {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.profile-name {
  font-size: 22px;
  line-height: 1.05;
  letter-spacing: -.025em;
}

.profile-active-dot {
  flex: 0 0 auto;
}

.profile-description {
  max-width: calc(100% - 54px);
  font-size: 11px;
  line-height: 1.4;
}

.profile-meta {
  display: block;
  margin-top: auto;
  padding-top: 9px;
}

.profile-meta span {
  font-size: 10px;
  font-weight: 650;
  color: var(--text);
}

.profile-ghost-emoji {
  right: 8px;
  bottom: -3px;
  font-size: 74px;
  opacity: .09;
  filter: grayscale(.08) saturate(.9);
}

.profile-card:hover .profile-ghost-emoji {
  opacity: .12;
}

.profile-card.active .profile-ghost-emoji {
  opacity: .115;
}

html[data-theme="dark"] .profile-card {
  background:
    linear-gradient(
      145deg,
      color-mix(in srgb, var(--card-gradient-a, #edf2ff) 11%, var(--surface)),
      color-mix(in srgb, var(--card-gradient-b, #f4efff) 8%, var(--surface)) 70%,
      var(--surface)
    );
}

html[data-theme="dark"] .profile-ghost-emoji {
  opacity: .06;
}

html[data-theme="dark"] .profile-card:hover .profile-ghost-emoji,
html[data-theme="dark"] .profile-card.active .profile-ghost-emoji {
  opacity: .08;
}

@media (max-width: 760px) {
  .profile-card {
    min-height: 112px;
    padding: 17px;
  }

  .profile-name {
    font-size: 21px;
  }

  .profile-ghost-emoji {
    font-size: 68px;
    opacity: .08;
  }
}


/* v45: ultra-minimal sound cards */
.profile-description{
  max-width:calc(100% - 54px);
  margin-top:2px;
}
.profile-meta{
  display:none !important;
}
.profile-card{
  min-height:104px;
}


/* v46: description only for active / hovered sound card */
.profile-card {
  min-height: 88px;
}

.profile-description {
  max-width: calc(100% - 54px);
  max-height: 0;
  margin: 0;
  opacity: 0;
  overflow: hidden;
  transform: translateY(-4px);
  transition:
    max-height .22s ease,
    opacity .18s ease,
    transform .22s ease,
    margin .22s ease;
}

.profile-card.active .profile-description,
.profile-card:hover .profile-description,
.profile-card:focus-visible .profile-description {
  max-height: 52px;
  margin-top: 4px;
  opacity: 1;
  transform: translateY(0);
}

.profile-card.active,
.profile-card:hover,
.profile-card:focus-visible {
  min-height: 108px;
}

/* Prevent layout jumps from feeling harsh */
.profile-card {
  transition:
    min-height .22s ease,
    background-color .18s ease,
    color .18s ease,
    border-color .18s ease,
    box-shadow .18s ease,
    transform .16s ease,
    opacity .16s ease;
}

@media (max-width: 760px) {
  .profile-card {
    min-height: 88px;
  }

  .profile-card:hover .profile-description {
    max-height: 0;
    margin: 0;
    opacity: 0;
    transform: translateY(-4px);
  }

  .profile-card.active {
    min-height: 108px;
  }

  .profile-card.active .profile-description {
    max-height: 52px;
    margin-top: 4px;
    opacity: 1;
    transform: translateY(0);
  }
}


/* v47: active-only description and readable selected card */
.profile-card:hover,
.profile-card:focus-visible {
  min-height: 88px;
  transform: none;
}

.profile-card:hover .profile-description,
.profile-card:focus-visible .profile-description {
  max-height: 0;
  margin: 0;
  opacity: 0;
  transform: translateY(-4px);
}

.profile-card.active {
  min-height: 108px;
}

.profile-card.active .profile-description {
  max-height: 52px;
  margin-top: 4px;
  opacity: 1;
  transform: translateY(0);
}

/* Keep hover visually calm: no emoji or card movement. */
.profile-card:hover .profile-ghost-emoji,
.profile-card:focus-visible .profile-ghost-emoji {
  opacity: .09;
  transform: rotate(-7deg) translateY(8px);
}

/* Selected card contrast */
.profile-card.active,
.profile-card.active .profile-name,
.profile-card.active .profile-description {
  color: #fff !important;
}

.profile-card.active .profile-description {
  opacity: .88;
}

.profile-card.active .profile-active-dot {
  background: #fff;
  box-shadow: 0 0 0 4px rgba(255,255,255,.20);
}

.profile-card.active .profile-ghost-emoji {
  opacity: .12;
  filter: grayscale(.12) saturate(.8) brightness(1.18);
}

html[data-theme="dark"] .profile-card.active,
html[data-theme="dark"] .profile-card.active .profile-name,
html[data-theme="dark"] .profile-card.active .profile-description {
  color: #fff !important;
}

@media (max-width: 760px) {
  .profile-card:hover,
  .profile-card:focus-visible {
    min-height: 88px;
  }

  .profile-card:hover .profile-description,
  .profile-card:focus-visible .profile-description {
    max-height: 0;
    margin: 0;
    opacity: 0;
    transform: translateY(-4px);
  }

  .profile-card.active {
    min-height: 108px;
  }

  .profile-card.active .profile-description {
    max-height: 52px;
    margin-top: 4px;
    opacity: .88;
    transform: translateY(0);
  }
}


/* v48: hold-to-accelerate test pedal */
.test-pedal-wrap {
  margin-top: 13px;
}

.test-accelerator-button {
  --pedal-progress: 0;
  position: relative;
  width: 100%;
  min-height: 64px;
  display: flex;
  align-items: center;
  gap: 12px;
  overflow: hidden;
  padding: 10px 15px;
  border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--line));
  border-radius: 14px;
  color: var(--text);
  background:
    linear-gradient(
      90deg,
      color-mix(in srgb, var(--accent) 12%, var(--surface))
        calc(var(--pedal-progress) * 100%),
      color-mix(in srgb, var(--surface) 96%, var(--bg))
        calc(var(--pedal-progress) * 100%)
    );
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  cursor: pointer;
  transition:
    border-color .16s ease,
    box-shadow .16s ease,
    transform .1s ease,
    background .12s linear;
}

.test-accelerator-button::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(
      circle at 18% 50%,
      color-mix(in srgb, var(--accent) 10%, transparent),
      transparent 42%
    );
}

.test-accelerator-button.pressed {
  border-color: color-mix(in srgb, var(--accent) 62%, var(--line));
  box-shadow:
    0 0 0 3px color-mix(in srgb, var(--accent) 10%, transparent),
    0 7px 18px color-mix(in srgb, var(--accent) 16%, transparent);
  transform: scale(.987);
}

.test-pedal-icon {
  position: relative;
  z-index: 2;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
  font-size: 18px;
  font-weight: 800;
  transition:
    color .16s ease,
    background .16s ease,
    transform .16s ease;
}

.test-accelerator-button.pressed .test-pedal-icon {
  color: #fff;
  background: var(--accent);
  transform: translateY(-2px);
}

.test-pedal-copy {
  position: relative;
  z-index: 2;
  display: grid;
  gap: 3px;
  min-width: 0;
  text-align: left;
}

.test-pedal-copy strong {
  font-size: 10px;
  letter-spacing: .07em;
}

.test-pedal-copy small {
  color: var(--muted);
  font-size: 9px;
}

.test-pedal-progress {
  position: absolute;
  right: 12px;
  z-index: 2;
  width: 7px;
  height: 36px;
  overflow: hidden;
  border-radius: 999px;
  background: color-mix(in srgb, var(--line) 76%, transparent);
}

.test-pedal-progress::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: calc(var(--pedal-progress) * 100%);
  border-radius: inherit;
  background: var(--accent);
  transition: height .1s linear;
}

@media (max-width: 760px) {
  .test-accelerator-button {
    min-height: 70px;
    padding: 12px 14px;
  }

  .test-pedal-icon {
    width: 40px;
    height: 40px;
  }

  .test-pedal-copy strong {
    font-size: 11px;
  }

  .test-pedal-copy small {
    font-size: 10px;
  }
}


/* v52: GPS debugging workspace */
.debug-panel[hidden] {
  display: none !important;
}

/* Mobile layout makes content panels block-level, so explicitly preserve the
   hidden state: Settings, Phone Link, and Debug occupy one shared workspace. */
.content-workspace > .content-panel[hidden] {
  display: none !important;
}

.debug-panel {
  min-height: 100%;
}

.debug-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
  margin: 18px 0 14px;
}

.debug-summary-item {
  min-width: 0;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: color-mix(in srgb, var(--surface) 94%, var(--bg));
}

.debug-summary-item span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: .1em;
}

.debug-summary-item strong {
  display: block;
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.debug-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid var(--line);
}

.debug-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
}

.debug-row:nth-child(odd) {
  border-right: 1px solid var(--line);
}

.debug-row span {
  color: var(--muted);
  font-size: 10px;
}

.debug-row strong {
  overflow: hidden;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10px;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.debug-log-block {
  margin-top: 16px;
}

.debug-log-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.debug-log-head > div {
  display: grid;
  gap: 3px;
}

.debug-log-head strong {
  font-size: 12px;
}

.debug-log-head span {
  color: var(--muted);
  font-size: 9px;
}

.debug-small-button {
  min-height: 34px !important;
}

.debug-log {
  width: 100%;
  height: 170px;
  box-sizing: border-box;
  overflow: auto;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  color: color-mix(in srgb, var(--text) 88%, var(--muted));
  background: color-mix(in srgb, var(--bg) 72%, var(--surface));
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 9px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.debug-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin-top: 12px;
}

.debug-actions button {
  min-height: 44px;
}

.debug-help {
  margin: 13px 0 0;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.5;
}

@media (max-width: 760px) {
  .global-mode-nav {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }

  .debug-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .debug-grid {
    grid-template-columns: 1fr;
  }

  .debug-row:nth-child(odd) {
    border-right: 0;
  }

  .debug-log {
    height: 210px;
  }
}

@media (max-width: 420px) {
  .global-mode-item {
    padding-left: 5px !important;
    padding-right: 5px !important;
    font-size: 11px;
  }

  .debug-actions {
    grid-template-columns: 1fr;
  }
}

/* v53: integrated application rail */
@media (min-width: 761px) {
  html {
    zoom: var(--ui-scale, 1);
  }

  .app {
    display: grid !important;
    grid-template-columns: 170px minmax(0, 1fr);
  }

  .global-mode-nav {
    position: sticky;
    top: 0;
    width: auto;
    height: 100vh;
    min-height: 100vh;
    padding: 28px 14px;
    align-self: start;
  }

  .content {
    min-width: 0;
    margin: 0 auto;
    padding: 28px;
  }
}

@media (min-width: 761px) and (max-width: 1050px) {
  .app {
    grid-template-columns: 92px minmax(0, 1fr);
  }

  .content {
    padding-left: 28px;
  }
}
