:root {
  --bg: #071018;
  --bg-2: #0c1824;
  --card: rgba(14, 28, 42, 0.88);
  --line: rgba(212, 175, 55, 0.22);
  --gold: #d4af37;
  --gold-2: #f0d78c;
  --teal: #2ee6a6;
  --rose: #ff6b88;
  --text: #eef3f8;
  --muted: #8ea0b5;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  --radius: 22px;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

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

html,
body {
  margin: 0;
  min-height: 100%;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: "IBM Plex Sans", "PingFang SC", "Noto Sans SC", sans-serif;
  overscroll-behavior: none;
  touch-action: pan-x pan-y;
}

body {
  min-height: -webkit-fill-available;
  background-image:
    radial-gradient(1200px 500px at 10% -10%, rgba(212, 175, 55, 0.16), transparent 55%),
    radial-gradient(800px 420px at 110% 8%, rgba(46, 230, 166, 0.12), transparent 50%),
    linear-gradient(180deg, #08131c 0%, #071018 40%, #081621 100%);
}

body::before {
  content: "";
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  height: env(safe-area-inset-top, 0px);
  background: #071018;
  z-index: 40;
  pointer-events: none;
}

.wrap {
  width: min(560px, 100%);
  margin: 0 auto;
  padding-top: calc(18px + env(safe-area-inset-top, 0px));
  padding-right: calc(16px + env(safe-area-inset-right, 0px));
  padding-bottom: calc(28px + env(safe-area-inset-bottom, 0px));
  padding-left: calc(16px + env(safe-area-inset-left, 0px));
}

@media (display-mode: standalone) {
  .install {
    display: none;
  }
}

.top {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.logo {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
}

.logo img {
  width: 100%;
  height: 100%;
  display: block;
}

.brand h1 {
  margin: 0;
  font-family: Sora, "IBM Plex Sans", sans-serif;
  font-size: 20px;
  letter-spacing: 0.02em;
}

.brand p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.section-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.switch button,
.chip {
  appearance: none;
  border: 1px solid transparent;
  background: #102232;
  color: var(--text);
  border-radius: 14px;
  min-height: 48px;
  cursor: pointer;
}

.switch button {
  font-family: Sora, sans-serif;
  font-weight: 600;
}

.switch button.is-active {
  background: linear-gradient(180deg, rgba(212, 175, 55, 0.2), rgba(212, 175, 55, 0.08));
  border-color: var(--gold);
  color: var(--gold-2);
}

#dir-buy.is-active {
  background: linear-gradient(180deg, rgba(46, 230, 166, 0.2), rgba(46, 230, 166, 0.08));
  border-color: var(--teal);
  color: var(--teal);
}

#dir-sell.is-active {
  background: linear-gradient(180deg, rgba(255, 107, 136, 0.22), rgba(255, 107, 136, 0.08));
  border-color: var(--rose);
  color: #ffd0d9;
}

.chips {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.chip {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  padding: 10px 12px;
  text-align: left;
}

.chip-name {
  font-weight: 650;
  font-size: 14px;
}

.chip-symbol {
  color: var(--muted);
  font-size: 11px;
  font-family: "IBM Plex Sans", monospace;
}

.chip.is-active {
  border-color: var(--gold);
  background: linear-gradient(180deg, rgba(212, 175, 55, 0.18), #13283a);
}

.field {
  margin-bottom: 12px;
}

.field:last-child {
  margin-bottom: 0;
}

.field label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
}

.field input,
.advanced-grid input {
  width: 100%;
  height: 48px;
  border: 1px solid rgba(142, 160, 181, 0.25);
  border-radius: 14px;
  background: #0b1a27;
  color: var(--text);
  padding: 0 14px;
  font-size: 18px;
  font-variant-numeric: tabular-nums;
}

.field input:focus,
.advanced-grid input:focus {
  outline: 2px solid rgba(212, 175, 55, 0.45);
  border-color: var(--gold);
}

.hint {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.hero {
  text-align: center;
  padding: 8px 8px 4px;
}

.hero .kicker {
  color: var(--gold);
  letter-spacing: 0.16em;
  font-size: 11px;
  text-transform: uppercase;
}

.hero .lots {
  font-family: Sora, sans-serif;
  font-size: 64px;
  line-height: 1;
  margin: 8px 0 6px;
  font-weight: 700;
  background: linear-gradient(180deg, #fff6d4, var(--gold));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero .unit {
  color: var(--muted);
  font-size: 14px;
}

.kv {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 13px;
}

.kv span {
  color: var(--muted);
}

.kv b {
  font-weight: 600;
  text-align: right;
}

.tp-head,
.tp-row {
  display: grid;
  grid-template-columns: 0.7fr 1.1fr 1.2fr;
  gap: 8px;
  align-items: center;
}

.tp-head {
  color: var(--muted);
  font-size: 12px;
  padding-bottom: 8px;
}

.tp-row {
  background: #102332;
  border-radius: 14px;
  padding: 12px;
  margin-bottom: 8px;
}

.tp-rr {
  color: var(--teal);
  font-weight: 700;
  font-family: Sora, sans-serif;
}

.tp-price {
  font-size: 18px;
  font-variant-numeric: tabular-nums;
  font-weight: 650;
}

.tp-profit {
  text-align: right;
  color: var(--gold-2);
  font-size: 13px;
}

.error {
  color: #ffb4c2;
  background: rgba(255, 107, 136, 0.12);
  border: 1px solid rgba(255, 107, 136, 0.28);
  border-radius: 16px;
  padding: 14px;
  margin-bottom: 14px;
}

details.card {
  padding: 0;
}

details.card summary {
  list-style: none;
  cursor: pointer;
  padding: 16px;
  font-weight: 650;
}

details.card summary::-webkit-details-marker {
  display: none;
}

.advanced-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 0 16px 16px;
}

.install {
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  line-height: 1.5;
  padding: 4px 8px 20px;
}

.foot {
  color: #6f8296;
  font-size: 11px;
  text-align: center;
  line-height: 1.5;
}

@media (max-width: 420px) {
  .hero .lots {
    font-size: 52px;
  }
  .chips {
    grid-template-columns: repeat(2, 1fr);
  }
}
