/* Dark indigo theme with amber accents — deliberately distinct from the
   light/teal elliptic-rank site and the plain-white eq677 site. */
:root {
  --bg: #16131f;          /* deep indigo-black */
  --bg-glow: #1c1730;
  --fg: #e9e5f2;
  --muted: #9d94b8;
  --accent: #fbbf24;      /* amber */
  --accent-dim: #b98a10;
  --panel: #201b31;
  --panel-edge: #352d4e;
  --valid: #34d399;
  --valid-bg: #0d2b21;
  --invalid: #f87171;
  --invalid-bg: #331416;
  --error-bg: #2c2410;
  --mono: "JetBrains Mono", "Fira Code", ui-monospace, SFMono-Regular, Menlo,
    Consolas, monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: radial-gradient(ellipse 120% 60% at 50% -10%, var(--bg-glow), var(--bg) 70%)
    fixed var(--bg);
  color: var(--fg);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial,
    sans-serif;
  line-height: 1.65;
}

.eq {
  font-family: var(--mono);
  white-space: nowrap;
}

header {
  border-bottom: 1px solid var(--panel-edge);
  background: rgba(22, 19, 31, 0.7);
}

header .inner {
  max-width: 780px;
  margin: 0 auto;
  padding: 1.2rem 1.5rem;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

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

header h1 a {
  color: var(--accent);
  text-decoration: none;
}

header h1 a:hover {
  color: #ffd267;
}

header nav .auth-nav {
  font-size: 0.9rem;
  color: var(--muted);
  white-space: nowrap;
}

header nav .auth-nav a.auth-login {
  display: inline-block;
  padding: 0.35rem 0.9rem;
  border: 1px solid var(--accent-dim);
  border-radius: 999px;
  color: var(--accent);
  font-weight: 600;
  font-style: normal;
  text-decoration: none;
}

header nav .auth-nav a.auth-login:hover {
  border-color: var(--accent);
  background: rgba(251, 191, 36, 0.1);
}

a.auth-user {
  font-weight: 600;
  color: var(--fg);
  text-decoration: none;
}

a.auth-user:hover {
  color: var(--accent);
}

.auth-logout {
  display: inline;
  margin-left: 0.6rem;
}

.auth-logout button {
  margin: 0;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  padding: 0;
  text-decoration: underline;
}

.auth-logout button:hover {
  color: var(--accent);
}

main {
  max-width: 780px;
  margin: 0 auto;
  padding: 1.5rem;
}

var {
  font-style: italic;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.05em;
}

.math,
.sqrt {
  font-family: Georgia, "Times New Roman", serif;
}

.sqrt {
  text-decoration: overline;
  font-style: italic;
}

.record-new {
  color: var(--accent);
  font-weight: 600;
}

.records-plot {
  width: 100%;
  height: auto;
  margin: 0.5rem 0;
  background: var(--bg);
  border: 1px solid var(--panel-edge);
  border-radius: 6px;
}

.records-plot .grid { stroke: var(--panel-edge); stroke-width: 1; }
.records-plot .axis { stroke: var(--muted); stroke-width: 1.5; }
.records-plot .tick {
  fill: var(--muted);
  font-size: 12px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.records-plot .tick .sup { font-size: 9px; }
.records-plot .axis-title {
  fill: var(--muted);
  font-size: 13px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.records-plot .guide { stroke-dasharray: 6 5; fill: none; }
.records-plot .guide-sqrt { stroke: var(--accent-dim); stroke-width: 1.8; }
.records-plot .guide-n { stroke: var(--panel-edge); stroke-width: 1.5; }
.records-plot .guide-label {
  fill: var(--muted);
  font-size: 12px;
  font-style: italic;
  font-family: Georgia, "Times New Roman", serif;
}
.records-plot .dot { fill: var(--accent); }
.records-plot .dot.beats-sqrt { fill: var(--valid); stroke: var(--fg); stroke-width: 1; }

.plot-caption {
  font-size: 0.85rem;
  margin-top: 0.2rem;
}

.form-note {
  font-size: 0.85rem;
  margin: 0.8rem 0 0;
}

/* Profile: API tokens & record witnesses */

.page-nav {
  margin: 0 0 1rem;
  font-size: 0.95rem;
}

.page-nav a {
  color: var(--accent);
  text-decoration: none;
}

.page-nav a:hover {
  text-decoration: underline;
}

.new-token {
  border: 1px solid var(--accent);
  background: rgba(251, 191, 36, 0.08);
  padding: 0.75rem 1rem;
  border-radius: 6px;
  margin: 1rem 0;
}

.token-secret {
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  padding: 0.5rem 0.75rem;
  border-radius: 3px;
  overflow-x: auto;
  white-space: nowrap;
  font-size: 0.95rem;
  margin: 0.5rem 0;
}

.tokens-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.95rem;
}

.tokens-table th, .tokens-table td {
  padding: 0.4rem 0.6rem;
  text-align: left;
  border-bottom: 1px solid var(--panel-edge);
  vertical-align: top;
}

.tokens-table th.num, .tokens-table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.tokens-table code {
  font-size: 0.9rem;
}

.inline-form {
  display: inline;
  margin: 0;
}

.link-button {
  margin: 0;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-weight: 400;
  padding: 0;
  text-decoration: underline;
}

.link-button:hover {
  color: var(--accent);
}

.new-token-form,
.profile-name-form {
  margin-top: 1rem;
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.new-token-form label {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin: 0;
}

.new-token-form input,
.profile-name-form input {
  width: auto;
  flex: 0 1 16rem;
}

.new-token-form button,
.profile-name-form button {
  margin-top: 0;
}

.my-witnesses {
  margin-top: 2rem;
}

/* Witness pages, commentary, recent activity */

.records-plot a .dot {
  cursor: pointer;
}

.records-plot a:hover .dot {
  fill: #ffd267;
  r: 7;
}

.witness-meta {
  margin: 1rem 0;
}

.witness-meta dt {
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 0.6rem;
}

.witness-meta dd {
  margin: 0.1rem 0 0;
}

.elements {
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  border-radius: 6px;
  padding: 0.75rem 1rem;
  max-height: 16rem;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.9rem;
}

.comment-section {
  margin-top: 2rem;
}

.comment-body {
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  border-radius: 6px;
  padding: 0.75rem 1rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.comment-meta {
  color: var(--muted);
  font-size: 0.85rem;
  margin: 0.4rem 0;
}

.comment-edit {
  margin-top: 0.5rem;
}

.comment-edit summary {
  color: var(--accent);
  cursor: pointer;
}

.comment-edit textarea {
  margin-top: 0.5rem;
}

.comment-edit button {
  margin-top: 0.6rem;
}

.comment-history {
  list-style: none;
  padding: 0;
}

.comment-history li {
  border-bottom: 1px solid var(--panel-edge);
  padding: 0.9rem 0;
}

.activity {
  list-style: none;
  padding: 0;
}

.activity li {
  border-bottom: 1px solid var(--panel-edge);
  padding: 0.8rem 0;
}

.activity-meta {
  color: var(--muted);
  font-size: 0.85rem;
  margin: 0 0 0.2rem;
}

.activity-line {
  margin: 0;
}

.activity .comment-body {
  margin-top: 0.5rem;
  font-size: 0.92rem;
}

.pager {
  display: flex;
  justify-content: space-between;
  margin: 1.5rem 0 0.5rem;
  font-size: 0.95rem;
}

.pager a {
  color: var(--accent);
  text-decoration: none;
}

.pager a:hover {
  text-decoration: underline;
}

.footer-links {
  margin-bottom: 0.5rem;
}

.footer-links a {
  color: var(--muted);
  text-decoration: none;
}

.footer-links a:hover {
  color: var(--accent);
}

.acknowledgment {
  max-width: 640px;
  margin: 1rem auto 0;
  padding-top: 1rem;
  border-top: 1px solid var(--panel-edge);
  font-size: 0.8rem;
  line-height: 1.5;
  text-align: left;
  color: var(--muted);
}

.acknowledgment a {
  color: var(--muted);
}

.acknowledgment a:hover {
  color: var(--accent);
}

.nowrap { white-space: nowrap; }

/* Outbound links get a small external-link glyph, colored to match. */
a.external::after {
  content: "";
  display: inline-block;
  width: 0.75em;
  height: 0.75em;
  margin-left: 0.25em;
  background-color: currentColor;
  opacity: 0.6;
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'><path d='M6 1h5v5L8.86 3.85 4.7 8 4 7.3l4.15-4.15zM2 3h2v1H3v6h6V8h1v3H2z'/></svg>") no-repeat center / contain;
          mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'><path d='M6 1h5v5L8.86 3.85 4.7 8 4 7.3l4.15-4.15zM2 3h2v1H3v6h6V8h1v3H2z'/></svg>") no-repeat center / contain;
}

.display-eq {
  text-align: center;
  font-size: 1.25rem;
  color: var(--accent);
  margin: 1.3rem 0;
}

.prose p {
  margin: 0.7rem 0;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  border-radius: 10px;
  padding: 1.2rem 1.4rem 1.4rem;
  margin: 1.6rem 0;
}

.panel h2,
.result h2 {
  margin: 0 0 0.8rem;
  font-size: 1.1rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}

.panel h2 {
  color: var(--accent);
}

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

form input,
form textarea {
  width: 100%;
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--panel-edge);
  border-radius: 6px;
  padding: 0.55rem 0.7rem;
  font-family: var(--mono);
  font-size: 0.95rem;
}

form input:focus,
form textarea:focus {
  outline: none;
  border-color: var(--accent-dim);
  box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.18);
}

form textarea {
  resize: vertical;
}

form button {
  margin-top: 1.1rem;
  background: var(--accent);
  color: #241a02;
  border: none;
  border-radius: 6px;
  padding: 0.6rem 1.6rem;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
}

form button:hover {
  background: #ffd267;
}

.result {
  border-radius: 10px;
  padding: 1.2rem 1.4rem;
  margin: 1.6rem 0;
  border: 1px solid;
}

.result-valid {
  background: var(--valid-bg);
  border-color: var(--valid);
}

.result-valid h2 {
  color: var(--valid);
}

.result-invalid {
  background: var(--invalid-bg);
  border-color: var(--invalid);
}

.result-invalid h2 {
  color: var(--invalid);
}

.result-error {
  background: var(--error-bg);
  border-color: var(--accent-dim);
}

.result-error h2 {
  color: var(--accent);
}

.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem 2.2rem;
  margin: 1rem 0 0.3rem;
}

.stats div {
  display: flex;
  flex-direction: column;
}

.stats dt {
  color: var(--muted);
  font-size: 0.85rem;
}

.stats dd {
  margin: 0;
  font-family: var(--mono);
  font-size: 1.15rem;
}

.stats .score {
  color: var(--accent);
  font-weight: 700;
}

.beats {
  color: var(--valid);
  font-weight: 700;
}

.muted {
  color: var(--muted);
}

code {
  font-family: var(--mono);
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  border-radius: 4px;
  padding: 0.1rem 0.35rem;
  font-size: 0.9em;
}

.api-note {
  color: var(--muted);
  font-size: 0.95rem;
}

.api-note h2 {
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

footer {
  border-top: 1px solid var(--panel-edge);
  margin-top: 2rem;
}

footer .inner {
  max-width: 780px;
  margin: 0 auto;
  padding: 1rem 1.5rem;
  color: var(--muted);
  font-size: 0.85rem;
}
