* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); -webkit-text-size-adjust: 100%; }
body { min-height: 100vh; }
a { color: var(--accent-text); text-decoration: none; }
button { font: inherit; cursor: pointer; }
input, select { font: inherit; }
.app { max-width: 720px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
.head { padding: calc(16px + env(safe-area-inset-top)) 20px 10px; display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.col { display: flex; flex-direction: column; gap: 4px; }
.title { font-size: 24px; font-weight: 700; margin: 0; }
.dim { color: var(--text-dim); font-size: 13px; }
.small { font-size: 12px; }
.mono { font-family: var(--mono); }
.list { padding: 0 16px 12px; display: flex; flex-direction: column; gap: 10px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.card.dashed { border-style: dashed; border-color: var(--line-strong); }
.card.link { color: var(--text); flex-direction: row; align-items: center; gap: 12px; padding: 12px 14px; }
.label { font-size: 12px; font-weight: 600; color: var(--text-dim); letter-spacing: .04em; text-transform: uppercase; }
.seg { display: flex; gap: 6px; background: var(--surface); border-radius: 12px; padding: 4px; }
.seg button { flex: 1; min-height: var(--tap); border: 0; border-radius: 9px; background: transparent; color: var(--text-dim); font-weight: 600; }
.seg button.on { background: var(--accent); color: #fff; }
.chip { font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 99px; background: var(--chip-bg); color: var(--chip-text); }
.chip.vol { background: var(--vol-bg); color: var(--vol-text); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.btn { min-height: 52px; border-radius: var(--radius); border: 1px solid var(--line-strong); background: transparent; color: var(--text); font-weight: 600; font-size: 16px; padding: 0 16px; display: inline-flex; align-items: center; justify-content: center; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }
.btn.half { background: var(--sell-half-bg); border-color: transparent; color: var(--vol-text); }
.btn.all { background: var(--sell-all-bg); border-color: transparent; color: var(--sell-all-text); }
.btn.sm { min-height: var(--tap); font-size: 14px; border-radius: 12px; }
.btn[disabled] { opacity: .5; }
.btns { display: flex; gap: 8px; }
.btns > * { flex: 1; }
.input { min-height: 48px; width: 100%; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--text); padding: 0 14px; font-size: 16px; }
.input.num { font-family: var(--mono); font-weight: 600; text-align: right; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; color: var(--text-dim); font-weight: 600; }
.code { display: flex; gap: 8px; }
.code input { width: 46px; height: 58px; text-align: center; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: 600 24px var(--mono); }
.big { font-family: var(--mono); font-weight: 700; font-size: 30px; line-height: 1; }
.profit { color: var(--profit); }
.loss { color: var(--loss); }
.bar { width: 150px; height: 8px; border-radius: 99px; background: var(--line); overflow: hidden; }
.bar > div { height: 8px; background: var(--warn); }
.kv { display: flex; justify-content: space-between; font-size: 15px; }
.kv span:first-child { color: var(--text-dim); }
.kv span:last-child { font-family: var(--mono); font-weight: 600; }
.rank { width: 26px; font-family: var(--mono); font-size: 13px; color: var(--text-dim); }
.grow { flex: 1; min-width: 0; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav { position: fixed; left: 0; right: 0; bottom: 0; display: flex; justify-content: center; border-top: 1px solid var(--line); background: var(--surface-2); padding: 6px 8px calc(8px + env(safe-area-inset-bottom)); }
.nav > div { display: flex; width: 100%; max-width: 720px; }
.nav a { flex: 1; min-height: 48px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--text-dim); font-size: 12px; position: relative; }
.nav a.on { color: var(--accent-text); font-weight: 600; }
.nav .dot { position: absolute; top: 4px; right: calc(50% - 18px); width: 9px; height: 9px; border-radius: 99px; background: var(--warn); }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(90px + env(safe-area-inset-bottom)); background: var(--surface); border: 1px solid var(--line-strong); color: var(--text); padding: 12px 16px; border-radius: 12px; max-width: 90vw; font-size: 14px; z-index: 9; }
.rule { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 42px; }
.rule label { font-size: 14px; flex: 1; }
.rule input[type=text], .rule input[type=number] { width: 96px; min-height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--text); text-align: right; padding: 0 10px; font: 600 15px var(--mono); }
.rule input[type=checkbox] { width: 22px; height: 22px; }
.center { padding: calc(64px + env(safe-area-inset-top)) 28px 40px; display: flex; flex-direction: column; gap: 28px; max-width: 440px; margin: 0 auto; }
.logo { width: 56px; height: 56px; border-radius: 14px; }
.bell { position: relative; width: var(--tap); height: var(--tap); border-radius: 12px; background: var(--vol-bg); color: var(--warn); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.bell span { position: absolute; top: -4px; right: -4px; min-width: 20px; height: 20px; border-radius: 99px; background: var(--warn); color: var(--bg); font: 700 12px var(--mono); display: flex; align-items: center; justify-content: center; padding: 0 4px; }
.summary { display: flex; flex-direction: column; gap: 4px; background: #1F1A10; border: 1px solid #5A4512; border-radius: 12px; padding: 10px 12px; color: var(--text); }
.sumgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.seg a { flex: 1; min-height: 40px; border-radius: 9px; color: var(--text-dim); font-weight: 600; font-size: 13px; display: flex; align-items: center; justify-content: center; }
.seg a.on { background: var(--accent); color: #fff; }
.sheet-bg { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: flex; align-items: flex-end; justify-content: center; z-index: 8; }
.sheet { width: 100%; max-width: 560px; background: var(--surface); border-top: 1px solid var(--line-strong); border-radius: 20px 20px 0 0; padding: 18px 20px calc(24px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 14px; }
.idea { display: flex; gap: 10px; align-items: flex-start; background: #14321F; border: 1px solid #1F5133; border-radius: 12px; padding: 10px 12px; }
.empty { color: var(--text-dim); font-size: 14px; padding: 18px 4px; line-height: 1.5; }
@media (min-width: 900px) { .app { max-width: 980px; } .list.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* countdown to the sell-by time: turns red at zero (never negative) */
.clock { margin-left: auto; display: flex; flex-direction: column; align-items: center; gap: 1px; background: var(--surface-2, #1E232B); border-radius: 10px; padding: 6px 12px; min-width: 96px; }
.clock .cd { font-size: 17px; }
.clock.done { background: #3A1A1A; }
.clock.done .cd, .clock.done .cdnote { color: var(--loss, #F87171); font-weight: 700; }
