:root {
    --bg: #0b0e11;
    --panel: #15181d;
    --panel-2: #1c2026;
    --line: #262a31;
    --text: #e8eaed;
    --muted: #8b929c;
    --up: #10c27c;
    --down: #f2495a;
    --accent: #f5c542;
    --radius: 6px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 13px/1.45 'Inter', 'Segoe UI', system-ui, sans-serif;
    font-variant-numeric: tabular-nums;
}
button, input { font: inherit; color: inherit; }
.up { color: var(--up); }
.down { color: var(--down); }
.muted { color: var(--muted); }
[hidden] { display: none !important; }

.top {
    height: 54px;
    display: flex;
    align-items: center;
    gap: 22px;
    padding: 0 16px;
    background: var(--panel);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 20;
}
.logo { font-weight: 700; font-size: 15px; letter-spacing: .02em; white-space: nowrap; }
.logo span { color: var(--accent); }
.tabs { display: flex; gap: 2px; }
.tabs button { background: none; border: 0; color: var(--muted); padding: 8px 12px; border-radius: var(--radius); cursor: pointer; font-weight: 500; }
.tabs button:hover { color: var(--text); }
.tabs button.on { color: var(--text); background: var(--panel-2); }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 20px; }
.figure { display: flex; flex-direction: column; line-height: 1.2; }
.figure small { color: var(--muted); font-size: 11px; }
.figure b { font-size: 15px; font-weight: 600; }
.tag { font-size: 10px; font-weight: 600; text-transform: uppercase; padding: 2px 7px; border-radius: 4px; background: var(--panel-2); color: var(--muted); }
.tag.paper { color: var(--accent); }
.tag.long { color: var(--up); background: rgba(16, 194, 124, .12); }
.tag.short { color: var(--down); background: rgba(242, 73, 90, .12); }

.switch {
    border: 0;
    border-radius: 99px;
    height: 34px;
    padding: 0 16px 0 10px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 600;
    background: var(--panel-2);
    color: var(--muted);
}
.switch i { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); }
.switch.on { background: rgba(16, 194, 124, .15); color: var(--up); }
.switch.on i { background: var(--up); box-shadow: 0 0 0 4px rgba(16, 194, 124, .2); }
.link { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 4px; }
.link:hover { color: var(--text); }

.btn { border: 0; border-radius: var(--radius); height: 34px; padding: 0 16px; cursor: pointer; font-weight: 600; background: var(--panel-2); color: var(--text); }
.btn:hover { filter: brightness(1.15); }
.btn.main { background: var(--accent); color: #1b1b1b; }
.btn.red { background: rgba(242, 73, 90, .14); color: var(--down); }
.btn.big { height: 44px; padding: 0 28px; font-size: 15px; }
.btn:disabled { opacity: .4; cursor: default; }

.page { display: none; }
.page.on { display: block; }

.trade {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr) 270px;
    grid-template-rows: minmax(420px, calc(100vh - 54px - 250px)) 250px;
    gap: 1px;
    background: var(--line);
    height: calc(100vh - 54px);
}
.trade > * { background: var(--panel); min-width: 0; min-height: 0; }
.coins { grid-row: 1 / 3; display: flex; flex-direction: column; }
.coins input { margin: 10px; padding: 7px 10px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); }
.coins input:focus { outline: none; border-color: var(--accent); }
.coins-head, .sheet-head, .sheet-open, .coin-dock { display: none; }
.coin-list { overflow: auto; flex: 1; }
.coin { display: flex; justify-content: space-between; gap: 8px; padding: 8px 12px; cursor: pointer; }
.coin:hover { background: var(--panel-2); }
.coin.on { background: var(--panel-2); box-shadow: inset 2px 0 0 var(--accent); }
.coin b { font-weight: 600; }
.coin .dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 6px; vertical-align: 2px; }
.coin .dot.long { background: var(--up); }
.coin .dot.short { background: var(--down); }
.coin-head { padding: 8px 12px 4px; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }

.chart-box { display: flex; flex-direction: column; }
.chart-bar { display: flex; align-items: center; gap: 14px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.chart-bar b { font-size: 16px; }
.chart-bar .frames { margin-left: auto; display: flex; gap: 2px; }
.chart-bar .frames button { background: none; border: 0; color: var(--muted); padding: 4px 9px; border-radius: 4px; cursor: pointer; }
.chart-bar .frames button.on { color: var(--text); background: var(--panel-2); }
#chart { flex: 1; min-height: 0; }

.side { grid-row: 1 / 3; grid-column: 3; padding: 14px; overflow: auto; display: flex; flex-direction: column; gap: 14px; }
.card { background: var(--panel-2); border-radius: var(--radius); padding: 12px 14px; }
.card h3 { margin: 0 0 8px; font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.rows { display: grid; grid-template-columns: auto 1fr; gap: 5px 10px; }
.rows span { color: var(--muted); }
.rows b { text-align: right; font-weight: 500; }
.big-number { font-size: 22px; font-weight: 600; }

.bottom { grid-column: 2; display: flex; flex-direction: column; }
.bottom-tabs { display: flex; gap: 2px; padding: 6px 10px 0; border-bottom: 1px solid var(--line); }
.bottom-tabs button { background: none; border: 0; color: var(--muted); padding: 8px 10px; cursor: pointer; border-bottom: 2px solid transparent; font-weight: 500; }
.bottom-tabs button.on { color: var(--text); border-bottom-color: var(--accent); }
.bottom-body { flex: 1; overflow: auto; }

table { width: 100%; border-collapse: collapse; }
th, td { padding: 7px 12px; text-align: right; white-space: nowrap; }
th { color: var(--muted); font-weight: 500; font-size: 11px; position: sticky; top: 0; background: var(--panel); }
th:first-child, td:first-child { text-align: left; }
tbody tr { cursor: pointer; }
tbody tr:hover td { background: var(--panel-2); }
.empty { color: var(--muted); padding: 22px; text-align: center; }

.narrow { max-width: 1100px; margin: 0 auto; padding: 20px 16px 60px; }
.narrow h2 { margin: 0 0 4px; font-size: 18px; }
.narrow .lead { color: var(--muted); margin: 0 0 16px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 16px; overflow: hidden; }
.panel > h3 { margin: 0; padding: 12px 16px; font-size: 13px; border-bottom: 1px solid var(--line); display: flex; gap: 10px; align-items: center; }
.panel > h3 small { color: var(--muted); font-weight: 400; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); }
.stats div { background: var(--panel); padding: 12px 16px; }
.stats small { display: block; color: var(--muted); font-size: 11px; }
.stats b { font-size: 18px; font-weight: 600; }

.styles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.style { text-align: left; background: var(--panel-2); border: 2px solid transparent; border-radius: var(--radius); padding: 14px 16px; cursor: pointer; }
.style:hover { border-color: rgba(245, 197, 66, .35); }
.style.on { border-color: var(--accent); }
.style b { display: block; font-size: 14px; margin: 4px 0; }
.style small { color: var(--muted); font-size: 12px; line-height: 1.45; display: block; }

details.advanced { margin-top: 6px; }
details.advanced summary { cursor: pointer; color: var(--muted); padding: 10px 0; font-weight: 500; }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 16px; margin-top: 8px; }
.field { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 9px 16px; border-top: 1px solid var(--line); }
.field input[type=number], .field input[type=text], .field input[type=email], .field input[type=password] { width: 130px; text-align: right; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 10px; }
.field input:focus { outline: none; border-color: var(--accent); }
.choices { display: flex; gap: 4px; }
.choices button { background: var(--panel-2); border: 0; color: var(--muted); border-radius: 4px; padding: 5px 10px; cursor: pointer; }
.choices button.on { background: var(--accent); color: #1b1b1b; }
.toggle { appearance: none; width: 38px; height: 21px; border-radius: 99px; background: #343944; position: relative; cursor: pointer; flex: 0 0 38px; }
.toggle::after { content: ''; position: absolute; top: 3px; left: 3px; width: 15px; height: 15px; border-radius: 50%; background: #fff; transition: left .15s; }
.toggle:checked { background: var(--up); }
.toggle:checked::after { left: 20px; }
.message { min-height: 20px; margin: 6px 0; }
.message.bad { color: var(--down); }
.message.good { color: var(--up); }

.modal { position: fixed; inset: 0; background: rgba(0, 0, 0, .6); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal-box { width: 100%; max-width: 760px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 24px; }
.modal-box h2 { margin: 0 0 6px; font-size: 20px; }
.modal-box p { margin: 0 0 18px; color: var(--muted); }
.modal-box .btn.big { margin-top: 18px; width: 100%; }

.toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast { background: var(--panel-2); border-left: 3px solid var(--accent); border-radius: var(--radius); padding: 10px 14px; min-width: 250px; box-shadow: 0 10px 30px rgba(0, 0, 0, .5); }
.toast.up { border-left-color: var(--up); }
.toast.down { border-left-color: var(--down); }

.gate { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.gate form { width: 100%; max-width: 360px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 26px; display: flex; flex-direction: column; gap: 12px; }
.gate h1 { margin: 0; font-size: 20px; }
.gate h1 span { color: var(--accent); }
.gate p { margin: 0 0 4px; color: var(--muted); }
.gate input { padding: 9px 12px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); }
.gate input:focus { outline: none; border-color: var(--accent); }

@media (max-width: 1100px) {
    .trade { grid-template-columns: 180px minmax(0, 1fr); grid-template-rows: 460px 260px auto; height: auto; }
    .side { grid-row: 3; grid-column: 1 / 3; flex-direction: row; flex-wrap: wrap; }
    .side .card { flex: 1 1 240px; }
    .coins { grid-row: 1 / 3; }
}

@media (max-width: 700px) {
    .top { height: auto; flex-wrap: wrap; padding: 8px 12px; gap: 10px; }
    .top-right { margin-left: 0; width: 100%; justify-content: space-between; gap: 10px; }
    .trade { display: flex; flex-direction: column; height: auto; }
    .chart-box { order: 1; height: 420px; flex: none; }
    .bottom { order: 2; min-height: 200px; flex: none; }
    .bottom-body { overflow-y: visible; }
    .side { order: 3; }
    .coins { display: none; }
    .trade.coins-open .coins { display: flex; position: fixed; inset: 0; z-index: 50; background: var(--bg); }
    .coins-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px 0; }
    #symbol { cursor: pointer; }
    #chart { touch-action: none; }
    body:has(#page-trade) { display: flex; flex-direction: column; height: 100vh; height: 100dvh; overflow: hidden; }
    body:has(#page-trade) > .top { position: relative; flex: none; }
    body:has(#page-trade) > .page.on { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
    body:has(#page-trade) > #page-trade.on { display: flex; flex-direction: column; overflow: hidden; }
    #page-trade .trade { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
    #page-trade .trade.coins-open, #page-trade .trade.side-open { overflow: hidden; }
    .trade.side-open::before { content: ''; position: fixed; inset: 0; z-index: 45; background: rgba(0, 0, 0, .55); }
    .trade.coins-open .coin-list, .trade.side-open .side { overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
    .trade.side-open .side { overflow-y: auto; }
    .coin-dock { display: flex; gap: 8px; order: 2; flex: none; position: relative; z-index: 40; padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); background: var(--panel); border-top: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
    .coin-dock::-webkit-scrollbar { display: none; }
    .chip { flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font-size: 13px; white-space: nowrap; cursor: pointer; }
    .chip.on { border-color: var(--accent); background: rgba(245, 197, 66, .1); }
    .chip.current b { color: var(--accent); }
    .chart-bar #symbol, .chart-bar #chart-note, .chart-bar #last-price { display: none; }
    .side { display: none; }
    .trade.side-open .side { display: flex; position: fixed; left: 0; right: 0; bottom: 0; max-height: 80vh; z-index: 50; flex-direction: column; flex-wrap: nowrap; border-top: 1px solid var(--line); border-radius: 12px 12px 0 0; box-shadow: 0 -8px 30px rgba(0, 0, 0, .5); }
    .side .card { flex: none; }
    .sheet-head { display: flex; align-items: center; justify-content: space-between; }
    .sheet-open { display: inline-block; margin-left: auto; color: var(--accent); }
    #symbol::after { content: ' \25BE'; color: var(--muted); }
    .styles, .stats { grid-template-columns: 1fr 1fr; }
    .fields { grid-template-columns: 1fr; }
    .trade > * { min-width: 0; }
    .top-right { flex-wrap: wrap; row-gap: 6px; }
    .top-right .tag { display: none; }
    .top-right .figure b { font-size: 15px; white-space: nowrap; }
    .switch span, .link { white-space: nowrap; }
    .chart-bar { flex-wrap: wrap; row-gap: 6px; gap: 10px; }
    .chart-bar #chart-note { white-space: nowrap; }
    .chart-bar .frames { margin-left: 0; width: 100%; overflow-x: auto; }
    .bottom-tabs { overflow-x: auto; }
    .bottom-body { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .bottom-body table th, .bottom-body table td { white-space: nowrap; }
}

.land { background: var(--bg); }
.land a { text-decoration: none; }
.land .btn { display: inline-flex; align-items: center; justify-content: center; }
.land-nav a { color: var(--muted); padding: 8px 12px; border-radius: var(--radius); font-weight: 500; }
.land-nav a:hover { color: var(--text); background: var(--panel-2); }
.land-wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px; }
.land-hero { padding: 90px 0 70px; background: radial-gradient(900px 380px at 20% -10%, rgba(245, 197, 66, .12), transparent 70%), radial-gradient(700px 300px at 90% 10%, rgba(16, 194, 124, .08), transparent 70%); border-bottom: 1px solid var(--line); }
.land-hero h1 { margin: 16px 0 16px; font-size: 46px; line-height: 1.12; letter-spacing: -.01em; }
.land-hero h1 span { color: var(--accent); }
.land-hero p { max-width: 640px; color: var(--muted); font-size: 16px; line-height: 1.6; margin: 0 0 26px; }
.land-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.land-section { padding: 64px 0; border-bottom: 1px solid var(--line); }
.land-section.dark { background: var(--panel); }
.land-section h2 { margin: 0 0 8px; font-size: 28px; }
.land-lead { color: var(--muted); font-size: 15px; margin: 0 0 24px; max-width: 680px; }
.land-grid { display: grid; gap: 16px; margin-top: 22px; }
.land-grid.three { grid-template-columns: repeat(3, 1fr); }
.land-grid.two { grid-template-columns: repeat(2, 1fr); max-width: 760px; }
.land-card { background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 22px; }
.land-card h3 { margin: 8px 0 8px; font-size: 17px; }
.land-card p { margin: 0; color: var(--muted); line-height: 1.6; }
.land-step { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: rgba(245, 197, 66, .15); color: var(--accent); }
.land-card.plan ul { margin: 14px 0 0; padding-left: 18px; color: var(--muted); line-height: 1.9; }
.land-card.premium { border-color: rgba(245, 197, 66, .45); }
.land-price { font-size: 30px; font-weight: 700; }
.land-price small { font-size: 14px; color: var(--muted); font-weight: 500; }
.land-stats { border-radius: 10px; overflow: hidden; border: 1px solid var(--line); }
.land-stats b { font-size: 26px; }
.land-note { margin-top: 14px; font-size: 12px; }
.narrow-text { max-width: 760px; }
.land details { border-bottom: 1px solid var(--line); padding: 14px 0; }
.land details summary { cursor: pointer; font-weight: 600; font-size: 15px; }
.land details p { color: var(--muted); line-height: 1.6; margin: 10px 0 0; }
.land-join { display: flex; gap: 10px; flex-wrap: wrap; }
.land-join input { flex: 1; min-width: 240px; padding: 0 14px; height: 44px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); }
.land-join input:focus { outline: none; border-color: var(--accent); }
.land-foot { padding: 26px 0 40px; font-size: 12px; }
.land-foot .land-wrap { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

@media (max-width: 800px) {
    .land-nav { display: none; }
    .land-hero { padding: 54px 0 46px; }
    .land-hero h1 { font-size: 32px; }
    .land-grid.three, .land-grid.two { grid-template-columns: 1fr; }
    .land-stats { grid-template-columns: 1fr 1fr; }
}

* { scrollbar-width: thin; scrollbar-color: #343944 transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #2c313a; border-radius: 99px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: #454b57; background-clip: padding-box; }
::-webkit-scrollbar-corner { background: transparent; }

.chart-overlay { position: absolute; inset: 0; pointer-events: none; z-index: 3; }

.chart-tools { display: flex; align-items: center; gap: 2px; padding: 4px 10px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.chart-tools button { background: none; border: 0; color: var(--muted); padding: 4px 8px; border-radius: 4px; cursor: pointer; font-size: 12px; }
.chart-tools button:hover { color: var(--text); background: var(--panel-2); }
.chart-tools button.on { color: var(--accent); background: rgba(245, 197, 66, .1); }
.chart-tools .sep { width: 1px; height: 16px; background: var(--line); margin: 0 6px; }
.chart-tools #tool-hint { margin-left: 8px; font-size: 12px; }
.legend { position: absolute; top: 8px; left: 12px; z-index: 4; font-size: 12px; color: var(--muted); pointer-events: none; white-space: nowrap; }
.legend b { color: var(--text); font-weight: 500; margin-right: 8px; }
.chart-message { position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; color: var(--muted); background: rgba(21, 24, 29, .85); font-size: 14px; }
#chart.drawing { cursor: crosshair; }

.chart-nav { position: absolute; left: 50%; bottom: 44px; transform: translateX(-50%); z-index: 6; display: flex; gap: 4px; padding: 4px; border-radius: 8px; background: rgba(28, 32, 38, .92); border: 1px solid var(--line); opacity: 0; transition: opacity .15s; }
#chart:hover .chart-nav { opacity: 1; }
.chart-nav button { width: 30px; height: 28px; border: 0; border-radius: 6px; background: none; color: var(--text); font-size: 16px; line-height: 1; cursor: pointer; }
.chart-nav button:hover { background: var(--panel-2); color: var(--accent); }
