:root {
  --bg: #0f1117;
  --surface: #181b23;
  --surface-2: #222633;
  --border: #2c3242;
  --text: #eef1f7;
  --muted: #9aa3b5;
  --accent: #f43f5e;
  --accent-soft: rgba(244, 63, 94, 0.16);
  --blue: #38bdf8;
  --green: #34d399;
  --amber: #fbbf24;
  --radius: 12px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  padding-bottom: 112px;
}

header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(15, 17, 23, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 12px 16px;
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.brand {
  font-weight: 700;
  font-size: 1.05rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand span.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  display: inline-block;
}

nav.tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
}

nav.tabs button {
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  padding: 7px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  white-space: nowrap;
}

nav.tabs button.active {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: rgba(244, 63, 94, 0.35);
}

main {
  max-width: 1100px;
  margin: 18px auto;
  padding: 0 16px;
}

.panel { display: none; }
.panel.active { display: block; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 12px;
}

.search-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

input, select {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 0.95rem;
}

.search-bar input { flex: 1; min-width: 0; }

button.primary {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 9px 16px;
  font-weight: 600;
  cursor: pointer;
}

button.secondary {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 11px;
  cursor: pointer;
  font-size: 0.85rem;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.badge {
  display: inline-block;
  font-size: 0.74rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid var(--border);
}

.badge.opening_monologue { color: var(--amber); border-color: rgba(251, 191, 36, 0.35); }
.badge.guest_interview { color: var(--blue); border-color: rgba(56, 189, 248, 0.35); }
.badge.advice_call, .badge.letter { color: var(--green); border-color: rgba(52, 211, 153, 0.35); }
.badge.theme { color: #e2e8f0; background: rgba(255,255,255,0.06); }

.result-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 0.84rem;
  color: var(--muted);
  margin-bottom: 6px;
}

.result-text {
  font-size: 0.95rem;
  margin: 6px 0 8px;
}

.result-text mark {
  background: var(--accent-soft);
  color: #fda4af;
  padding: 1px 3px;
  border-radius: 4px;
}

.grid-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.stat-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
}

.stat-label { font-size: 0.78rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.stat-value { font-size: 1.45rem; font-weight: 700; margin-top: 2px; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

th, td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}

th { color: var(--muted); font-weight: 600; }

.table-wrap { overflow-x: auto; }

.player-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(24, 27, 35, 0.96);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
  padding: 10px 16px;
  z-index: 30;
}

.player-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.player-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.86rem;
}

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

.player-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.player-controls audio {
  flex: 1;
  height: 36px;
  min-width: 180px;
}

.login-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 17, 23, 0.96);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 16px;
}

.login-overlay.hidden { display: none; }

.login-box {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
}

.theme-bar-row {
  display: grid;
  grid-template-columns: 160px 1fr 48px;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 0.88rem;
}

.theme-bar-track {
  background: var(--surface-2);
  border-radius: 6px;
  height: 12px;
  overflow: hidden;
}

.theme-bar-fill {
  background: var(--accent);
  height: 100%;
  border-radius: 6px;
}
