:root {
  --bg: #0c0f14;
  --surface: #141a22;
  --border: #263041;
  --text: #e8ecf1;
  --muted: #8b98a8;
  --accent: #3d9cf0;
  --accent-dim: #2563a8;
  --success: #34c759;
  --radius: 10px;
  --font: "DM Sans", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  background: radial-gradient(1200px 600px at 20% -10%, #1a2840 0%, transparent 55%),
    radial-gradient(900px 500px at 90% 0%, #152238 0%, transparent 50%), var(--bg);
  color: var(--text);
  line-height: 1.5;
}

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

.layout {
  max-width: 1120px;
  margin: 0 auto;
  padding: 2rem 1.25rem 3rem;
}

.header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 2rem;
}

.brand {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.logo {
  font-size: 1.75rem;
  color: var(--accent);
  line-height: 1.2;
}

.header h1 {
  margin: 0;
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.tagline {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
  max-width: 36ch;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.35rem;
  margin-bottom: 1.25rem;
}

.label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.url-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.url-input {
  flex: 1;
  min-width: 200px;
  font-family: var(--mono);
  font-size: 0.85rem;
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}

.url-input:focus {
  outline: 2px solid var(--accent-dim);
  outline-offset: 2px;
}

.hint {
  margin: 0.85rem 0 0;
  font-size: 0.88rem;
  color: var(--muted);
}

.hint code {
  font-family: var(--mono);
  font-size: 0.82em;
  background: var(--bg);
  padding: 0.12em 0.35em;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.btn {
  font-family: var(--font);
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.6rem 1rem;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  background: var(--accent);
  color: #061018;
}

.btn:hover {
  filter: brightness(1.08);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: none;
}

.btn.secondary {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent-dim);
}

.btn.ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
}

.btn.ghost:hover:not(:disabled) {
  color: var(--text);
  border-color: var(--muted);
}

.requests-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.requests-head h2 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.empty {
  color: var(--muted);
  font-size: 0.95rem;
  padding: 1.5rem 0;
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: 8px;
}

.requests-split {
  display: grid;
  grid-template-columns: minmax(240px, 300px) 1fr;
  min-height: 440px;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg);
}

@media (max-width: 720px) {
  .requests-split {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(200px, 38vh) 1fr;
  }

  .request-sidebar {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
}

.request-sidebar {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.2);
  min-height: 0;
}

.sidebar-caption {
  margin: 0;
  padding: 0.65rem 0.85rem;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-list {
  list-style: none;
  margin: 0;
  padding: 0.35rem;
  overflow-y: auto;
  flex: 1;
}

.sidebar-item-btn {
  width: 100%;
  text-align: left;
  font-family: var(--font);
  font-size: 0.88rem;
  padding: 0.65rem 0.7rem;
  margin-bottom: 0.25rem;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
}

.sidebar-item-btn:hover {
  background: var(--surface);
  border-color: var(--border);
}

.sidebar-item-btn:focus-visible {
  outline: 2px solid var(--accent-dim);
  outline-offset: 2px;
}

.sidebar-item-btn.is-selected {
  background: var(--surface);
  border-color: var(--accent-dim);
  box-shadow: inset 3px 0 0 0 var(--accent);
}

.sidebar-item-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
}

.sidebar-item-meta {
  flex: 1;
  min-width: 0;
}

.sidebar-time {
  font-size: 0.8rem;
  color: var(--text);
  font-weight: 500;
  line-height: 1.3;
}

.sidebar-time-sub {
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 400;
}

.request-detail {
  min-height: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.detail-content {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem 1rem 1.15rem;
}

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin: 0 0 0.75rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--border);
}

.detail-meta .time {
  font-size: 0.85rem;
}

.detail-path {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--muted);
  word-break: break-all;
}

.detail-fold {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.15);
  margin-top: 0.65rem;
}

.detail-meta + .detail-fold {
  margin-top: 0.35rem;
}

.detail-fold-summary {
  list-style: none;
  cursor: pointer;
  padding: 0.55rem 0.75rem;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  user-select: none;
}

.detail-fold-summary::-webkit-details-marker {
  display: none;
}

.detail-fold-summary::before {
  content: "▾";
  font-size: 0.65rem;
  color: var(--muted);
  width: 0.9rem;
  transition: transform 0.12s ease;
}

.detail-fold:not([open]) .detail-fold-summary::before {
  transform: rotate(-90deg);
}

.detail-fold-body {
  padding: 0 0.65rem 0.65rem;
}

.detail-fold-body .block {
  max-height: min(420px, 50vh);
}

.method {
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.2em 0.45em;
  border-radius: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.method.get {
  color: #7dd3a0;
}
.method.post {
  color: #7eb6ff;
}
.method.put,
.method.patch {
  color: #e0b45c;
}
.method.delete {
  color: #f08080;
}

.time {
  color: var(--muted);
  font-size: 0.82rem;
}

.sub {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin: 0.85rem 0 0.35rem;
}

.detail-content > .sub:first-of-type {
  margin-top: 0;
}

pre.block {
  margin: 0;
  padding: 0.65rem 0.75rem;
  border-radius: 6px;
  background: #0a0c10;
  border: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 0.75rem;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: min(480px, 55vh);
  overflow-y: auto;
}

.toast {
  position: fixed;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  padding: 0.55rem 1.1rem;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.88rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
}

.toast.success {
  border-color: var(--success);
}
