/* Abuse registration POC — styled to match the FLÓ/zeitkort POC shell. */

*, *::before, *::after { box-sizing: border-box; }

:root,
[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f1ec;
  --fg: #1a1d22;
  --muted: #595f68;
  --dim: #9299a2;
  --border: rgba(26, 29, 34, 0.12);
  --border-soft: rgba(26, 29, 34, 0.06);
  --dotted: rgba(26, 29, 34, 0.12);
  --field-bg: rgba(26, 29, 34, 0.03);
  --field-border: rgba(26, 29, 34, 0.18);
  --btn-bg: rgba(26, 29, 34, 0.05);
  --btn-bg-hover: rgba(26, 29, 34, 0.09);
  --btn-border: rgba(26, 29, 34, 0.18);
  --header-border: rgba(26, 29, 34, 0.12);
  --link: #2c5a7a;
  --accent: #2c5a7a;
  --nav-bg: rgba(244, 241, 236, 0.6);
  --bg-panel: rgba(255, 253, 250, 0.72);
  --notice-fg: #2a6e2a;
  --notice-bg: rgba(42, 110, 42, 0.06);
  --notice-border: rgba(42, 110, 42, 0.25);
  --error-fg: #a03030;
  --error-bg: rgba(160, 48, 48, 0.06);
  --error-border: rgba(160, 48, 48, 0.25);
  --shadow: rgba(0, 0, 0, 0.12);
  --toggle-bg: linear-gradient(135deg, #07070d 0%, #64dcff 100%);
  --toggle-border: rgba(26, 29, 34, 0.2);
  --toggle-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

[data-theme="tokyo"] {
  color-scheme: dark;
  --bg: #07070d;
  --fg: #e8f4ff;
  --muted: #a3b3cc;
  --dim: #7886a0;
  --border: rgba(100, 220, 255, 0.12);
  --border-soft: rgba(100, 220, 255, 0.06);
  --dotted: rgba(100, 220, 255, 0.1);
  --field-bg: rgba(100, 220, 255, 0.04);
  --field-border: rgba(100, 220, 255, 0.15);
  --btn-bg: rgba(100, 220, 255, 0.06);
  --btn-bg-hover: rgba(100, 220, 255, 0.1);
  --btn-border: rgba(100, 220, 255, 0.18);
  --header-border: rgba(100, 220, 255, 0.12);
  --link: #64dcff;
  --accent: #64dcff;
  --nav-bg: rgba(7, 7, 13, 0.65);
  --bg-panel: rgba(15, 16, 28, 0.72);
  --notice-fg: #8fe08f;
  --notice-bg: rgba(143, 224, 143, 0.06);
  --notice-border: rgba(143, 224, 143, 0.25);
  --error-fg: #ff9b9b;
  --error-bg: rgba(255, 155, 155, 0.06);
  --error-border: rgba(255, 155, 155, 0.2);
  --shadow: rgba(0, 0, 0, 0.5);
  --toggle-bg: #f4f1ec;
  --toggle-border: rgba(100, 220, 255, 0.4);
  --toggle-shadow: 0 0 10px rgba(100, 220, 255, 0.5), 0 0 25px rgba(100, 220, 255, 0.3);
}

html, body { max-width: 100%; overflow-x: hidden; }
body {
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', monospace;
  font-size: 0.88rem;
  font-weight: 300;
  line-height: 1.55;
  color: var(--fg);
  background: var(--bg);
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: background 0.3s ease, color 0.3s ease;
}

main {
  overflow-wrap: break-word;
  padding: 16px;
  max-width: 1040px;
  margin: 0 auto;
  width: 100%;
  flex: 1;
}

header {
  border-bottom: 1px solid var(--header-border);
  padding: 1rem 1.5rem;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  background: var(--nav-bg);
  backdrop-filter: blur(12px) saturate(120%);
  -webkit-backdrop-filter: blur(12px) saturate(120%);
  position: sticky;
  top: 0;
  z-index: 20;
  transition: background 0.3s ease;
}

.back-link {
  font-weight: 400;
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--muted);
  text-decoration: none;
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 2px;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}
.back-link:hover { color: var(--fg); border-color: var(--muted); background: var(--bg-panel); }

.brand {
  justify-self: center;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.02em;
  color: var(--fg);
  text-decoration: none;
  display: inline-flex;
  align-items: baseline;
  gap: 0.35rem;
  white-space: nowrap;
}
.brand-sep { font-weight: 300; color: var(--dim); }
.brand-sub {
  font-weight: 400;
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}
[data-theme="tokyo"] .brand { color: #e8f4ff; text-shadow: 0 0 8px rgba(100, 220, 255, 0.3); }

footer {
  padding: 0.9rem 1.5rem;
  color: var(--muted);
  font-size: 0.68rem;
  letter-spacing: 0.05em;
  border-top: 1px solid var(--border-soft);
  background: var(--nav-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.5rem;
}
footer a { color: inherit; text-decoration: none; border-bottom: 1px solid transparent; }
footer a:hover { color: var(--accent); }
.footer-icon { color: var(--muted); text-decoration: none; display: flex; align-items: center; border-bottom: none; transition: color 0.25s ease; }
.footer-icon:hover { color: var(--accent); border-bottom: none; }

h1, h2, h3 { font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', monospace; font-weight: 700; letter-spacing: -0.02em; }
h1 { margin: 0 0 0.9rem; font-size: clamp(1.35rem, 4vw, 2rem); }
h2 { margin: 0 0 0.9rem; font-size: 1.1rem; }
h3 { margin: 1rem 0 0.4rem; font-size: 0.86rem; color: var(--fg); }
.workflow-content h3:first-child { margin-top: 0; }
p { margin: 0 0 0.8rem; }
a { color: var(--link); }
code { font-family: inherit; font-size: 0.86em; }
.muted { color: var(--muted); font-size: 0.78rem; }

.intro-card,
.section-block {
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--field-bg);
  padding: 1.2rem 1.4rem;
  margin: 0 0 14px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.columns { display: flex; gap: 16px; flex-wrap: wrap; }
.col { flex: 1 1 340px; min-width: 0; }

fieldset {
  border: 1px solid var(--border);
  margin: 0;
  padding: 10px 12px;
  min-width: 0;
  border-radius: 3px;
  background: var(--field-bg);
  transition: border-color 0.3s ease, background 0.3s ease;
}
legend {
  font-weight: 500;
  padding: 0 6px;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

pre {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border-soft);
  border-radius: 3px;
  background: rgba(26, 29, 34, 0.04);
  margin: 0.8rem 0 0;
  padding: 0.85rem 0.95rem;
  font-size: 0.78rem;
  line-height: 1.45;
}
[data-theme="tokyo"] pre { background: rgba(100, 220, 255, 0.04); }

.harmonium {
  display: grid;
  gap: 10px;
  margin-top: 1rem;
}
.workflow-panel {
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--field-bg);
  overflow: hidden;
}
.workflow-panel summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1rem;
  cursor: pointer;
  color: var(--fg);
  border-bottom: 1px solid transparent;
  user-select: none;
}
.workflow-panel summary::-webkit-details-marker { display: none; }
.workflow-panel summary::before {
  content: '+';
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.2rem;
  height: 1.2rem;
  margin-right: 0.2rem;
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--muted);
  flex: 0 0 auto;
}
.workflow-panel summary span:first-child { margin-right: auto; }
.workflow-panel[open] summary {
  border-bottom-color: var(--border-soft);
  background: var(--btn-bg);
}
.workflow-panel[open] summary::before { content: '−'; color: var(--accent); }
.summary-hint {
  color: var(--dim);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}
.workflow-content { padding: 1rem; }
.workflow-content pre:last-child { margin-bottom: 0; }

select, input[type=text], input[type=number], input:not([type]) {
  font: inherit;
  font-size: 0.85rem;
  padding: 0.35rem 0.55rem;
  border: 1px solid var(--field-border);
  border-radius: 3px;
  background: var(--field-bg);
  color: var(--fg);
  transition: border-color 0.2s;
  outline: none;
  width: 100%;
}
[data-theme="tokyo"] select,
[data-theme="tokyo"] option { background: #0f1018; color: #e8f4ff; }
select:focus, input:focus { border-color: var(--accent); }
label { display: block; font-size: 0.78rem; color: var(--muted); margin-bottom: 0.75rem; }
label input, label select { margin-top: 0.25rem; }

button {
  font: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--btn-border);
  border-radius: 3px;
  background: var(--btn-bg);
  color: var(--fg);
  cursor: pointer;
  letter-spacing: 0.02em;
  transition: background 0.15s, border-color 0.15s;
}
button:hover { background: var(--btn-bg-hover); }
.inline { display: inline-flex; gap: 6px; align-items: center; margin: 0; flex-wrap: wrap; }

.data-browser {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.filter-form {
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--field-bg);
  padding: 12px;
  position: sticky;
  top: 66px;
}
.json-pane { min-width: 0; }
.json-output { min-height: 360px; margin-top: 0.4rem; }

.reset-banner {
  position: sticky;
  top: 52px;
  z-index: 18;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 8px 16px;
  border-bottom: 1px solid var(--error-border);
  background: var(--error-bg);
  color: var(--error-fg);
  text-align: center;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.reset-label { font-weight: 500; text-transform: uppercase; letter-spacing: 0.12em; font-size: 0.72rem; }
.reset-countdown {
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', monospace;
  font-size: clamp(1.5rem, 6vw, 2.5rem);
  font-weight: 700;
  line-height: 1;
  padding: 2px 10px;
  border: 1px solid currentColor;
  border-radius: 3px;
  background: var(--bg);
}
.reset-note { flex-basis: 100%; font-size: 0.72rem; font-weight: 500; letter-spacing: 0.04em; }

.theme-toggle {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--toggle-border);
  cursor: pointer;
  padding: 0;
  z-index: 30;
  transition: all 0.3s ease;
  box-shadow: var(--toggle-shadow);
  background: var(--toggle-bg);
}
.theme-toggle:hover { transform: scale(1.08); }

@media (min-width: 641px) {
  .reset-banner {
    position: fixed;
    left: 1rem;
    bottom: 1rem;
    top: auto;
    justify-content: flex-start;
    gap: 8px;
    max-width: calc(100vw - 2rem);
    padding: 6px 10px;
    border: 1px solid var(--error-border);
    border-radius: 999px;
    font-size: 0.7rem;
    text-align: left;
  }
  .reset-countdown { font-size: 0.9rem; padding: 1px 8px; border-radius: 999px; }
  .reset-note { display: none; }
}

@media (max-width: 760px) {
  header { padding: 0.7rem 0.9rem; gap: 0.6rem; }
  .back-link { font-size: 0.58rem; padding: 0.25rem 0.4rem; letter-spacing: 0.08em; }
  .brand { font-size: 0.9rem; }
  main { padding: 12px; }
  footer { font-size: 0.62rem; padding: 0.7rem 0.9rem; }
  .theme-toggle { width: 20px; height: 20px; bottom: 1rem; right: 0.9rem; }
  .reset-banner { top: 44px; }
  .data-browser { grid-template-columns: 1fr; }
  .filter-form { position: static; }
}
