:root {
  --bg: #08110e;
  --panel: rgba(12, 28, 23, 0.92);
  --line: #1d3b31;
  --text: #e7f6ee;
  --muted: #8eaa9c;
  --live: #3ee08f;
  --limited: #f5c15d;
  --card: #ff8a4c;
  --agent: #5ec8ff;
  --ended: #6d7a74;
  --danger: #ff8d8d;
  color-scheme: dark;
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse 70% 45% at 0% -10%, rgba(62, 224, 143, 0.16), transparent 55%),
    radial-gradient(ellipse 40% 30% at 100% 0%, rgba(94, 200, 255, 0.08), transparent 50%),
    linear-gradient(rgba(62, 224, 143, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(62, 224, 143, 0.045) 1px, transparent 1px);
  background-size: auto, auto, 32px 32px, 32px 32px;
}

.top, .stats, .views, .filters, .state, .board, .changes, footer {
  width: min(1180px, calc(100% - 32px));
  margin-left: auto;
  margin-right: auto;
}

.top {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-end;
  padding: 28px 0 12px;
}

.brand { display: flex; gap: 14px; align-items: center; }

.mark {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--live);
  background:
    radial-gradient(circle, transparent 38%, rgba(62, 224, 143, 0.45) 39% 41%, transparent 42%),
    conic-gradient(from 20deg, transparent 0 72%, rgba(62, 224, 143, 0.85) 78%, transparent 86%);
  box-shadow: 0 0 18px rgba(62, 224, 143, 0.35);
  flex: none;
}

.word {
  margin: 0;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  letter-spacing: 0.16em;
  font-size: 12px;
  color: var(--live);
}

h1 {
  margin: 2px 0 0;
  font-size: 22px;
  font-weight: 560;
  letter-spacing: -0.02em;
}

.readout {
  margin: 0;
  color: var(--muted);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 12px;
  text-align: right;
}

.tools {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  flex: none;
}

.lang { display: flex; gap: 6px; }

.lang button {
  min-height: 32px;
  padding: 4px 10px;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 12px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  padding-bottom: 8px;
}

.stat {
  border: 1px solid var(--line);
  background: var(--panel);
  padding: 10px 12px;
}

.stat b {
  display: block;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 22px;
  font-weight: 500;
}

.stat span { color: var(--muted); font-size: 12px; }
.stat.live b { color: var(--live); }
.stat.limited b { color: var(--limited); }
.stat.daily b { color: var(--live); }
.stat.agent b { color: var(--agent); }

.views { display: flex; gap: 8px; padding: 8px 0; }

button, .chip {
  font: inherit;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  min-height: 40px;
  cursor: pointer;
}

button.is-on, .chip.is-on {
  border-color: var(--live);
  color: var(--bg);
  background: var(--live);
}

.filters { display: grid; gap: 8px; padding-bottom: 8px; }
.filter-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filter-row em {
  font-style: normal;
  color: var(--muted);
  font-size: 12px;
  min-width: 3em;
}

.state { color: var(--muted); min-height: 1.4em; }
.state.error { color: var(--danger); }

.board {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px;
  padding-bottom: 28px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-left-width: 4px;
  padding: 12px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 210px;
}

.card.tone-live { border-left-color: var(--live); }
.card.tone-limited { border-left-color: var(--limited); }
.card.tone-card { border-left-color: var(--card); }
.card.tone-agent { border-left-color: var(--agent); }
.card.tone-ended { border-left-color: var(--ended); opacity: 0.72; }

.card h2 {
  margin: 0;
  font-size: 18px;
}

.card h2 button {
  border: 0;
  padding: 0;
  min-height: 0;
  border-radius: 0;
  font-size: 18px;
  font-weight: 600;
  text-align: left;
}

.card h2 button:hover { color: var(--live); }

.model, .quota, .meta {
  margin: 0;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 13px;
}

.quota { font-size: 14px; }
.sub { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.meta { color: var(--limited); }

.badges { display: flex; flex-wrap: wrap; gap: 6px; }
.badge {
  font-size: 11px;
  letter-spacing: 0.02em;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 7px;
  color: var(--muted);
}
.badge.agent { color: var(--agent); border-color: rgba(94, 200, 255, 0.45); }
.badge.card { color: var(--card); border-color: rgba(255, 138, 76, 0.5); }
.badge.stale { color: var(--danger); border-color: rgba(255, 141, 141, 0.45); }
.badge.use { color: var(--text); }

.actions { display: flex; gap: 8px; margin-top: auto; }
.actions a, .actions button {
  text-decoration: none;
  border-radius: 6px;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
}
.actions a {
  background: var(--text);
  color: var(--bg);
  padding: 8px 10px;
  font-weight: 600;
  font-size: 13px;
}
.actions button { font-size: 13px; }

.changes { display: grid; gap: 8px; padding-bottom: 32px; }
.event {
  border-left: 3px solid var(--agent);
  background: var(--panel);
  padding: 10px 12px;
}
.event time { color: var(--muted); font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 12px; }
.event p { margin: 4px 0 0; }

dialog {
  width: min(640px, calc(100% - 24px));
  border: 1px solid var(--line);
  background: #0c1814;
  color: var(--text);
  padding: 0;
}
dialog::backdrop { background: rgba(0, 0, 0, 0.62); }
dialog form { padding: 16px; }
dialog header { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
dialog h2 { margin: 0; font-size: 20px; }
dialog h3 { margin: 16px 0 6px; font-size: 13px; letter-spacing: 0.08em; color: var(--muted); }
dialog p { line-height: 1.5; }
pre {
  white-space: pre-wrap;
  background: #07110e;
  border: 1px solid var(--line);
  padding: 10px;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 12px;
  overflow-x: auto;
}
.ghost { border-radius: 6px; }
code { font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 12px; }

footer {
  color: var(--muted);
  font-size: 13px;
  padding-bottom: 28px;
}

@media (max-width: 800px) {
  .top { flex-direction: column; align-items: flex-start; }
  .tools, .readout { align-items: flex-start; text-align: left; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  h1 { font-size: 18px; }
  .top, .stats, .views, .filters, .state, .board, .changes, footer {
    width: min(1180px, calc(100% - 20px));
  }
}
