/* SJOEFF — design system: tokens, layout primitives, shared components */

/* === ROOT VARIABLES === */
:root {
  /* Surface — light overall tint (not pure white), neutral */
  --color-bg: #e8e8ed;
  --color-bg-elevated: #f0f0f4;
  --color-surface: #f4f4f7;
  --color-surface-raised: #fafafb;
  --color-surface-hover: #e0e0e7;
  --color-border: #d6d6dd;
  --color-border-strong: #c0c0c9;
  --color-border-bright: #a2a2ad;

  /* Text — dark on light, neutral */
  --color-text: #1b1b1f;
  --color-text-secondary: #44444c;
  --color-text-muted: #6e6e78;
  --color-text-dim: #9a9aa4;

  /* Brand / accent — single bold electric pop (violet) */
  --color-accent: #5a40e6;
  --color-accent-dim: rgba(90, 64, 230, 0.14);

  /* Lock state */
  --color-lock: #ffd43b;
  --color-lock-dim: rgba(255, 212, 59, 0.15);

  /* Mix relationship colors */
  --mix-perfect: #00ffd1;
  --mix-minus: #4dabf7;
  --mix-plus: #ffd43b;
  --mix-energy: #ff6b35;
  --mix-scale: #b794f6;
  --mix-diagonal: #f783ac;
  --mix-jaws: #ff4757;
  --mix-mood: #20c997;

  /* Camelot wheel colors — Mixed In Key style, rainbow around the wheel.
     Same hue for A and B (letter = minor/major), brightness via separate filter. */
  --key-1:  #84e1bc;  /* 1A/1B  — turquoise-green */
  --key-2:  #6fe0d3;  /* 2A/2B  — cyan */
  --key-3:  #7dc8f7;  /* 3A/3B  — blue */
  --key-4:  #92aef9;  /* 4A/4B  — purple-blue */
  --key-5:  #b794f6;  /* 5A/5B  — purple */
  --key-6:  #e082e8;  /* 6A/6B  — magenta */
  --key-7:  #f783ac;  /* 7A/7B  — pink */
  --key-8:  #ff8787;  /* 8A/8B  — coral-red */
  --key-9:  #ffa94d;  /* 9A/9B  — orange */
  --key-10: #ffd43b;  /* 10A/10B — yellow */
  --key-11: #c0eb75;  /* 11A/11B — lime */
  --key-12: #8ce99a;  /* 12A/12B — green */

  /* Typography */
  --font-display: 'Space Grotesk', 'SF Pro Display', -apple-system, sans-serif;
  --font-body: 'Inter', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Menlo', monospace;

  /* Spacing scale */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;

  /* Sizing */
  --card-min-width: 220px;
  --grid-gap: 1rem;

  /* Animation */
  --transition-fast: 120ms ease;
  --transition-base: 240ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 6px 20px rgba(0, 0, 0, 0.10);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.13);
  --shadow-glow: 0 0 32px var(--color-accent-dim);
  --shadow-lock: 0 0 24px var(--color-lock-dim);

  /* Z-index scale */
  --z-canvas: 1;
  --z-cards: 10;
  --z-card-locked: 15;
  --z-card-hovered: 20;
  --z-tooltip: 100;
  --z-overlay: 200;
}

/* === BASE === */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
html { font-size: 17px; }

body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;

  background-image:
    radial-gradient(ellipse at top left, rgba(77, 171, 247, 0.04) 0%, transparent 50%),
    radial-gradient(ellipse at bottom right, rgba(183, 148, 246, 0.04) 0%, transparent 50%);
}

/* === LAYOUT === */
.app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  position: relative;
}

.app__header {
  position: sticky;
  top: 0;
  z-index: var(--z-overlay);
  height: 58px;
  padding-left: max(var(--space-2xl), calc((100vw - 1400px) / 2));
  padding-right: max(var(--space-2xl), calc((100vw - 1400px) / 2));
  background: rgba(240, 240, 244, 0.82);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: var(--space-md);
}

.app__title { justify-self: start; grid-column: 1; }

.app__right {
  justify-self: end;
  grid-column: 3;
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

/* Center bay (tool pages): page title + help */
.app__tool {
  justify-self: center;
  grid-column: 2;
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 3px 3px 3px var(--space-md);
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: 999px;
}

.app__tool-name {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--color-text);
  white-space: nowrap;
}

.app__title {
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  color: var(--color-text);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a.app__title:hover {
  color: var(--color-accent);
}

.app__title-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-accent);
  box-shadow: 0 0 12px var(--color-accent);
  animation: pulse 2s ease-in-out infinite;
}

/* === HEADER CTA === */
.app__cta {
  padding: var(--space-xs) var(--space-md);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--color-bg);
  background: var(--color-accent);
  border: 1px solid var(--color-accent);
  border-radius: 6px;
  text-decoration: none;
  transition: all var(--transition-fast);
}

.app__cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px var(--color-accent-dim);
}

/* === NAV === */
.app__nav {
  display: flex;
  gap: var(--space-xs);
}

.app__nav-link {
  padding: var(--space-xs) var(--space-md);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-text-muted);
  text-decoration: none;
  border-radius: 6px;
  border: 1px solid transparent;
  transition: all var(--transition-fast);
}

.app__nav-link:hover {
  color: var(--color-text);
  background: var(--color-surface);
}

.app__nav-link--active {
  color: var(--color-accent);
  background: var(--color-accent-dim);
  border-color: var(--color-accent);
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* Stats bar — lives inside the tool content (mixer: under toolbar, wheel: above wheel).
   Was originally in the header; moved out so the website header stays clean. */
.app__stats {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--color-text-muted);
  padding: var(--space-sm) var(--space-md);
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  margin-bottom: var(--space-md);
}

.app__stats--bottom {
  position: absolute;
  bottom: var(--space-lg);
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  z-index: 5;
}

.app__stats-group {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
}

/* Selection sits in the center of the available row */
.app__stats-group--selection {
  margin: 0 auto;
  gap: var(--space-md);
  padding: 4px var(--space-md);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-bg);
  opacity: 0.5;
  transition: opacity var(--transition-base), border-color var(--transition-base);
}

.app__stats-group--selection.app__stats--active {
  opacity: 1;
  border-color: var(--color-border-strong);
}

/* Global stays on the right side */
.app__stats-group--global {
  order: 2;
}

/* Selection filters sit in the bottom bar on the mixer, left-aligned */
.controls__bottom .app__stats-group--selection {
  margin: 0;
}

.app__stat {
  display: flex;
  align-items: baseline;
}

.app__stat-label {
  color: var(--color-text-dim);
  margin-right: var(--space-xs);
}

.app__stat-value {
  color: var(--color-text);
  font-weight: 500;
}

/* Clickable selection stats */
.app__stat--clickable {
  background: transparent;
  border: 1px solid transparent;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  transition: all var(--transition-fast);
}

.app__stats--active .app__stat--clickable {
  border-color: var(--color-border);
}

.app__stat--clickable:hover {
  border-color: var(--color-accent);
  background: var(--color-accent-dim);
}

.app__stat--clickable .app__stat-label {
  color: var(--color-accent);
}

.app__stats--active .app__stat--clickable .app__stat-value {
  color: var(--color-accent);
  font-weight: 600;
}

/* Active filter — currently engaged stat */
.app__stat--filter-active {
  background: var(--color-accent-dim) !important;
  border-color: var(--color-accent) !important;
  box-shadow: 0 0 12px var(--color-accent-dim);
}

.app__main {
  flex: 1;
  position: relative;
  padding: var(--space-2xl);
  width: 100%;
}

/* === TOOLBAR === */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
  align-items: center;
}

.toolbar__divider {
  width: 1px;
  height: 24px;
  background: var(--color-border-strong);
  margin: 0 var(--space-xs);
}

/* === FILTERS === */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
  margin-bottom: var(--space-2xl);
  padding: var(--space-md) var(--space-lg);
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: 12px;
}

.filters__group {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding-right: var(--space-lg);
  border-right: 1px solid var(--color-border);
}

.filters__group:last-child {
  border-right: none;
  padding-right: 0;
}

.filters__label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-text-muted);
}

.filters__btn {
  padding: var(--space-xs) var(--space-md);
  background: transparent;
  border: 1px solid var(--color-border-strong);
  border-radius: 6px;
  color: var(--color-text-secondary);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.filters__btn:hover {
  border-color: var(--color-border-bright);
  color: var(--color-text);
  background: var(--color-surface);
}

.filters__btn--active {
  background: var(--color-accent-dim);
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.filters__input {
  background: var(--color-bg);
  border: 1px solid var(--color-border-strong);
  border-radius: 6px;
  padding: var(--space-sm) var(--space-md);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 0.85rem;
  min-width: 220px;
  transition: border-color var(--transition-fast);
}

.filters__input::placeholder {
  color: var(--color-text-dim);
}

.filters__input:focus {
  outline: none;
  border-color: var(--color-accent);
}

/* === TRACK GRID === */
/* Auto-fill met grote min-width geeft max 5 cols op normale schermen.
   Voor ultra-wide schermen forceren we expliciet 5 cols. */
.grid {
  position: relative;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--card-min-width), 1fr));
  gap: var(--grid-gap);
}

/* Hard cap at 5 columns — kicks in as soon as a 6th would fit */
@media (min-width: 1400px) {
  .grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

/* SVG overlay for connection paths */
.grid__canvas {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: var(--z-canvas);
  opacity: 0;
  transition: opacity var(--transition-base);
}

.grid__canvas--active {
  opacity: 1;
}

.grid__path {
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  opacity: 0;
  transition: opacity var(--transition-fast);
  filter: drop-shadow(0 0 4px currentColor);
}

.grid__path--visible {
  opacity: 0.55;
}

/* === TRACK CARD === */
.card {
  position: relative;
  z-index: var(--z-cards);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: var(--space-md);
  cursor: pointer;
  transition: all var(--transition-base);
  display: flex;
  flex-direction: column;
  /* Fixed height; title is one line so content can never exceed it */
  min-height: 110px;
  height: 110px;
  /* Grid item must be allowed to shrink below its content,
     otherwise a long one-line title widens its column and breaks the grid */
  min-width: 0;
}

.card:hover {
  background: var(--color-surface-raised);
  border-color: var(--color-border-strong);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.card--hovered {
  z-index: var(--z-card-hovered);
  background: var(--color-surface-raised);
  border-color: var(--color-accent);
  box-shadow: var(--shadow-glow);
  transform: translateY(-2px);
}

.card--locked {
  z-index: var(--z-card-locked);
  background: var(--color-surface-raised);
  border-color: var(--color-lock);
  border-width: 2px;
  box-shadow: var(--shadow-lock);
}

.card--locked .card__lock-indicator {
  opacity: 1;
}

.card--connected {
  border-color: var(--connection-color, var(--color-accent));
  box-shadow: 0 0 20px var(--connection-color-dim, var(--color-accent-dim));
}

.card--dimmed {
  opacity: 0.2;
  filter: saturate(0.3);
}

.card--no-key {
  opacity: 0.55;
}

.card__lock-indicator {
  position: absolute;
  top: var(--space-sm);
  right: var(--space-sm);
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--color-lock);
  box-shadow: 0 0 12px var(--color-lock);
  opacity: 0;
  transition: opacity var(--transition-base);
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 8px;
  color: #0a0a0b;
}

.card__lock-indicator::after {
  content: '●';
}

.card__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
}

.card__title-block {
  flex: 1;
  min-width: 0;
  padding-right: var(--space-md); /* room for lock indicator */
}

.card__title {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-text);
  margin: 0 0 2px 0;
  line-height: 1.25;
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card__artist {
  font-size: 0.75rem;
  color: var(--color-text-secondary);
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 400;
}

.card__key {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 26px;
  padding: 0 var(--space-xs);
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
  background: var(--key-color, var(--color-bg));
  color: #0a0a0b;
  border: 1px solid var(--key-color, var(--color-border-strong));
  box-shadow: 0 0 12px var(--key-color-glow, transparent);
}

.card__key--minor {
  /* A keys (minor) — outline style, transparent background */
  background: transparent;
  color: var(--key-color, var(--color-text));
  border: 2px solid var(--key-color, var(--color-border-strong));
}

.card__key--unknown {
  color: var(--color-text-dim);
  font-style: italic;
  background: var(--color-bg);
  border: 1px solid var(--color-border-strong);
  box-shadow: none;
}

.card__meta {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-top: auto;
  padding-top: var(--space-sm);
  padding-right: 76px; /* room for the toast badge bottom-right */
  border-top: 1px solid var(--color-border);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--color-text-secondary);
}

.card__meta-item {
  display: flex;
  align-items: baseline;
  gap: var(--space-xs);
}

.card__meta-label {
  color: var(--color-text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.65rem;
}

/* === CONNECTION TOAST — bottom-right on card, with label === */
.card__connection-badge {
  position: absolute;
  bottom: var(--space-sm);
  right: var(--space-sm);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  background: var(--connection-color, var(--color-accent));
  color: #0a0a0b;
  opacity: 0;
  transform: translateY(4px);
  transition: all var(--transition-base);
  pointer-events: none;
  z-index: 2;
  white-space: nowrap;
}

.card--connected .card__connection-badge {
  opacity: 1;
  transform: translateY(0);
}

/* Edit button — touch devices only (mouse users right-click instead) */
.card__edit {
  display: none;
  position: absolute;
  top: 6px;
  right: 6px;
  width: 26px;
  height: 26px;
  align-items: center;
  justify-content: center;
  background: var(--color-surface-raised);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  color: var(--color-text-muted);
  font-size: 1.05rem;
  line-height: 1;
  padding: 0;
  cursor: pointer;
  z-index: 3;
}

@media (hover: none) and (pointer: coarse) {
  .card__edit { display: flex; }
  .card__header { padding-right: 30px; }
}

/* Legend hint adapts to input type */
.legend__hint--touch { display: none; }
@media (hover: none) and (pointer: coarse) {
  .legend__hint--mouse { display: none; }
  .legend__hint--touch { display: inline; }
}

/* === LEGEND === */
.legend {
  position: fixed;
  bottom: var(--space-xl);
  right: var(--space-xl);
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border-strong);
  border-radius: 12px;
  padding: var(--space-md);
  max-width: 280px;
  box-shadow: var(--shadow-lg);
  z-index: var(--z-overlay);
  transition: all var(--transition-base);
}

.legend--collapsed .legend__list {
  display: none;
}

.legend__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-sm);
}

.legend__title {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-text-muted);
  margin: 0;
}

.legend__toggle {
  background: transparent;
  border: none;
  color: var(--color-text-secondary);
  cursor: pointer;
  padding: 0 var(--space-xs);
  font-family: var(--font-mono);
  font-size: 1rem;
  line-height: 1;
}

.legend__toggle:hover {
  color: var(--color-text);
}

.legend__list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  margin-top: var(--space-sm);
}

.legend__item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 0.78rem;
  color: var(--color-text-secondary);
}

.legend__item-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.legend__item-label {
  flex: 1;
}

.legend__item-symbol {
  font-family: var(--font-mono);
  color: var(--color-text-dim);
}

/* Locked-state hint in legend */
.legend__hint {
  margin-top: var(--space-md);
  padding-top: var(--space-md);
  border-top: 1px solid var(--color-border);
  font-size: 0.7rem;
  color: var(--color-text-muted);
  line-height: 1.5;
}

.legend__hint kbd {
  display: inline-block;
  padding: 1px 5px;
  background: var(--color-surface);
  border: 1px solid var(--color-border-strong);
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--color-text);
}

/* === EMPTY STATE === */
.empty-state {
  text-align: center;
  padding: var(--space-3xl);
  color: var(--color-text-muted);
  grid-column: 1 / -1;
}

.empty-state__title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--color-text);
  margin: 0 0 var(--space-sm) 0;
}

.empty-state__hint {
  margin: 0 0 var(--space-xl) 0;
  max-width: 420px;
  margin-left: auto;
  margin-right: auto;
}

.empty-state__actions {
  display: flex;
  gap: var(--space-md);
  justify-content: center;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
  .app__header {
    display: flex;
    height: auto;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md);
  }

  .app__main {
    padding: var(--space-md);
  }

  .filters {
    flex-direction: column;
    align-items: stretch;
  }

  .filters__group {
    border-right: none;
    border-bottom: 1px solid var(--color-border);
    padding-right: 0;
    padding-bottom: var(--space-sm);
    flex-wrap: wrap;
  }

  .legend {
    bottom: var(--space-md);
    right: var(--space-md);
    left: var(--space-md);
    max-width: none;
  }
}

/* === MOBILE TOOL BLOCKER ===
   Hides tool UI on small viewports and shows a back-to-home overlay.
   Activated by adding `tool-page` class to body in mixer.html / wheel.html. */
.tool-mobile-block {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-xl);
  background:
    radial-gradient(ellipse at 30% 30%, rgba(90, 64, 230, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 70% 70%, rgba(183, 148, 246, 0.06) 0%, transparent 50%),
    var(--color-bg);
}

.tool-mobile-block__icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--color-accent-dim);
  border: 1px solid var(--color-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-lg);
}

.tool-mobile-block__icon svg {
  width: 28px;
  height: 28px;
  color: var(--color-accent);
}

.tool-mobile-block__eyebrow {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--color-accent);
  margin: 0 0 var(--space-sm) 0;
}

.tool-mobile-block__title {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--color-text);
  margin: 0 0 var(--space-md) 0;
  max-width: 320px;
}

.tool-mobile-block__msg {
  font-size: 0.95rem;
  color: var(--color-text-muted);
  line-height: 1.6;
  max-width: 360px;
  margin: 0 0 var(--space-xl) 0;
}

.tool-mobile-block__back {
  padding: var(--space-sm) var(--space-lg);
  background: var(--color-accent);
  color: var(--color-bg);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  border: none;
  border-radius: 8px;
  text-decoration: none;
  transition: all var(--transition-base);
}

.tool-mobile-block__back:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px var(--color-accent-dim);
}

@media (max-width: 767px) {
  body.tool-page .app {
    display: none;
  }
  body.tool-page .tool-mobile-block {
    display: flex;
  }
}

/* === HEADER RESPONSIVE TWEAKS === */
@media (max-width: 768px) {
  .app__cta {
    margin-left: 0;
    align-self: stretch;
    text-align: center;
  }
}

/* === COMBINED CONTROLS PANEL (mixer) — one bar instead of three === */
.controls {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  margin-bottom: var(--space-2xl);
}

.controls__top {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  flex-wrap: wrap;
}

.controls__bottom {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
  padding-top: var(--space-md);
  border-top: 1px solid var(--color-border);
}

/* Neutralize the inner groups so the panel is the single bar */
.controls .toolbar {
  margin: 0;
  flex: 1 1 auto;
}
.controls .app__stats {
  margin: 0;
  padding: 0;
  background: none;
  border: none;
  border-radius: 0;
  margin-left: auto;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--space-xs);
}
.controls .filters {
  margin: 0;
  padding: 0;
  background: none;
  border: none;
  border-radius: 0;
  flex: 1;
}

/* === HEADER HELP BUTTON === */
.app__help {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--color-border-strong);
  background: transparent;
  color: var(--color-text-muted);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.app__help:hover {
  color: var(--color-accent);
  border-color: var(--color-accent);
  background: var(--color-accent-dim);
}
