:root {
  color-scheme: dark;
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background-color: #050505;
  --transport-border: rgba(90, 160, 255, 0.85);
  --transport-border-muted: rgba(90, 160, 255, 0.35);
  --transport-surface: linear-gradient(180deg, rgba(9, 16, 28, 0.95), rgba(4, 7, 14, 0.92));
  --transport-surface-soft: linear-gradient(180deg, rgba(8, 14, 24, 0.88), rgba(3, 6, 12, 0.92));
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at top, #0b0f17, #030303 60%);
  color: #f8f9fb;
}

.app-shell {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

.app-shell canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.audio-transport {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translate3d(-50%, 0, 0);
  width: min(92vw, 820px);
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding: 0.85rem 1rem 0.95rem;
  background: radial-gradient(140% 160% at 50% 0%, rgba(21, 54, 104, 0.4), rgba(3, 6, 12, 0.95)),
    var(--transport-surface);
  border: 1px solid var(--transport-border);
  border-radius: 0;
  box-shadow: 0 18px 45px rgba(0, 10, 35, 0.65), inset 0 0 25px rgba(77, 139, 255, 0.12);
  color: #f4f8ff;
  z-index: 10;
  backdrop-filter: blur(6px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  will-change: opacity, transform;
}

.audio-transport.audio-transport--hidden {
  opacity: 0;
  transform: translate3d(-50%, 20px, 0);
  pointer-events: none;
}

.audio-transport__row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.55rem;
}

.audio-transport__row--primary {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.audio-transport__row--meta {
  align-items: stretch;
}

.audio-transport__slider-row {
  border: 1px solid var(--transport-border-muted);
  border-radius: 0;
  background: var(--transport-surface-soft);
  padding: 0.6rem 0.8rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.audio-btn {
  border: 1px solid var(--transport-border-muted);
  background: var(--transport-surface);
  color: inherit;
  min-height: 2.35rem;
  border-radius: 0;
  padding: 0.25rem 0.75rem;
  font: inherit;
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
  box-shadow: inset 0 0 12px rgba(77, 139, 255, 0.12);
}

.audio-btn:hover,
.audio-btn:focus-visible {
  border-color: var(--transport-border);
  box-shadow: 0 0 18px rgba(73, 145, 255, 0.35), inset 0 0 16px rgba(77, 139, 255, 0.25);
  transform: translateY(-1px);
}

.audio-btn--ghost {
  background: linear-gradient(180deg, rgba(19, 27, 44, 0.95), rgba(12, 19, 34, 0.9));
  border-color: rgba(90, 160, 255, 0.25);
}

.audio-btn--ghost:hover,
.audio-btn--ghost:focus-visible {
  border-color: var(--transport-border);
}

.audio-btn:disabled,
.audio-select:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.audio-select-wrapper {
  position: relative;
}

.audio-select {
  appearance: none;
  width: 100%;
  min-height: 2.35rem;
  border-radius: 0;
  border: 1px solid var(--transport-border-muted);
  background: var(--transport-surface);
  color: inherit;
  padding: 0 2.1rem 0 0.9rem;
  font: inherit;
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: inset 0 0 12px rgba(77, 139, 255, 0.12);
}

.audio-select__arrow {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-left: 0.4rem solid transparent;
  border-right: 0.4rem solid transparent;
  border-top: 0.45rem solid rgba(12, 18, 32, 0.9);
  pointer-events: none;
}

.audio-select option {
  background-color: #050a14;
  color: #eaf6ff;
  text-transform: none;
}

.audio-status {
  min-height: 2.35rem;
  border-radius: 0;
  border: 1px solid var(--transport-border-muted);
  background: var(--transport-surface);
  display: flex;
  align-items: center;
  padding: 0 0.85rem;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: none;
  color: rgba(236, 245, 255, 0.92);
  grid-column: span 2;
  box-shadow: inset 0 0 12px rgba(77, 139, 255, 0.12);
}

.audio-volume {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
}

.audio-volume__label {
  font-size: 0.65rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(247, 251, 255, 0.78);
}

.audio-volume__slider {
  appearance: none;
  flex: 1;
  height: 4px;
  border-radius: 0;
  background: linear-gradient(90deg, rgba(76, 140, 255, 0.2), rgba(92, 183, 255, 0.75));
  outline: none;
  cursor: pointer;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.6);
}

.audio-volume__slider::-webkit-slider-thumb {
  appearance: none;
  width: 16px;
  height: 26px;
  border-radius: 0;
  background: linear-gradient(180deg, #59b5ff, #297aff);
  border: 1px solid rgba(255, 255, 255, 0.8);
  box-shadow: 0 0 12px rgba(77, 139, 255, 0.45);
}

.audio-volume__slider::-moz-range-track {
  background: transparent;
}

.audio-volume__slider::-moz-range-thumb {
  width: 16px;
  height: 26px;
  border-radius: 0;
  background: linear-gradient(180deg, #59b5ff, #297aff);
  border: 1px solid rgba(255, 255, 255, 0.8);
  box-shadow: 0 0 12px rgba(77, 139, 255, 0.45);
}

.audio-volume__value {
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  min-width: 3rem;
  text-align: right;
  color: rgba(247, 251, 255, 0.85);
}

.audio-repeat {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border-radius: 0;
  border: 1px solid var(--transport-border-muted);
  background: var(--transport-surface);
  padding: 0 0.75rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-size: 0.65rem;
  color: rgba(247, 251, 255, 0.85);
  cursor: pointer;
  box-shadow: inset 0 0 12px rgba(77, 139, 255, 0.12);
}

.audio-repeat__input {
  width: 1rem;
  height: 1rem;
  margin: 0;
  cursor: pointer;
  accent-color: #6ebaed;
}

.audio-repeat__text {
  font-size: 0.65rem;
  letter-spacing: 0.18em;
}

@media (max-width: 720px) {
  .audio-transport {
    width: calc(100vw - 2rem);
    left: 50%;
    transform: translateX(-50%);
    padding: 0.75rem;
  }

  .audio-transport__row {
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  }

  .audio-status {
    grid-column: span 1;
  }

  .audio-transport__slider-row {
    flex-direction: column;
    align-items: stretch;
    padding: 0.55rem 0.65rem;
  }

  .audio-volume {
    flex-direction: column;
    align-items: flex-start;
  }

  .audio-volume__slider,
  .audio-volume__value {
    width: 100%;
  }

  .audio-volume__value {
    text-align: left;
  }
}

.audio-gate {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(5, 7, 10, 0.78);
  backdrop-filter: blur(6px);
  color: #f7fbff;
  text-align: center;
  padding: 2rem;
  z-index: 20;
}

.audio-gate p {
  margin-bottom: 1rem;
  letter-spacing: 0.02em;
}

.audio-gate__button {
  border: none;
  border-radius: 999px;
  padding: 0.75rem 1.5rem;
  background: linear-gradient(135deg, #5ddcff, #3c67e3 70%);
  color: #050505;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 10px 35px rgba(60, 103, 227, 0.35);
}

.audio-gate.is-loading .audio-gate__button {
  opacity: 0.6;
  pointer-events: none;
}

.audio-drop-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(18, 22, 30, 0.65);
  border: 2px dashed rgba(125, 225, 255, 0.5);
  border-radius: 1rem;
  margin: 1.25rem;
  pointer-events: none;
  opacity: 0;
  transform: scale(0.98);
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 15;
  color: rgba(247, 251, 255, 0.9);
  text-align: center;
  font-size: 1.1rem;
}

.audio-drop-overlay p {
  margin: 0;
}

body.audio-drop-active .audio-drop-overlay {
  opacity: 1;
  transform: scale(1);
}

.onboarding-tip {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  width: min(24rem, calc(100% - 2.5rem));
  padding: 1rem 1.25rem 1.25rem;
  border-radius: 1rem;
  background: rgba(10, 14, 24, 0.92);
  border: 1px solid rgba(125, 225, 255, 0.25);
  box-shadow: 0 25px 40px rgba(0, 0, 0, 0.55);
  color: #f7fbff;
  z-index: 12;
  backdrop-filter: blur(14px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.onboarding-tip.is-hidden {
  opacity: 0;
  transform: translateY(-10px);
  pointer-events: none;
}

.onboarding-tip h3 {
  margin: 0 0 0.25rem;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
}

.onboarding-tip p {
  margin: 0 0 0.5rem;
  font-size: 0.9rem;
  color: rgba(247, 251, 255, 0.9);
}

.onboarding-tip ul {
  margin: 0 0 0.75rem 1.1rem;
  padding: 0;
  font-size: 0.85rem;
  color: rgba(247, 251, 255, 0.82);
}

.onboarding-tip li {
  margin-bottom: 0.35rem;
}

.onboarding-tip__button {
  border: none;
  border-radius: 999px;
  padding: 0.55rem 1.35rem;
  background: linear-gradient(135deg, #7de1ff, #587dff 70%);
  color: #06090f;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(88, 125, 255, 0.35);
}

.onboarding-tip__button:focus-visible {
  outline: 2px solid rgba(247, 251, 255, 0.9);
  outline-offset: 3px;
}

.training-panel {
  position: fixed;
  top: 50%;
  right: 1rem;
  transform: translateY(-50%);
  width: min(380px, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
  padding: 1.25rem;
  border-radius: 1rem;
  background: rgba(5, 8, 16, 0.92);
  border: 1px solid rgba(125, 225, 255, 0.25);
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.55);
  z-index: 11;
  backdrop-filter: blur(12px);
}

.training-panel.training-panel--embedded {
  position: static;
  top: auto;
  right: auto;
  transform: none;
  width: 100%;
  max-height: none;
  margin: 0.5rem 0 0;
  padding: 0.9rem 0.75rem;
  background: rgba(5, 8, 16, 0.7);
  border-radius: 0.75rem;
  border-width: 1px;
  box-shadow: none;
  backdrop-filter: blur(8px);
}

.lil-gui.root {
  width: 500px;
}

.lil-gui .training-panel.training-panel--embedded {
  width: calc(100% - 0.5rem);
}

.training-panel-embed {
  margin-top: 0.75rem;
}

.training-panel__header h3 {
  margin: 0 0 0.25rem;
  letter-spacing: 0.04em;
  font-size: 1rem;
}

.training-panel__header p {
  margin: 0;
  color: rgba(247, 251, 255, 0.75);
  font-size: 0.85rem;
}

.training-panel__model-label {
  margin: 0 0 0.75rem;
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: rgba(247, 251, 255, 0.7);
}

.training-panel__status {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1rem 0 1.25rem;
  font-size: 0.85rem;
}

.training-panel__status-text {
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #7de1ff;
}

.training-panel__progress {
  position: relative;
  flex: 1;
  height: 4px;
  background: rgba(125, 225, 255, 0.15);
  border-radius: 999px;
  overflow: hidden;
}

.training-panel__progress-bar {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, #3c67e3, #5ddcff);
  transform-origin: left center;
  transform: scaleX(0);
  transition: transform 0.2s ease;
}

.training-panel__loss {
  font-family: 'JetBrains Mono', 'SFMono-Regular', Consolas, monospace;
  font-size: 0.78rem;
  color: rgba(247, 251, 255, 0.65);
}

.training-panel__section {
  margin-bottom: 1rem;
  padding: 0.85rem 0.1rem;
  border-top: 1px solid rgba(125, 225, 255, 0.15);
}

.training-panel__section h4 {
  margin: 0 0 0.35rem;
  font-size: 0.92rem;
  letter-spacing: 0.03em;
}

.training-panel__description {
  margin: 0 0 0.75rem;
  font-size: 0.75rem;
  color: rgba(247, 251, 255, 0.65);
}

.training-panel__correlation-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.training-panel__correlation-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.4rem;
  padding: 0.5rem;
  border-radius: 0.65rem;
  background: rgba(10, 15, 24, 0.85);
  border: 1px solid rgba(125, 225, 255, 0.15);
}

.training-panel__correlation-row select,
.training-panel__correlation-row input[type='range'] {
  width: 100%;
}

.training-panel__strength {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.75rem;
  color: rgba(247, 251, 255, 0.8);
}

.training-panel__btn {
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.4rem 1rem;
  font: inherit;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.2s ease, background 0.2s ease;
}

.training-panel__btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.training-panel__btn--primary {
  background: linear-gradient(120deg, #5ddcff, #3c67e3);
  color: #050505;
  border-color: transparent;
}

.training-panel__btn--ghost {
  background: rgba(125, 225, 255, 0.12);
  color: #f7fbff;
  border-color: rgba(125, 225, 255, 0.3);
}

.training-panel__btn--danger {
  background: rgba(255, 99, 99, 0.16);
  color: #ffc8c8;
  border-color: rgba(255, 120, 120, 0.4);
}

.training-panel__btn--small {
  padding: 0.3rem 0.75rem;
  font-size: 0.75rem;
}

.training-panel__correlation-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.75rem;
}

.training-panel__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.training-panel__field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.78rem;
  color: rgba(247, 251, 255, 0.65);
}

.training-panel__field input,
.training-panel__field textarea,
.training-panel__correlation-row select {
  border: 1px solid rgba(125, 225, 255, 0.25);
  border-radius: 0.65rem;
  padding: 0.4rem 0.65rem;
  background: rgba(7, 11, 20, 0.95);
  color: #f7fbff;
  font: inherit;
}

.training-panel__field textarea {
  resize: vertical;
}

.training-panel__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.training-panel__results {
  font-size: 0.78rem;
  color: rgba(247, 251, 255, 0.8);
}

.training-panel__result-list {
  padding-left: 1.1rem;
  margin: 0.35rem 0 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.training-panel__error {
  margin: 0.5rem 0 0;
  font-size: 0.78rem;
  color: #ffb3b3;
}

.training-panel__empty {
  color: rgba(247, 251, 255, 0.6);
  font-size: 0.8rem;
}

@media (max-width: 768px) {
  .training-panel {
    position: static;
    transform: none;
    width: calc(100% - 2rem);
    margin: 1rem auto;
    max-height: none;
  }

  .training-panel__correlation-row {
    grid-template-columns: repeat(1, minmax(0, 1fr));
  }

  .training-panel__grid {
    grid-template-columns: repeat(1, minmax(0, 1fr));
  }
}
