:root {
  --bg: #f6f8fb;
  --card: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --border: #d1d5db;
  --accent: #0f766e;
  --code-bg: #f3f4f6;
  --pre-bg: #0b1020;
  --pre-text: #f8fafc;
  --event-active: #ecfeff;
  --event-border: #eceff3;
  --pill-bg: #cffafe;
  --pill-text: #0f172a;
  --tab-bg: transparent;
  --tab-active-bg: var(--accent);
  --tab-active-text: #ffffff;
  --tab-text: var(--muted);
  --gradient-start: #f0fdfa;
  /* macOS 26+ surfaces: hairlines, fills, soft depth */
  --hairline: rgba(15, 23, 42, 0.1);
  --fill: rgba(15, 23, 42, 0.05);
  --fill-hover: rgba(15, 23, 42, 0.08);
  --card-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px rgba(15, 23, 42, 0.06);
  --accent-glow: rgba(15, 118, 110, 0.25);
  --ring: rgba(15, 118, 110, 0.22);
  --on-accent: #ffffff;
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #0f172a;
  --card: #1e293b;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --border: #334155;
  --accent: #14b8a6;
  --code-bg: #1e293b;
  --pre-bg: #020617;
  --pre-text: #e2e8f0;
  --event-active: #1e3a4a;
  --event-border: #334155;
  --pill-bg: #134e4a;
  --pill-text: #ccfbf1;
  --gradient-start: #0f172a;
  --code-bg: #172235;
  --hairline: rgba(255, 255, 255, 0.09);
  --fill: rgba(255, 255, 255, 0.07);
  --fill-hover: rgba(255, 255, 255, 0.11);
  --card-shadow: 0 1px 2px rgba(0, 0, 0, 0.25), 0 10px 30px rgba(0, 0, 0, 0.28);
  --accent-glow: rgba(20, 184, 166, 0.25);
  --ring: rgba(20, 184, 166, 0.25);
  --on-accent: #042f2e; /* dark ink: white on the bright teal falls short of AA */
  --tab-active-text: var(--on-accent);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  background: linear-gradient(180deg, var(--gradient-start) 0%, var(--bg) 35%);
  color: var(--text);
  transition: background 0.2s, color 0.2s;
}

.container {
  max-width: 980px;
  margin: 0 auto;
  padding: 24px 16px 40px;
}

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

h1 {
  margin: 0;
  letter-spacing: -0.02em;
}

h2 {
  letter-spacing: -0.01em;
}

.subtitle {
  margin: 8px 0 20px;
  color: var(--muted);
}

.card {
  background: var(--card);
  border: 0;
  border-radius: 20px;
  box-shadow: inset 0 0 0 0.5px var(--hairline), var(--card-shadow);
  padding: 16px 16px 18px;
  margin-bottom: 16px;
  transition: background 0.2s;
}

.endpoint-row {
  display: flex;
  gap: 12px;
  align-items: center;
}

code {
  display: block;
  width: 100%;
  background: var(--code-bg);
  box-shadow: inset 0 0 0 0.5px var(--hairline);
  border-radius: 12px;
  padding: 10px;
  overflow-wrap: anywhere;
  font-size: 14px;
  overflow-x: auto;
  color: var(--text);
  transition: background 0.2s;
}

button {
  border: none;
  background: var(--accent);
  color: var(--on-accent);
  padding: 10px 14px;
  border-radius: 999px;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: inset 0 0.5px 0 rgba(255, 255, 255, 0.4), 0 4px 14px var(--accent-glow);
  transition: background 0.2s, transform 0.15s;
}

button:hover {
  opacity: 0.9;
}

button:active {
  transform: scale(0.97);
}

button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.theme-toggle {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  background: var(--fill);
  box-shadow: inset 0 0 0 0.5px var(--hairline);
  color: var(--text);
  font-size: 18px;
  padding: 0;
  border-radius: 50%;
  line-height: 1;
}

.theme-toggle:hover {
  opacity: 1;
  background: var(--fill-hover);
}

.note {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.latest-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.status {
  font-size: 13px;
  color: var(--muted);
  padding: 4px 11px;
  border-radius: 999px;
  background: var(--fill);
}

.split {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 12px;
}

/* request list: a source list with inset, rounded selection */
.events {
  list-style: none;
  margin: 0;
  padding: 5px;
  border: 0.5px solid var(--hairline);
  border-radius: 14px;
  max-height: 520px;
  overflow: auto;
}

.event-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s;
}

.event-item + .event-item {
  margin-top: 2px;
}

.event-item:hover {
  background: var(--event-active);
}

.event-item.active {
  background: var(--event-active);
}

.pill {
  background: var(--pill-bg);
  color: var(--pill-text);
  font-weight: 700;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
  transition: background 0.2s, color 0.2s;
}

.meta {
  font-size: 12px;
  color: var(--muted);
}

/* Detail panel */
.detail-panel {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 0.5px solid var(--hairline);
  border-radius: 14px;
  overflow: hidden;
  min-height: 520px;
  max-height: 520px;
}

.detail-tabs {
  display: flex;
  gap: 4px;
  align-items: center;
  background: var(--code-bg);
  border-bottom: 0.5px solid var(--hairline);
  padding: 6px;
  flex-shrink: 0;
}

.detail-tab {
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  border: none;
  background: var(--tab-bg);
  color: var(--tab-text);
  cursor: pointer;
  border-radius: 999px;
  box-shadow: none;
  transition: background 0.15s, color 0.15s;
}

.detail-tab:hover {
  opacity: 1;
  background: var(--fill);
}

.detail-tab.active {
  background: var(--tab-active-bg);
  color: var(--tab-active-text);
  box-shadow: inset 0 0.5px 0 rgba(255, 255, 255, 0.35), 0 2px 8px var(--accent-glow);
}

.detail-tab-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
}

.copy-detail-btn {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 999px;
  background: transparent;
  box-shadow: none;
  color: var(--muted);
}

.copy-detail-btn:hover {
  opacity: 1;
  color: var(--accent);
  background: var(--fill);
}

.detail-content {
  flex: 1;
  overflow: auto;
}

pre {
  margin: 0;
  padding: 12px;
  background: var(--pre-bg);
  color: var(--pre-text);
  border-radius: 0;
  min-height: 100%;
  overflow: auto;
  font-size: 13px;
  line-height: 1.5;
  transition: background 0.2s, color 0.2s;
}

/* Metadata table */
.meta-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.meta-table td {
  padding: 8px 12px;
  border-bottom: 0.5px solid var(--hairline);
  vertical-align: top;
}

.meta-table tr:last-child td {
  border-bottom: none;
}

.meta-table .meta-key {
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
  width: 160px;
}

.meta-table .meta-val {
  word-break: break-all;
  color: var(--text);
}

.meta-section {
  padding: 12px;
  background: var(--card);
  min-height: 100%;
  overflow: auto;
}

.meta-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin: 0 0 8px;
  padding: 0 0 6px;
  border-bottom: 0.5px solid var(--hairline);
}

.meta-section-title:not(:first-child) {
  margin-top: 16px;
}

@media (max-width: 760px) {
  .split {
    grid-template-columns: 1fr;
  }

  /* keeps the whole endpoint readable beside the Copy button on a phone */
  .endpoint-row {
    gap: 10px;
  }

  code {
    font-size: 13px;
  }

  .events,
  .detail-panel {
    max-height: 300px;
    min-height: 300px;
  }
}
