:root {
  color-scheme: dark;
  --bg: #07101d;
  --bg-deep: #050b14;
  --panel: rgba(13, 25, 42, 0.88);
  --panel-strong: #0f2137;
  --line: rgba(157, 186, 219, 0.17);
  --line-bright: rgba(157, 186, 219, 0.31);
  --text: #edf5ff;
  --muted: #8fa8c2;
  --faint: #5c7794;
  --cyan: #66e2dc;
  --cyan-deep: #1db9bb;
  --gold: #f6c66f;
  --violet: #b99cff;
  --red: #ff7e86;
  --green: #70e3a2;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.32);
  --radius: 18px;
  --mono: 'DM Mono', 'Cascadia Code', 'SFMono-Regular', Consolas, monospace;
  --sans: 'Space Grotesk', 'Segoe UI', 'Microsoft YaHei', sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 74% -12%, rgba(34, 117, 141, .24), transparent 31rem),
    radial-gradient(circle at -12% 34%, rgba(87, 58, 135, .14), transparent 30rem),
    linear-gradient(155deg, var(--bg) 0%, var(--bg-deep) 100%);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.5;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  content: '';
  opacity: .23;
  background-image: linear-gradient(rgba(117, 158, 197, .07) 1px, transparent 1px), linear-gradient(90deg, rgba(117, 158, 197, .07) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: linear-gradient(to bottom, black, transparent 78%);
}

button, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .68; transform: none !important; }

.app-shell { width: min(1440px, calc(100% - 48px)); margin: 0 auto; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 76px;
  border-bottom: 1px solid var(--line);
}

.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--text); text-decoration: none; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(102, 226, 220, .45);
  border-radius: 11px;
  color: var(--cyan);
  font-size: 25px;
  line-height: 1;
  box-shadow: inset 0 0 18px rgba(102, 226, 220, .1), 0 0 18px rgba(102, 226, 220, .08);
}
.brand strong { display: block; font-size: 15px; letter-spacing: .06em; }
.brand small { display: block; margin-top: 1px; color: var(--faint); font-family: var(--mono); font-size: 9px; letter-spacing: .16em; }
.topbar-meta { display: flex; align-items: center; gap: 16px; color: var(--faint); font-family: var(--mono); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }
.local-pill { display: inline-flex; align-items: center; gap: 7px; padding: 7px 10px; border: 1px solid rgba(112, 227, 162, .24); border-radius: 99px; color: var(--green); background: rgba(112, 227, 162, .06); }
.pulse-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px rgba(112, 227, 162, .1), 0 0 12px var(--green); }

.hero { display: flex; align-items: center; justify-content: space-between; gap: 32px; padding: 72px 7% 58px; }
.hero-copy { max-width: 760px; }
.eyebrow, .section-kicker { margin: 0 0 10px; color: var(--cyan); font-family: var(--mono); font-size: 10px; letter-spacing: .18em; text-transform: uppercase; }
.hero h1 { margin: 0; max-width: 700px; font-size: clamp(42px, 6vw, 78px); line-height: .98; letter-spacing: -.055em; font-weight: 600; }
.hero-subtitle { max-width: 610px; margin: 23px 0 0; color: var(--muted); font-size: clamp(16px, 1.7vw, 20px); }
.hero-orbit { position: relative; flex: 0 0 205px; width: 205px; height: 205px; margin-right: 4%; }
.orbit-ring { position: absolute; inset: 0; border: 1px solid rgba(102, 226, 220, .3); border-radius: 50%; transform: rotate(-25deg) skewX(-14deg); }
.ring-two { inset: 18px -9px; border-color: rgba(185, 156, 255, .28); transform: rotate(62deg) skewX(-11deg); }
.orbit-core { position: absolute; inset: 58px; display: grid; place-items: center; border: 1px solid rgba(102, 226, 220, .48); border-radius: 50%; color: var(--cyan); background: rgba(18, 51, 71, .52); box-shadow: 0 0 35px rgba(102, 226, 220, .13), inset 0 0 28px rgba(102, 226, 220, .11); font-family: var(--mono); font-size: 17px; letter-spacing: .12em; }
.orbit-core::after { position: absolute; width: 6px; height: 6px; border-radius: 50%; content: ''; background: var(--gold); box-shadow: 0 0 14px var(--gold); transform: translate(48px, -42px); }

.privacy-banner { display: flex; align-items: flex-start; gap: 13px; margin-bottom: 28px; padding: 17px 20px; border: 1px solid rgba(102, 226, 220, .2); border-radius: 14px; background: linear-gradient(105deg, rgba(29, 129, 140, .13), rgba(22, 49, 74, .35)); }
.privacy-icon { flex: none; color: var(--cyan); font-size: 20px; line-height: 1.2; }
.privacy-banner strong { font-size: 13px; font-weight: 600; }
.privacy-banner p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }

.workspace-grid { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(315px, .85fr); gap: 22px; align-items: start; }
.side-column { display: grid; gap: 22px; }
.panel { border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(145deg, rgba(16, 33, 55, .9), rgba(9, 19, 34, .9)); box-shadow: var(--shadow); }
.decoder-panel { padding: 27px; }
.panel-heading, .subheading-row, .output-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.compact-heading { align-items: center; }
.panel-heading h2 { margin: 0; font-size: 23px; letter-spacing: -.035em; }
.section-kicker { margin-bottom: 5px; color: var(--faint); font-size: 9px; }
.panel-heading .section-kicker, .subheading-row .section-kicker { color: var(--cyan); }
.quiet-button, .secondary-button, .primary-button, .icon-button, .text-button { border: 0; transition: border-color .2s, background .2s, color .2s, transform .2s, box-shadow .2s; }
.quiet-button { padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); background: transparent; font-size: 11px; }
.quiet-button:hover, .secondary-button:hover, .icon-button:hover { border-color: var(--line-bright); color: var(--text); background: rgba(157, 186, 219, .08); }
.field-label { display: block; margin: 19px 0 7px; color: var(--muted); font-family: var(--mono); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }
textarea, select { width: 100%; border: 1px solid var(--line); border-radius: 10px; outline: none; color: var(--text); background: rgba(4, 12, 23, .62); transition: border-color .2s, box-shadow .2s; }
textarea:focus, select:focus { border-color: rgba(102, 226, 220, .72); box-shadow: 0 0 0 3px rgba(102, 226, 220, .1); }
textarea::placeholder { color: #526b86; }
.token-input { min-height: 118px; padding: 15px; resize: vertical; color: #dcecff; font-family: var(--mono); font-size: 12px; line-height: 1.7; }
.key-input { min-height: 98px; padding: 12px; resize: vertical; font-family: var(--mono); font-size: 11px; line-height: 1.5; }
.small-input { min-height: 72px; padding: 11px; resize: vertical; font-family: var(--mono); font-size: 11px; line-height: 1.55; }
.json-input { min-height: 137px; padding: 12px; resize: vertical; font-family: var(--mono); font-size: 11px; line-height: 1.6; }
.payload-editor { min-height: 170px; }
.select-input { min-height: 39px; padding: 0 11px; font-size: 12px; cursor: pointer; }
.select-input option { color: #142238; background: #e9f2fb; }
.action-row { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; margin-top: 12px; }
.primary-button, .secondary-button { min-height: 39px; padding: 0 15px; border-radius: 9px; font-size: 12px; font-weight: 600; }
.primary-button { border: 1px solid rgba(102, 226, 220, .6); color: #062126; background: linear-gradient(130deg, #79ede1, #47c7cd); box-shadow: 0 8px 21px rgba(50, 196, 202, .13); }
.primary-button:hover { transform: translateY(-1px); box-shadow: 0 11px 27px rgba(50, 196, 202, .23); }
.primary-button:active { transform: translateY(0); }
.primary-button kbd { margin-left: 10px; padding: 2px 5px; border: 1px solid rgba(6, 33, 38, .24); border-radius: 4px; background: rgba(255, 255, 255, .2); font-family: var(--mono); font-size: 9px; font-weight: 400; }
.secondary-button { border: 1px solid var(--line); color: var(--muted); background: rgba(157, 186, 219, .05); }
.full-button { width: 100%; margin-top: 17px; }
.inline-message { min-height: 20px; color: var(--muted); font-size: 11px; }
.inline-message.error, .generator-message.error { color: var(--red); }
.inline-message.success, .generator-message.success { color: var(--green); }

.status-strip { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 1px; margin-top: 24px; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: var(--line); }
.status-main, .status-detail { min-height: 75px; padding: 14px 15px; background: rgba(11, 28, 46, .78); }
.status-main { display: flex; flex-direction: column; justify-content: center; }
.status-label, .status-detail span, .issued-summary span { color: var(--faint); font-family: var(--mono); font-size: 9px; letter-spacing: .08em; text-transform: uppercase; }
.status-badge { display: inline-flex; align-items: center; width: fit-content; margin-top: 7px; padding: 4px 8px; border: 1px solid var(--line); border-radius: 99px; color: var(--muted); font-family: var(--mono); font-size: 10px; letter-spacing: .06em; }
.status-badge.valid { border-color: rgba(112, 227, 162, .33); color: var(--green); background: rgba(112, 227, 162, .08); }
.status-badge.expired { border-color: rgba(255, 126, 134, .36); color: var(--red); background: rgba(255, 126, 134, .08); }
.status-badge.pending { border-color: rgba(246, 198, 111, .35); color: var(--gold); background: rgba(246, 198, 111, .08); }
.status-badge.neutral { color: var(--muted); }
.status-detail { display: flex; flex-direction: column; justify-content: center; gap: 6px; }
.status-detail strong { overflow: hidden; color: var(--text); font-family: var(--mono); font-size: 11px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }

.output-grid { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 13px; margin-top: 17px; }
.code-card { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: rgba(4, 13, 25, .56); }
.signature-card { grid-column: 1 / -1; }
.card-heading { display: flex; align-items: center; justify-content: space-between; min-height: 45px; padding: 0 12px; border-bottom: 1px solid var(--line); }
.card-heading > div { display: flex; align-items: center; gap: 8px; }
.card-heading h3 { margin: 0; font-size: 12px; font-weight: 600; }
.data-dot { width: 7px; height: 7px; border-radius: 50%; }
.dot-red { background: var(--red); box-shadow: 0 0 9px rgba(255, 126, 134, .7); }
.dot-gold { background: var(--gold); box-shadow: 0 0 9px rgba(246, 198, 111, .65); }
.dot-violet { background: var(--violet); box-shadow: 0 0 9px rgba(185, 156, 255, .65); }
.icon-button { padding: 4px 6px; border: 1px solid transparent; border-radius: 6px; color: var(--faint); background: transparent; font-family: var(--mono); font-size: 9px; letter-spacing: .05em; text-transform: uppercase; }
.code-output { min-height: 165px; max-height: 310px; margin: 0; padding: 14px; overflow: auto; color: #cce5fb; font-family: var(--mono); font-size: 11px; line-height: 1.65; white-space: pre-wrap; word-break: break-word; }
.signature-output { min-height: 70px; max-height: 140px; color: #c8baf4; }
.empty-output { color: #536c87; font-style: italic; }
.signature-meta { display: flex; flex-wrap: wrap; gap: 14px; padding: 10px 14px 13px; border-top: 1px solid rgba(157, 186, 219, .09); color: var(--muted); font-family: var(--mono); font-size: 10px; }
.signature-meta b { color: var(--text); font-weight: 500; }

.claims-section { margin-top: 25px; }
.subheading-row { align-items: end; margin-bottom: 12px; }
.subheading-row h3 { margin: 0; font-size: 16px; }
.issued-summary { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.issued-summary strong { color: var(--text); font-family: var(--mono); font-size: 11px; font-weight: 500; }
.claims-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 11px; }
.claims-table { width: 100%; border-collapse: collapse; min-width: 530px; font-size: 11px; }
.claims-table th { padding: 10px 12px; color: var(--faint); background: rgba(157, 186, 219, .045); font-family: var(--mono); font-size: 9px; font-weight: 500; letter-spacing: .08em; text-align: left; text-transform: uppercase; }
.claims-table td { padding: 11px 12px; border-top: 1px solid rgba(157, 186, 219, .1); vertical-align: top; }
.claims-table td:first-child { width: 68px; color: var(--gold); font-family: var(--mono); font-weight: 500; }
.claims-table td:nth-child(2) { max-width: 290px; color: var(--text); word-break: break-word; }
.claims-table td:nth-child(3) { color: var(--muted); }
.empty-row td { color: var(--faint) !important; font-style: italic; text-align: center; }
.claim-time { display: block; margin-top: 2px; color: var(--cyan); font-family: var(--mono); font-size: 10px; }

.verify-panel, .base64-panel { padding: 23px; }
.feature-tag { padding: 5px 8px; border: 1px solid rgba(102, 226, 220, .25); border-radius: 99px; color: var(--cyan); background: rgba(102, 226, 220, .06); font-family: var(--mono); font-size: 9px; white-space: nowrap; }
.feature-tag.muted { border-color: var(--line); color: var(--faint); background: transparent; }
.warning-tag { border-color: rgba(246, 198, 111, .27); color: var(--gold); background: rgba(246, 198, 111, .06); }
.panel-note { margin: 16px 0 0; color: var(--muted); font-size: 11px; line-height: 1.65; }
.field-inline { display: grid; grid-template-columns: 1fr; gap: 10px; }
.field-inline .field-label { margin-top: 15px; }
.verify-result { display: flex; align-items: flex-start; gap: 9px; min-height: 46px; margin-top: 13px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 9px; color: var(--muted); font-size: 11px; line-height: 1.45; }
.verify-result .result-mark { display: grid; flex: 0 0 17px; place-items: center; width: 17px; height: 17px; border-radius: 50%; color: #07101d; background: var(--faint); font-family: var(--mono); font-size: 10px; font-weight: 700; }
.verify-result.success { border-color: rgba(112, 227, 162, .35); color: var(--green); background: rgba(112, 227, 162, .06); }
.verify-result.success .result-mark { background: var(--green); }
.verify-result.failure { border-color: rgba(255, 126, 134, .35); color: var(--red); background: rgba(255, 126, 134, .06); }
.verify-result.failure .result-mark { background: var(--red); }
.verify-result.busy { border-color: rgba(246, 198, 111, .3); color: var(--gold); }
.verify-result.busy .result-mark { background: var(--gold); }
.split-actions { display: grid; grid-template-columns: 1fr 1fr; }
.split-actions button { padding: 0 5px; }
.output-input { color: var(--cyan); }
.text-button { display: block; margin: 8px 0 0 auto; padding: 0; color: var(--faint); background: transparent; font-family: var(--mono); font-size: 9px; }
.text-button:hover { color: var(--cyan); }

.generator-panel { margin-top: 22px; padding: 27px; }
.generator-layout { display: grid; grid-template-columns: minmax(0, 1.03fr) minmax(300px, .97fr); gap: 24px; margin-top: 4px; }
.two-col { grid-template-columns: 1fr 1fr; gap: 13px; }
.two-col .field-label { margin-top: 14px; }
.generator-secret { min-height: 83px; }
.generator-message { min-height: 20px; margin-top: 9px; font-size: 11px; }
.generated-output-wrap { display: flex; flex-direction: column; min-width: 0; padding: 15px; border: 1px solid var(--line); border-radius: 12px; background: rgba(4, 13, 25, .52); }
.output-heading { align-items: center; color: var(--muted); font-family: var(--mono); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }
.generated-token { flex: 1; min-height: 238px; margin-top: 12px; padding: 14px; resize: none; color: var(--cyan); font-family: var(--mono); font-size: 11px; line-height: 1.7; word-break: break-all; }
.helper-text { margin: 10px 0 0; color: var(--faint); font-size: 10px; }
.generator-warning { display: flex; align-items: center; gap: 8px; margin-top: 22px; padding-top: 17px; border-top: 1px solid var(--line); color: var(--gold); font-size: 11px; }
.generator-warning > span { display: grid; flex: 0 0 18px; place-items: center; width: 18px; height: 18px; border: 1px solid rgba(246, 198, 111, .5); border-radius: 50%; font-family: var(--mono); font-size: 11px; }

.footer { display: flex; justify-content: space-between; gap: 15px; padding: 28px 2px 35px; color: var(--faint); font-family: var(--mono); font-size: 9px; letter-spacing: .04em; }
.toast { position: fixed; right: 22px; bottom: 22px; z-index: 10; max-width: min(360px, calc(100vw - 44px)); padding: 11px 14px; border: 1px solid rgba(102, 226, 220, .35); border-radius: 9px; color: var(--text); background: #10283d; box-shadow: var(--shadow); font-size: 11px; opacity: 0; pointer-events: none; transform: translateY(8px); transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: translateY(0); }
.clipboard-helper { position: fixed; top: -10000px; left: -10000px; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

@media (max-width: 1000px) {
  .hero { padding-inline: 2%; }
  .workspace-grid { grid-template-columns: 1fr; }
  .side-column { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 720px) {
  .app-shell { width: min(100% - 28px, 620px); }
  .topbar { min-height: 65px; }
  .version-label { display: none; }
  .hero { padding: 50px 0 38px; }
  .hero-orbit { display: none; }
  .privacy-banner { padding: 14px; }
  .decoder-panel, .verify-panel, .base64-panel, .generator-panel { padding: 18px; }
  .side-column, .generator-layout { grid-template-columns: 1fr; }
  .output-grid { grid-template-columns: 1fr; }
  .signature-card { grid-column: auto; }
  .status-strip { grid-template-columns: 1fr 1fr; }
  .status-main { grid-column: 1 / -1; min-height: 67px; }
  .footer { flex-direction: column; padding-bottom: 25px; }
}

@media (max-width: 440px) {
  .topbar-meta { display: none; }
  .hero h1 { font-size: 42px; }
  .two-col { grid-template-columns: 1fr; gap: 0; }
  .status-strip { grid-template-columns: 1fr; }
  .status-main { grid-column: auto; }
  .status-detail { min-height: 58px; }
  .action-row .primary-button { flex: 1; }
  .privacy-banner p { font-size: 11px; }
}
