:root {
  --bg: #101417;
  --surface: #181e23;
  --surface2: #20282e;
  --line: #35414a;
  --text: #edf2f4;
  --muted: #b2c0c9;
  --accent: #f9a438;
  --green: #95d4ae;
  --red: #ed9898;
  --blue: #82b9e3;
  --shadow: 0 12px 32px #0002;
  font-family:
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  font-size: 18px;
  color-scheme: dark;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
}
body.light {
  --bg: #f3f5f6;
  --surface: #fff;
  --surface2: #edf1f3;
  --line: #b9c6ce;
  --text: #17252e;
  --muted: #465b68;
  --accent: #985300;
  --green: #247344;
  --red: #a63434;
  --blue: #226896;
  color-scheme: light;
}
a {
  color: var(--blue);
  text-underline-offset: 4px;
}
button,
input,
select,
textarea {
  font: inherit;
}
button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface2);
  color: var(--text);
  padding: 9px 14px;
  cursor: pointer;
  text-decoration: none;
  min-height: 44px;
}
button:hover,
.button:hover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 11%, var(--surface));
}
button:disabled {
  opacity: 0.5;
  cursor: wait;
}
button.primary,
.button.primary {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
  font-weight: 750;
}
button.quiet,
.button.quiet {
  background: transparent;
}
button[aria-pressed="true"] {
  border-color: var(--accent);
  color: var(--accent);
}
:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}
.calculator-page .layout {
  display: block;
}
.calculator-page .sidebar {
  display: none;
}
.calculator-page main {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
}
.tool-breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--bg);
  padding: 10px 0;
  margin: -10px 0 22px;
  border-bottom: 1px solid var(--line);
}
.detail-panel .result-title {
  flex-wrap: wrap;
  align-items: flex-start;
}
.detail-panel .result-title > div {
  flex: 1 1 280px;
  min-width: 0;
}
.detail-panel .result-title > label {
  width: 290px;
  max-width: 100%;
}
.detail-y-title {
  color: var(--muted);
  margin: 12px 0 0;
}
.detail-chart {
  scroll-margin-top: 90px;
}
@media (max-width: 520px) {
  .detail-chart {
    scroll-margin-top: 145px;
  }
}
.detail-plot {
  width: 100%;
  min-width: 0;
  touch-action: pan-y;
}
.detail-plot svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}
.detail-plot svg text {
  font: 18px system-ui;
  fill: var(--muted);
}
.detail-plot .axis {
  stroke: var(--line);
}
.detail-plot .series {
  fill: none;
  stroke-width: 3;
  stroke-linejoin: round;
}
.detail-plot .zero-line {
  stroke: var(--green);
  stroke-width: 2;
  stroke-dasharray: 5 5;
}
.detail-plot .cursor-line {
  stroke: var(--muted);
  stroke-dasharray: 3 5;
  opacity: 0.8;
}
.chart-marker line {
  stroke-width: 2;
  stroke-dasharray: 7 5;
}
.detail-plot .chart-marker text {
  font-weight: 700;
}
.detail-readout {
  margin-top: 18px;
  border-top: 1px solid var(--line);
  padding-top: 15px;
}
.detail-readout .metrics {
  margin: 12px 0 18px;
}
.detail-readout .metric {
  padding: 14px;
}
.detail-readout .metric dd {
  font-size: 23px;
}
.detail-range {
  margin: 12px 0;
}
.detail-range input {
  padding: 0;
  accent-color: var(--accent);
}
.scenario-details {
  margin: 22px 0;
}
.scenario-details summary {
  cursor: pointer;
  color: var(--blue);
  padding: 12px 0;
}
.taproot-comparison {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
#related-result .table-wrap table {
  min-width: 900px;
}
#related-result td .code {
  white-space: nowrap;
}
.taproot-comparison .panel {
  padding: 18px;
  margin: 14px 0;
}
.taproot-schema {
  padding: 22px 0;
  text-align: center;
}
.tap-node {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  background: var(--surface2);
}
.tap-node.output {
  width: max-content;
  max-width: 100%;
  margin: 0 auto 22px;
  border-color: var(--blue);
}
.tap-branches {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  border-top: 2px solid var(--muted);
  padding-top: 18px;
}
.tap-node.internal {
  border-color: #aa80ec;
}
.tap-node.leaf {
  border-color: var(--accent);
}
.tap-node code {
  display: block;
  overflow-wrap: anywhere;
  font-size: 18px;
}
.rainbow-scale {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin: 15px 0;
  color: var(--muted);
}
.rainbow-scale i {
  display: block;
  flex: 1 1 140px;
  height: 16px;
  border-radius: 6px;
  background: linear-gradient(
    90deg,
    #db4747,
    #ef9b3f,
    #ead74f,
    #8ebf52,
    #409650
  );
}
.rainbow-plot svg .zero-line {
  stroke: var(--muted);
  stroke-dasharray: 4 6;
}
.rainbow-plot { position: relative; }
.rainbow-tooltip {
  position: absolute; z-index: 2; left: 50%; top: 10px; transform: translateX(-50%);
  width: min(490px, calc(100% - 16px)); padding: 12px;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface2); color: var(--text); box-shadow: var(--shadow);
  pointer-events: none; font-size: 17px; line-height: 1.3;
}
.rainbow-tooltip[hidden] { display: none; }
.rainbow-tooltip-date, .rainbow-tooltip-scenario { display: block; }
.rainbow-tooltip dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; margin: 10px 0; }
.rainbow-tooltip .metric { padding: 0; border: 0; background: none; min-width: 0; }
.rainbow-tooltip .metric dt { font-size: 17px; color: var(--muted); }
.rainbow-tooltip .metric dd { font-size: 18px; margin: 3px 0 0; overflow-wrap: anywhere; }
.rainbow-tooltip-scenario { color: var(--muted); }
@media (max-width: 480px) {
  .rainbow-tooltip { padding: 10px; }
  .rainbow-tooltip dl { gap: 8px 10px; }
  .rainbow-tooltip .metric:nth-child(n + 5) { display: none; }
}
@media (max-width: 800px) {
  .taproot-comparison {
    grid-template-columns: 1fr;
  }
}
input,
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  background: var(--bg);
  min-height: 46px;
}
textarea {
  min-height: 145px;
  resize: vertical;
  font-family: ui-monospace, monospace;
  font-size: 18px;
}
label {
  display: grid;
  gap: 5px;
  color: var(--muted);
}
small,
.small {
  font-size: 18px;
  color: var(--muted);
}
h1,
h2,
h3,
p {
  margin: 0 0 16px;
}
h1 {
  font-size: clamp(28px, 3.2vw, 43px);
  line-height: 1.2;
  letter-spacing: -0.03em;
}
h2 {
  font-size: 25px;
  line-height: 1.3;
}
h3 {
  font-size: 21px;
}
strong {
  font-weight: 750;
}
.topbar {
  min-height: 93px;
  padding: 16px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  text-decoration: none;
  font-size: 21px;
  letter-spacing: 0.04em;
  line-height: 1.2;
}
.brand b {
  color: var(--accent);
}
.brand small {
  display: block;
  font-size: 18px;
  letter-spacing: 0;
  margin-top: 6px;
  color: var(--muted);
}
.brand-icon {
  width: 46px;
  height: 46px;
  border: 1px solid var(--accent);
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-size: 35px;
  color: var(--accent);
}
.top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.top-actions label {
  display: flex;
  align-items: center;
  gap: 8px;
}
.top-actions select {
  width: auto;
}
.local-banner {
  padding: 10px 28px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  background: color-mix(in srgb, var(--accent) 5%, var(--bg));
}
.status-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  background: var(--accent);
  border-radius: 50%;
  margin-right: 8px;
}
.layout {
  display: grid;
  grid-template-columns: 285px minmax(0, 1fr);
  max-width: 1900px;
  margin: auto;
}
.sidebar {
  border-right: 1px solid var(--line);
  padding: 22px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
}
.role-controls {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin-bottom: 19px;
}
.role-controls button {
  padding: 7px 9px;
}
.search-label {
  margin-bottom: 5px;
}
#module-search {
  margin-bottom: 16px;
}
.nav-item {
  display: flex;
  gap: 10px;
  align-items: center;
  color: var(--muted);
  text-decoration: none;
  border-radius: 7px;
  padding: 11px 9px;
  margin-bottom: 5px;
  border: 1px solid transparent;
}
.nav-item.active {
  color: var(--accent);
  border-color: var(--line);
  background: var(--surface2);
}
.nav-number {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  min-width: 24px;
}
.sidebar-footer {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 10px;
  color: var(--muted);
}
#data-tools {
  margin-top: 20px;
  color: var(--muted);
}
#data-tools summary {
  cursor: pointer;
  padding: 8px 0;
}
main {
  padding: 32px 34px 60px;
  min-width: 0;
  max-width: 1500px;
}
.eyebrow {
  color: var(--accent);
  font-weight: 750;
  letter-spacing: 0.1em;
  margin-bottom: 9px;
}
.lead {
  max-width: 1000px;
  color: var(--muted);
  font-size: 20px;
}
.hero {
  position: relative;
  background: linear-gradient(
    125deg,
    var(--surface),
    color-mix(in srgb, var(--accent) 8%, var(--surface))
  );
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 32px;
  margin-bottom: 24px;
  overflow: hidden;
}
.hero:after {
  content: "";
  position: absolute;
  right: -50px;
  top: -90px;
  width: 300px;
  height: 300px;
  border: 1px solid color-mix(in srgb, var(--accent) 18%, transparent);
  border-radius: 50%;
  pointer-events: none;
}
.hero p {
  max-width: 920px;
}
.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 20px;
}
.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
.module-card {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 9px;
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--shadow);
}
.module-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}
.module-card h2 {
  font-size: 22px;
  margin: 0;
}
.module-card p {
  color: var(--muted);
  margin: 0;
  flex: 1;
}
.card-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--accent);
}
.badge {
  max-width: 100%;
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 40px;
  padding: 3px 10px;
  font-size: 18px;
  color: var(--muted);
}
.badge.green {
  color: var(--green);
}
.badge.red {
  color: var(--red);
}
.panel {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 24px;
  background: var(--surface);
  margin: 20px 0;
  min-width: 0;
}
.panel.highlight {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
}
.forms {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 17px;
}
.forms .wide {
  grid-column: 1/-1;
}
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 13px;
  margin: 20px 0;
}
.metric {
  padding: 19px;
  background: var(--surface2);
  border: 1px solid var(--line);
  border-radius: 9px;
  min-width: 0;
}
.metric dt {
  color: var(--muted);
  margin-bottom: 7px;
}
.metric dd {
  font-size: 27px;
  font-weight: 780;
  line-height: 1.25;
  margin: 0;
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}
.metric small {
  display: block;
  margin-top: 7px;
}
.positive {
  color: var(--green);
}
.negative {
  color: var(--red);
}
.accent {
  color: var(--accent);
}
.note {
  padding: 13px 16px;
  border-left: 3px solid var(--blue);
  background: color-mix(in srgb, var(--blue) 6%, var(--surface));
  margin: 18px 0;
  color: var(--muted);
}
.note.warning {
  border-color: var(--accent);
}
.note.danger {
  border-color: var(--red);
  color: var(--red);
}
.error {
  border: 1px solid var(--red);
  color: var(--red);
  background: var(--surface);
  padding: 16px;
  border-radius: 8px;
  margin: 16px 0;
}
.table-wrap {
  max-width: 100%;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-top: 15px;
}
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 18px;
}
th,
td {
  padding: 12px 13px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
th {
  color: var(--muted);
  background: var(--surface2);
  font-weight: 600;
}
td.number,
th.number {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
tbody tr:last-child td {
  border-bottom: 0;
}
tr.selected {
  background: color-mix(in srgb, var(--accent) 9%, var(--surface));
}
.chart {
  min-height: 260px;
  width: 100%;
  margin: 15px 0 8px;
  overflow: hidden;
}
.chart svg {
  display: block;
  width: 100%;
  height: 280px;
  overflow: visible;
}
.chart svg text {
  fill: var(--muted);
  font: 18px system-ui;
}
.chart svg .axis {
  stroke: var(--line);
}
.chart svg .series {
  fill: none;
  stroke-width: 3;
}
.chart-legend {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
  color: var(--muted);
}
.chart-legend i {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-right: 7px;
}
.stack {
  height: 16px;
  display: flex;
  min-width: 120px;
  background: var(--surface2);
  border-radius: 3px;
  overflow: hidden;
}
.stack span {
  display: block;
  height: 100%;
}
.tools {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 15px 0;
}
.review {
  margin-top: 30px;
  border-top: 1px solid var(--line);
  padding-top: 22px;
}
.review-head {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.review-head h2 {
  margin: 0;
}
.review select {
  width: auto;
  max-width: 100%;
}
.review textarea {
  font: inherit;
  min-height: 80px;
}
.review small {
  display: block;
  margin-top: 9px;
}
.empty {
  color: var(--muted);
  padding: 28px;
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: 9px;
}
.timeline {
  border-left: 2px solid var(--line);
  padding-left: 22px;
  margin-left: 8px;
}
.timeline article {
  position: relative;
  margin: 20px 0;
  padding: 15px;
  background: var(--surface2);
  border-radius: 7px;
  overflow-wrap: anywhere;
}
.timeline article:before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  position: absolute;
  left: -28px;
  top: 25px;
}
.timeline article p {
  margin: 5px 0;
}
.code {
  font-family: ui-monospace, monospace;
  overflow-wrap: anywhere;
}
.watch-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.scenario-list {
  display: grid;
  gap: 9px;
}
.scenario-item {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.scenario-item span {
  flex: 1;
}
.digest-card {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface2);
  margin: 12px 0;
}
.digest-card p {
  margin: 9px 0 0;
}
.key-value {
  display: grid;
  grid-template-columns: minmax(170px, 1fr) 2fr;
  gap: 12px;
  margin: 15px 0;
}
.key-value dt {
  color: var(--muted);
}
.key-value dd {
  margin: 0;
  overflow-wrap: anywhere;
}
.nowrap {
  white-space: nowrap;
}
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface2);
  border: 1px solid var(--accent);
  padding: 14px 20px;
  border-radius: 8px;
  z-index: 30;
  max-width: 90vw;
  box-shadow: var(--shadow);
}
.skip {
  position: absolute;
  left: 15px;
  top: -100px;
  z-index: 99;
  padding: 12px;
  background: var(--surface);
}
.skip:focus {
  top: 10px;
}
footer {
  padding: 24px 30px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  max-width: 1900px;
  margin: auto;
}
.muted {
  color: var(--muted);
}
.hidden,
[hidden] {
  display: none !important;
}
.result-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.loading {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 24px;
  color: var(--muted);
}
.loading:before {
  content: "";
  height: 20px;
  width: 20px;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
@media (max-width: 1200px) {
  .layout {
    grid-template-columns: 250px minmax(0, 1fr);
  }
  main {
    padding: 25px;
  }
  .grid,
  .forms {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .topbar {
    align-items: flex-start;
  }
  .top-actions {
    justify-content: flex-end;
  }
  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 800px) {
  .brand small,
  .desktop-privacy {
    display: none;
  }
  .brand-icon {
    width: 36px;
    height: 36px;
    font-size: 28px;
  }
  .top-actions {
    flex-wrap: nowrap;
  }
  .top-actions button,
  .top-actions .button {
    padding: 8px 10px;
  }
  .top-actions select {
    padding: 8px;
  }
  .topbar {
    padding: 15px;
    display: block;
  }
  .top-actions {
    justify-content: flex-start;
    margin-top: 16px;
  }
  .local-banner {
    padding: 12px 15px;
  }
  .layout {
    display: block;
  }
  .sidebar {
    position: static;
    height: auto;
    padding: 15px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .role-controls {
    margin-bottom: 12px;
  }
  .search-label,
  #module-search {
    display: none;
  }
  #navigation {
    display: flex;
    overflow: auto;
    gap: 6px;
    padding-bottom: 6px;
  }
  .nav-item {
    white-space: nowrap;
    margin: 0;
    padding: 9px 12px;
    border-color: var(--line);
  }
  .sidebar-footer {
    margin: 10px 0 0;
    padding-top: 12px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
  }
  .sidebar-footer #data-status {
    flex-basis: 100%;
  }
  main {
    padding: 22px 15px 35px;
  }
  .hero {
    padding: 22px;
  }
  .grid {
    grid-template-columns: 1fr 1fr;
  }
  .forms,
  .two-col {
    grid-template-columns: 1fr 1fr;
  }
  .panel {
    padding: 18px;
  }
  .metrics {
    grid-template-columns: 1fr 1fr;
  }
  .metric {
    padding: 14px;
  }
  .metric dd {
    font-size: 24px;
  }
  .review-head {
    display: block;
  }
  .review select {
    width: 100%;
    margin-top: 10px;
  }
  .key-value {
    grid-template-columns: 1fr;
  }
  .key-value dd {
    margin-bottom: 10px;
  }
  .chart {
    margin-left: 0;
    margin-right: 0;
  }
  .brand small {
    font-size: 18px;
  }
}
@media (max-width: 520px) {
  .top-actions {
    flex-wrap: wrap;
  }
  .grid,
  .forms,
  .two-col,
  .metrics {
    grid-template-columns: 1fr;
  }
  .top-actions .button {
    width: auto;
  }
  .top-actions {
    gap: 8px;
  }
  .hero-actions > * {
    width: 100%;
  }
  .module-card {
    padding: 19px;
  }
  .hero h1 {
    font-size: 30px;
  }
  th,
  td {
    padding: 10px;
  }
  .watch-item {
    align-items: flex-start;
    flex-wrap: wrap;
  }
  .chart-legend {
    gap: 7px 12px;
  }
  footer {
    padding: 20px 15px;
  }
}
