* {
  box-sizing: border-box;
}

:root {
  --edge: clamp(14px, 5.4vw, 30px);
  --panel-gap: clamp(18px, 5vw, 26px);
  --deep-teal: #164e59;
  --text: #20373a;
  --muted: #819ca1;
  --divider: rgba(255, 255, 255, 0.72);
}

html {
  min-height: 100%;
  background: #f6f9fb;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 7% 0%, rgba(77, 144, 234, 0.34), transparent 28%),
    linear-gradient(90deg, #5e86e8 0%, #7a48b1 100%);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", Arial, sans-serif;
}

button,
input {
  font: inherit;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.phone-shell {
  width: min(100vw, 480px);
  min-height: 100vh;
  margin: 0 auto;
  padding-bottom: max(18px, env(safe-area-inset-bottom));
  background:
    linear-gradient(90deg, #5e86e8 0%, #7a48b1 100%) top / 100% 47px no-repeat,
    #ffffff;
  box-shadow: 0 0 0 1px rgba(55, 30, 115, 0.26), 0 18px 50px rgba(28, 21, 72, 0.28);
}

.top-bar {
  position: relative;
  min-height: max(47px, calc(47px + env(safe-area-inset-top)));
  padding: max(3px, env(safe-area-inset-top)) 12px 0;
  color: #ffffff;
  font-size: clamp(12px, 3.1vw, 15px);
  line-height: 1.2;
  text-align: center;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.18);
}

.stealth-button {
  position: absolute;
  top: max(7px, calc(env(safe-area-inset-top) + 6px));
  right: 9px;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
  box-shadow: 0 1px 4px rgba(34, 20, 82, 0.18);
  opacity: 0.72;
  cursor: pointer;
}

.stealth-button:focus-visible {
  outline: 1px solid rgba(255, 255, 255, 0.65);
  opacity: 0.6;
}

.query-panel {
  padding: 34px var(--edge) 0;
  background: #ffffff;
}

.query-form {
  display: grid;
  gap: 18px;
}

.editor-form {
  display: grid;
  gap: 13px;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 11px;
}

.field {
  display: grid;
  gap: 10px;
  color: #2d383b;
  font-size: clamp(14px, 3.9vw, 17px);
}

.field input {
  width: 100%;
  height: clamp(48px, 12vw, 56px);
  padding: 0 14px;
  color: #111617;
  background: #ffffff;
  border: 1px solid #d6d6d6;
  border-radius: 10px;
  outline: none;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.07);
}

.field input:focus {
  border-color: #765bdd;
  box-shadow: 0 0 0 3px rgba(118, 91, 221, 0.16), inset 0 1px 3px rgba(0, 0, 0, 0.05);
}

.compact-field {
  gap: 7px;
  font-size: clamp(12px, 3.4vw, 14px);
}

.compact-field input {
  height: clamp(38px, 10.4vw, 45px);
  padding-inline: 10px;
  font-size: clamp(12px, 3.4vw, 14px);
}

.button-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: stretch;
}

.submit-button {
  width: 100%;
  min-height: clamp(52px, 12.8vw, 59px);
  margin-top: 2px;
  color: #ffffff;
  font-size: clamp(16px, 4.2vw, 19px);
  font-weight: 800;
  letter-spacing: 0.02em;
  border: 0;
  border-radius: 10px;
  background: linear-gradient(90deg, #5f88ee 0%, #7940b1 100%);
  box-shadow: 0 9px 16px rgba(102, 91, 203, 0.18);
  cursor: pointer;
}

.submit-button:active {
  filter: brightness(0.96);
}

.reset-button {
  min-height: 42px;
  padding: 0 14px;
  color: #654aa4;
  font-size: clamp(13px, 3.5vw, 15px);
  font-weight: 800;
  border: 1px solid rgba(117, 74, 178, 0.28);
  border-radius: 10px;
  background: #ffffff;
  cursor: pointer;
}

.editor-panel {
  margin-top: 16px;
  padding: 12px;
  border: 1px solid rgba(118, 91, 221, 0.16);
  border-radius: 12px;
  background: #f8f7ff;
}

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

.editor-head p {
  margin: 0;
  color: #26393d;
  font-size: clamp(13px, 3.5vw, 15px);
  font-weight: 800;
}

.editor-head button {
  min-height: 30px;
  padding: 0 10px;
  color: #654aa4;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid rgba(117, 74, 178, 0.22);
  border-radius: 8px;
  background: #ffffff;
  cursor: pointer;
}

.form-tip {
  min-height: 18px;
  margin: -8px 0 0;
  color: #c2410c;
  font-size: clamp(12px, 3.2vw, 14px);
}

.result-card {
  margin-top: var(--panel-gap);
  padding: clamp(14px, 4vw, 18px) clamp(14px, 4.2vw, 18px) 18px;
  overflow: hidden;
  border: 1px solid rgba(187, 238, 238, 0.8);
  border-radius: 10px;
  background:
    linear-gradient(rgba(206, 244, 244, 0.92), rgba(206, 244, 244, 0.92)),
    repeating-linear-gradient(0deg, transparent 0 11px, rgba(255, 255, 255, 0.16) 11px 12px),
    repeating-linear-gradient(90deg, transparent 0 11px, rgba(255, 255, 255, 0.12) 11px 12px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.status-list {
  margin: 0;
}

.status-row {
  display: grid;
  grid-template-columns: minmax(74px, 33%) minmax(0, 1fr);
  min-height: clamp(38px, 9.8vw, 45px);
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--divider);
}

.status-row dt,
.status-row dd {
  margin: 0;
  min-width: 0;
  font-size: clamp(12px, 3.3vw, 15px);
}

.status-row dt {
  color: #789ca2;
}

.status-row dd {
  color: var(--deep-teal);
  text-align: right;
  overflow-wrap: anywhere;
}

.status-row .strong {
  font-weight: 800;
}

.status-row .success {
  color: #238f4f;
}

.status-row .danger {
  color: #c2410c;
}

.trade-section {
  padding-top: clamp(22px, 5.6vw, 27px);
}

.trade-section h2 {
  margin: 0 0 9px;
  color: #223539;
  font-size: clamp(13px, 3.6vw, 16px);
  font-weight: 800;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  scrollbar-width: thin;
}

table {
  width: 100%;
  min-width: 326px;
  border-collapse: collapse;
  table-layout: fixed;
  background: rgba(214, 246, 246, 0.42);
}

th,
td {
  height: clamp(31px, 8vw, 36px);
  padding: 5px 7px;
  border: 1px solid rgba(255, 255, 255, 0.92);
  color: var(--deep-teal);
  font-size: clamp(10px, 2.9vw, 13px);
  text-align: center;
  white-space: nowrap;
}

th {
  background: rgba(255, 255, 255, 0.88);
  font-weight: 800;
}

td.amount {
  color: #d35260;
}

@media (max-width: 360px) {
  :root {
    --edge: 12px;
  }

  .query-panel {
    padding-top: 28px;
  }

  .status-row {
    grid-template-columns: 70px minmax(0, 1fr);
  }

  .result-card {
    padding-inline: 12px;
  }

  th,
  td {
    padding-inline: 5px;
  }

  .field-grid,
  .button-row {
    grid-template-columns: 1fr;
  }

  .reset-button {
    min-height: 42px;
  }
}

@media (min-width: 481px) {
  body {
    padding: 0 18px;
  }

  .phone-shell {
    min-height: 100svh;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
