:root {
  color: #172033;
  background: #f3f6fb;
  font-family:
    Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  font-synthesis: none;
  --blue: #1677ff;
  --blue-dark: #0958d9;
  --red: #ff4d4f;
  --green: #28c76f;
  --border: #e5eaf2;
  --muted: #7c879d;
  --panel: #ffffff;
  --shadow: 0 12px 34px rgba(33, 52, 88, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 8% 0%, rgba(22, 119, 255, 0.09), transparent 29rem),
    #f3f6fb;
}

button,
input,
select,
textarea {
  font: inherit;
}

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

.hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  margin-bottom: 18px;
}

.eyebrow,
.section-kicker {
  margin: 0 0 8px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.16em;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 10px;
  font-size: clamp(28px, 3vw, 42px);
  line-height: 1.12;
  letter-spacing: -0.035em;
}

h2 {
  margin-bottom: 0;
  font-size: 20px;
}

.hero-copy {
  margin-bottom: 0;
  color: #6e7890;
  font-size: 15px;
}

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

.status-pill,
.runtime-pill {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 9px;
  min-width: 112px;
  padding: 11px 15px;
  border: 1px solid #dce3ed;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  color: #69758c;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 7px 21px rgba(39, 57, 91, 0.05);
}

.runtime-pill {
  min-width: auto;
  border-color: #d9e1ed;
  color: #778297;
}

.runtime-pill[data-mode="dry"] {
  border-color: #ffe0a3;
  color: #a66200;
  background: #fff8e8;
}

.runtime-pill[data-mode="live"] {
  border-color: #ffccc7;
  color: #c53032;
  background: #fff1f0;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #a5afbf;
}

.status-pill[data-state="running"] {
  border-color: rgba(40, 199, 111, 0.25);
  color: #138a49;
  background: #effcf5;
}

.status-pill[data-state="running"] .status-dot {
  background: var(--green);
  box-shadow: 0 0 0 5px rgba(40, 199, 111, 0.12);
  animation: pulse 1.6s infinite;
}

.status-pill[data-state="stopping"] {
  color: #b26a00;
  background: #fff8e8;
}

.status-pill[data-state="stopping"] .status-dot {
  background: #faad14;
}

.card {
  overflow: hidden;
  border: 1px solid rgba(222, 229, 239, 0.9);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.parameter-card {
  margin-bottom: 20px;
}

.section-heading,
.output-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
}

.security-note {
  margin-bottom: 0;
  padding: 9px 12px;
  border: 1px solid #d9f2e4;
  border-radius: 9px;
  color: #257b4b;
  background: #f3fcf7;
  font-size: 13px;
  font-weight: 600;
}

form {
  padding: 22px 24px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  grid-template-areas:
    "rpc rpc auth target target target"
    "keys keys keys cap interval value";
  gap: 18px 20px;
}

.field {
  display: flex;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  flex-direction: column;
  gap: 9px;
}

.rpc-field {
  grid-area: rpc;
}

.access-code-field {
  grid-area: auth;
}

.private-keys-field {
  grid-area: keys;
}

.market-field {
  grid-area: cap;
}

.interval-field {
  grid-area: interval;
}

.value-field {
  grid-area: value;
}

.field > span,
.field legend {
  color: #2b3447;
  font-size: 14px;
  font-weight: 750;
}

.field em {
  margin-left: 5px;
  color: #8993a5;
  font-size: 12px;
  font-style: normal;
  font-weight: 600;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #dbe2ec;
  border-radius: 9px;
  outline: none;
  color: #1d2739;
  background: #fbfcfe;
  transition:
    border-color 150ms ease,
    box-shadow 150ms ease,
    background-color 150ms ease;
}

input,
select {
  height: 48px;
  padding: 0 14px;
}

textarea {
  min-height: 64px;
  height: 64px;
  padding: 14px;
  resize: vertical;
  line-height: 1.65;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(22, 119, 255, 0.1);
}

input:disabled,
select:disabled,
textarea:disabled {
  cursor: not-allowed;
  color: #8b95a7;
  background: #f0f2f5;
}

.rpc-control {
  display: flex;
  gap: 8px;
}

.rpc-control select {
  flex: 0 0 132px;
  padding-right: 8px;
}

.rpc-control input {
  min-width: 0;
  flex: 1 1 auto;
}

.rpc-control input[hidden] {
  display: none;
}

.secret-input {
  -webkit-text-security: disc;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  letter-spacing: 0.05em;
}

.private-keys-control {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 8px;
}

.wallet-preview {
  display: flex;
  height: 38px;
  min-width: 0;
  gap: 7px;
  overflow-x: auto;
  overflow-y: hidden;
  color: #566278;
  font: 12px/1.4 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  scrollbar-color: #b7c0ce #eef1f5;
}

.wallet-preview-empty {
  display: flex;
  width: 100%;
  height: 100%;
  padding: 0 13px;
  align-items: center;
  border: 1px dashed #dbe2ec;
  border-radius: 9px;
  color: #9aa3b2;
  background: #fafbfd;
}

.wallet-preview-row {
  display: inline-flex;
  height: 36px;
  flex: 0 0 auto;
  gap: 9px;
  align-items: center;
  padding: 0 7px 0 6px;
  border: 1px solid #dce6f3;
  border-radius: 9px;
  background: linear-gradient(180deg, #fff, #f7faff);
  box-shadow: 0 2px 7px rgba(44, 60, 91, 0.06);
}

.wallet-preview-index {
  padding: 4px 7px;
  border-radius: 6px;
  color: #1677ff;
  background: #eaf3ff;
  font: 700 11px/1.2 system-ui, sans-serif;
  font-weight: 800;
  white-space: nowrap;
}

.wallet-preview-address {
  color: #3f4c62;
  user-select: all;
}

.wallet-copy-button {
  height: 24px;
  padding: 0 7px;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  color: #5f6f86;
  background: #edf1f6;
  font: 700 11px/1 system-ui, sans-serif;
  white-space: nowrap;
}

.wallet-copy-button:hover {
  color: #1677ff;
  background: #e6f1ff;
}

.wallet-preview-row[data-valid="false"] .wallet-preview-address {
  color: #d45757;
}

.field small {
  min-height: 18px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.target-field {
  grid-area: target;
}

.target-row {
  display: flex;
  gap: 10px;
}

.radio-group {
  display: inline-flex;
  flex: 0 0 auto;
  height: 48px;
  padding: 4px;
  border: 1px solid #dbe2ec;
  border-radius: 9px;
  background: #f4f6f9;
}

.radio-group label {
  position: relative;
  display: flex;
  cursor: pointer;
  align-items: center;
}

.radio-group input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.radio-group span {
  display: grid;
  min-width: 55px;
  height: 38px;
  padding: 0 12px;
  border-radius: 7px;
  color: #7b8597;
  font-size: 13px;
  font-weight: 700;
  place-items: center;
  transition: 150ms ease;
}

.radio-group input:checked + span {
  color: var(--blue);
  background: white;
  box-shadow: 0 2px 7px rgba(44, 60, 91, 0.12);
}

.radio-group input:disabled + span {
  cursor: not-allowed;
  opacity: 0.55;
}

.action-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.button {
  min-width: 124px;
  height: 44px;
  padding: 0 22px;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 750;
  transition:
    transform 120ms ease,
    box-shadow 120ms ease,
    opacity 120ms ease;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
}

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

.button-primary,
.button-secondary {
  color: white;
  background: var(--blue);
  box-shadow: 0 7px 18px rgba(22, 119, 255, 0.2);
}

.button-primary:hover:not(:disabled),
.button-secondary:hover:not(:disabled) {
  background: var(--blue-dark);
}

.button-danger {
  color: white;
  background: var(--red);
  box-shadow: 0 7px 18px rgba(255, 77, 79, 0.18);
}

.button-ghost {
  border-color: #dbe2ec;
  color: #58657b;
  background: white;
}

.output-heading {
  padding-top: 20px;
  padding-bottom: 20px;
}

.output-heading > span {
  color: #8a95a8;
  font-size: 13px;
  font-weight: 700;
}

.terminal {
  min-height: 320px;
  max-height: 560px;
  overflow: auto;
  padding: 22px 24px;
  color: #c8d2e4;
  background:
    linear-gradient(rgba(255, 255, 255, 0.015) 1px, transparent 1px),
    #080b11;
  background-size: 100% 29px;
  font: 13px/1.75 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
    monospace;
  scrollbar-color: #485064 #141923;
}

.terminal-empty {
  display: grid;
  min-height: 270px;
  color: #5f6b80;
  text-align: center;
  place-content: center;
}

.terminal-empty span {
  color: #3e92ff;
  font-size: 30px;
  font-weight: 800;
}

.terminal-empty p {
  margin: 10px 0 0;
}

.log-line {
  display: grid;
  grid-template-columns: 185px 64px 1fr;
  gap: 12px;
  padding: 3px 0;
  overflow-wrap: anywhere;
}

.log-time {
  color: #78859a;
}

.log-level {
  font-weight: 800;
}

.log-line[data-level="info"] .log-level {
  color: #62a7ff;
}

.log-line[data-level="success"] .log-level {
  color: #55d98b;
}

.log-line[data-level="warn"] .log-level {
  color: #f3bb4d;
}

.log-line[data-level="error"] .log-level {
  color: #ff7072;
}

.log-line[data-level="success"] .log-message {
  color: #71e39c;
}

.log-line[data-level="error"] .log-message {
  color: #ff8e90;
}

@keyframes pulse {
  0%,
  100% {
    box-shadow: 0 0 0 4px rgba(40, 199, 111, 0.1);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(40, 199, 111, 0);
  }
}

@media (max-width: 900px) {
  .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas:
      "rpc auth"
      "target target"
      "keys keys"
      "cap interval"
      "value value";
  }
}

@media (max-width: 660px) {
  .page-shell {
    width: min(100% - 24px, 1440px);
    padding: 24px 0 36px;
  }

  .hero,
  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .status-cluster {
    flex-wrap: wrap;
  }

  .form-grid {
    grid-template-columns: 1fr;
    grid-template-areas:
      "rpc"
      "auth"
      "keys"
      "target"
      "cap"
      "interval"
      "value";
  }

  form,
  .section-heading,
  .output-heading {
    padding-right: 18px;
    padding-left: 18px;
  }

  .target-row {
    flex-direction: column;
  }

  .radio-group {
    align-self: flex-start;
  }

  .action-bar {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .button {
    width: 100%;
    min-width: 0;
  }

  .terminal {
    padding: 18px;
  }

  .log-line {
    grid-template-columns: 1fr;
    gap: 0;
    margin-bottom: 12px;
  }
}
