:root {
  color-scheme: dark;
  --bg: #08090b;
  --panel: #0f1115;
  --panel-2: #14171d;
  --panel-3: #191d24;
  --text: #f4f5f7;
  --muted: #8b949e;
  --line: #252a33;
  --line-soft: #1a1e25;
  --accent: #27d17f;
  --accent-dark: #19a765;
  --accent-soft: rgba(39, 209, 127, 0.12);
  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(--text);
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.app-shell {
  display: grid;
  grid-template-rows: 64px minmax(0, 1fr) 86px;
  min-height: 100vh;
}

.topbar {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 18px;
  align-items: center;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
  background: #08090b;
}

.brand {
  display: flex;
  gap: 10px;
  align-items: center;
  min-width: 0;
  color: var(--text);
  font-weight: 800;
  text-decoration: none;
}

.brand-mark {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 5px var(--accent-soft);
}

.search-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 104px;
  gap: 8px;
}

.search-form input,
.text-input {
  width: 100%;
  min-width: 0;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 13px;
  outline: none;
  background: var(--panel);
  color: var(--text);
}

.search-form input::placeholder,
.text-input::placeholder {
  color: #68717d;
}

.search-form input:focus,
.text-input:focus {
  border-color: var(--accent-dark);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.search-form button,
.play-button,
.copy-button,
.quick-list button,
.tab-button {
  min-height: 40px;
  border-radius: 8px;
  font-weight: 750;
  transition: background 140ms ease, color 140ms ease, border-color 140ms ease;
}

.search-form button,
.play-button {
  background: var(--accent);
  color: #03110a;
}

.search-form button:hover,
.play-button:hover {
  background: #47e49a;
}

.copy-button,
.quick-list button,
.tab-button {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
}

.copy-button:hover,
.quick-list button:hover,
.tab-button:hover,
.tab-button.active {
  border-color: var(--accent-dark);
  background: var(--accent-soft);
}

.workspace {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 0;
}

.control-panel {
  display: grid;
  align-content: start;
  gap: 22px;
  min-height: 0;
  padding: 18px;
  border-right: 1px solid var(--line);
  background: var(--panel);
}

.panel-section {
  display: grid;
  gap: 14px;
}

.section-label,
.muted {
  margin: 0;
}

.section-label {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1,
h2,
h3 {
  margin: 0;
}

h1 {
  margin-top: 3px;
  font-size: 1.25rem;
  line-height: 1.2;
}

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

h3 {
  font-size: 0.98rem;
  line-height: 1.25;
}

.field-group {
  display: grid;
  gap: 8px;
}

.field-label {
  color: #c9ced6;
  font-size: 0.84rem;
  font-weight: 700;
}

.segmented,
.separator-grid {
  display: grid;
  gap: 7px;
}

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

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

.segmented input,
.separator-grid input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented span,
.separator-grid span {
  display: grid;
  min-height: 38px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--muted);
  font-weight: 750;
}

.segmented input:checked + span,
.separator-grid input:checked + span {
  border-color: var(--accent-dark);
  background: var(--accent-soft);
  color: var(--text);
}

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

.quick-list button,
.tab-button {
  justify-content: start;
  min-height: 38px;
  padding: 0 12px;
  text-align: left;
}

.tab-nav {
  display: grid;
  gap: 8px;
}

.tab-button.active {
  color: var(--text);
}

.results-panel,
.docs-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  background: #0a0b0e;
}

.tab-panel[hidden] {
  display: none;
}

.results-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  min-height: 70px;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
}

.results-header .muted {
  text-align: right;
}

.results-list {
  display: grid;
  align-content: start;
  min-height: 0;
  overflow: auto;
}

.result-item {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  min-height: 86px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--line-soft);
  background: transparent;
}

.result-item:hover {
  background: rgba(255, 255, 255, 0.035);
}

.thumbnail-wrap {
  position: relative;
  overflow: hidden;
  width: 88px;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-3);
}

.thumbnail {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.duration-badge {
  position: absolute;
  right: 5px;
  bottom: 5px;
  max-width: calc(100% - 10px);
  border-radius: 5px;
  padding: 2px 5px;
  background: rgba(0, 0, 0, 0.72);
  color: #ffffff;
  font-size: 0.68rem;
  font-weight: 800;
}

.result-info {
  min-width: 0;
}

.result-title,
.now-playing h2 {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-meta {
  margin: 5px 0 0;
  font-size: 0.86rem;
}

.result-actions {
  display: grid;
  grid-template-columns: 76px 76px;
  gap: 8px;
}

.empty-state,
.loading-state {
  display: grid;
  place-items: center;
  min-height: 100%;
  padding: 28px;
  color: var(--muted);
  text-align: center;
}

.docs-content {
  display: grid;
  align-content: start;
  gap: 16px;
  min-height: 0;
  overflow: auto;
  padding: 20px;
}

.doc-block {
  display: grid;
  gap: 12px;
  max-width: 980px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.018);
}

.doc-block h2 {
  color: var(--text);
}

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

code {
  font-family: "Cascadia Code", "Consolas", ui-monospace, SFMono-Regular, Menlo, monospace;
}

.endpoint-list code {
  display: block;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--panel);
  color: #cfe9da;
  white-space: nowrap;
}

pre {
  margin: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #07080a;
}

pre code {
  display: block;
  min-width: 0;
  padding: 14px;
  color: #d9dee7;
  font-size: 0.86rem;
  line-height: 1.55;
  white-space: pre;
}

.loading-state::before {
  content: "";
  width: 30px;
  height: 30px;
  margin-bottom: 12px;
  border: 3px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 800ms linear infinite;
}

.player-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 520px);
  gap: 18px;
  align-items: center;
  padding: 10px 18px;
  border-top: 1px solid var(--line);
  background: #08090b;
}

.now-playing {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-width: 0;
}

.now-playing img {
  width: 54px;
  height: 54px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-3);
  object-fit: cover;
}

.now-playing p {
  margin-top: 3px;
  font-size: 0.84rem;
}

audio {
  width: 100%;
  accent-color: var(--accent);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 860px) {
  .app-shell {
    grid-template-rows: auto minmax(0, 1fr) auto;
  }

  .topbar,
  .workspace,
  .player-bar {
    grid-template-columns: 1fr;
  }

  .topbar {
    padding: 12px;
  }

  .control-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
}

@media (max-width: 560px) {
  .result-item {
    grid-template-columns: 76px minmax(0, 1fr);
    gap: 10px;
    padding: 10px 12px;
  }

  .thumbnail-wrap {
    width: 76px;
  }

  .result-actions {
    grid-column: 1 / -1;
    grid-template-columns: 1fr 1fr;
  }

  .results-header {
    display: grid;
    padding: 14px 12px;
  }

  .results-header .muted {
    text-align: left;
  }
}
