:root {
  color-scheme: light;
  --bg: #f5f7f8;
  --panel: #ffffff;
  --ink: #172026;
  --muted: #66727a;
  --line: #d8e0e3;
  --teal: #0f766e;
  --teal-dark: #0b5f59;
  --coral: #c2410c;
  --amber: #b45309;
  --shadow: 0 14px 34px rgba(20, 32, 38, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
}

.topbar {
  min-height: 72px;
  padding: 14px clamp(16px, 4vw, 34px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px);
}

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

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 8px;
  background: var(--teal);
  color: #fff;
  font-weight: 800;
  letter-spacing: 0;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 1.12rem;
  line-height: 1.2;
}

h2 {
  font-size: 1rem;
  line-height: 1.25;
}

.brand p,
.now-playing p,
.status {
  color: var(--muted);
  font-size: 0.92rem;
}

.now-playing p,
.status {
  overflow-wrap: anywhere;
}

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

main {
  width: 100%;
}

.auth-view {
  min-height: calc(100vh - 72px);
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-panel,
.player-surface,
.editor {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.auth-panel {
  width: min(100%, 430px);
  padding: 18px;
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 4px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef3f4;
}

.tab {
  min-height: 38px;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}

.tab.active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 4px 12px rgba(20, 32, 38, 0.08);
}

.form-stack,
.editor {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: #34424a;
  font-size: 0.9rem;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
}

input:focus,
select:focus {
  outline: 3px solid rgba(15, 118, 110, 0.16);
  border-color: var(--teal);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(260px, 360px) minmax(320px, 1fr);
  gap: 18px;
  padding: 18px clamp(14px, 3vw, 34px) 34px;
  overflow-x: hidden;
}

.station-column,
.player-column {
  min-width: 0;
  max-width: 100%;
}

.section-head {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.station-list {
  display: grid;
  gap: 8px;
}

.station-item {
  width: 100%;
  min-height: 64px;
  padding: 12px;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) min-content;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  text-align: left;
}

.station-item.active {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.station-item.playing {
  border-color: var(--coral);
}

.station-item strong,
.station-url {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.station-url {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.84rem;
}

.badge {
  padding: 4px 7px;
  border-radius: 999px;
  background: #eef3f4;
  color: #43505a;
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
}

.station-play {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  justify-self: start;
  border-radius: 50%;
  background: var(--teal);
  color: #fff;
  font-size: 0.82rem;
  line-height: 1;
}

.station-play:hover {
  background: var(--teal-dark);
}

.player-column {
  display: grid;
  gap: 18px;
  align-content: start;
  min-width: 0;
}

.player-surface {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: clamp(16px, 3vw, 24px);
  display: grid;
  gap: 18px;
  overflow: hidden;
}

.now-playing {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.kicker {
  color: var(--teal);
  font-size: 0.75rem;
  font-weight: 900;
  text-transform: uppercase;
}

.transport {
  min-height: 64px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.round {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--teal);
  color: #fff;
  font-size: 1.1rem;
}

.round.quiet {
  background: #25323a;
}

.volume {
  min-width: min(260px, 100%);
  flex: 1;
}

.device-row,
.form-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
  min-width: 0;
}

.editor {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: clamp(16px, 3vw, 22px);
  overflow: hidden;
}

.checkline {
  display: flex;
  align-items: center;
  gap: 9px;
}

.checkline input {
  width: 18px;
  min-height: 18px;
}

.primary,
.secondary,
.ghost {
  min-height: 40px;
  padding: 9px 13px;
  border-radius: 6px;
  font-weight: 800;
}

.primary {
  background: var(--teal);
  color: #fff;
}

.primary:hover,
.round:hover {
  background: var(--teal-dark);
}

.secondary {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.ghost {
  background: transparent;
  color: var(--teal);
}

.danger {
  color: var(--coral);
}

.status {
  min-height: 22px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: min(420px, calc(100vw - 36px));
  padding: 12px 14px;
  border-radius: 8px;
  background: #172026;
  color: #fff;
  box-shadow: var(--shadow);
  transform: translateY(24px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.hidden {
  display: none !important;
}

@media (max-width: 1100px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .device-row,
  .form-grid {
    grid-template-columns: 1fr;
  }
}
