  :root {
      --bg0: #0b1220;
      /* slate-950-ish */
      --bg1: #0f172a;
      /* slate-900 */
      --bg2: #111827;
      /* slate-900 alt */
      --muted: #1f2937;
      /* slate-800 */
      --muted2: #334155;
      /* slate-700 */
      --text: #e5e7eb;
      /* slate-200 */
      --text2: #cbd5e1;
      /* slate-300 */
      --text3: #94a3b8;
      /* slate-400 */
      --indigo: #6366f1;
      /* indigo-500 */
      --indigoDim: #4338ca;
      /* indigo-700 */
      --indigoSoft: #312e81;
      /* indigo-900 */
      --emerald: #10b981;
      /* emerald-500 */
      --emeraldDim: #064e3b;
      /* emerald-900 */
      --rose: #f43f5e;
      /* rose-500 */
      --ok: #22c55e;
      /* success */
  }

  * {
      box-sizing: border-box
  }

  html,
  body {
      height: 100%
  }

  body {
      margin: 0;
      color: var(--text);
      background: linear-gradient(135deg, var(--bg0), var(--bg1));
      font: 14px/1.4 system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, sans-serif;
  }

  header {
      position: sticky;
      top: 0;
      z-index: 10;
      backdrop-filter: saturate(1.1) blur(4px);
      border-bottom: 1px solid var(--muted);
      background: rgba(15, 23, 42, .8);
      padding: 14px 24px;
  }

  .header-inner {
      max-width: 1120px;
      margin: 0 auto;
      display: flex;
      align-items: center;
      justify-content: space-between
  }

  .title {
      font-weight: 700;
      letter-spacing: .2px
  }

  main {
      max-width: 1120px;
      margin: 16px auto;
      padding: 0 16px;
      display: flex;
      gap: 24px
  }

  /* Roadmap */
  .roadmap {
      width: 240px;
      flex: 0 0 240px;
      border-right: 1px solid var(--muted);
      padding: 16px
  }

  .roadmap h2 {
      margin: 0 0 8px;
      font-size: 12px;
      color: var(--text2);
      text-transform: uppercase;
      letter-spacing: .08em
  }

  .step {
      width: 100%;
      display: flex;
      gap: 12px;
      align-items: center;
      padding: 8px 10px;
      margin: 6px 0;
      border-radius: 12px;
      background: transparent;
      border: 0;
      color: inherit;
      text-align: left;
      cursor: pointer
  }

  .step:hover {
      background: rgba(15, 23, 42, .6)
  }

  .step.active {
      background: #0b1325;
      outline: 1px solid rgba(99, 102, 241, .3)
  }

  .badge {
      width: 24px;
      height: 24px;
      border-radius: 999px;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 12px;
      font-weight: 700
  }

  .badge.active {
      background: var(--indigo);
      color: #fff
  }

  .badge.inactive {
      background: #334155;
      color: #cbd5e1
  }

  .dot {
      color: #34d399;
      font-size: 10px
  }

  .step-caption {
      font-size: 11px;
      color: var(--text3)
  }

  /* Card/panel */
  .panel {
      flex: 1;
  }

  .card {
      background: var(--bg1);
      border: 1px solid var(--muted);
      border-radius: 16px;
      padding: 20px
  }

  .row {
      display: flex;
      align-items: center;
      gap: 8px
  }

  .row-sb {
      display: flex;
      align-items: center;
      justify-content: space-between
  }

  .h1 {
      font-size: 18px;
      font-weight: 700
  }

  .muted {
      color: var(--text3)
  }

  .btn {
      font-size: 12px;
      padding: 6px 10px;
      border-radius: 8px;
      border: 1px solid var(--muted);
      background: #0f172a;
      color: var(--text);
      cursor: pointer;
      transition: transform .12s ease, box-shadow .12s ease, background-color .12s ease, border-color .12s ease;
      user-select: none;
  }

  .btn.primary {
      background: var(--indigo);
      border-color: transparent;
      cursor: pointer
  }

  .btn.solid {
      background: #1f2937;
      cursor: pointer
  }

  .btn.running {
      background: var(--rose);
      border-color: transparent;
      color: #fff
  }

  .btn:disabled {
      opacity: .7;
      cursor: not-allowed
  }

  /* Hover / Focus / Active feedback for buttons */
  .btn:hover:not(:disabled) {
      transform: translateY(-2px);
      box-shadow: 0 6px 18px rgba(2, 6, 23, .45);
  }

  .btn:active:not(:disabled) {
      transform: translateY(0) scale(.995);
      box-shadow: 0 2px 6px rgba(2, 6, 23, .35);
  }

  .btn:focus-visible {
      outline: 2px solid rgba(99, 102, 241, .35);
      outline-offset: 3px;
  }

  /* Next button pulse preserved */
  .next.pulse {
      animation: pulse 1.1s ease-in-out infinite
  }

  /* Step (roadmap) button feedback */
  .step {
      will-change: transform, background
  }

  .step:hover {
      background: rgba(15, 23, 42, .65);
      transform: translateX(4px)
  }

  .step:active {
      transform: translateX(2px) scale(.997)
  }

  .step:focus-visible {
      outline: 2px solid rgba(99, 102, 241, .18);
      outline-offset: 3px
  }

  /* Badge hover to give emphasis */
  .badge {
      transition: transform .12s ease, box-shadow .12s ease
  }

  .badge:hover {
      transform: translateY(-2px);
      box-shadow: 0 6px 14px rgba(99, 102, 241, .12)
  }

  @keyframes pulse {
      0% {
          box-shadow: 0 0 0 0 rgba(16, 185, 129, .0)
      }

      70% {
          box-shadow: 0 0 0 6px rgba(16, 185, 129, .18)
      }

      100% {
          box-shadow: 0 0 0 0 rgba(16, 185, 129, .0)
      }
  }

  /* Grid cards */
  .grid {
      display: grid;
      gap: 12px
  }

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

  @media(min-width:840px) {
      .grid.g4 {
          grid-template-columns: repeat(4, minmax(0, 1fr))
      }
  }

  .tile {
      border: 1px solid var(--muted);
      background: var(--bg2);
      border-radius: 12px;
      padding: 12px;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 8px
  }

  /* Timers */
  .mono {
      font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace
  }

  /* Tooltip */
  .help {
      position: relative;
      display: inline-flex;
      align-items: center
  }

  .help i {
      display: inline-flex;
      width: 16px;
      height: 16px;
      align-items: center;
      justify-content: center;
      border-radius: 999px;
      background: #334155;
      color: #e5e7eb;
      font-size: 10px;
      font-weight: 700;
      cursor: help;
      margin-left: 6px
  }

  .help .tip {
      display: none;
      position: absolute;
      top: 22px;
      left: -6px;
      width: 260px;
      background: #0b1325;
      border: 1px solid var(--muted);
      color: var(--text);
      font-size: 12px;
      border-radius: 8px;
      padding: 8px;
      z-index: 5
  }

  .help:hover .tip {
      display: block
  }

  /* Siren */
  .siren {
      width: 80px;
      height: 220px;
      border: 1px solid var(--muted);
      background: var(--bg2);
      border-radius: 14px;
      margin: 0 auto;
      position: relative;
      overflow: hidden
  }

  .siren .fill {
      position: absolute;
      inset: 0;
      background: rgba(99, 102, 241, .5);
      animation: siren 10s ease-in-out infinite
  }

  @keyframes siren {
      0% {
          transform: translateY(0%)
      }

      50% {
          transform: translateY(-100%)
      }

      100% {
          transform: translateY(0%)
      }
  }

  /* Footer progress */
  .progress {
      display: flex;
      align-items: center;
      gap: 8px;
      color: var(--text3);
      font-size: 12px;
      margin-top: 12px
  }

  .bar {
      height: 6px;
      width: 56px;
      border-radius: 999px;
      background: #1f2637
  }

  .bar.done {
      background: var(--indigo)
  }

  .bar.active {
      background: #1b1f36
  }

  /* Piano */
  .piano-wrap {
      position: relative
  }

  .piano-viewport {
      overflow-x: auto;
      border: 1px solid var(--muted);
      background: var(--bg2);
      border-radius: 12px;
      padding: 8px
  }

  .keys {
      display: flex
  }

  .key {
      width: 40px;
      height: 48px;
      border-radius: 5px;
      border: 3px solid var(--muted);
      font-size: 10px;
      color: var(--text);
      display: flex;
      align-items: center;
      justify-content: center;
      margin-right: 4px;
      background: #3f577a;
      cursor: pointer
  }

  .key.sharp {
      background: #050520;
      color: #e5e7eb;
      transform: translateY(-4px)
  }

  .key.active:not(.sharp) {
      background: #34d399;
      color: #0f172a
  }

  .key.active.sharp {
      background: #065f46;
      color: #fff
  }

  .key {
      transition: transform .09s ease, box-shadow .09s ease, background-color .12s ease
  }

  .key:hover {
      transform: translateY(-3px);
      box-shadow: 0 8px 18px rgba(2, 6, 23, .5)
  }

  .key:active {
      transform: translateY(0) scale(.995);
      box-shadow: 0 3px 8px rgba(2, 6, 23, .35)
  }

  .key:focus-visible {
      outline: 2px solid rgba(99, 102, 241, .22);
      outline-offset: 2px
  }

  .bars {
      margin-top: 10px
  }

  .barrow {
      display: flex;
      align-items: center;
      gap: 8px;
      margin: 8px 0
  }

  .barlabel {
      width: 96px;
      font-size: 11px;
      color: var(--text2)
  }

  .bartrack {
      position: relative;
      overflow: hidden;
      height: 12px;
      border: 1px solid var(--muted);
      background: var(--bg2);
      border-radius: 999px
  }

  .barseg {
      position: absolute;
      top: 0;
      height: 100%;
      border-radius: 999px;
      background: rgba(99, 102, 241, .65)
  }

  .barseg.active {
      background: #a5b4fc
  }

  /* Controls */
  .controls {
      display: flex;
      align-items: center;
      gap: 8px
  }

  .spacer {
      flex: 1
  }

  /* Mobile / narrow layout: stack roadmap above content and allow piano to be full-width */
  @media (max-width: 720px) {
      main {
          flex-direction: column;
          padding: 12px
      }

      .roadmap {
          width: 100%;
          flex: 0 0 auto;
          border-right: none;
          border-bottom: 1px solid var(--muted);
          padding: 12px 8px
      }

      .panel {
          width: 100%
      }

      .piano-wrap {
          margin-left: 0 !important
      }

      .piano-viewport {
          width: 100% !important;
          min-width: 0 !important;
          max-width: 100% !important
      }

      .header-inner {
          padding: 12px
      }

      .card {
          padding: 14px
      }
  }

  /* Samples / Tag Explorer */
  .tag-group {
      margin-bottom: 12px;
  }

  .tag-header {
      font-size: 11px;
      text-transform: uppercase;
      letter-spacing: 0.05em;
      color: var(--text3);
      margin-bottom: 6px;
      font-weight: 700;
  }

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

  .tag-pill {
      font-size: 11px;
      padding: 4px 10px;
      border-radius: 999px;
      background: var(--bg0);
      border: 1px solid var(--muted);
      color: var(--text2);
      cursor: pointer;
      user-select: none;
      transition: all 0.12s ease;
  }

  .tag-pill:hover {
      background: var(--muted);
      border-color: var(--text3);
  }

  .tag-pill.active {
      background: rgba(99, 102, 241, 0.2);
      border-color: var(--indigo);
      color: var(--indigo);
  }

  .sample-card {
      background: var(--bg2);
      border: 1px solid var(--muted);
      border-radius: 12px;
      padding: 12px;
      display: flex;
      flex-direction: column;
      gap: 4px;
      transition: transform 0.12s ease, border-color 0.12s ease;
      cursor: pointer;
      position: relative;
      overflow: hidden;
  }

  .sample-card:hover {
      transform: translateY(-2px);
      border-color: var(--text3);
      box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
  }

  /* mini visualization of matching strength or just style */
  .sample-card::before {
      content: '';
      position: absolute;
      top: 0;
      left: 0;
      width: 4px;
      height: 100%;
      background: var(--muted);
      transition: background 0.2s;
  }

  .sample-card:hover::before {
      background: var(--indigo);
  }

  .s-artist {
      font-weight: 700;
      font-size: 14px;
      color: var(--text);
  }

  .s-song {
      font-size: 12px;
      color: var(--text2);
      font-style: italic;
  }

  .s-section {
      font-size: 11px;
      color: var(--text3);
      margin-top: 2px;
  }

  .s-tags {
      display: flex;
      flex-wrap: wrap;
      gap: 4px;
      margin-top: 8px;
  }

  .s-tag {
      font-size: 9px;
      padding: 2px 6px;
      border-radius: 4px;
      background: var(--muted);
      color: var(--text3);
  }

  .s-tag.match {
      background: rgba(16, 185, 129, 0.15);
      color: var(--emerald);
      border: 1px solid rgba(16, 185, 129, 0.2);
  }

  /* Color coded tags */
  .tag-cat-weight_texture {
      border-color: rgba(6, 182, 212, 0.5);
      color: #22d3ee;
  }

  /* cyan */
  .tag-cat-weight_texture.active {
      background: rgba(6, 182, 212, 0.2) !important;
  }

  .tag-cat-power {
      border-color: rgba(244, 63, 94, 0.5);
      color: #fb7185;
  }

  /* rose */
  .tag-cat-power.active {
      background: rgba(244, 63, 94, 0.2) !important;
  }

  .tag-cat-resonance_placement {
      border-color: rgba(168, 85, 247, 0.5);
      color: #c084fc;
  }

  /* purple */
  .tag-cat-resonance_placement.active {
      background: rgba(168, 85, 247, 0.2) !important;
  }

  .tag-cat-skillfulness {
      border-color: rgba(59, 130, 246, 0.5);
      color: #60a5fa;
  }

  /* blue */
  .tag-cat-skillfulness.active {
      background: rgba(59, 130, 246, 0.2) !important;
  }

  .tag-cat-expressiveness {
      border-color: rgba(236, 72, 153, 0.5);
      color: #f472b6;
  }

  /* pink */
  .tag-cat-expressiveness.active {
      background: rgba(236, 72, 153, 0.2) !important;
  }

  .tag-cat-delivery {
      border-color: rgba(245, 158, 11, 0.5);
      color: #fbbf24;
  }

  /* amber */
  .tag-cat-delivery.active {
      background: rgba(245, 158, 11, 0.2) !important;
  }

  .tag-cat-articulation {
      border-color: rgba(34, 197, 94, 0.5);
      color: #4ade80;
  }

  /* green */
  .tag-cat-articulation.active {
      background: rgba(34, 197, 94, 0.2) !important;
  }

  .tag-cat-register {
      border-color: rgba(99, 102, 241, 0.5);
      color: #818cf8;
  }

  /* indigo */
  .tag-cat-register.active {
      background: rgba(99, 102, 241, 0.2) !important;
  }

  .tag-cat-onset_offset {
      border-color: rgba(148, 163, 184, 0.5);
      color: #cbd5e1;
  }

  /* slate */
  .tag-cat-onset_offset.active {
      background: rgba(148, 163, 184, 0.2) !important;
  }

  /* Apply same colors to sample card tags */
  .s-tag.tag-cat-weight_texture {
      color: #22d3ee;
      border: 1px solid rgba(6, 182, 212, 0.3);
  }

  .s-tag.tag-cat-power {
      color: #fb7185;
      border: 1px solid rgba(244, 63, 94, 0.3);
  }

  .s-tag.tag-cat-resonance_placement {
      color: #c084fc;
      border: 1px solid rgba(168, 85, 247, 0.3);
  }

  .s-tag.tag-cat-skillfulness {
      color: #60a5fa;
      border: 1px solid rgba(59, 130, 246, 0.3);
  }

  .s-tag.tag-cat-expressiveness {
      color: #f472b6;
      border: 1px solid rgba(236, 72, 153, 0.3);
  }

  .s-tag.tag-cat-delivery {
      color: #fbbf24;
      border: 1px solid rgba(245, 158, 11, 0.3);
  }

  .s-tag.tag-cat-articulation {
      color: #4ade80;
      border: 1px solid rgba(34, 197, 94, 0.3);
  }

  .s-tag.tag-cat-register {
      color: #818cf8;
      border: 1px solid rgba(99, 102, 241, 0.3);
  }

  .s-tag.tag-cat-onset_offset {
      color: #cbd5e1;
      border: 1px solid rgba(148, 163, 184, 0.3);
  }

  /* Disabled tag state */
  .tag-pill.disabled {
      opacity: 0.3;
      pointer-events: none;
      filter: grayscale(0.8);
      border-style: dashed;
  }

  /* Play Button */
  .play-btn {
      /* functionality passed off to sample card clicks for now*/
      visibility: hidden;
      position: absolute;
      top: 12px;
      right: 12px;
      width: 32px;
      height: 32px;
      border-radius: 50%;
      background: var(--bg0);
      border: 1px solid var(--muted);
      color: var(--text);
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      z-index: 2;
      transition: all 0.2s ease;
      font-size: 12px;
      padding-left: 2px;
  }

  .play-btn:hover {
      background: var(--indigo);
      border-color: transparent;
      color: #fff;
      transform: scale(1.1);
      box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
  }

  /* Filter Logic Segmented Control */
  .filter-logic-toggle {
      display: inline-flex;
      background: var(--bg0);
      border: 1px solid var(--muted);
      border-radius: 999px;
      padding: 3px;
      gap: 2px;
  }

  .filter-logic-toggle label {
      position: relative;
      cursor: pointer;
  }

  .filter-logic-toggle input {
      position: absolute;
      opacity: 0;
      pointer-events: none;
  }

  .filter-logic-toggle span {
      display: block;
      padding: 4px 12px;
      border-radius: 999px;
      font-size: 11px;
      font-weight: 600;
      color: var(--text3);
      transition: all 0.15s ease;
  }

  .filter-logic-toggle input:checked+span {
      background: var(--muted2);
      color: var(--text);
      box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  }

  .filter-logic-toggle:hover span {
      color: var(--text2);
  }

  .filter-logic-toggle input:checked+span:hover {
      color: var(--text);
  }