:root {
  --bg: #0f1115;
  --panel: #16181b;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #f3f5f8;
  --text-2: #cccccc;
  --muted: #8a94a2;
  --accent: #b8c0cb;
  --green: #4ec46a;
  --red: #ff6b6b;
  --amber: #f5b849;
  --radius: 1rem;
  --mono: ui-monospace, "SF Mono", "SFMono-Regular", Menlo, Consolas, "Liberation Mono",
    monospace;
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
}

body {
  margin: 0;
  background: radial-gradient(120% 90% at 50% -10%, #1a1d22 0%, var(--bg) 55%) no-repeat;
  background-attachment: fixed;
  color: var(--text);
  font-family: "Sora", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.wrap {
  max-width: 880px;
  margin: 0 auto;
  padding: clamp(1.5rem, 4vw, 3.5rem) 1.25rem 4rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* Header */
.site-header {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 0.25rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  flex: none;
  border-radius: 0.75rem;
  border: 1px solid var(--border-strong);
  background: linear-gradient(160deg, #202329, #14161a);
  color: var(--accent);
  font-family: var(--mono);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -1px;
}

.brand-text h1 {
  margin: 0;
  font-size: clamp(1.5rem, 3.5vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.tagline {
  margin: 0.15rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.privacy {
  margin: 0;
  align-self: flex-start;
  padding: 0.5rem 0.85rem;
  border: 1px solid rgba(78, 196, 106, 0.28);
  border-radius: 999px;
  background: rgba(78, 196, 106, 0.08);
  color: #d6f5df;
  font-size: 0.86rem;
  font-weight: 500;
}

/* Panels */
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.panel-head label,
.segment-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex: none;
}
.dot-header {
  background: var(--accent);
}
.dot-payload {
  background: #7aa2ff;
}
.dot-sig {
  background: var(--amber);
}

/* Input */
.input-actions {
  display: flex;
  gap: 0.5rem;
}

.token-input {
  width: 100%;
  resize: vertical;
  min-height: 96px;
  padding: 0.85rem 0.95rem;
  border-radius: 0.75rem;
  border: 1px solid var(--border);
  background: #101215;
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.9rem;
  line-height: 1.5;
  word-break: break-all;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.token-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(184, 192, 203, 0.14);
}

.token-input::placeholder {
  color: #4b525c;
}

.hint {
  margin: 0.6rem 0 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.error {
  margin: 0.75rem 0 0;
  padding: 0.65rem 0.85rem;
  border-radius: 0.6rem;
  border: 1px solid rgba(255, 107, 107, 0.35);
  background: rgba(255, 107, 107, 0.09);
  color: #ffd2d2;
  font-size: 0.85rem;
}

/* Buttons */
.btn {
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  border-radius: 0.5rem;
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--border-strong);
  background: #1d2025;
  color: var(--text-2);
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.btn:hover {
  background: #24282e;
  color: var(--text);
  border-color: var(--accent);
}

.btn:active {
  transform: translateY(1px);
}

.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn-copy.copied {
  color: var(--green);
  border-color: rgba(78, 196, 106, 0.5);
}

/* Results grid */
.results {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

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

/* JSON view */
.json {
  margin: 0;
  padding: 0.85rem 0.95rem;
  border-radius: 0.7rem;
  background: #101215;
  border: 1px solid var(--border);
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 0.85rem;
  line-height: 1.55;
}

.json code {
  font-family: inherit;
  white-space: pre;
}

.json.sig code {
  white-space: pre-wrap;
  word-break: break-all;
  color: var(--amber);
}

/* Syntax highlight tokens */
.tok-key {
  color: var(--accent);
}
.tok-string {
  color: #8ee6a0;
}
.tok-number {
  color: #7aa2ff;
}
.tok-boolean {
  color: #f5b849;
}
.tok-null {
  color: var(--muted);
}
.tok-punct {
  color: #6b7280;
}

/* Claims table */
.table-scroll {
  overflow-x: auto;
}

.claims-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

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

.claims-table th {
  color: var(--muted);
  font-weight: 500;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.claims-table tbody tr:last-child td,
.claims-table tr:last-child td {
  border-bottom: none;
}

.claim-label {
  color: var(--text);
  font-weight: 500;
  white-space: nowrap;
}

.claim-code {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.75rem;
}

.claim-value {
  color: var(--text-2);
  font-family: var(--mono);
  word-break: break-word;
}

.claim-value .human {
  display: block;
  margin-top: 0.15rem;
  color: var(--muted);
  font-family: "Sora", sans-serif;
  font-size: 0.8rem;
}

/* Badges */
.badge {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  letter-spacing: 0.01em;
}

.badge-valid {
  color: var(--green);
  border-color: rgba(78, 196, 106, 0.45);
  background: rgba(78, 196, 106, 0.1);
}
.badge-expired {
  color: var(--red);
  border-color: rgba(255, 107, 107, 0.45);
  background: rgba(255, 107, 107, 0.1);
}
.badge-nbf {
  color: var(--amber);
  border-color: rgba(245, 184, 73, 0.45);
  background: rgba(245, 184, 73, 0.1);
}
.badge-alg {
  color: var(--accent);
  font-family: var(--mono);
}

.note {
  margin: 0.75rem 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}
.note strong {
  color: var(--red);
  font-weight: 600;
}

/* Footer */
.site-footer {
  margin-top: 1rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--muted);
  font-size: 0.82rem;
}

.site-footer a {
  color: var(--text-2);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.site-footer a:hover {
  color: var(--text);
  border-bottom-color: var(--accent);
}

::selection {
  background: rgba(184, 192, 203, 0.28);
}
