:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --border: #e3e5ea;
  --text: #1c1f24;
  --muted: #6b7280;
  --accent: #4f46e5;
  --accent-soft: #eef0ff;
  --danger: #dc2626;
  --ok: #16a34a;
  --radius: 12px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

h1,
h2 {
  margin: 0;
  font-weight: 600;
}

h1 {
  font-size: 1.15rem;
}

h2 {
  font-size: 1.4rem;
  margin-bottom: 16px;
  word-break: break-word;
}

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

.center {
  text-align: center;
  margin: 48px 0;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85em;
}

/* Layout */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-logo {
  width: 28px;
  height: 28px;
  padding: 4px;
  border-radius: 8px;
  background: var(--accent-soft);
}

#app {
  display: grid;
  grid-template-columns: minmax(280px, 2fr) 3fr;
  gap: 20px;
  padding: 20px 24px;
  height: calc(100vh - 61px);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  overflow-y: auto;
}

#left-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

@media (max-width: 760px) {
  #app {
    grid-template-columns: 1fr;
    height: auto;
  }
}

/* Asset list */
#asset-filter {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  outline: none;
}

#asset-filter:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

#asset-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.asset-container {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  outline: none;
}

.asset-container:hover,
.asset-container:focus-visible {
  background: var(--bg);
}

.asset-container.active {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.asset-main {
  flex: 1;
  min-width: 0;
}

.asset-title {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.asset-meta {
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Buttons */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.icon-btn svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.icon-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.asset-delete:hover {
  color: var(--danger);
  background: #fee2e2;
}

/* Details */
.details {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 10px 16px;
  margin: 0 0 24px;
}

.details dt {
  color: var(--muted);
  font-weight: 500;
}

.details dd {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.85rem;
  background: #f3f4f6;
  color: var(--muted);
}

.badge.ok {
  background: #dcfce7;
  color: var(--ok);
}

/* Player */
#player {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--text);
  color: #fff;
}

#aPlay {
  background: var(--accent);
  color: #fff;
}

#aCron {
  color: #d1d5db;
  white-space: nowrap;
}

#aSeek {
  flex: 1;
}

#aVolume {
  width: 80px;
}

#player input[type="range"] {
  accent-color: var(--accent);
}

/* Toast */
#toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  max-width: 420px;
  padding: 12px 16px;
  border-radius: 8px;
  background: var(--danger);
  color: #fff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}
