:root {
  --bg: #08080a;
  --panel: #0f0f13;
  --panel-2: #14141a;
  --line: #24242e;
  --line-soft: #1a1a22;
  --ink: #f5f5f0;
  --muted: #8b8b98;
  --acid: #c8ff00;
  --acid-deep: #9ccc00;
  --radius: 18px;
  --font: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", "Cascadia Code", ui-monospace, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

body::before {
  content: "";
  position: fixed;
  inset: -20% -10% auto -10%;
  height: 70vh;
  background:
    radial-gradient(50% 50% at 30% 20%, rgba(200, 255, 0, 0.10), transparent 70%),
    radial-gradient(40% 40% at 78% 10%, rgba(120, 90, 255, 0.10), transparent 70%);
  filter: blur(20px);
  pointer-events: none;
  z-index: 0;
}

.grain {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------------------------------- topbar --------------------------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px clamp(18px, 4vw, 48px);
  background: rgba(8, 8, 10, 0.72);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line-soft);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 800;
  letter-spacing: -0.02em;
  font-size: 15px;
}

.brand em {
  font-style: normal;
  color: var(--muted);
  font-weight: 600;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--acid);
  box-shadow: 0 0 0 4px rgba(200, 255, 0, 0.12), 0 0 22px rgba(200, 255, 0, 0.55);
}

.meta { display: flex; align-items: center; gap: 10px; }

.pill {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--acid);
  border: 1px solid rgba(200, 255, 0, 0.28);
  background: rgba(200, 255, 0, 0.07);
  padding: 7px 12px;
  border-radius: 999px;
  white-space: nowrap;
}

/* ---------------------------------- layout --------------------------------- */

main {
  position: relative;
  z-index: 2;
  width: min(1080px, calc(100% - 36px));
  margin: 0 auto;
  padding: clamp(40px, 7vw, 84px) 0 40px;
}

.hero h1 {
  font-size: clamp(38px, 7.2vw, 78px);
  line-height: 0.98;
  letter-spacing: -0.045em;
  font-weight: 800;
  margin: 0 0 18px;
}

.hero h1 em {
  font-style: normal;
  color: var(--acid);
  text-shadow: 0 0 60px rgba(200, 255, 0, 0.25);
}

.sub {
  margin: 0;
  font-size: clamp(14px, 1.7vw, 17px);
  color: #cfcfc8;
  max-width: 56ch;
  line-height: 1.55;
}

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

/* -------------------------------- composer -------------------------------- */

.composer {
  margin-top: 34px;
  background: linear-gradient(180deg, var(--panel), #0c0c10);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: 0 24px 60px -30px rgba(0, 0, 0, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.presets {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 2px 12px;
  scrollbar-width: none;
}
.presets::-webkit-scrollbar { display: none; }

.preset {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 13px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: #d8d8d2;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.15s, color 0.15s;
  white-space: nowrap;
}

.preset span.e { font-size: 15px; line-height: 1; }

.preset:hover { border-color: #3a3a48; transform: translateY(-1px); }

.preset[aria-selected="true"] {
  border-color: var(--acid);
  background: rgba(200, 255, 0, 0.10);
  color: var(--acid);
}

.field {
  display: block;
  position: relative;
}

textarea {
  width: 100%;
  resize: none;
  border: 1px solid var(--line);
  background: #07070a;
  color: var(--ink);
  border-radius: 12px;
  padding: 16px 16px 26px;
  font: inherit;
  font-size: clamp(15px, 1.9vw, 18px);
  line-height: 1.45;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

textarea::placeholder { color: #55555f; }

textarea:focus {
  border-color: rgba(200, 255, 0, 0.55);
  box-shadow: 0 0 0 3px rgba(200, 255, 0, 0.09);
}

.counter {
  position: absolute;
  right: 14px;
  bottom: 10px;
  font-size: 11px;
  font-family: var(--mono);
  color: #5a5a66;
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.chips { display: flex; gap: 6px; flex-wrap: wrap; }

.chip {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.03em;
  color: #7c7c88;
  border: 1px solid var(--line-soft);
  padding: 5px 9px;
  border-radius: 7px;
}

/* --------------------------------- buttons -------------------------------- */

button { font-family: inherit; }

.primary {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: 12px;
  background: var(--acid);
  color: #0a0a0a;
  font-weight: 800;
  font-size: 15px;
  letter-spacing: -0.01em;
  padding: 13px 20px;
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.15s, background 0.15s;
  box-shadow: 0 0 0 0 rgba(200, 255, 0, 0.4);
}

.primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 10px 30px -10px rgba(200, 255, 0, 0.6);
  background: #d4ff1f;
}

.primary:disabled { opacity: 0.45; cursor: not-allowed; }

.primary kbd {
  font-family: var(--mono);
  font-size: 11px;
  background: rgba(0, 0, 0, 0.14);
  border-radius: 5px;
  padding: 2px 6px;
  font-weight: 700;
}

.ghost {
  border: 1px solid var(--line);
  background: transparent;
  color: #cfcfc8;
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.ghost:hover { border-color: #3d3d4a; color: var(--ink); background: rgba(255, 255, 255, 0.03); }
.ghost.small { padding: 8px 12px; font-size: 12px; border-radius: 999px; }
.ghost.hidden { display: none; }

/* ---------------------------------- stage --------------------------------- */

.stage[hidden],
.toast[hidden] { display: none; }

.stage {
  margin-top: 26px;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
  animation: rise 0.45s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

.canvasWrap {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
  aspect-ratio: 1 / 1;
  background: #0b0b0e;
}

.checker {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(45deg, #1a1a20 25%, transparent 25%),
    linear-gradient(-45deg, #1a1a20 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #1a1a20 75%),
    linear-gradient(-45deg, transparent 75%, #1a1a20 75%);
  background-size: 26px 26px;
  background-position: 0 0, 0 13px, 13px -13px, -13px 0;
  background-color: #111114;
}

#canvas {
  position: relative;
  z-index: 2;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

#fallback {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.badge {
  position: absolute;
  z-index: 3;
  left: 12px;
  bottom: 12px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  color: #0a0a0a;
  background: rgba(200, 255, 0, 0.85);
  padding: 5px 8px;
  border-radius: 5px;
  font-weight: 700;
}

.badge.hidden { display: none; }
.badge.ok { background: rgba(255, 255, 255, 0.92); }

.side { display: flex; flex-direction: column; gap: 16px; }

.modes {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 5px;
}

.mode {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 700;
  padding: 9px 6px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.mode:hover { color: var(--ink); }
.mode[aria-pressed="true"] { background: var(--panel-2); color: var(--acid); box-shadow: inset 0 0 0 1px var(--line); }

.actions { display: flex; flex-direction: column; gap: 8px; }
.actions .primary { justify-content: center; }

.note {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--muted);
  min-height: 1.5em;
}

.promptBox {
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: #0a0a0d;
  overflow: hidden;
}

.promptBox summary {
  cursor: pointer;
  padding: 10px 13px;
  font-size: 12px;
  font-weight: 700;
  color: #9b9ba6;
  list-style: none;
  user-select: none;
}
.promptBox summary::-webkit-details-marker { display: none; }
.promptBox summary::before { content: "▸ "; color: var(--acid); }
.promptBox[open] summary::before { content: "▾ "; }

.promptBox pre {
  margin: 0;
  padding: 0 13px 13px;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.65;
  color: #8f8f9c;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ----------------------------------- how ---------------------------------- */

/* -------------------------------- name row -------------------------------- */

.navlink {
  color: #b9b9c4;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 10px;
  border-radius: 8px;
  transition: color 0.15s, background 0.15s;
}
.navlink:hover { color: var(--acid); background: rgba(200, 255, 0, 0.06); }

.nameRow {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 8px;
  padding: 10px 2px 2px;
  flex-wrap: wrap;
}

.nameField {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--line);
  background: #07070a;
  border-radius: 10px;
  padding: 0 12px;
  flex: 0 1 320px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.nameField:focus-within {
  border-color: rgba(200, 255, 0, 0.5);
  box-shadow: 0 0 0 3px rgba(200, 255, 0, 0.08);
}

.nameField span {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #6e6e7a;
  white-space: nowrap;
}

.nameField input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 13.5px;
  padding: 10px 0;
  outline: none;
}

.nameField input::placeholder { color: #4f4f5a; }

.nameNote {
  margin: 0;
  font-size: 11.5px;
  color: #6b6b78;
  line-height: 1.45;
  flex: 1 1 240px;
}

/* ------------------------------- certificate ------------------------------ */

.cert {
  border: 1px solid var(--line);
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(200, 255, 0, 0.05), transparent 55%),
    var(--panel);
  padding: 14px;
  position: relative;
  overflow: hidden;
}

.cert[hidden] { display: none; }

.cert::after {
  content: "";
  position: absolute;
  inset: 6px;
  border: 1px dashed rgba(200, 255, 0, 0.16);
  border-radius: 10px;
  pointer-events: none;
}

.certHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.certKicker {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.14em;
  color: #7c7c88;
}

.certStatus {
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 4px 7px;
  border-radius: 5px;
}

.certStatus[data-status="pending"] {
  color: #ffd166;
  background: rgba(255, 209, 102, 0.1);
  border: 1px solid rgba(255, 209, 102, 0.25);
}

.certStatus[data-status="sealed"] {
  color: var(--acid);
  background: rgba(200, 255, 0, 0.1);
  border: 1px solid rgba(200, 255, 0, 0.3);
}

.certName {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin-bottom: 4px;
  word-break: break-word;
}

.certSerial {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--acid);
  letter-spacing: 0.02em;
  margin-bottom: 12px;
  word-break: break-all;
}

.certMeta {
  margin: 0 0 12px;
  display: grid;
  gap: 5px;
  font-family: var(--mono);
  font-size: 10.5px;
}

.certMeta > div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.certMeta dt { color: #6b6b78; }
.certMeta dd { margin: 0; color: #c9c9d2; text-align: right; word-break: break-all; }

.certLink {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  color: var(--acid);
  text-decoration: none;
  border-bottom: 1px solid rgba(200, 255, 0, 0.35);
  padding-bottom: 1px;
}

.certLink:hover { border-bottom-color: var(--acid); }

.how {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: clamp(48px, 8vw, 90px);
}

.step {
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.step span {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--acid);
  letter-spacing: 0.1em;
}

.step h3 {
  margin: 8px 0 6px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.step p {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--muted);
}

/* ---------------------------------- foot ---------------------------------- */

.foot {
  position: relative;
  z-index: 2;
  width: min(1080px, calc(100% - 36px));
  margin: 0 auto;
  padding: 26px 0 40px;
  border-top: 1px solid var(--line-soft);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-family: var(--mono);
  font-size: 11px;
  color: #5a5a66;
}

/* --------------------------------- skeletons ------------------------------ */

.skeleton {
  position: absolute;
  inset: 0;
  z-index: 4;
  background:
    linear-gradient(100deg, transparent 20%, rgba(255, 255, 255, 0.06) 40%, transparent 60%);
  background-size: 220% 100%;
  animation: sweep 1.1s linear infinite;
  background-color: #0e0e12;
  display: grid;
  place-items: center;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  color: #6b6b78;
}

@keyframes sweep {
  from { background-position: 120% 0; }
  to { background-position: -120% 0; }
}

/* ---------------------------------- toast --------------------------------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%) translateY(10px);
  z-index: 40;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 12px 18px;
  border-radius: 12px;
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: 0 20px 50px -20px rgba(0, 0, 0, 0.9);
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { border-color: #4a2020; color: #ff9a9a; }

/* --------------------------------- responsive ----------------------------- */

@media (max-width: 820px) {
  .stage { grid-template-columns: 1fr; }
  .how { grid-template-columns: 1fr; gap: 22px; }
  .foot { flex-direction: column; }
  .hero h1 { font-size: clamp(34px, 10vw, 52px); }
  .row { flex-direction: column; align-items: stretch; }
  .row .primary { justify-content: center; }
  .chips { display: none; }
}

/* ------------------------------- verify page ------------------------------ */

.vgrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 34px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--panel), #0c0c10);
  padding: 20px;
}

.panel h2 {
  margin: 0 0 14px;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.panelNote {
  margin: 0 0 14px;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--muted);
}

.inp {
  display: block;
  margin-bottom: 10px;
}

.inp > span {
  display: block;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #6e6e7a;
  margin-bottom: 6px;
}

.inp > span em { font-style: normal; text-transform: none; letter-spacing: 0; color: #4f4f5a; }

.inp input {
  width: 100%;
  border: 1px solid var(--line);
  background: #07070a;
  color: var(--ink);
  border-radius: 10px;
  padding: 12px 13px;
  font: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.inp input:focus {
  border-color: rgba(200, 255, 0, 0.5);
  box-shadow: 0 0 0 3px rgba(200, 255, 0, 0.08);
}

.panel .primary { width: 100%; justify-content: center; margin-top: 4px; }

.drop {
  display: grid;
  place-items: center;
  text-align: center;
  min-height: 128px;
  padding: 18px;
  border: 1px dashed #33333f;
  border-radius: 12px;
  background: #08080b;
  color: #8a8a96;
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.drop:hover, .drop.over {
  border-color: rgba(200, 255, 0, 0.55);
  background: rgba(200, 255, 0, 0.04);
  color: var(--ink);
}

.result {
  margin-top: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 20px;
}

.result[hidden] { display: none; }
.result.tone-ok { border-color: rgba(200, 255, 0, 0.4); background: linear-gradient(180deg, rgba(200, 255, 0, 0.06), var(--panel) 60%); }
.result.tone-warn { border-color: rgba(255, 209, 102, 0.35); }
.result.tone-bad { border-color: rgba(255, 120, 120, 0.35); }

.resHead {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.resBadge {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 6px 10px;
  border-radius: 6px;
}

.tone-ok .resBadge { color: #0a0a0a; background: var(--acid); }
.tone-warn .resBadge { color: #1a1400; background: #ffd166; }
.tone-bad .resBadge { color: #1a0000; background: #ff8080; }

.resVia { font-family: var(--mono); font-size: 10.5px; color: #6b6b78; }

.resNote { margin: 0 0 16px; font-size: 13.5px; color: #c9c9d2; line-height: 1.55; }

.resMeta {
  margin: 0 0 14px;
  display: grid;
  gap: 7px;
  font-size: 12.5px;
}

.resMeta > div { display: flex; justify-content: space-between; gap: 16px; padding-bottom: 7px; border-bottom: 1px solid var(--line-soft); }
.resMeta dt { color: #6b6b78; }
.resMeta dd { margin: 0; color: var(--ink); text-align: right; word-break: break-all; }
.resMeta dd.mono { font-family: var(--mono); font-size: 11.5px; color: var(--acid); }

.resLinks a {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--acid);
  text-decoration: none;
  border-bottom: 1px solid rgba(200, 255, 0, 0.35);
}

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

/* ------------------------------ style DNA bits ---------------------------- */

.certSigRow[hidden] { display: none; }

.certDna {
  margin: 0 0 12px;
  font-family: var(--mono);
  font-size: 9.5px;
  line-height: 1.55;
  color: #75757f;
  letter-spacing: 0.01em;
}

.nameRow + .nameNote {
  margin: 8px 2px 0;
  max-width: 62ch;
}

.genomeHint {
  font-family: var(--mono);
  font-size: 10px;
  color: #6b6b78;
  letter-spacing: 0.04em;
}
