:root {
  color-scheme: dark;
  --bg: #0a0d16;
  --panel: #131a2a;
  --border: #26304a;
  --text: #e9edf9;
  --dim: #98a2c2;
  --accent: #7c6cff;
  --crypto: #35d6a4;
  --warn: #f0b429;
  --error: #ff6b81;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: radial-gradient(900px 400px at 20% -10%, rgba(124, 108, 255, 0.16), transparent 70%), var(--bg);
  color: var(--text);
  font: 14px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

.top {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding: 12px 20px;
  background: rgba(10, 13, 22, 0.92);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
}

.brand { display: flex; align-items: center; gap: 8px; font-size: 17px; font-weight: 700; }
.brand .sub { font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--dim); }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px rgba(124, 108, 255, 0.2); }

.controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.inline { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--dim); }
.inline.check { cursor: pointer; }

main { max-width: 880px; margin: 0 auto; padding: 20px 20px 120px; }

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 18px;
  margin-bottom: 16px;
}

h1 { font-size: 20px; margin: 0 0 8px; }
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.09em; color: var(--dim); margin: 0 0 10px; }
p { margin: 0 0 10px; }
.note { font-size: 12.5px; color: var(--dim); }
code, pre, kbd {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
}
code { color: var(--accent); }
kbd {
  background: #0e1322;
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 1px 5px;
  color: var(--text);
}

button {
  font: inherit;
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
  background: #1b2236;
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 7px 13px;
  cursor: pointer;
}
button:hover { background: #232c46; }
button.primary { background: linear-gradient(180deg, var(--accent), #6354e0); border-color: #5a4bd8; color: #fff; }

select, input[type="text"], input[type="search"], input[type="password"], textarea {
  font: inherit;
  font-size: 13px;
  color: var(--text);
  background: #0d1220;
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 8px 10px;
  outline: none;
  width: 100%;
}
input[type="search"], input[type="password"] { width: auto; }
select { width: auto; }

textarea { resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

input:focus, textarea:focus, select:focus, .rich:focus {
  border-color: rgba(124, 108, 255, 0.7);
  box-shadow: 0 0 0 3px rgba(124, 108, 255, 0.16);
}

.field { display: block; margin: 8px 0 14px; font-size: 12px; color: var(--dim); }
.field > *:not(label) { margin-top: 5px; }
form { margin: 5px 0 0; }
form input { margin: 0; }

.rich {
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 10px;
  min-height: 52px;
  color: var(--text);
  background: #0d1220;
  font-size: 13.5px;
}

.log {
  list-style: none;
  margin: 0 0 10px;
  padding: 8px 10px;
  max-height: 230px;
  overflow-y: auto;
  background: #0d1220;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11.5px;
}
.log li { padding: 3px 0; border-bottom: 1px dashed rgba(255, 255, 255, 0.06); word-break: break-all; }
.log li:last-child { border-bottom: none; }
.log .kind-plain { color: var(--warn); }
.log .kind-envelope { color: var(--crypto); }
.log .kind-event { color: var(--dim); }
.log .empty { color: var(--dim); }

.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.out {
  margin-top: 10px;
  padding: 10px;
  min-height: 40px;
  background: #0d1220;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  white-space: pre-wrap;
  word-break: break-word;
}
pre#format-sample {
  margin: 0;
  padding: 10px;
  background: #0d1220;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow-x: auto;
  color: var(--crypto);
}

.demo-foot {
  margin: 8px auto 32px;
  max-width: 980px;
  padding: 0 20px;
  color: var(--dim, #98a2c2);
  font-size: 11.5px;
  line-height: 1.6;
  text-align: center;
}

.demo-foot a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}
