/* Perps (Hyperliquid): screener | header + chart + funding/account | book + trades | order preview. Scoped under .pp */
.pp { display: grid; height: 100%; min-height: 0; font-size: 12px; background: var(--bg);
  grid-template-columns: 300px minmax(0, 1fr) 252px 292px; grid-template-rows: auto minmax(0, 1fr);
  grid-template-areas: "scr head head form" "scr mid ob form"; }
.pp > * { min-width: 0; min-height: 0; }
.pp .mono, .pp b, .pp td, .pp .pp-lv, .pp .pp-tr { font-variant-numeric: tabular-nums; }
.pp button { font: inherit; }
.pp .pp-empty { padding: 22px 12px; color: var(--muted); text-align: center; font-family: var(--sans); white-space: normal; }
.pp .pp-pulse { display: inline-block; width: 7px; height: 7px; margin-right: 8px; border-radius: 50%; background: var(--accent); vertical-align: 1px; animation: blink 1.2s infinite; }
.pp .pp-note { position: absolute; inset: 0; display: grid; place-items: center; padding: 12px; color: var(--muted); text-align: center; pointer-events: none; z-index: 2; }
.pp .pp-hint { margin: 0; color: var(--dim); font-size: 11px; line-height: 1.45; }
.pp .pp-link { padding: 0; border: 0; background: none; color: var(--accent); font: inherit; cursor: pointer; }
.pp .pp-link:hover { text-decoration: underline; }
.pp .fl-up { animation: pp-up 1s ease-out; } .pp .fl-dn { animation: pp-dn 1s ease-out; }
@keyframes pp-up { from { background: color-mix(in srgb, var(--up) 26%, transparent); } to { background: transparent; } }
@keyframes pp-dn { from { background: color-mix(in srgb, var(--down) 26%, transparent); } to { background: transparent; } }
.pp-switch { display: none; }

/* screener */
.pp-scr { grid-area: scr; display: grid; grid-template-rows: auto minmax(0, 1fr); border-right: 1px solid var(--line); background: var(--panel); }
.pp-scr-h { display: grid; gap: 7px; padding: 9px 10px; border-bottom: 1px solid var(--line); }
.pp-q { display: flex; align-items: center; gap: 7px; height: 30px; padding: 0 9px; border: 1px solid var(--line-2); border-radius: 7px; background: var(--bg); color: var(--muted); }
.pp-q:focus-within { border-color: var(--accent-2); }
.pp-q input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: var(--fg); font: 12px var(--mono); }
.pp-only { display: flex; gap: 4px; }
.pp-only button { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border: 1px solid var(--line-2); border-radius: 6px; background: none; color: var(--muted); font-size: 11.5px; font-weight: 600; }
.pp-only button.on { color: var(--fg); background: var(--panel-2); border-color: var(--dim); }
.pp-only button[data-only="fav"].on { --f: var(--warn); color: var(--warn); }
.pp-only .pp-wide { margin-left: auto; font-weight: 500; }
.pp.wide .pp-scr { grid-column: 1 / 4; grid-row: 1 / -1; z-index: 5; box-shadow: var(--shadow-lg, var(--shadow)); }
.pp.wide .pp-tbl { width: 100%; }
/* the 300px rail shows Market, Price and 24h (funding is in the header and the panel below the chart); Expand shows every column */
@media (min-width: 1101px) { .pp:not(.wide) .pp-tbl :is(th, td):nth-child(n+4) { display: none; } }
.pp-tbl-wrap { overflow: auto; min-height: 0; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
.pp-tbl { border-collapse: separate; border-spacing: 0; width: max-content; min-width: 100%; font: 11.5px/1 var(--mono); }
.pp-tbl th { position: sticky; top: 0; z-index: 2; padding: 8px 8px; background: var(--panel); border-bottom: 1px solid var(--line); color: var(--muted); font: 500 10.5px/1 var(--sans); text-transform: uppercase; letter-spacing: .04em; text-align: right; white-space: nowrap; cursor: pointer; user-select: none; }
.pp-tbl th:hover, .pp-tbl th.on { color: var(--fg); }
.pp-tbl th:first-child { left: 0; z-index: 3; text-align: left; padding-left: 10px; }
.pp-tbl td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
.pp-tbl td.c0 { position: sticky; left: 0; z-index: 1; display: flex; align-items: center; gap: 6px; padding-left: 6px; text-align: left; background: var(--panel); min-width: 92px; }
.pp-tbl td.c0 b { font: 600 12px/1 var(--sans); color: var(--fg); }
.pp-tbl tbody tr { cursor: pointer; }
.pp-tbl tbody tr:hover td { background: var(--panel-2); }
.pp-tbl tbody tr.on td { background: color-mix(in srgb, var(--accent) 9%, var(--panel)); }
.pp-tbl tbody tr.on td.c0 { box-shadow: inset 2px 0 0 var(--accent); }
.pp-tbl td.pp-empty { text-align: center; position: static; }
.pp-fav { flex: none; display: inline-grid; place-items: center; width: 20px; height: 20px; padding: 0; border: 0; border-radius: 4px; background: none; color: var(--dim); cursor: pointer; }
.pp-fav:hover { color: var(--fg); }
.pp-fav.on { --f: var(--warn); color: var(--warn); }

/* market header */
.pp-head { grid-area: head; display: flex; align-items: center; gap: 14px; min-height: 52px; padding: 6px 12px; border-bottom: 1px solid var(--line); background: var(--panel); }
.pp-id { display: flex; align-items: center; gap: 6px; flex: none; }
.pp-coin { font: 700 16px/1 var(--sans); letter-spacing: -.01em; }
.pp-tag { padding: 2px 5px; border: 1px solid var(--line-2); border-radius: 4px; color: var(--muted); font: 600 10px/1.2 var(--mono); text-transform: uppercase; white-space: nowrap; }
.pp-tag.lev { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.pp-last { flex: none; padding: 3px 5px; border-radius: 5px; font: 600 17px/1 var(--mono); }
.pp-stats { display: flex; min-width: 0; flex: 1; overflow-x: auto; scrollbar-width: none; }
.pp-stats::-webkit-scrollbar { display: none; }
.pp-stats div { display: grid; gap: 4px; padding: 0 10px; border-left: 1px solid var(--line); white-space: nowrap; }
.pp-stats i { font-style: normal; }
@media (max-width: 1599px) { .pp-head .pp-q-tag { display: none; } }
.pp-stats span { color: var(--muted); font-size: 10.5px; }
.pp-stats b { font: 500 12px/1 var(--mono); }
.pp-out { flex: none; padding: 6px 9px; border: 1px solid var(--line-2); border-radius: 6px; color: var(--muted); font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.pp-out:hover { color: var(--fg); border-color: var(--dim); }

/* chart + lower panel */
.pp-mid { grid-area: mid; display: grid; grid-template-rows: auto minmax(180px, 1fr) 232px; }
.pp-bar { display: flex; align-items: center; gap: 3px; padding: 5px 10px; border-bottom: 1px solid var(--line); }
.pp-bar button { height: 23px; padding: 0 8px; border: 0; border-radius: 5px; background: none; color: var(--muted); font: 500 11.5px/1 var(--mono); }
.pp-bar button:hover { color: var(--fg); }
.pp-bar button.on { background: var(--panel-2); color: var(--fg); }
.pp-src { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; color: var(--dim); font-size: 11px; white-space: nowrap; }
.pp-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--dim); }
.pp-dot.live { background: var(--up); box-shadow: 0 0 0 3px color-mix(in srgb, var(--up) 20%, transparent); }
.pp-dot.bad { background: var(--down); }
.pp-chart { position: relative; min-height: 0; }
.pp-low { display: grid; grid-template-rows: auto minmax(0, 1fr); border-top: 1px solid var(--line); background: var(--panel); min-height: 0; }
.pp-tabs { display: flex; align-items: center; gap: 2px; padding: 0 8px; border-bottom: 1px solid var(--line); min-width: 0; overflow-x: auto; scrollbar-width: none; }
.pp-tabs button { height: 32px; padding: 0 9px; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--muted); font-size: 12px; font-weight: 600; white-space: nowrap; }
.pp-tabs button.on { color: var(--fg); border-bottom-color: var(--accent); }
.pp-tabs-r { margin-left: auto; padding-left: 10px; color: var(--muted); font-size: 11.5px; white-space: nowrap; }
.pp-fund { display: grid; grid-template-columns: minmax(0, 1fr) 300px; min-height: 0; }
.pp-fwrap { display: grid; grid-template-rows: auto minmax(0, 1fr); min-height: 0; border-right: 1px solid var(--line); }
.pp-fhd { display: flex; justify-content: space-between; gap: 10px; padding: 7px 10px 2px; color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; }
.pp-fhd b { font-weight: 500; }
.pp-fchart { position: relative; min-height: 0; }
.pp-fside { display: grid; align-content: start; gap: 5px; padding: 9px 12px; overflow-y: auto; min-height: 0; }
.pp-kv { display: flex; justify-content: space-between; gap: 10px; }
.pp-kv span { color: var(--muted); }
.pp-kv b { font: 500 12px/1.2 var(--mono); }
.pp-mini { width: 100%; margin-top: 2px; border-collapse: collapse; font: 11px/1 var(--mono); }
.pp-mini th { padding: 5px 4px; color: var(--muted); font: 500 10px/1 var(--sans); text-transform: uppercase; letter-spacing: .04em; text-align: right; border-bottom: 1px solid var(--line); }
.pp-mini td { padding: 5px 4px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
.pp-mini th:first-child, .pp-mini td:first-child { text-align: left; font-family: var(--sans); }
.pp-acct { min-height: 0; overflow: auto; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
.pp-addr { display: grid; gap: 10px; max-width: 560px; padding: 16px 14px; }
.pp-addr p { margin: 0; color: var(--muted); line-height: 1.5; }
.pp-addr-row { display: flex; gap: 6px; flex-wrap: wrap; }
.pp-addr-row input { flex: 1 1 220px; min-width: 0; height: 32px; padding: 0 10px; border: 1px solid var(--line-2); border-radius: 7px; background: var(--bg); color: var(--fg); font: 12px var(--mono); outline: 0; }
.pp-addr-row input:focus { border-color: var(--accent-2); }
.pp-sum { display: flex; flex-wrap: wrap; gap: 4px 18px; padding: 8px 12px; border-bottom: 1px solid var(--line); color: var(--muted); }
.pp-sum b { color: var(--fg); font: 500 12px var(--mono); }
.pp-t-wrap { overflow-x: auto; }
.pp-t { width: 100%; border-collapse: collapse; font: 11.5px/1 var(--mono); }
.pp-t th { position: sticky; top: 0; padding: 7px 10px; background: var(--panel); color: var(--muted); font: 500 10.5px/1 var(--sans); text-transform: uppercase; letter-spacing: .04em; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.pp-t td { padding: 6px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.pp-acct > .pp-hint { padding: 8px 12px; }
.pp-warn { padding: 6px 12px; color: var(--warn); font-size: 11.5px; border-bottom: 1px solid var(--line); }
.pp-warn-t { color: var(--warn); }

/* order book + trades */
.pp-ob { grid-area: ob; display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto minmax(0, 1fr) auto auto minmax(0, .9fr); border-left: 1px solid var(--line); background: var(--bg); }
.pp-sec-h { display: flex; align-items: center; gap: 6px; height: 34px; padding: 0 10px; border-bottom: 1px solid var(--line); background: var(--panel); }
.pp-sec-h b { font: 600 12px/1 var(--sans); margin-right: auto; }
.pp-tr-h { border-top: 1px solid var(--line); }
.pp-sec-h select { height: 22px; padding: 0 4px; border: 1px solid var(--line-2); border-radius: 5px; background: var(--bg); color: var(--fg); font: 11px var(--mono); }
.pp-unit { height: 22px; padding: 0 7px; border: 1px solid var(--line-2); border-radius: 5px; background: none; color: var(--muted); font: 600 10.5px/1 var(--mono); max-width: 70px; overflow: hidden; text-overflow: ellipsis; }
.pp-unit:hover { color: var(--fg); }
.pp-cols, .pp-lv, .pp-tr { display: grid; grid-template-columns: 1.1fr 1fr 1fr; gap: 6px; padding: 0 10px; }
.pp-cols { padding-top: 5px; padding-bottom: 4px; color: var(--dim); font-size: 10.5px; }
.pp-cols span:not(:first-child), .pp-lv span:not(:first-child), .pp-tr span:not(:first-child) { text-align: right; }
.pp-asks { display: flex; flex-direction: column; justify-content: flex-end; overflow: hidden; }
.pp-bids { display: flex; flex-direction: column; overflow: hidden; }
.pp-lv { position: relative; flex: none; height: 19px; align-items: center; font: 11.5px/1 var(--mono); cursor: pointer; }
.pp-lv::before { content: ""; position: absolute; top: 1px; bottom: 1px; right: 0; width: var(--w, 0%); pointer-events: none; }
.pp-lv.a::before { background: color-mix(in srgb, var(--down) 13%, transparent); }
.pp-lv.b::before { background: color-mix(in srgb, var(--up) 13%, transparent); }
.pp-lv.a span:first-child { color: var(--down); } .pp-lv.b span:first-child { color: var(--up); }
.pp-lv span { position: relative; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pp-lv:hover { background: var(--panel-2); }
.pp-spread { display: flex; align-items: center; justify-content: center; gap: 10px; height: 26px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--panel); font: 11.5px/1 var(--mono); }
.pp-spread b { font-weight: 500; }
.pp-trades { overflow-y: auto; min-height: 0; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
.pp-tr { height: 19px; align-items: center; font: 11.5px/1 var(--mono); }
.pp-tr span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pp-tr.buy span:first-child { color: var(--up); } .pp-tr.sell span:first-child { color: var(--down); }
.pp-tr span:last-child { color: var(--muted); }

/* order preview. Its form controls (side switch, fields, quote, go button) moved here from style.css. */
.pp-form .bs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; background: var(--bg); border-radius: 9px; border: 1px solid var(--line); }
.pp-form .bs button { height: 30px; border: 0; border-radius: 6px; background: none; color: var(--muted); font-weight: 700; }
.pp-form .bs button:hover { color: var(--fg); }
/* the active side: a tint with ink pulled toward the text colour, so it reads on dark and on white alike */
.pp-form .bs button.on.buy { background: color-mix(in srgb, var(--up) 16%, transparent); color: color-mix(in srgb, var(--up) 70%, var(--fg)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--up) 42%, transparent); }
.pp-form .bs button.on.sell { background: color-mix(in srgb, var(--down) 16%, transparent); color: color-mix(in srgb, var(--down) 70%, var(--fg)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--down) 42%, transparent); }
.pp-form .field { display: grid; gap: 6px; }
.pp-form .field > span { display: flex; justify-content: space-between; color: var(--muted); font-size: 11.5px; }
.pp-form .amt { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 6px 0 10px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--bg); }
.pp-form .amt:focus-within { border-color: var(--accent-2); }
.pp-form .amt input { flex: 1; min-width: 0; padding: 0; border: 0; outline: 0; background: none; color: var(--fg); font: 600 14px/1 var(--mono); }
.pp-form .amt em { font-style: normal; color: var(--muted); font-family: var(--mono); }
.pp-form .presets { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; }
.pp-form .presets button { height: 24px; border: 1px solid var(--line-2); border-radius: 6px; background: none; color: var(--muted); font: 500 11.5px/1 var(--mono); }
.pp-form .presets button:hover { color: var(--fg); border-color: var(--dim); }
.pp-form .quote { display: grid; gap: 5px; padding: 9px 10px; border: 1px dashed var(--line-2); border-radius: 8px; font-size: 11.5px; }
.pp-form .quote > div:not(.pp-warns) { display: flex; justify-content: space-between; gap: 10px; }
.pp-form .quote > div > span { color: var(--muted); } /* labels only: values keep their up/down colours */
.pp-form .quote b { font: 500 11.5px/1.3 var(--mono); text-align: right; }
.pp-form .quote b > .up { color: var(--up); } .pp-form .quote b > .down { color: var(--down); }
.pp-form .go { height: 38px; border: 0; border-radius: 9px; font: 700 12.5px/1 var(--sans); }
.pp-form .go.buy { background: var(--up); color: #04150d; }
.pp-form .go.sell { background: var(--down); color: #1a0306; }
/* switched off: reads as a notice, not as a faded buy button */
.pp-form .go:disabled { background: var(--panel-2); color: var(--muted); border: 1px dashed var(--line-2); opacity: 1; font-weight: 600; cursor: not-allowed; }
.pp-form .note { margin: 0; color: var(--dim); font-size: 11px; line-height: 1.5; }
.pp-form { grid-area: form; display: grid; align-content: start; gap: 11px; padding: 12px; border-left: 1px solid var(--line); background: var(--panel); overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
.pp-form > *, .pp-tpsl > *, .pp-form .field, .pp-form .amt { min-width: 0; }
.pp-form { overflow-x: hidden; }
.pp-fh { display: flex; align-items: center; justify-content: space-between; }
.pp-fh b { font: 600 13px/1 var(--sans); }
.pp-ro { padding: 2px 6px; border: 1px solid color-mix(in srgb, var(--warn) 45%, transparent); border-radius: 4px; color: var(--warn); font: 600 10px/1.3 var(--mono); text-transform: uppercase; }
.pp-seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; }
.pp-seg button { height: 28px; border: 1px solid var(--line-2); border-radius: 6px; background: none; color: var(--muted); font-size: 12px; font-weight: 600; }
.pp-seg button.on { color: var(--fg); background: var(--panel-2); border-color: var(--dim); }
.pp-seg button:disabled { opacity: 1; cursor: default; }
.pp-form .field > span b { color: var(--fg); font-weight: 600; }
.pp-mini-btn { flex: none; height: 24px; padding: 0 7px; border: 1px solid var(--line-2); border-radius: 5px; background: var(--panel-2); color: var(--muted); font: 600 11px/1 var(--mono); max-width: 96px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pp-mini-btn:hover { color: var(--fg); }
.pp-range { width: 100%; margin: 2px 0 0; accent-color: var(--accent); }
.pp-ticks { display: flex; justify-content: space-between; color: var(--dim); font: 10.5px var(--mono); }
.pp-check { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; cursor: pointer; }
.pp-check input { width: 14px; height: 14px; margin: 0; accent-color: var(--accent); }
.pp-tpsl { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.pp-tpsl .amt input { font-size: 12.5px; }
.pp-form .quote .pp-prose { font-family: var(--sans); }
.pp-warns { display: grid; gap: 3px; padding-top: 4px; border-top: 1px solid var(--line); }
.pp-warns p { margin: 0; color: var(--warn); font-size: 11.5px; line-height: 1.4; }
.pp-form .quote .pp-hint { padding-top: 2px; }
.pp-hl { height: 36px; }

/* mid widths: book and preview share one column */
@media (max-width: 1360px) and (min-width: 1101px) {
  .pp { grid-template-columns: 264px minmax(0, 1fr) 272px; grid-template-rows: auto minmax(0, 1.8fr) minmax(0, 1fr);
    grid-template-areas: "scr head head" "scr mid ob" "scr mid form"; }
  .pp-form { border-top: 1px solid var(--line); }
  .pp-ob { grid-template-rows: auto auto minmax(0, 1fr) auto minmax(0, 1fr) auto auto minmax(0, .55fr); }
  .pp-fund { grid-template-columns: minmax(0, 1fr) 260px; }
}

/* phones and tablets: one pane at a time */
@media (max-width: 1100px) {
  .pp { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto minmax(0, 1fr); grid-template-areas: "head" "switch" "pane"; }
  .pp-switch { grid-area: switch; display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; padding: 6px 8px; border-bottom: 1px solid var(--line); background: var(--panel); }
  .pp-switch button { height: 30px; border: 1px solid var(--line-2); border-radius: 6px; background: none; color: var(--muted); font-size: 12px; font-weight: 600; }
  .pp-switch button.on { color: var(--fg); background: var(--panel-2); border-color: var(--dim); }
  .pp-scr, .pp-mid, .pp-ob, .pp-form { grid-area: pane; display: none; border: 0; }
  .pp-only .pp-wide { display: none; }
  .pp.wide .pp-scr { grid-column: auto; grid-row: auto; box-shadow: none; }
  .pp[data-pane="markets"] .pp-scr { display: grid; }
  .pp[data-pane="chart"] .pp-mid { display: grid; }
  .pp[data-pane="book"] .pp-ob { display: grid; }
  .pp[data-pane="trade"] .pp-form { display: grid; }
  .pp-mid { grid-template-rows: auto minmax(220px, 1fr) minmax(220px, 40%); }
  .pp-head { flex-wrap: wrap; gap: 6px 12px; padding: 8px 10px; }
  .pp-stats { flex-basis: 100%; order: 3; }
  .pp-stats div:first-child { border-left: 0; padding-left: 0; }
  .pp-out { margin-left: auto; }
  .pp-form { max-width: 520px; width: 100%; justify-self: center; }
}
/* tablets: the book stays beside the chart */
@media (min-width: 761px) and (max-width: 1100px) {
  .pp { grid-template-columns: minmax(0, 1fr) 256px; grid-template-areas: "head head" "switch switch" "pane ob"; }
  .pp-switch { grid-template-columns: repeat(3, 1fr); }
  .pp-switch [data-pane="book"] { display: none; }
  .pp .pp-ob { display: grid; grid-area: ob; border-left: 1px solid var(--line); }
  .pp[data-pane="book"] .pp-mid { display: grid; }
}
@media (max-width: 640px) {
  .pp-fund { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(120px, 1fr) auto; overflow-y: auto; }
  .pp-fwrap { border-right: 0; border-bottom: 1px solid var(--line); }
  .pp-fside { overflow: visible; }
  .pp-tabs-r { display: none; }
  .pp-head .pp-tag:not(.lev) { display: none; }
  .pp-out { padding: 5px 7px; font-size: 11px; }
}
