/* ==========================================================================
   Subnet Bridge — playground front end.
   Phone-first: every layout rule below starts at the narrow case and widens
   at min-width. No framework, no build step, no webfont (an external font
   request on a page whose whole point is "check what you are talking to"
   would be a poor look, and system stacks render instantly).
   ========================================================================== */

:root {
  --bg:        #0a0b0f;
  --bg-2:      #0d0f14;
  --surface:   #12151c;
  --surface-2: #171b24;
  --line:      #232833;
  --line-soft: #1b202a;

  --text:      #e6e9ef;
  --text-dim:  #98a0b0;
  --text-mute: #6b7385;

  /* One accent. Teal reads as "instrument", not as "token launch". */
  --accent:      #5eead4;
  --accent-dim:  #2dd4bf;
  --accent-ink:  #04231f;

  /* Amber is reserved exclusively for the simulated/warning channel, so its
     appearance always means the same thing. */
  --warn:      #fbbf24;
  --warn-bg:   rgba(251, 191, 36, .08);
  --warn-line: rgba(251, 191, 36, .28);

  --ok:        #4ade80;
  --bad:       #f87171;

  --radius:    14px;
  --radius-sm: 9px;

  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  /* A single very soft wash keeps the page from reading as a flat black slab
     without adding a decorative element that competes with the data. */
  background-image:
    radial-gradient(90rem 40rem at 50% -20rem, rgba(94, 234, 212, .05), transparent 70%);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  width: 100%;
  max-width: 940px;
  margin-inline: auto;
  padding-inline: 16px;
}
@media (min-width: 700px) { .wrap { padding-inline: 24px; } }

.mono { font-family: var(--mono); font-size: .92em; font-variant-numeric: tabular-nums; }
.break { word-break: break-all; }

/* --------------------------------------------------------------------------
   Simulated banner
   -------------------------------------------------------------------------- */
.sim-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px;
  padding: 9px 16px;
  background: var(--warn-bg);
  border-bottom: 1px solid var(--warn-line);
  color: var(--warn);
  font-size: 13px;
  line-height: 1.45;
}
.sim-banner strong { color: var(--warn); letter-spacing: .01em; }
.sim-banner span:not(.sim-dot) { color: #d9c48a; }
.sim-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--warn);
  flex: 0 0 auto;
  align-self: center;
  box-shadow: 0 0 0 3px rgba(251, 191, 36, .16);
}

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */
.site-head {
  border-bottom: 1px solid var(--line-soft);
  background: rgba(10, 11, 15, .82);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 20;
}
.head-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-block: 12px;
}
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.brand-mark { width: 30px; height: 30px; color: var(--accent); flex: 0 0 auto; }
.brand-name {
  font-weight: 620;
  font-size: 16px;
  letter-spacing: -.01em;
  line-height: 1.2;
}
.brand-sub {
  font-size: 11.5px;
  color: var(--text-mute);
  letter-spacing: .02em;
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */
.btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 520;
  padding: 10px 15px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .14s ease, border-color .14s ease, opacity .14s ease;
  /* 44px min touch target on phones. */
  min-height: 42px;
  white-space: nowrap;
}
.btn:hover:not(:disabled) { background: #1e232e; border-color: #2e3644; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  font-weight: 620;
}
.btn-primary:hover:not(:disabled) { background: #79f2dd; border-color: #79f2dd; }

.btn-ghost { background: transparent; }
.btn-small { font-size: 13px; padding: 7px 11px; min-height: 34px; }
.btn-connect { flex: 0 0 auto; }

.btn-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.btn-row .btn { flex: 1 1 auto; }
@media (min-width: 560px) { .btn-row .btn { flex: 0 0 auto; } }

/* --------------------------------------------------------------------------
   Status strip
   -------------------------------------------------------------------------- */
.status-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  margin-top: 16px;
  background: var(--line-soft);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  overflow: hidden;
}
@media (min-width: 640px) { .status-strip { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.stat { background: var(--bg-2); padding: 11px 14px; min-width: 0; }
.stat-label {
  display: block;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-mute);
  margin-bottom: 3px;
}
.stat-value {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 14px;
  font-weight: 550;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dot { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 auto; }
.dot-ok   { background: var(--ok);   box-shadow: 0 0 0 3px rgba(74, 222, 128, .15); }
.dot-bad  { background: var(--bad);  box-shadow: 0 0 0 3px rgba(248, 113, 113, .15); }
.dot-idle { background: var(--text-mute); }

/* --------------------------------------------------------------------------
   Cards
   -------------------------------------------------------------------------- */
main { padding-block: 22px 40px; display: flex; flex-direction: column; gap: 18px; }

.card {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 18px 16px;
}
@media (min-width: 700px) { .card { padding: 22px 24px; } }

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.card h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 620;
  letter-spacing: .01em;
  color: var(--text);
}

.pill {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: 4px 9px;
  border-radius: 100px;
  border: 1px solid var(--line);
  color: var(--text-dim);
  white-space: nowrap;
}
.pill-sim  { color: var(--warn); border-color: var(--warn-line); background: var(--warn-bg); }
.pill-real { color: var(--accent); border-color: rgba(94, 234, 212, .3); background: rgba(94, 234, 212, .07); }
.pill-ok   { color: var(--ok); border-color: rgba(74, 222, 128, .3); background: rgba(74, 222, 128, .07); }

.lede { margin: 0 0 14px; color: var(--text-dim); font-size: 14px; }
.lede strong, .lede em { color: var(--text); }

.note {
  margin: 12px 0 0;
  font-size: 12.5px;
  color: var(--text-mute);
  line-height: 1.5;
}
.note strong { color: var(--text-dim); }

/* Callouts ---------------------------------------------------------------- */
.callout {
  border: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-dim);
  margin-bottom: 14px;
}
.callout strong { color: var(--text); }
.callout-warn {
  border-color: var(--warn-line);
  background: var(--warn-bg);
  color: #cbb787;
}
.callout-warn strong { color: var(--warn); }
.callout-warn em { color: #e2cf9d; font-style: normal; font-weight: 560; }

/* Key/value list ---------------------------------------------------------- */
.kv { display: flex; flex-direction: column; gap: 1px; background: var(--line-soft);
      border: 1px solid var(--line-soft); border-radius: var(--radius-sm); overflow: hidden; }
.kv > div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 14px;
  padding: 9px 13px;
  background: var(--bg-2);
  font-size: 13px;
}
.kv > div > span:first-child { color: var(--text-mute); flex: 0 0 auto; }
.kv > div > span:last-child  { color: var(--text); text-align: right; min-width: 0; }

/* --------------------------------------------------------------------------
   Balances
   -------------------------------------------------------------------------- */
.bal-eth {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 12px 14px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  background: var(--bg-2);
  margin-bottom: 14px;
}
.bal-eth-label { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--text-mute); margin-right: auto; }
.bal-eth-value { font-size: 20px; font-weight: 620; }
.bal-eth-unit  { font-size: 12px; color: var(--text-mute); }

.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin-inline: -16px; padding-inline: 16px; }
@media (min-width: 700px) { .table-scroll { margin-inline: 0; padding-inline: 0; } }

.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 520px; }
.tbl th {
  text-align: left;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-mute);
  font-weight: 600;
  padding: 0 10px 8px;
  border-bottom: 1px solid var(--line-soft);
  white-space: nowrap;
}
.tbl td {
  padding: 11px 10px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: baseline;
}
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl .num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl th.num { text-align: right; }
.tbl .empty { text-align: center; color: var(--text-mute); padding: 22px 10px; font-style: italic; }

.tok { display: flex; flex-direction: column; gap: 1px; }
.tok-sym { font-weight: 620; letter-spacing: -.005em; }
.tok-net { font-size: 11px; color: var(--text-mute); }
.bal-strong { color: var(--text); font-weight: 600; }
.bal-zero { color: var(--text-mute); }

.tag { font-size: 10.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
       padding: 3px 7px; border-radius: 5px; white-space: nowrap; }
.tag-fresh { color: var(--ok);   background: rgba(74, 222, 128, .1);  border: 1px solid rgba(74, 222, 128, .25); }
.tag-stale { color: var(--warn); background: var(--warn-bg);          border: 1px solid var(--warn-line); }

/* --------------------------------------------------------------------------
   Forms
   -------------------------------------------------------------------------- */
.form { display: grid; grid-template-columns: 1fr; gap: 12px; align-items: end; }
@media (min-width: 620px) {
  .form { grid-template-columns: 1.3fr 1fr auto; }
  .field-wide { grid-column: 1 / -1; }
}

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-mute);
  font-weight: 600;
}
.field input, .field select {
  appearance: none;
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 11px 12px;
  font: inherit;
  font-size: 15px; /* >=16px avoids iOS zoom-on-focus; 15 + no zoom via viewport is fine */
  font-family: var(--mono);
  min-height: 42px;
}
.field select {
  font-family: var(--sans);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5' stroke='%236b7385' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  background-size: 12px;
  padding-right: 32px;
}
.field input:focus, .field select:focus {
  outline: none;
  border-color: var(--accent-dim);
  box-shadow: 0 0 0 3px rgba(94, 234, 212, .12);
}
.form .btn { min-height: 42px; }
@media (max-width: 619px) { .form .btn { width: 100%; } }

/* --------------------------------------------------------------------------
   Results
   -------------------------------------------------------------------------- */
.result {
  margin-top: 14px;
  border: 1px solid var(--line);
  background: var(--bg-2);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 13px;
}
.result[data-kind="ok"]   { border-color: rgba(74, 222, 128, .3);  background: rgba(74, 222, 128, .05); }
.result[data-kind="err"]  { border-color: rgba(248, 113, 113, .3); background: rgba(248, 113, 113, .05); }
.result[data-kind="busy"] { border-color: var(--line); }
.result-title { font-weight: 620; margin-bottom: 7px; display: flex; align-items: center; gap: 8px; }
.result[data-kind="ok"]  .result-title { color: var(--ok); }
.result[data-kind="err"] .result-title { color: var(--bad); }
.result-rows { display: flex; flex-direction: column; gap: 4px; }
.result-row { display: flex; gap: 10px; justify-content: space-between; align-items: baseline; }
.result-row > span:first-child { color: var(--text-mute); font-size: 12px; flex: 0 0 auto; }
.result-row > span:last-child  { font-family: var(--mono); font-size: 12px; word-break: break-all; text-align: right; }

.spinner {
  width: 12px; height: 12px; flex: 0 0 auto;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } }

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */
.site-foot {
  border-top: 1px solid var(--line-soft);
  background: var(--bg-2);
  padding-block: 30px 44px;
}
.foot-h { font-size: 14px; font-weight: 620; margin: 0 0 16px; letter-spacing: .01em; }
.foot-grid { display: grid; grid-template-columns: 1fr; gap: 22px; }
@media (min-width: 720px) { .foot-grid { grid-template-columns: 1fr 1fr; gap: 32px; } }

.foot-col h3 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .09em;
  margin: 0 0 10px;
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--text-dim);
}
.tick  { color: var(--ok);   font-size: 13px; }
.cross { color: var(--warn); font-size: 13px; }
.foot-col ul { margin: 0; padding-left: 17px; display: flex; flex-direction: column; gap: 8px; }
.foot-col li { font-size: 12.5px; color: var(--text-mute); line-height: 1.5; }
.foot-col li strong { color: var(--text-dim); }
.foot-col .mono { color: var(--text-dim); }

.foot-note {
  margin: 26px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--line-soft);
  font-size: 12px;
  color: var(--text-mute);
  line-height: 1.55;
}
.foot-note strong { color: var(--text-dim); }
#foot-cfg { display: block; margin-top: 6px; font-size: 11px; color: #4d5464; }

/* --------------------------------------------------------------------------
   Toast
   -------------------------------------------------------------------------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 11px 16px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  box-shadow: 0 10px 34px rgba(0, 0, 0, .55);
  z-index: 60;
  max-width: calc(100vw - 32px);
  text-align: center;
}
.toast[data-kind="err"] { border-color: rgba(248, 113, 113, .4); }
.toast[data-kind="ok"]  { border-color: rgba(74, 222, 128, .4); }
