:root {
  --bg: #f3ecdf;
  --bg-panel: rgba(255, 250, 242, 0.82);
  --ink: #1c2220;
  --muted: #5f625c;
  --line: rgba(28, 34, 32, 0.14);
  --accent: #9e4b21;
  --accent-soft: #e8c6a2;
  --olive: #6f7a46;
  --rose: #b0574f;
  --shadow: 0 18px 50px rgba(40, 28, 17, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(158, 75, 33, 0.16), transparent 28%),
    radial-gradient(circle at top right, rgba(111, 122, 70, 0.18), transparent 24%),
    linear-gradient(180deg, #f8f1e7 0%, var(--bg) 100%);
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
}

code,
pre,
input,
button {
  font-family: "Courier New", "SFMono-Regular", Consolas, monospace;
}

.shell {
  width: min(1180px, calc(100vw - 2rem));
  margin: 0 auto;
  padding: 2rem 0 3rem;
}

.hero {
  padding: 1.25rem 0 1rem;
}

.kicker {
  margin: 0;
  color: var(--accent);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.8rem;
}

.hero h1 {
  margin: 0.2rem 0 0.5rem;
  font-size: clamp(2.4rem, 5vw, 4.7rem);
  line-height: 0.95;
}

.lede {
  margin: 0;
  max-width: 55rem;
  color: var(--muted);
  font-size: 1.05rem;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--bg-panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 1rem;
  padding: 1rem;
}

.control-block {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 0.9rem 1rem;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.58);
}

.control-block label,
.control-block span {
  font-size: 0.9rem;
  color: var(--muted);
}

.control-block input {
  width: 100%;
}

.inline-control {
  display: flex;
  gap: 0.6rem;
}

.inline-control input {
  flex: 1 1 auto;
}

.inline-control button {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--ink);
  color: #fff8ef;
  padding: 0.55rem 0.85rem;
  cursor: pointer;
}

.command code {
  font-size: 0.86rem;
  white-space: pre-wrap;
}

.grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 1rem;
  margin-top: 1rem;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 1rem;
  padding: 1.2rem 1.2rem 0.6rem;
}

.panel-header h2,
.subpanel h3 {
  margin: 0;
}

.panel-header p {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.8rem;
  padding: 0 1.2rem 1rem;
}

.stat-card,
.chip {
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.68);
}

.stat-card p,
.chip p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.stat-card h3,
.chip h3 {
  margin: 0.25rem 0 0;
}

.chip-type {
  color: var(--accent) !important;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.75rem !important;
}

.subpanel {
  padding: 0 1.2rem 1.2rem;
}

.metric-list {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.4rem 1rem;
  margin: 0.8rem 0 0;
}

.metric-list dt {
  color: var(--muted);
}

.metric-list dd {
  margin: 0;
  text-align: right;
  font-family: "Courier New", "SFMono-Regular", Consolas, monospace;
}

.chips {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.8rem;
  margin-top: 0.8rem;
}

.edge-list {
  margin: 0.8rem 0 0;
  padding-left: 1.2rem;
}

#trace-panel {
  margin-top: 1rem;
}

.trace-controls {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.filter {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  border-radius: 999px;
  padding: 0.45rem 0.8rem;
  cursor: pointer;
}

.filter.is-active {
  border-color: transparent;
  background: var(--ink);
  color: #fff8ef;
}

#trace-status {
  padding: 0 1.2rem;
  color: var(--muted);
}

.trace-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
  padding: 1rem 1.2rem 1.2rem;
}

.trace-card {
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.74);
}

.trace-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: start;
}

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

.trace-title {
  margin: 0.2rem 0 0;
  font-size: 1.05rem;
}

.badge {
  border-radius: 999px;
  padding: 0.3rem 0.65rem;
  font-size: 0.82rem;
  background: var(--accent-soft);
}

.badge.accepted {
  background: rgba(111, 122, 70, 0.18);
  color: #3f5120;
}

.badge.rejected {
  background: rgba(176, 87, 79, 0.16);
  color: #7d2f2a;
}

.compact {
  margin-top: 0.8rem;
}

.detail-block {
  margin-top: 0.8rem;
}

.detail-block summary {
  cursor: pointer;
  color: var(--accent);
}

.json-block {
  margin: 0.6rem 0 0;
  padding: 0.85rem;
  border-radius: 14px;
  background: #f7f1e8;
  border: 1px solid rgba(28, 34, 32, 0.08);
  overflow-x: auto;
  font-size: 0.82rem;
  line-height: 1.45;
}

.empty-note {
  color: var(--muted);
  margin-top: 0.8rem;
}

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

  .panel-header {
    flex-direction: column;
  }

  .inline-control {
    flex-direction: column;
  }
}
