* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --page-bg: #f5ecdd;
  --page-text: #201812;
  --page-muted: #5f5240;
  --page-accent: #8b6315;
  --page-rule: #d7c29c;
  --surface-soft: #f0e5d2;
  --surface-warning: #f8e7c2;
  --surface-query: #fcf0d5;
  --surface-table: #fffbf3;
  --accent-warning: #8b6111;
  --accent-warning-strong: #6d4c0f;
  --focus-ring: #a67519;
}

body {
  background: var(--page-bg);
  color: var(--page-text);
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  line-height: 1.65;
  padding: clamp(1.5rem, 4vw, 3rem) 1rem;
}

.container {
  max-width: 42rem;
  margin: 0 auto;
}

.page {
  display: grid;
  gap: 0;
}

.page-header {
  margin-bottom: clamp(0.75rem, 2vw, 1.25rem);
}

.eyebrow {
  color: var(--page-muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  margin-bottom: 0.35rem;
  text-transform: uppercase;
}

h1 {
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.1;
}

h2 {
  color: var(--page-accent);
  font-size: clamp(1.1rem, 2vw, 1.25rem);
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 0.85rem;
}

p {
  max-width: 66ch;
}

.section {
  border-top: 1px solid var(--page-rule);
  padding: clamp(1rem, 2.5vw, 1.5rem) 0;
}

.kv-list {
  display: grid;
  gap: 0.85rem;
}

.kv-row {
  display: grid;
  gap: 0.2rem;
}

.label {
  color: var(--page-muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.value {
  font-family: ui-monospace, "SFMono-Regular", "Cascadia Code", "JetBrains Mono", monospace;
  font-size: 0.95rem;
  line-height: 1.6;
}

.wrap {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.empty-state,
.client-note,
.section-intro,
.helper-text,
.warning-copy,
.table-caption {
  color: var(--page-muted);
  font-size: 0.95rem;
}

.client-section {
  background: var(--surface-soft);
  margin-inline: -1rem;
  padding-inline: 1rem;
}

.client-note {
  margin-bottom: 0.9rem;
}

.warning-box {
  background: var(--surface-warning);
  border-inline-start: 4px solid var(--accent-warning);
  padding: 1rem 1.1rem;
}

.warning-title {
  color: var(--accent-warning-strong);
  margin-bottom: 0.45rem;
}

.section-intro {
  margin-bottom: 0.75rem;
}

.helper-text {
  margin-top: 0.75rem;
}

.qs-display {
  background: var(--surface-query);
  font-family: ui-monospace, "SFMono-Regular", "Cascadia Code", "JetBrains Mono", monospace;
  font-size: 0.9rem;
  overflow-wrap: anywhere;
  padding: 0.85rem 0.9rem;
}

.qs-key {
  color: var(--accent-warning);
  font-weight: 700;
}

.qs-val {
  color: var(--page-text);
}

.qs-sep {
  color: var(--page-muted);
}

table.ref {
  background: var(--surface-table);
  border-collapse: collapse;
  font-size: 0.9rem;
  width: 100%;
}

.table-caption {
  margin-bottom: 0.6rem;
  padding-inline: 0.75rem;
  text-align: left;
}

table.ref th {
  border-bottom: 2px solid var(--page-rule);
  color: var(--page-accent);
  font-weight: 700;
  padding: 0.55rem 0.75rem;
  text-align: left;
}

table.ref td {
  border-bottom: 1px solid var(--page-rule);
  padding: 0.55rem 0.75rem;
  vertical-align: top;
}

table.ref tbody tr td:first-child {
  color: var(--page-accent);
}

code {
  font-family: ui-monospace, "SFMono-Regular", "Cascadia Code", "JetBrains Mono", monospace;
  font-size: 0.92em;
}

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

@media (max-width: 40rem) {
  body {
    padding-inline: 0.9rem;
  }

  .client-section {
    margin-inline: -0.9rem;
    padding-inline: 0.9rem;
  }

  table.ref,
  .qs-display,
  .value {
    font-size: 0.92rem;
  }
}

/* Live Request Feed */
.live-container { max-width: 52rem; }
.live-header { position: relative; }
.live-status {
  position: absolute; top: 0; right: 0;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--page-muted);
}
.live-status.connected { background: #4a7c59; }
.live-status.reconnecting { background: var(--accent-warning); }
.live-table {
  width: 100%; border-collapse: collapse;
  font-size: 0.85rem; margin-top: 1rem;
}
.live-table thead th {
  border-bottom: 2px solid var(--page-rule);
  color: var(--page-accent); font-weight: 700;
  font-size: 0.78rem; letter-spacing: 0.05em;
  padding: 0.45rem 0.5rem; text-align: left;
  text-transform: uppercase;
}
.live-cell {
  border-bottom: 1px solid var(--page-rule);
  padding: 0.35rem 0.5rem; vertical-align: top;
}
.live-ua {
  color: var(--page-muted); font-size: 0.75rem;
  max-width: 160px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.live-badge {
  display: inline-block; padding: 0.1rem 0.4rem;
  font-family: ui-monospace, "SFMono-Regular", "Cascadia Code", "JetBrains Mono", monospace;
  font-size: 0.75rem; font-weight: 700; letter-spacing: 0.03em;
}
.method-get { background: #e0eed4; color: #335c1e; }
.method-post { background: var(--surface-warning); color: var(--accent-warning-strong); }
.method-other { background: var(--surface-soft); color: var(--page-muted); }
.live-status-ok { color: #4a7c59; }
.live-status-err { color: #a83220; font-weight: 700; }
.live-row { animation: liveFadeIn 0.3s ease-in; }
@keyframes liveFadeIn {
  from { opacity: 0; background: var(--surface-query); }
  to { opacity: 1; background: transparent; }
}
.live-empty {
  color: var(--page-muted); font-size: 0.95rem;
  font-style: italic; padding: 2rem 0; text-align: center;
}
.live-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.live-col-ip, .live-col-ua { }
/* Student identity */
.ident-valid { color: var(--page-text); font-weight: 600; }
.ident-missing { color: var(--page-muted); font-style: italic; }
.ident-invalid { color: #a83220; font-style: italic; }
.live-col-user { }
@media (max-width: 40rem) {
  .live-container { max-width: 100%; }
  .live-col-ip, .live-col-ua, .live-col-user { display: none; }
  .live-table { font-size: 0.82rem; }
}
