/* Dark spruce theme with phosphor-mint and coral accents, mono display
   headings, and a faint unit-circle motif — deliberately distinct from the
   other icarm sites: elliptic-rank (light teal, serif), ruzsa-genus-one
   (dark indigo, amber), additive-squares (light lavender, violet/magenta,
   slab), eq677 (blue-cast light, cobalt), and
   matroid-correlation-constants (warm paper, teal + rust). */
:root {
  --bg: #0d1512;            /* near-black with a green cast */
  --bg-glow: #12241c;
  --fg: #e3efe8;
  --muted: #8ba79a;
  --accent: #35d6a2;        /* phosphor mint */
  --accent-dim: #1e9c74;
  --accent-soft: #12352a;
  --coral: #ff8f6b;         /* secondary accent */
  --coral-dim: #d96a49;
  --panel: #131e19;         /* cards, inputs */
  --panel-edge: #26443a;
  --code-bg: #16261f;
  --ok: #35d6a2;
  --ok-bg: #0e2f23;
  --bad: #ff8f6b;
  --bad-bg: #33170e;
  --pending: #d8c46a;
  --pending-bg: #2c2610;
  --mono: "IBM Plex Mono", "JetBrains Mono", ui-monospace, SFMono-Regular,
    Menlo, Consolas, monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  color: var(--fg);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial,
    sans-serif;
  line-height: 1.65;
  /* faint concentric circles, top right: the unit circle motif */
  background:
    radial-gradient(circle at 85% -120px,
      transparent 118px, rgba(53, 214, 162, 0.05) 119px, transparent 121px,
      transparent 178px, rgba(53, 214, 162, 0.04) 179px, transparent 181px,
      transparent 238px, rgba(53, 214, 162, 0.03) 239px, transparent 241px),
    radial-gradient(ellipse 130% 55% at 50% -8%, var(--bg-glow), var(--bg) 72%)
      fixed,
    var(--bg);
}

a {
  color: var(--accent);
}
a:hover {
  color: #7ff0c9;
}

code,
.mono {
  font-family: var(--mono);
}
code {
  background: var(--code-bg);
  padding: 0.06em 0.32em;
  border-radius: 3px;
  font-size: 0.92em;
}

.muted {
  color: var(--muted);
}
.small {
  font-size: 0.85em;
}
.nowrap {
  white-space: nowrap;
}
.math {
  font-style: italic;
}
.num {
  font-family: var(--mono);
  text-align: right;
}

.inner {
  max-width: 920px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ---------------- header ---------------- */

header {
  background: rgba(9, 15, 12, 0.92);
  border-bottom: 3px solid var(--accent);
}

header .inner {
  padding-top: 1rem;
  padding-bottom: 1rem;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}

header h1 {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 600;
  font-family: var(--mono);
  letter-spacing: 0.01em;
}

header h1 a {
  color: var(--fg);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}
header h1 a:hover {
  color: #fff;
}
header .logo {
  transform: translateY(1px);
}

header nav a {
  color: var(--muted);
  text-decoration: none;
  margin-left: 1rem;
  font-size: 0.92rem;
}
header nav a:hover {
  color: var(--accent);
}

.auth-nav {
  margin-left: 1rem;
  white-space: nowrap;
}
.auth-user {
  font-weight: 600;
  color: var(--fg) !important;
}
.auth-logout {
  display: inline;
  margin-left: 0.5rem;
}
.auth-logout button {
  margin: 0;
  padding: 0.1rem 0.55rem;
  font-size: 0.8rem;
  font-weight: 400;
  background: transparent;
  border: 1px solid var(--panel-edge);
  color: var(--muted);
}
.auth-logout button:hover {
  color: var(--coral);
  border-color: var(--coral-dim);
  background: transparent;
}

.login-cta {
  display: inline-block;
  background: var(--panel);
  border: 1px solid var(--accent-dim);
  border-radius: 6px;
  padding: 0.45rem 1.1rem;
  font-family: var(--mono);
  text-decoration: none;
}
.login-cta:hover {
  background: var(--accent-soft);
}
.login-note {
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  border-radius: 8px;
  padding: 1rem;
}

.token-banner {
  background: var(--ok-bg);
  border: 1px solid var(--accent-dim);
  border-radius: 6px;
  padding: 0.7rem 0.9rem;
  margin: 1rem 0;
  overflow-wrap: anywhere;
}

button.danger {
  margin: 0;
  padding: 0.1rem 0.6rem;
  font-size: 0.8rem;
  font-weight: 400;
  background: transparent;
  border: 1px solid var(--coral-dim);
  color: var(--coral);
}
button.danger:hover {
  background: var(--bad-bg);
}

tr.revoked td {
  opacity: 0.5;
}

.inline-form {
  display: flex;
  gap: 0.8rem;
  align-items: flex-end;
  flex-wrap: wrap;
  margin-top: 1rem;
}
.inline-form label {
  flex: 0 1 300px;
  margin: 0;
}
.inline-form button {
  margin: 0;
  padding: 0.5rem 1rem;
}

.acknowledgment {
  font-size: 0.82rem;
}

/* ---------------- sections ---------------- */

main {
  padding-top: 1.5rem;
  padding-bottom: 3rem;
}

section {
  margin: 2.2rem 0;
}

h2 {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 1.15rem;
  color: var(--accent);
  letter-spacing: 0.01em;
  margin: 0 0 0.7rem;
}

h3 {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 0.98rem;
  margin: 1.4rem 0 0.5rem;
}

.display-eq {
  text-align: center;
  font-size: 1.05rem;
  color: var(--coral);
  margin: 1rem 0;
}

.flash {
  padding: 0.6rem 0.9rem;
  border-radius: 6px;
  margin: 1rem 0;
}
.flash.bad {
  background: var(--bad-bg);
  color: var(--bad);
  border: 1px solid var(--coral-dim);
}

/* ---------------- ratio plot ---------------- */

.plot-wrap {
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  border-radius: 8px;
  padding: 0.6rem 0.6rem 0.2rem;
}
.ratio-plot {
  display: block;
  width: 100%;
  height: auto;
  font-family: var(--mono);
}
.ratio-plot .grid line {
  stroke: rgba(38, 68, 58, 0.55);
  stroke-width: 1;
}
.ratio-plot .axis line {
  stroke: var(--muted);
  stroke-width: 1;
}
.ratio-plot .axis text {
  fill: var(--muted);
  font-size: 11px;
}
.ratio-plot .axis-title {
  fill: var(--fg);
  font-size: 12px;
}
.ratio-plot .ref {
  stroke-width: 1.2;
  stroke-dasharray: 5 4;
}
.ratio-plot .ref.target {
  stroke: var(--coral);
}
.ratio-plot .ref.random {
  stroke: var(--muted);
}
.ratio-plot .ref-label {
  font-size: 11px;
}
.ratio-plot .ref-label.target {
  fill: var(--coral);
}
.ratio-plot .ref-label.random {
  fill: var(--muted);
}
.ratio-plot .pt {
  fill: var(--accent);
  stroke: #0d1512;
  stroke-width: 1;
}
.ratio-plot a:hover .pt {
  fill: var(--coral);
  opacity: 1;
}

/* ---------------- records table ---------------- */

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--panel-edge);
  border-radius: 8px;
  background: var(--panel);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

th,
td {
  text-align: left;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid rgba(38, 68, 58, 0.5);
}

th {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--muted);
  text-transform: lowercase;
  letter-spacing: 0.04em;
}

th a.sort {
  color: var(--muted);
  text-decoration: none;
}
th a.sort:hover,
th a.sort.active {
  color: var(--accent);
}

.star {
  color: var(--coral);
  font-size: 0.85em;
}

tbody tr:last-child td {
  border-bottom: none;
}
tbody tr:hover {
  background: var(--accent-soft);
}

td.rank {
  color: var(--muted);
  font-family: var(--mono);
}

.score {
  font-family: var(--mono);
  color: var(--accent);
  font-weight: 600;
}

.badge {
  font-family: var(--mono);
  font-size: 0.75rem;
  padding: 0.12em 0.5em;
  border-radius: 999px;
}
.badge.verified {
  color: var(--ok);
  background: var(--ok-bg);
}
.badge.pending {
  color: var(--pending);
  background: var(--pending-bg);
}
.badge.rejected {
  color: var(--bad);
  background: var(--bad-bg);
}

/* ---------------- forms ---------------- */

form label {
  display: block;
  margin: 0.6rem 0 0.3rem;
  font-size: 0.92rem;
  color: var(--muted);
}

textarea,
input[type="text"] {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  border-radius: 6px;
  color: var(--fg);
  font-family: var(--mono);
  font-size: 0.92rem;
  padding: 0.55rem 0.7rem;
}
textarea:focus,
input[type="text"]:focus {
  outline: none;
  border-color: var(--accent-dim);
}

.form-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}
.form-row label {
  flex: 1 1 220px;
}

button {
  margin-top: 1rem;
  background: var(--accent);
  border: none;
  border-radius: 6px;
  color: #06231a;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 0.95rem;
  padding: 0.55rem 1.4rem;
  cursor: pointer;
}
button:hover {
  background: #5ce4b6;
}

.signs-box {
  width: 100%;
  resize: vertical;
  word-break: break-all;
}

/* ---------------- record page ---------------- */

.record-meta {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.3rem 1.2rem;
  margin: 1rem 0;
}
.record-meta dt {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.85rem;
}
.record-meta dd {
  margin: 0;
  overflow-wrap: anywhere;
}

/* ---------------- api & footer ---------------- */

.api-list {
  list-style: none;
  padding: 0;
}
.api-list li {
  padding: 0.35rem 0;
  border-bottom: 1px dashed rgba(38, 68, 58, 0.6);
  font-size: 0.92rem;
}
.api-list li:last-child {
  border-bottom: none;
}

footer {
  border-top: 1px solid var(--panel-edge);
  padding-top: 1rem;
  padding-bottom: 2rem;
  font-size: 0.88rem;
}
