:root {
  --bg: #0C0F0E;
  --surface: #151A18;
  --surface-2: #1C2320;
  --bar: #111514;
  --line: #27302C;
  --text: #F2F4F1;
  --muted: #9BA59F;
  --gold: #E6B84A;
  --green: #4FD69C;
  --green-bg: #17302A;
  --red: #FF8F7A;
  --red-bg: #36201C;
  --sans: Inter, system-ui, -apple-system, sans-serif;
  --head: 'Space Grotesk', Inter, system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, Menlo, monospace;
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, p { margin: 0; }
a { color: var(--gold); }

#root {
  max-width: 480px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  padding-top: env(safe-area-inset-top);
}

.pad { padding: 24px 20px; display: flex; flex-direction: column; gap: 20px; flex: 1; }
.grow { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.mono { font-family: var(--mono); font-weight: 600; }
.green { color: var(--green); }
.red { color: var(--red); }
.goldc { color: var(--gold); }
.label { font-size: 11px; font-weight: 600; letter-spacing: 0.08em; color: var(--muted); text-transform: uppercase; }

/* brand */
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 40px; height: 40px; border-radius: 12px; background: #0C0F0E; border: 1px solid rgba(232,184,74,.35); overflow: hidden; display: flex; align-items: center; justify-content: center; flex: none; }
.brand-mark img { width: 100%; height: 100%; display: block; }
.brand-name { font-family: var(--head); font-weight: 700; font-size: 17px; }
.brand-sub { font-size: 12px; color: var(--muted); }

h1 { font-family: var(--head); font-weight: 700; font-size: 26px; line-height: 1.15; }
h2 { font-family: var(--head); font-weight: 700; font-size: 22px; }

/* form */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .field .flabel { font-size: 12px; font-weight: 600; color: var(--muted); }
.input, select.input, textarea.input {
  width: 100%;
  min-height: 50px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font-size: 16px;
  outline: none;
}
textarea.input { padding: 12px 14px; min-height: 92px; resize: vertical; font-size: 15px; }
.input:focus { border-color: var(--gold); }
.input.num { font-family: var(--mono); font-weight: 600; }
.hint { font-size: 12px; color: var(--muted); min-height: 17px; }

.btn {
  min-height: 52px;
  padding: 0 18px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font-family: var(--head);
  font-weight: 700;
  font-size: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-decoration: none;
}
.btn.gold { background: var(--gold); border-color: var(--gold); color: var(--bg); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); font-family: var(--sans); font-weight: 600; font-size: 14px; min-height: 44px; }
.btn.sm { min-height: 44px; font-size: 14px; border-radius: 12px; padding: 0 14px; }
.btn.danger { color: var(--red); }
.btn[disabled] { opacity: 0.55; cursor: default; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.rowx { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }

.msg { font-size: 13px; min-height: 18px; }
.msg.err { color: var(--red); }
.msg.ok { color: var(--green); }

/* cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.steps { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; }
.step { display: flex; align-items: center; gap: 12px; padding: 14px; border-bottom: 1px solid var(--line); }
.step:last-child { border-bottom: 0; }
.step-n { width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-family: var(--mono); font-size: 13px; font-weight: 600; flex: none; border: 1px solid var(--line); color: var(--muted); }
.step.done .step-n { background: var(--green-bg); color: var(--green); border-color: transparent; }
.step.now .step-n { background: var(--gold); color: var(--bg); border-color: transparent; }
.step-t { font-size: 14px; font-weight: 600; }
.step:not(.done):not(.now) .step-t { color: var(--muted); }

/* app header */
.top { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px 12px; }
.pricebar { display: flex; align-items: baseline; justify-content: space-between; padding: 4px 20px 14px; }
.content { flex: 1; padding: 0 16px 16px; display: flex; flex-direction: column; gap: 14px; }
.foot { padding: 4px 20px 12px; text-align: center; font-size: 12px; color: var(--muted); }

.pill { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; background: var(--green-bg); color: var(--green); font-size: 12px; font-weight: 600; }
.pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); }
.dir { display: inline-flex; align-items: center; gap: 8px; padding: 12px 18px; border-radius: 14px; font-family: var(--head); font-weight: 700; font-size: 18px; color: var(--bg); }
.dir.buy { background: var(--green); }
.dir.sell { background: var(--red); }
.pair { font-family: var(--head); font-weight: 700; font-size: 30px; line-height: 1; }

.live { display: flex; align-items: flex-end; justify-content: space-between; padding: 14px 16px; border-radius: 14px; background: var(--bg); }
.live .big { font-family: var(--mono); font-weight: 600; font-size: 32px; line-height: 1; }

.range { position: relative; height: 46px; }
.range .track { position: absolute; left: 0; right: 0; top: 8px; height: 6px; border-radius: 3px; background: var(--line); }
.range .zone { position: absolute; top: 8px; height: 6px; background: var(--gold); }
.range .gain { position: absolute; top: 8px; height: 6px; background: var(--green); }
.range .mark { position: absolute; top: 2px; width: 4px; height: 18px; margin-left: -2px; border-radius: 2px; background: var(--text); }
.range .tick { position: absolute; top: 5px; width: 2px; height: 12px; background: var(--muted); }
.range .lab { position: absolute; top: 28px; font-size: 11px; font-weight: 600; color: var(--muted); white-space: nowrap; }

.lv { display: flex; align-items: center; justify-content: space-between; padding: 10px 6px 10px 14px; border-radius: 14px; border: 1px solid var(--line); min-height: 72px; }
.lv .v { font-family: var(--mono); font-weight: 600; font-size: 16px; }
.lv .p { font-family: var(--mono); font-size: 12px; }
.copy { width: 44px; height: 44px; border: 0; border-radius: 10px; background: transparent; display: flex; align-items: center; justify-content: center; color: var(--muted); flex: none; }
.copy.done { color: var(--green); }
.note { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; border-radius: 14px; background: var(--surface-2); font-size: 14px; }

.empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center; padding: 48px 24px; color: var(--muted); }

/* record */
.tile { display: flex; flex-direction: column; gap: 6px; padding: 14px 12px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.tile .n { font-family: var(--mono); font-weight: 600; font-size: 22px; }
.list { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.item { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-bottom: 1px solid var(--line); }
.item:last-child { border-bottom: 0; }
.chip { width: 46px; padding: 6px 0; border-radius: 8px; font-size: 12px; font-weight: 700; text-align: center; flex: none; }
.chip.buy { background: var(--green-bg); color: var(--green); }
.chip.sell { background: var(--red-bg); color: var(--red); }
.item .mid { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.item .t1 { font-family: var(--mono); font-weight: 600; font-size: 14px; overflow-wrap: anywhere; }
.item .t2 { font-size: 12px; color: var(--muted); }
.tag { font-family: var(--mono); font-weight: 600; font-size: 13px; flex: none; }
.tag.win { color: var(--green); }
.tag.be { color: var(--gold); }
.tag.sl { color: var(--red); }
.tag.off { color: var(--muted); }

/* tab bar */
.tabbar { position: sticky; bottom: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--line); background: var(--bar); padding: 6px 12px calc(10px + env(safe-area-inset-bottom)); }
.tab { min-height: 52px; border: 0; background: transparent; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--muted); font-size: 12px; font-weight: 500; }
.tab.on { color: var(--gold); font-weight: 600; }

/* segmented */
.seg { display: grid; gap: 4px; padding: 4px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.seg.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.seg.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.seg button { min-height: 44px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-size: 14px; font-weight: 500; }
.seg button.on { background: var(--gold); color: var(--bg); font-weight: 600; }
.seg button.on.buy { background: var(--green); }
.seg button.on.sell { background: var(--red); }

/* watermark + toast */
.wm { position: fixed; inset: 0; pointer-events: none; z-index: 5; overflow: hidden; opacity: 0.06; font-family: var(--mono); font-size: 13px; line-height: 64px; color: var(--text); word-spacing: 40px; transform: rotate(-24deg) scale(1.5); }
.toast { position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translateX(-50%); max-width: 88%; padding: 12px 16px; border-radius: 12px; background: var(--text); color: var(--bg); font-size: 14px; font-weight: 600; z-index: 20; text-align: center; }
