:root {
  color-scheme: dark;
  --bg: #0f1115;
  --surface: #171a20;
  --surface-2: #1f242c;
  --surface-3: #252b34;
  --text: #f4f6f8;
  --muted: #98a3af;
  --line: #2f3742;
  --accent: #2ed3a2;
  --accent-ink: #06120e;
  --warn: #efbd4d;
  --danger: #ff6574;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.32);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, Segoe UI, Arial, sans-serif;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

button,
a {
  transition: border-color 140ms ease, background 140ms ease, color 140ms ease, transform 140ms ease;
}

button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-3);
  color: var(--text);
  padding: 0 14px;
  cursor: pointer;
}

button:hover,
a:hover {
  border-color: #586574;
}

button:active {
  transform: translateY(1px);
}

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  font-weight: 800;
}

button.danger.active,
button.danger:hover {
  background: var(--danger);
  border-color: var(--danger);
  color: #180408;
}

button.ghost-btn {
  background: transparent;
}

input {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #101318;
  color: var(--text);
  padding: 0 12px;
  outline: none;
}

input:focus {
  border-color: var(--accent);
}

input[type="range"] {
  min-height: 24px;
  padding: 0;
  accent-color: var(--accent);
}

a {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-3);
  color: var(--text);
  padding: 0 14px;
  text-decoration: none;
}

.hidden {
  display: none !important;
}

.app-shell {
  width: min(1540px, calc(100vw - 28px));
  margin: 0 auto;
  padding: 18px 0 32px;
}

.app-header {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
}

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

.brand-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 900;
  letter-spacing: 0;
}

.brand-fields {
  min-width: min(520px, 56vw);
}

.brand-fields label,
.auth-form span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.station-input {
  height: 44px;
  border-color: transparent;
  background: transparent;
  font-size: 30px;
  font-weight: 850;
  padding-left: 0;
}

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.user-pill,
.count-pill {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #11151a;
  color: var(--muted);
  padding: 0 10px;
  font-size: 13px;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(360px, 1.25fr) minmax(320px, 0.95fr) minmax(260px, 0.65fr);
  gap: 14px;
  align-items: stretch;
  margin-bottom: 14px;
}

.now-panel,
.mixer-panel,
.stream-panel,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(23, 26, 32, 0.96);
  box-shadow: var(--shadow);
}

.now-panel {
  min-height: 300px;
  display: grid;
  align-content: start;
  gap: 16px;
  padding: 18px;
}

.status-line {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #4d5662;
}

.status-dot.active {
  background: var(--accent);
  box-shadow: 0 0 0 5px rgba(46, 211, 162, 0.12);
}

.warning {
  color: var(--warn);
}

.now-panel h1 {
  min-height: 78px;
  margin: 0;
  font-size: 36px;
  line-height: 1.08;
  overflow-wrap: anywhere;
}

.now-panel p {
  margin: 0;
  color: var(--muted);
}

.meter {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #0a0d11;
}

.meter-fill {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--warn), var(--danger));
  transition: width 100ms linear;
}

audio {
  width: 100%;
  height: 42px;
}

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

.transport button {
  min-height: 46px;
  font-weight: 800;
}

.mixer-panel,
.stream-panel {
  display: grid;
  align-content: start;
  gap: 14px;
  padding: 16px;
}

.panel-title {
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-title h2,
.panel-head h2 {
  margin: 0;
  font-size: 17px;
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.switch input {
  width: 18px;
  min-height: 18px;
  accent-color: var(--accent);
}

.slider-row {
  display: grid;
  grid-template-columns: 86px minmax(120px, 1fr) 44px;
  align-items: center;
  gap: 12px;
}

.slider-row label,
.slider-row span {
  color: var(--muted);
  font-size: 13px;
}

.slider-row span {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.stream-panel code {
  min-height: 76px;
  display: flex;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #101318;
  color: var(--accent);
  word-break: break-all;
}

.stream-actions {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
}

.workspace {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
  align-items: start;
}

.panel {
  min-height: 460px;
  overflow: hidden;
}

.panel-head {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}

.upload {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.file-picker {
  min-width: 132px;
  max-width: 180px;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #101318;
  color: var(--muted);
  cursor: pointer;
  padding: 0 10px;
}

.file-picker input {
  display: none;
}

.file-picker span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.generator {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(130px, 0.75fr) auto;
  gap: 8px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

.list {
  display: grid;
  gap: 8px;
  padding: 12px;
}

.item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-width: 0;
  border: 1px solid #2a323d;
  border-radius: 8px;
  background: #12161c;
  padding: 10px;
}

.item.current {
  border-color: var(--accent);
  background: rgba(46, 211, 162, 0.08);
}

.title,
.sub {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.title {
  font-weight: 800;
}

.sub {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.actions {
  display: flex;
  gap: 6px;
}

.actions button {
  min-width: 36px;
  min-height: 34px;
  padding: 0 9px;
  font-size: 13px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 50;
  max-width: min(420px, calc(100vw - 36px));
  border-radius: 8px;
  background: var(--text);
  color: #101318;
  padding: 12px 14px;
  box-shadow: var(--shadow);
  font-weight: 800;
}

.auth-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 18px;
}

.auth-card {
  width: min(420px, 100%);
  display: grid;
  gap: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(23, 26, 32, 0.96);
  box-shadow: var(--shadow);
  padding: 24px;
}

.auth-card h1 {
  margin: 0;
  font-size: 30px;
}

.auth-note {
  margin: -8px 0 0;
  color: var(--muted);
}

.auth-form {
  display: grid;
  gap: 14px;
}

.form-error {
  margin: 0;
  color: var(--danger);
  font-weight: 800;
}

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

  .panel {
    min-height: auto;
  }
}

@media (max-width: 720px) {
  .app-shell {
    width: min(100vw - 16px, 1540px);
    padding-top: 10px;
  }

  .app-header,
  .header-actions,
  .brand {
    align-items: stretch;
    flex-direction: column;
  }

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

  .station-input {
    font-size: 24px;
  }

  .now-panel h1 {
    min-height: 0;
    font-size: 27px;
  }

  .transport,
  .stream-actions,
  .generator,
  .upload {
    grid-template-columns: 1fr;
    display: grid;
  }

  .slider-row {
    grid-template-columns: 74px minmax(100px, 1fr) 42px;
  }

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

  .file-picker {
    max-width: none;
  }
}
