/*!
 * drei simulator
 * Version 1.0.0
 * Copyright (c) drei audio / Tim Nelles
 */
@font-face {
  font-family: "Manrope";
  src: url("/fonts/manrope/Manrope-400.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Manrope";
  src: url("/fonts/manrope/Manrope-600.ttf") format("truetype");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Manrope";
  src: url("/fonts/manrope/Manrope-700.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Manrope";
  src: url("/fonts/manrope/Manrope-800.ttf") format("truetype");
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: dark;
  font-family: "Manrope", sans-serif;
  --bg: #000000;
  --bg-elevated: #050505;
  --surface-1: rgba(10, 10, 10, 0.98);
  --surface-2: rgba(16, 16, 16, 0.98);
  --surface-3: rgba(22, 22, 22, 0.98);
  --panel: rgba(9, 9, 9, 0.96);
  --panel-alt: rgba(14, 14, 14, 0.98);
  --panel-border: rgba(255, 255, 255, 0.12);
  --panel-border-strong: rgba(255, 255, 255, 0.22);
  --line-faint: rgba(255, 255, 255, 0.06);
  --text: #ffffff;
  --muted: rgba(255, 255, 255, 0.66);
  --muted-strong: rgba(255, 255, 255, 0.82);
  --button: #111111;
  --button-hover: #1a1a1a;
  --button-active: #ffffff;
  --button-active-text: #000000;
  --shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
}

* {
  box-sizing: border-box;
}

html,
body,
#app {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at top center, rgba(255, 255, 255, 0.08), transparent 22%),
    radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.03), transparent 18%),
    linear-gradient(180deg, #060606 0%, #000000 100%);
}

button,
input,
select {
  font: inherit;
}

button {
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  padding: 0.7rem 1rem;
  color: var(--text);
  background: var(--button);
  cursor: pointer;
  transition:
    transform 140ms ease,
    border-color 140ms ease,
    background 140ms ease,
    color 140ms ease;
}

.ui-button {
  min-height: 44px;
  border-radius: 999px;
  padding: 0.7rem 1.1rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

button:hover {
  transform: translateY(-1px);
  border-color: var(--panel-border-strong);
  background: var(--button-hover);
}

button.active {
  color: var(--button-active-text);
  background: var(--button-active);
  border-color: rgba(255, 255, 255, 0.9);
}

button.danger {
  border-color: rgba(255, 255, 255, 0.18);
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

input,
select {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 0.75rem 0.8rem;
  color: var(--text);
  background: rgba(3, 3, 3, 0.96);
}

input::placeholder {
  color: rgba(255, 255, 255, 0.34);
}

.app-shell {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  min-height: 100vh;
  padding: 1.6rem;
}

.app-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.1rem 0 0;
  color: rgba(255, 255, 255, 0.52);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
}

.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.9rem;
  padding: 0.2rem 0 1.2rem;
}

.hero-brand {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.brand-logo {
  display: block;
  width: clamp(360px, 46vw, 520px);
  height: auto;
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--muted);
  font-size: 0.72rem;
}

.hero h1 {
  margin: 0;
  max-width: 16ch;
  font-size: clamp(2rem, 4vw, 3.2rem);
  line-height: 0.98;
  letter-spacing: -0.04em;
}

.hero-copy {
  max-width: 100ch;
  color: var(--muted);
  line-height: 1.6;
  font-size: 1rem;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(340px, 420px);
  align-items: start;
  gap: 1rem;
  flex: 1;
}

.canvas-panel,
.panel,
.ui-card {
  border: 1px solid var(--panel-border);
  border-radius: 22px;
  background:
    linear-gradient(180deg, var(--surface-2), var(--surface-1));
  box-shadow: var(--shadow);
}

.canvas-panel {
  display: flex;
  flex-direction: column;
  min-height: 720px;
  overflow: visible;
}

.panel-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.1rem 0.95rem;
}

.toolbar-groups {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  align-items: center;
}

.button-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.mode-button-group {
  display: inline-flex;
  gap: 0;
  align-items: stretch;
}

.mode-button-group .ui-button {
  flex: 0 0 auto;
  position: relative;
  border-radius: 0;
  white-space: nowrap;
}

.mode-button-group .ui-button + .ui-button {
  margin-left: -1px;
}

.mode-button-group .ui-button:first-child {
  border-radius: 999px 0 0 999px;
}

.mode-button-group .ui-button:last-child {
  border-radius: 0 999px 999px 0;
}

.mode-button-group .ui-button:hover {
  z-index: 1;
}

.toolbar-mode-group {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.55rem;
}

.toolbar-mode-label {
  color: var(--muted-strong);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.toolbar-mode-hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.35;
}

.toolbar-status {
  display: flex;
  align-items: center;
  color: var(--muted);
  text-align: right;
  font-size: 0.92rem;
}

.toolbar-status .button-group {
  justify-content: flex-end;
}

.canvas-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 88px;
  align-items: start;
  gap: 1rem;
  padding: 1rem;
  flex: 1;
  overflow: visible;
}

.canvas-help {
  padding: 0.35rem 1.25rem 1.2rem;
  color: rgba(255, 255, 255, 0.56);
  font-size: 0.88rem;
  line-height: 1.45;
}

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

.ui-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.18), transparent 65%);
}

.ui-card-header {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 1rem 1rem 0;
}

.ui-card-header-copy {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  align-items: flex-start;
}

.ui-card-header-button {
  width: 100%;
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  border: 0;
  border-radius: 0;
  padding: 1rem 1rem 1rem;
  background: transparent;
  text-align: left;
  transform: none;
}

.ui-card-header-button:hover {
  transform: none;
  border-color: transparent;
  background: transparent;
}

.ui-card-eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.ui-card-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.ui-card-chevron {
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1;
  transition: transform 140ms ease;
  transform: rotate(180deg);
}

.ui-card-chevron.collapsed {
  transform: rotate(90deg);
}

.ui-card-body {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 1rem 1rem 1.1rem;
}

.ui-card-collapsed .ui-card-header-button {
  align-items: center;
  padding-bottom: 0.95rem;
}

.ui-card-collapsed .ui-card-header-copy {
  gap: 0.18rem;
}

.ui-field,
.field {
  display: flex;
  flex-direction: column;
  gap: 0.42rem;
  color: var(--muted);
  font-size: 0.86rem;
}

.ui-field-label {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.field-note {
  margin: -0.15rem 0 0;
  color: rgba(255, 255, 255, 0.56);
  font-size: 0.84rem;
  line-height: 1.5;
}

.ui-input,
input,
select {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 0.8rem 0.85rem;
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(7, 7, 7, 0.98), rgba(2, 2, 2, 0.98));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.ui-field-inline {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.ui-field-inline input[type="checkbox"] {
  width: auto;
  accent-color: #ffffff;
}

.room-canvas {
  position: relative;
  height: 620px;
  min-height: 620px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  overflow: visible;
  z-index: 3;
  background:
    linear-gradient(180deg, rgba(15, 15, 15, 0.96), rgba(4, 4, 4, 0.96)),
    repeating-linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.025) 0,
      rgba(255, 255, 255, 0.025) 1px,
      transparent 1px,
      transparent 48px
    ),
    repeating-linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.025) 0,
      rgba(255, 255, 255, 0.025) 1px,
      transparent 1px,
      transparent 48px
    );
}

.canvas-context-menu {
  position: absolute;
  z-index: 40;
  width: 260px;
  max-height: min(460px, calc(100vh - 5rem));
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  padding: 0.9rem;
  overflow-y: auto;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 16px;
  background: linear-gradient(180deg, var(--surface-3), var(--surface-1));
  box-shadow: 0 20px 46px rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(10px);
}

.probe-context-menu {
  width: 240px;
}

.subwoofer-context-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.subwoofer-context-header > div {
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
}

.subwoofer-context-header strong {
  font-size: 0.98rem;
}

.subwoofer-context-header span {
  color: var(--muted);
  font-size: 0.8rem;
}

.subwoofer-context-close {
  min-width: 2.2rem;
  padding: 0.35rem 0.55rem;
  line-height: 1;
  font-size: 1.1rem;
}

.subwoofer-context-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
}

.subwoofer-context-field {
  display: flex;
  flex-direction: column;
  gap: 0.32rem;
  color: var(--muted);
  font-size: 0.86rem;
}

.subwoofer-context-field input,
.subwoofer-context-field select {
  padding: 0.58rem 0.7rem;
}

.subwoofer-context-delete {
  width: 100%;
}

.legend {
  position: relative;
  z-index: 1;
  width: 88px;
  min-width: 88px;
  display: flex;
  flex-direction: row;
  align-items: stretch;
  justify-content: center;
  gap: 0.6rem;
  height: 620px;
  padding: 0.2rem 0;
}

.legend-bar {
  display: block;
  width: 22px;
  height: 100%;
  flex: 1 0 auto;
  min-height: 520px;
  border-radius: 999px;
  background: linear-gradient(
    180deg,
    rgb(118, 25, 156) 0%,
    rgb(203, 31, 79) 14%,
    rgb(237, 90, 43) 32%,
    rgb(246, 202, 59) 48%,
    rgb(175, 235, 84) 62%,
    rgb(62, 218, 193) 76%,
    rgb(38, 151, 250) 88%,
    rgb(24, 50, 184) 100%
  );
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.24);
}

.legend-labels {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex: 0 0 auto;
  height: 100%;
  color: var(--muted-strong);
  font-size: 0.84rem;
  text-align: left;
}

.room-cursor-label {
  position: absolute;
  z-index: 24;
  pointer-events: none;
  padding: 0.3rem 0.5rem;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.92);
  color: #ffffff;
  font-size: 0.8rem;
  line-height: 1;
  white-space: nowrap;
  transform: translate(0, 0);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45);
}

.control-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.panel-empty,
.chart-empty {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.probe-chart {
  width: 100%;
  height: auto;
  border-radius: 16px;
}

.probe-stats {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.probe-card-delete {
  position: absolute;
  top: 0.85rem;
  right: 0.85rem;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  min-width: 2rem;
  height: 2rem;
  padding: 0;
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.72);
  background: rgba(255, 255, 255, 0.04);
}

.probe-card-delete svg {
  width: 0.9rem;
  height: 0.9rem;
}

.probe-card-delete:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.09);
}

.scenario-actions,
.scenario-item-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

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

  .control-panel {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    align-items: start;
  }
}

@media (max-width: 840px) {
  .app-shell {
    padding: 1rem;
  }

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

  .hero-brand {
    flex-direction: column;
    align-items: flex-start;
  }

  .panel-toolbar {
    flex-direction: column;
  }

  .toolbar-mode-group {
    order: 2;
  }

  .toolbar-status {
    order: 1;
    text-align: left;
  }

  .canvas-panel {
    min-height: 0;
  }

  .canvas-layout {
    grid-template-columns: 1fr;
    gap: 0.85rem;
    padding: 1rem 1rem 0;
  }

  .room-canvas {
    width: 100%;
    height: auto;
    min-height: 0;
  }

  .legend {
    width: 100%;
    min-width: 0;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 0.45rem;
    height: auto;
    padding: 0;
  }

  .legend-bar {
    height: 22px;
    min-height: 22px;
    width: 100%;
    min-width: 0;
    background: linear-gradient(
      90deg,
      rgb(24, 50, 184) 0%,
      rgb(38, 151, 250) 12%,
      rgb(62, 218, 193) 24%,
      rgb(175, 235, 84) 38%,
      rgb(246, 202, 59) 52%,
      rgb(237, 90, 43) 68%,
      rgb(203, 31, 79) 84%,
      rgb(118, 25, 156) 100%
    );
  }

  .legend-labels {
    flex-direction: row-reverse;
    justify-content: space-between;
    align-items: center;
    height: auto;
    width: 100%;
  }

  .app-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
  }
}
