/* Motion: the trading app. Wide screens first, then tablets, then phones, then phones held sideways. */

/* thesis and lanes */
.thesis { padding: 30px 0 18px; display: flex; align-items: flex-end; justify-content: space-between; gap: 14px 20px; flex-wrap: wrap; }
.thesis h1 {
  margin: 0;
  font-family: var(--display);
  font-style: italic;
  font-weight: 700;
  font-size: clamp(32px, 5.2vw, 62px);
  line-height: 0.95;
  letter-spacing: 0.005em;
  text-transform: uppercase;
}
.thesis h1 span { color: var(--ink-faint); white-space: nowrap; }
.thesis p { margin: 0; max-width: 360px; color: var(--ink-dim); font-size: 15.5px; }

.lanes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; min-height: 174px; }
.lanes[data-n="1"] { grid-template-columns: minmax(0, 440px); }
.lanes[data-n="2"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.lanes[data-n="4"] { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.lanes[data-n="5"] { grid-template-columns: repeat(5, minmax(0, 1fr)); }
/* with more markets than lanes: the way to all of them */
.all-mk {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; margin-top: 10px;
  min-height: 46px; padding: 0 16px; background: none; border: 1px dashed var(--line-strong); border-radius: var(--r-sm);
  color: var(--ink-dim); text-align: left;
}
.all-mk:hover { border-color: var(--ink); border-style: solid; }
.all-mk-n { font-family: var(--display); font-style: italic; font-weight: 600; font-size: 19px; text-transform: uppercase; letter-spacing: 0.03em; color: var(--ink); white-space: nowrap; }
.all-mk-find { position: relative; padding-left: 22px; font-size: 14px; color: var(--ink-faint); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.all-mk-find::before { content: ""; position: absolute; left: 0; top: 50%; width: 10px; height: 10px; margin-top: -8px; border: 2px solid currentColor; border-radius: 50%; }
.all-mk-find::after { content: ""; position: absolute; left: 11px; top: 50%; width: 7px; height: 2px; margin-top: 4px; background: currentColor; transform: rotate(45deg); transform-origin: left center; }
.lane {
  position: relative;
  text-align: left;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 14px 16px 15px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 4px 12px;
  align-items: center;
  min-width: 0;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.lane:hover { border-color: var(--line-strong); }
.lane[aria-pressed="true"] { background: var(--panel-2); border-color: var(--ink); }
.lane-rank { position: absolute; top: 10px; right: 14px; font-family: var(--display); font-style: italic; font-weight: 600; font-size: 15px; color: var(--ink-faint); letter-spacing: 0.04em; }
.lane img { width: 46px; height: 46px; border-radius: 50%; object-fit: cover; display: block; background: var(--panel-3); }
.lane-who { min-width: 0; }
.lane-name { font-weight: 600; font-size: 16.5px; line-height: 1.15; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-name .tag, .mk-name .tag { margin-left: 7px; vertical-align: 1px; }
/* a new listing carries a small flag on the top edge of its lane */
.lane-new { position: absolute; top: -9px; left: 14px; padding: 0 6px 1px; background: var(--flag); color: #1a1503; border-radius: 3px; transform: skewX(-10deg); font-family: var(--display); font-style: italic; font-weight: 600; font-size: 13px; line-height: 1.3; text-transform: uppercase; letter-spacing: 0.05em; }
/* coin day: the same kind of flag counts down to the hour this market opens for real trading */
.lane-open { font-variant-numeric: tabular-nums; white-space: nowrap; max-width: calc(100% - 20px); overflow: hidden; }
.lane-new + .lane-open { left: auto; right: 14px; }
.lane-handle { color: var(--ink-faint); font-size: 13px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lane-price { font-family: var(--display); font-style: italic; font-weight: 600; font-size: 34px; line-height: 1; text-align: right; padding-top: 12px; }
.lane-chg { grid-column: 3; text-align: right; font-size: 13px; font-family: var(--mono); white-space: nowrap; }
.lane-spark { grid-column: 1 / -1; width: 100%; height: 34px; margin-top: 6px; display: block; }
.tug { grid-column: 1 / -1; height: 9px; border-radius: 2px; background: var(--short); position: relative; overflow: hidden; transform: skewX(-24deg); margin: 6px 3px 0; display: block; }
.tug i { position: absolute; inset: 0 auto 0 0; background: var(--long); border-right: 3px solid var(--bg); transition: width 0.5s ease; }
.tug-legend { grid-column: 1 / -1; display: flex; justify-content: space-between; font-size: 12px; color: var(--ink-faint); font-family: var(--mono); }

/* main grid */
.main { display: grid; grid-template-columns: minmax(0, 1fr) 372px; gap: 14px; margin-top: 14px; align-items: start; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); min-width: 0; }
.card-pad { padding: 18px 20px; }

.mk-head { display: flex; align-items: center; gap: 16px; padding: 18px 20px 6px; flex-wrap: wrap; }
.mk-head img { width: 58px; height: 58px; border-radius: 50%; object-fit: cover; flex: none; background: var(--panel-3); }
/* the name of the market is the button that changes it */
.mk-pick { display: flex; align-items: center; gap: 16px; min-width: 0; max-width: 100%; min-height: 48px; background: none; border: 0; padding: 4px 12px 4px 4px; margin: -4px 0 -4px -4px; border-radius: 12px; text-align: left; }
.mk-pick:hover { background: var(--panel-2); }
.mk-who { display: block; min-width: 0; }
.mk-name { display: flex; align-items: center; font-size: 20px; font-weight: 600; line-height: 1.1; min-width: 0; }
.mk-name > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mk-handle { display: block; color: var(--ink-faint); font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chev { flex: none; width: 9px; height: 9px; margin: -4px 2px 0 10px; border-right: 2px solid var(--ink-dim); border-bottom: 2px solid var(--ink-dim); transform: rotate(45deg); }
/* name and price share one line wherever there is room for both: a long handle is cut short before the price moves down */
@media (min-width: 340px) {
  .mk-head { flex-wrap: nowrap; }
  .mk-pick { flex: 0 1 auto; }
  .mk-price { flex: 0 100 auto; min-width: min-content; }      /* the line under the price gives way first, then the handle */
  html.bigtext .mk-head { flex-wrap: wrap; }
}
.mk-pick[aria-expanded="true"] .chev { transform: rotate(225deg); margin-top: 5px; }
.mk-price { margin-left: auto; text-align: right; }
.mk-price .big { font-family: var(--display); font-style: italic; font-weight: 700; font-size: 60px; line-height: 0.9; letter-spacing: 0.005em; white-space: nowrap; }
.mk-price .big small { font-size: 22px; font-weight: 600; color: var(--ink-faint); margin-left: 6px; font-style: italic; }
.mk-price .chg { font-family: var(--mono); font-size: 13.5px; margin-top: 6px; }

.stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin-top: 12px; min-height: 61px; }
.stats[data-n="6"] { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.stat { padding: 11px 20px; border-right: 1px solid var(--line); min-width: 0; }
.stat:last-child { border-right: 0; }
.stat-k { font-size: 12px; color: var(--ink-faint); text-transform: uppercase; letter-spacing: 0.08em; }
.stat-v { font-family: var(--mono); font-size: 14px; margin-top: 2px; overflow-wrap: anywhere; }      /* a number is never cut short: it takes a second line */
/* how full a side is stands on a line of its own, always: 99% and 100% take the same room, and the row keeps its height */
.stat-pct { display: block; white-space: nowrap; }
.meter { height: 5px; background: var(--panel-3); border-radius: 2px; margin-top: 6px; overflow: hidden; transform: skewX(-24deg); }
.meter i { display: block; height: 100%; background: var(--ink); transition: width 0.5s ease; }
.meter.hot i { background: var(--flag); }

/* the chart: candle length and chart type above it, the picture itself, the line of numbers over it */
.chart-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; padding: 12px 20px 0; flex-wrap: wrap; }
.ivs, .seg { display: inline-flex; gap: 2px; padding: 2px; background: var(--panel-3); border-radius: 8px; }
.iv, .tool { border: 0; background: none; color: var(--ink-dim); height: 30px; min-width: 40px; padding: 0 10px; border-radius: 6px; white-space: nowrap; }
.iv { font-family: var(--mono); font-size: 12.5px; }
.tool { font-size: 13px; }
.iv:hover, .tool:hover { color: var(--ink); }
.iv[aria-pressed="true"], .seg .tool[aria-pressed="true"] { background: var(--ink); color: #12110e; }
.chart-tools { display: inline-flex; align-items: center; gap: 8px; }
.tool-map { border: 1px solid rgba(242, 194, 48, 0.4); color: var(--flag); font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; height: 34px; border-radius: 8px; }
.tool-map:hover { color: var(--flag); border-color: var(--flag); }
.tool-map[aria-pressed="false"] { color: var(--ink-faint); border-color: var(--line-strong); }
.chart-box { position: relative; padding: 6px 0 0; }
#chart {
  width: 100%; height: 400px; display: block; cursor: crosshair; outline-offset: -3px;
  touch-action: pan-y;                      /* an up or down swipe on the chart scrolls the page, always */
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
.chart-legend { position: absolute; left: 12px; top: 12px; pointer-events: none; font-family: var(--mono); font-size: 11.5px; line-height: 1.5; color: var(--ink-faint); }
.lg-bar { display: flex; flex-wrap: wrap; gap: 0 10px; }
.lg-bar span { white-space: nowrap; }
.lg-bar b { font-weight: 500; color: var(--ink-dim); }
.lg-bar .lg-t { color: var(--flag); }
.lg-note { margin-top: 5px; max-width: 320px; padding: 5px 9px; background: rgba(10, 9, 8, 0.9); border-left: 2px solid var(--flag); border-radius: 0 6px 6px 0; font-family: var(--body); font-size: 12.5px; line-height: 1.4; color: var(--ink); }
.lg-note:empty { display: none; }
.near { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 4px 20px 18px; }
.near div { background: var(--flag-soft); border-radius: var(--r-sm); padding: 9px 12px; font-size: 13.5px; color: var(--ink-dim); }
.near b { color: var(--flag); font-weight: 600; }
.near .mono { color: var(--ink); }
.near .near-band { grid-column: 1 / -1; background: none; border: 1px solid var(--line); }
.near .near-band b { color: var(--ink); }
.near p { margin: 0; }
.near a { color: var(--ink); white-space: nowrap; }

/* ticket */
.ticket { position: sticky; top: 76px; }
.sheet-head, .scrim, .tradebar { display: none; }
.sides { display: grid; grid-template-columns: 1fr 1fr; gap: 0; padding: 14px 14px 0; }
.side-btn {
  border: 0; background: var(--panel-3); color: var(--ink-dim);
  font-family: var(--display); font-style: italic; font-weight: 700; font-size: 25px; text-transform: uppercase; letter-spacing: 0.03em;
  padding: 9px 0 10px; transform: skewX(-12deg); min-height: 48px;
  transition: background 0.15s ease, color 0.15s ease;
}
.side-btn span { display: inline-block; transform: skewX(12deg); }
.side-btn:first-child { border-radius: 8px 0 0 8px; margin-right: 2px; }
.side-btn:last-child { border-radius: 0 8px 8px 0; margin-left: 2px; }
/* Close, the third choice, is there only while the trader holds a position in the market on screen */
.sides.three { grid-template-columns: 1fr 1fr 1fr; }
.side-btn[hidden] { display: none; }
.sides:not(.three) .side-btn.short { border-radius: 0 8px 8px 0; margin-left: 2px; }
.sides.three .side-btn.short { border-radius: 0; margin-left: 2px; margin-right: 2px; }
.side-btn.close[aria-pressed="true"] { background: var(--ink); color: #12110e; }
.t-body[hidden] { display: none !important; }
.t-close .close-pos { margin-top: 0; padding-top: 0; border-top: 0; }
.close-k { margin-top: 16px; }
.chip[aria-pressed="true"] { background: var(--ink); color: #12110e; }
.close-note { margin-top: 10px; font-size: 13px; color: var(--ink-dim); }
.close-note:empty { display: none; }
.side-btn.long[aria-pressed="true"] { background: var(--long); color: #06240f; }
.side-btn.short[aria-pressed="true"] { background: var(--short); color: #2b0704; }
.t-body { padding: 16px 20px 20px; }
.field-k { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-faint); margin-bottom: 6px; }
.field-k b { font-weight: 500; color: var(--ink-dim); text-transform: none; letter-spacing: 0; font-family: var(--mono); font-size: 12.5px; white-space: nowrap; }
.amount { display: flex; align-items: baseline; gap: 8px; background: var(--bg); border: 1px solid var(--line-strong); border-radius: var(--r-sm); padding: 8px 14px; }
.amount:focus-within { border-color: var(--ink); }
.amount input { flex: 1; min-width: 0; width: 100%; min-height: 44px; background: none; border: 0; outline: 0; font-family: var(--display); font-style: italic; font-weight: 600; font-size: 34px; line-height: 1.1; padding: 0; border-radius: 0; -webkit-appearance: none; appearance: none; }
.amount em { font-style: normal; color: var(--ink-faint); font-size: 14px; }
.chips { display: flex; gap: 6px; margin-top: 8px; }
.chip { flex: 1; min-width: 0; background: var(--panel-3); border: 0; border-radius: 6px; padding: 5px 0; font-family: var(--mono); font-size: 12.5px; color: var(--ink-dim); }
.chip:hover { color: var(--ink); }
.chip[aria-pressed="true"]:hover { color: #12110e; }   /* the chosen chip is light: light text on it would vanish under the pointer */
.lev { margin-top: 18px; }
/* the five numbers and, beside them, Max: six choices of one size (Max stands outside the list, which is rebuilt as the offer moves) */
.gear-row { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 1fr); gap: 4px; padding: 0 3px; }
.gears { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; }
.gear, .gear-max {
  background: var(--panel-3); border: 0; padding: 8px 0 9px;
  font-family: var(--display); font-style: italic; font-weight: 600; font-size: 21px; color: var(--ink-dim);
  transform: skewX(-12deg); border-radius: 4px;
}
.gear span, .gear-max span { display: inline-block; transform: skewX(12deg); }
.gear[aria-pressed="true"], .gear-max[aria-pressed="true"] { background: var(--ink); color: #12110e; }
/* with Max chosen, the number it stands at this moment wears a ring */
.gear.at { box-shadow: inset 0 0 0 1.5px var(--ink-dim); color: var(--ink); }
.gear:disabled { opacity: 0.32; cursor: not-allowed; }
.lev-note { font-size: 12.5px; color: var(--ink-faint); margin-top: 8px; min-height: 19px; }
.sum { margin: 16px 0 0; padding: 12px 0 0; border-top: 1px solid var(--line); display: grid; gap: 7px; }
.sum div { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.sum dt { color: var(--ink-dim); }
.sum dd { margin: 0; font-family: var(--mono); font-size: 13.5px; text-align: right; white-space: nowrap; }
.push { margin-top: 12px; background: var(--flag-soft); border-left: 3px solid var(--flag); padding: 8px 11px; font-size: 13px; color: var(--ink-dim); border-radius: 0 6px 6px 0; display: none; }
.push.on { display: block; }
.push b { color: var(--flag); font-weight: 600; }
.err { margin-top: 12px; color: var(--short); font-size: 13.5px; min-height: 20px; }
.go {
  width: 100%; margin-top: 6px; border: 0; border-radius: 8px; padding: 13px 0 14px; min-height: 52px;
  font-family: var(--display); font-style: italic; font-weight: 700; font-size: 25px; text-transform: uppercase; letter-spacing: 0.03em;
}
.go.long { background: var(--long); color: #06240f; }
.go.short { background: var(--short); color: #2b0704; }
.go:disabled { background: var(--panel-3); color: var(--ink-faint); cursor: not-allowed; }
/* connected, and the wallet's own state is still being read: a whole sentence on the button, so smaller letters */
.go.reading { font-size: 17px; letter-spacing: 0.02em; padding-left: 10px; padding-right: 10px; cursor: progress; }
/* an order on its way: the button keeps its colour and says where the order is; a band of stripes runs along it */
.go.busy { position: relative; overflow: hidden; cursor: progress; }
.go.long.busy:disabled { background: var(--long); color: #06240f; }
.go.short.busy:disabled { background: var(--short); color: #2b0704; }
.go.busy::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 5px; background: repeating-linear-gradient(-66deg, rgba(0, 0, 0, 0.42) 0 9px, rgba(0, 0, 0, 0) 9px 18px); animation: march 0.5s linear infinite; }
@keyframes march { to { background-position: 19.7px 0; } }
.go-note { margin-top: 8px; font-size: 13px; color: var(--ink-dim); }
.go-note:empty { display: none; }
.warn { margin-top: 12px; display: flex; gap: 9px; align-items: flex-start; font-size: 13.5px; color: var(--ink-dim); }
.warn i { flex: none; width: 9px; height: 18px; background: var(--flag); transform: skewX(-24deg); margin-top: 1px; }
.warn b { color: var(--ink); font-weight: 600; }
/* the link from the ticket's note to the docs page that has the rest: a line of its own, tall enough for a finger */
.warn-link { display: flex; align-items: center; width: max-content; max-width: 100%; min-height: 40px; color: var(--ink); font-weight: 600; }
.pos-note a { color: var(--ink-dim); }

/* lower */
/* positions take the full width: the table has a column for everything a position needs watched, and two buttons */
.lower { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; margin-top: 14px; }
#pos-body th, #pos-body td { padding-left: 8px; padding-right: 8px; }
#pos-body th:first-child, #pos-body td:first-child { padding-left: 20px; }
#pos-body th:last-child, #pos-body td:last-child { padding-right: 20px; }
.h { font-family: var(--display); font-style: italic; font-weight: 600; font-size: 22px; text-transform: uppercase; letter-spacing: 0.03em; margin: 0; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 16px 20px 10px; }
.card-head small { color: var(--ink-faint); font-size: 12.5px; text-align: right; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th { text-align: right; font-weight: 500; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-faint); padding: 6px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { text-align: right; padding: 9px 10px; border-bottom: 1px solid var(--line); font-family: var(--mono); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; padding-left: 20px; }
th:last-child, td:last-child { padding-right: 20px; }
td.who { font-family: var(--body); font-weight: 600; font-size: 14.5px; }
tr:last-child td { border-bottom: 0; }
.tag { display: inline-block; font-family: var(--display); font-style: italic; font-weight: 600; font-size: 15px; text-transform: uppercase; letter-spacing: 0.04em; padding: 0 7px 1px; border-radius: 3px; transform: skewX(-10deg); }
.tag.long { background: var(--long-soft); color: var(--long); }
.tag.short { background: var(--short-soft); color: var(--short); }
.tag.liq { background: var(--flag); color: #1a1503; }
.tag.close { background: var(--panel-3); color: var(--ink-dim); }
.tag.band { background: var(--flag-soft); color: var(--flag); }
.tag.new { background: var(--flag); color: #1a1503; font-size: 12.5px; padding: 0 5px 1px; }
.close-btn { background: none; border: 1px solid var(--line-strong); border-radius: 999px; padding: 4px 12px; font-size: 13px; font-family: var(--body); min-height: 30px; }
.close-btn:hover { border-color: var(--ink); }
.close-btn:disabled { cursor: default; color: var(--ink-faint); }
.close-btn.busy:disabled { border-color: var(--flag); color: var(--flag); cursor: progress; }
/* a position that is signed and on its way, and one that is being closed */
tr.pending td { color: var(--ink-dim); }
tr.pending td.who { color: var(--ink); }
tr.closing td:not(.act) { opacity: 0.5; }
.confirming { display: inline-flex; align-items: center; gap: 8px; min-height: 30px; font-family: var(--body); font-size: 13px; font-weight: 600; color: var(--flag); white-space: nowrap; }
.confirming::before { content: ""; width: 7px; height: 14px; background: var(--flag); transform: skewX(-24deg); animation: beat 0.9s ease-in-out infinite alternate; }
.act .confirming + .close-btn { margin-left: 10px; }
.act .add-btn { margin-right: 8px; }
/* what the band rule closed: one row across the table, the words and the button that collects */
tr.waiting td { text-align: left; white-space: normal; font-family: var(--body); padding-top: 12px; padding-bottom: 12px; }
.wait-box { display: flex; align-items: center; justify-content: space-between; gap: 14px; background: var(--flag-soft); border-left: 3px solid var(--flag); border-radius: 0 8px 8px 0; padding: 10px 12px; font-size: 13.5px; color: var(--ink-dim); }
.wait-box b { color: var(--ink); font-weight: 600; }
.wait-box .collect-btn { flex: none; border-color: var(--flag); color: var(--ink); }
.pos-note { margin: 0; padding: 12px 20px 16px; border-top: 1px solid var(--line); font-size: 12.5px; line-height: 1.5; color: var(--ink-faint); }
.pos-note[hidden] { display: none; }
.pos-note b { color: var(--ink-dim); font-weight: 600; }
.warn-full { margin-top: 8px; font-size: 12.5px; color: var(--ink-faint); }
.warn-full i { background: var(--line-strong); }
.warn-full b { color: var(--ink-dim); }
td[data-c="liq"] .past { display: block; font-family: var(--body); font-size: 11.5px; color: var(--short); white-space: nowrap; }
td[data-c="wear"].flagc { color: var(--flag); }
td[data-c="wear"].dim { color: var(--ink-faint); }
/* the referral code a first trade would bind, on the ticket, with the button that takes it off */
.ref-row { margin-top: 12px; padding: 9px 11px; border: 1px solid var(--line-strong); border-radius: 8px; font-size: 13.5px; color: var(--ink-dim); }
.ref-row[hidden] { display: none; }
.ref-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.ref-top b { color: var(--ink); font-weight: 500; font-size: 13px; margin-left: 4px; white-space: nowrap; }
.ref-x { flex: none; background: none; border: 1px solid var(--line-strong); border-radius: 999px; padding: 4px 12px; min-height: 30px; font-size: 13px; font-family: var(--body); color: var(--ink); }
.ref-x:hover { border-color: var(--ink); }
.ref-x[hidden] { display: none; }
.ref-note { margin-top: 5px; font-size: 12.5px; color: var(--ink-faint); }
/* live markets that do not answer: said in the place of the markets, with the two things a trader can do */
/* (the box rules name the section itself: "down" is also the word for a red number, and a label in a short's colour
   must not take this section's padding, which once made the bar at the foot of a phone 118 px tall) */
section.down { padding: 56px 0 80px; max-width: 620px; }
section.down[hidden] { display: none; }
.down h1 { font-family: var(--display); font-style: italic; font-weight: 700; font-size: 44px; line-height: 1; text-transform: uppercase; letter-spacing: 0.01em; margin: 0 0 14px; }
.down p { margin: 0 0 22px; color: var(--ink-dim); font-size: 16px; }
.down-acts { display: flex; gap: 12px; flex-wrap: wrap; }
.down-acts .btn-ghost { min-height: 44px; padding: 10px 20px; font-size: 15px; }
.down-acts a.btn-ghost { background: none; color: var(--ink); border: 1px solid var(--line-strong); }
html.down #view-trade, html.down #view-token, html.down .tradebar, html.down .tabs, html.down .strip { display: none; }
html.halted .go, html.halted .tb-btn { opacity: 0.55; }
@keyframes beat { from { opacity: 0.25; } to { opacity: 1; } }
.toast.stage { background: var(--panel-3); color: var(--ink); border: 1px solid var(--line-strong); display: flex; align-items: center; gap: 10px; }
.toast.stage::before { content: ""; flex: none; width: 7px; height: 15px; background: var(--flag); transform: skewX(-24deg); animation: beat 0.9s ease-in-out infinite alternate; }
html.stale .mk-price .big, html.stale .lane-price { opacity: 0.5; }
.flagc { color: var(--flag); }
.empty { padding: 26px 20px 30px; color: var(--ink-dim); font-size: 14.5px; }
.feed { max-height: 318px; overflow-x: auto; overflow-y: hidden; }
.feed tr.liq td { background: var(--flag-soft); }

/* how */
.how { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; margin: 44px 0 0; border-top: 1px solid var(--line-strong); }
.how div { padding: 22px 24px 8px 0; }
.how div + div { padding-left: 24px; border-left: 1px solid var(--line); }
.how h3 { margin: 0 0 6px; font-family: var(--display); font-style: italic; font-weight: 600; font-size: 27px; line-height: 1.05; text-transform: uppercase; letter-spacing: 0.02em; }
.how p { margin: 0; color: var(--ink-dim); max-width: 340px; }
.how a { color: var(--ink); }

/* $motion page */
.tk-top { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 14px; }
.tk-burn { padding: 22px 24px 20px; }
.tk-big { font-family: var(--display); font-style: italic; font-weight: 700; font-size: clamp(40px, 7.4vw, 96px); line-height: 0.95; color: var(--flag); margin-top: 4px; overflow-wrap: anywhere; }
.tk-big small { font-size: 0.3em; color: var(--ink-faint); margin-left: 10px; font-weight: 600; white-space: nowrap; }
.tk-sub { color: var(--ink-dim); font-size: 13.5px; margin-top: 10px; }
.tk-next { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 14px; color: var(--ink-dim); }
.tk-next b { color: var(--ink); font-weight: 600; }
.tk-you p { margin: 6px 0 0; font-size: 14.5px; }
.flow { display: grid; grid-template-columns: minmax(0, 1fr) 22px minmax(0, 1.25fr) 22px minmax(0, 0.9fr) 22px minmax(0, 1.25fr); gap: 0 10px; padding: 6px 20px 22px; align-items: stretch; }
.fl-box { background: var(--panel-2); border-radius: var(--r-sm); padding: 14px 16px; min-width: 0; }
.fl-box h3 { margin: 0 0 8px; font-size: 12px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-faint); }
.fl-row { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; padding: 3px 0; }
.fl-row span:last-child { font-family: var(--mono); font-size: 13.5px; white-space: nowrap; }
.fl-arrow { align-self: center; height: 34px; background: var(--ink-faint); clip-path: polygon(0 0, 45% 0, 100% 50%, 45% 100%, 0 100%, 55% 50%); }
.fl-burn { background: var(--flag-soft); }
.fl-burn .fl-row:first-of-type span { color: var(--flag); font-weight: 600; }
.tk-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-top: 14px; }
.tk-gap { margin-top: 14px; }
.tk-note { margin: 6px 0 14px; font-size: 14.5px; }
/* coin day: the coin's address, shown once the launch file names it */
.tk-coin { margin-bottom: 14px; border-color: var(--flag); }
/* paper trading mode: the counts on this page are play numbers, said in one line under the real coin's address */
.tk-paper { margin: 0 0 14px; padding: 11px 16px; border-radius: var(--r-sm); background: var(--flag-soft); color: var(--flag); font-weight: 500; font-size: 14.5px; line-height: 1.45; }
.tk-coin-k { font-family: var(--display); font-style: italic; font-weight: 600; font-size: 17px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--flag); }
.tk-addr { margin-top: 8px; font-size: 16px; line-height: 1.4; color: var(--ink); overflow-wrap: anywhere; -webkit-user-select: all; user-select: all; }
.tk-coin-acts { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.tk-coin-acts .btn-ghost { min-height: 44px; padding: 10px 18px; font-size: 15px; }
.tk-coin-acts a.btn-ghost { background: none; color: var(--ink); border: 1px solid var(--line-strong); }
.supply-bar { display: flex; height: 16px; transform: skewX(-24deg); margin: 6px 6px 14px; gap: 3px; }
.supply-bar i { display: block; background: var(--ink); border-radius: 1px; }
.supply-bar i.pub { width: 90%; }
.supply-bar i.t { background: var(--flag); width: 10%; }
.legend { display: grid; gap: 8px; font-size: 14px; }
.legend div { display: grid; grid-template-columns: 12px 1fr auto; gap: 10px; align-items: baseline; }
.legend i { width: 9px; height: 14px; transform: skewX(-24deg); background: var(--ink); display: block; align-self: center; }
.legend i.t { background: var(--flag); }
.legend i.m { background: var(--ink-faint); }
.legend b { font-family: var(--mono); font-weight: 500; font-size: 13.5px; }
.legend small { grid-column: 2 / -1; color: var(--ink-faint); font-size: 12.5px; margin-top: -6px; }
.paid { margin: 12px 0 0; padding: 0; list-style: none; display: grid; gap: 12px; font-size: 14.5px; color: var(--ink-dim); }
.paid b { color: var(--ink); font-weight: 600; }
.day td:first-child { font-family: var(--display); font-style: italic; font-weight: 600; font-size: 19px; text-transform: uppercase; letter-spacing: 0.03em; white-space: nowrap; }
.day td { text-align: left; font-family: var(--body); font-size: 14.5px; white-space: normal; color: var(--ink-dim); }
.day tr.live td { color: var(--ink); }
.more { display: inline-flex; align-items: center; min-height: 44px; margin-top: 6px; color: var(--ink); font-weight: 600; font-size: 14.5px; }

/* all markets, and the panel for a browser with no wallet: a panel on wide screens, a sheet from the bottom on small ones */
.board {
  position: fixed; z-index: 80; left: 50%; top: 84px; display: flex; flex-direction: column;
  width: min(720px, calc(100vw - 48px)); max-height: calc(100vh - 120px); max-height: calc(100dvh - 120px);
  background: var(--panel); border: 1px solid var(--line-strong); border-radius: var(--r);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.7);
  visibility: hidden; opacity: 0; pointer-events: none; transform: translate(-50%, -8px);
  transition: opacity 0.16s ease, transform 0.16s ease, visibility 0s linear 0.16s;
}
.board.wallets { width: min(460px, calc(100vw - 48px)); }
html.board-open #board, html.wallets-open #wallets { visibility: visible; opacity: 1; pointer-events: auto; transform: translate(-50%, 0); transition: opacity 0.16s ease, transform 0.16s ease; }
.board:focus { outline: none; }
html.board-open .scrim, html.wallets-open .scrim { display: block; position: fixed; inset: 0; z-index: 70; width: 100%; border: 0; padding: 0; background: rgba(0, 0, 0, 0.64); opacity: 1; pointer-events: auto; }
.board-head { display: flex; align-items: baseline; gap: 12px; padding: 12px 8px 4px 20px; flex: none; }
.board-head small { color: var(--ink-faint); font-size: 13px; }
.x-btn { flex: none; align-self: center; margin-left: auto; width: 44px; height: 44px; border: 0; background: none; border-radius: 50%; position: relative; }
.x-btn::before, .x-btn::after { content: ""; position: absolute; left: 13px; right: 13px; top: 21px; height: 2px; background: var(--ink-dim); border-radius: 1px; }
.x-btn::before { transform: rotate(45deg); }
.x-btn::after { transform: rotate(-45deg); }
.x-btn:hover::before, .x-btn:hover::after { background: var(--ink); }
.board-now { display: flex; align-items: center; gap: 4px 9px; flex-wrap: wrap; padding: 0 20px 10px; font-size: 14px; color: var(--ink-dim); flex: none; }
.board-now img { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; background: var(--panel-3); }
.board-now b { color: var(--ink); font-weight: 600; }
.board-now .mono { font-size: 13px; }
.now-k { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-faint); }
.board-find { padding: 0 20px; flex: none; }
.board-find input { width: 100%; min-height: 46px; padding: 0 14px; background: var(--bg); border: 1px solid var(--line-strong); border-radius: var(--r-sm); font-size: 16px; outline: 0; -webkit-appearance: none; appearance: none; }
.board-find input::placeholder { color: var(--ink-faint); opacity: 1; }
.board-find input:focus { border-color: var(--ink); }
.board-find input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.board-sort { display: flex; gap: 6px; flex-wrap: wrap; padding: 10px 20px; flex: none; }
.chip2 { min-height: 34px; padding: 0 13px; border: 1px solid var(--line-strong); border-radius: 999px; background: none; color: var(--ink-dim); font-size: 13.5px; white-space: nowrap; }
.chip2:hover { color: var(--ink); }
.chip2[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #12110e; font-weight: 600; }
.board-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; border-top: 1px solid var(--line); border-radius: 0 0 var(--r) var(--r); }
.row {
  display: grid; grid-template-columns: 28px 36px minmax(0, 1fr) 96px 78px 76px; gap: 0 12px; align-items: center;
  width: 100%; min-height: 58px; padding: 6px 20px 6px 14px; background: none; border: 0; border-bottom: 1px solid var(--line); text-align: left;
}
.with-vol .row { grid-template-columns: 28px 36px minmax(0, 1fr) 96px 78px 76px 104px; }
.row:last-child { border-bottom: 0; }
.row:hover, .row.on { background: var(--panel-2); }
.row[aria-current="true"] { background: var(--panel-2); box-shadow: inset 3px 0 0 var(--ink); }
.row:focus-visible { outline-offset: -2px; }
.row-rank { font-family: var(--display); font-style: italic; font-weight: 600; font-size: 16px; color: var(--ink-faint); text-align: right; }
.row img { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; display: block; background: var(--panel-3); }
.row-who { min-width: 0; }
.row-name { display: flex; align-items: center; min-width: 0; font-weight: 600; font-size: 15.5px; line-height: 1.2; }
.row-n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-name .tag { flex: none; font-size: 12.5px; padding: 0 5px 1px; }
.row-handle { display: block; color: var(--ink-faint); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-v2 { display: none; }
.row-spark { width: 96px; height: 28px; display: block; }
.row-price { font-family: var(--display); font-style: italic; font-weight: 600; font-size: 22px; line-height: 1; text-align: right; white-space: nowrap; }
.row-chg, .row-vol { font-family: var(--mono); font-size: 12.5px; text-align: right; white-space: nowrap; }
.row-vol { color: var(--ink-dim); }
.board-empty { padding: 26px 20px 30px; color: var(--ink-dim); font-size: 14.5px; overflow-wrap: anywhere; }
.wallets-body { padding: 2px 20px 20px; overflow-y: auto; overscroll-behavior: contain; font-size: 15px; color: var(--ink-dim); }
.wallets-body p { margin: 0 0 12px; }
.wallets-body p:first-child { color: var(--ink); }
.wallets-body a { color: var(--ink); }
.wallet-links { display: grid; gap: 10px; margin: 16px 0; }
.wallet-link {
  display: flex; align-items: center; justify-content: center; width: 100%; min-height: 54px; padding: 6px 14px; border: 0; border-radius: 10px;
  background: var(--ink); color: #12110e; text-decoration: none; text-align: center;
  font-family: var(--display); font-style: italic; font-weight: 700; font-size: 23px; text-transform: uppercase; letter-spacing: 0.03em;
}
.wallets-body a.wallet-link { color: #12110e; }
/* a list to pick from: the wallets found in this browser, or the accounts a wallet shares */
.wallet-links.pick .wallet-link { gap: 12px; }
.wallet-links.pick .wallet-link img { width: 28px; height: 28px; border-radius: 7px; flex: none; }
.wallet-links.pick .wallet-link span { min-width: 0; overflow-wrap: anywhere; }
.wallet-link.mono-link { font-family: var(--mono); font-style: normal; font-weight: 500; font-size: 17px; text-transform: none; letter-spacing: 0; }
/* adding margin: the ticket's own field, chips, sums and button, in the panel */
.wallets-body .field-k { margin-top: 6px; }
.wallets-body .sum { margin-top: 14px; }
.wallets-body .err { margin-top: 10px; min-height: 0; }
.wallets-body .err:empty { display: none; }
.wallets-body .go { margin-top: 6px; }
.go.add { background: var(--ink); color: #12110e; }
/* the button stays in reach on a short screen, or above a keyboard, while the rest of the panel scrolls under it */
.addm-foot { position: sticky; bottom: 0; background: var(--panel); padding: 8px 0 calc(16px + var(--sb, 0px)); margin-bottom: calc(-20px - var(--sb, 0px)); }
.gear:disabled { opacity: 0.35; cursor: not-allowed; }
/* a wide screen that is short (a large phone held sideways): the panels use the height there is */
@media (min-width: 900px) and (max-height: 560px) {
  .board { top: 10px; max-height: calc(100vh - 20px); max-height: calc(100dvh - 20px); }
  .board-now { display: none; }
  .board-sort { padding-top: 8px; padding-bottom: 8px; }
  .wallets-body p { margin-bottom: 8px; }
  .wallet-links { grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 10px 0; }
  .wallet-link { min-height: 46px; font-size: 19px; }
}
/* measures the text size the phone is set to (see textSize in app.js) */
.tz-probe { position: absolute; left: -300px; top: 0; visibility: hidden; padding: 0; border: 0; font-size: 20px; line-height: 1; white-space: nowrap; }

/* ---------- 1199 and under: the side column narrows ---------- */
@media (max-width: 1199px) {
  .main { grid-template-columns: minmax(0, 1fr) 340px; }
  .stats, .stats[data-n="6"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stat:nth-child(3) { border-right: 0; }
  .stat:nth-child(n+4) { border-top: 1px solid var(--line); }
}
@media (max-width: 1040px) {
  .tk-top, .tk-grid { grid-template-columns: minmax(0, 1fr); }
  .flow { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .fl-arrow { display: none; }
  .lower { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- below 900: one column. The ticket becomes a sheet that slides up from the bottom. ---------- */
@media (max-width: 899px) {
  body.view-trade { --tradebar-h: 60px; }
  .main { grid-template-columns: minmax(0, 1fr); }

  .tradebar {
    display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; align-items: center;
    position: fixed; left: 0; right: 0; bottom: calc(var(--tabs-h) + var(--sb)); z-index: 55;
    height: var(--tradebar-h); padding: 0 max(12px, var(--sr)) 0 max(12px, var(--sl));
    background: var(--panel);
    border-top: 1px solid var(--line-strong);
  }
  body.view-token .tradebar { display: none; }
  .tb-info { display: flex; align-items: center; gap: 9px; min-width: 0; background: none; border: 0; padding: 0; text-align: left; height: 100%; }
  .tb-info img { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; flex: none; background: var(--panel-3); }
  .tb-txt { min-width: 0; display: grid; }
  .tb-name { font-weight: 600; font-size: 14px; line-height: 1.15; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tb-price { font-family: var(--mono); font-size: 12.5px; color: var(--ink-dim); white-space: nowrap; }
  .tb-btn {
    border: 0; border-radius: 7px; min-width: 92px; height: 44px; padding: 0 14px;
    font-family: var(--display); font-style: italic; font-weight: 700; font-size: 23px; text-transform: uppercase; letter-spacing: 0.03em;
    transform: skewX(-12deg);
  }
  .tb-btn span { display: inline-block; transform: skewX(12deg); }
  .tb-btn.long { background: var(--long); color: #06240f; }
  .tb-btn.short { background: var(--short); color: #2b0704; }

  .scrim { display: block; position: fixed; inset: 0; z-index: 70; width: 100%; border: 0; padding: 0; background: rgba(0, 0, 0, 0.64); opacity: 0; pointer-events: none; transition: opacity 0.2s ease; }
  html.sheet-open .scrim { opacity: 1; pointer-events: auto; }
  html.sheet-open, html.sheet-open body { overflow: hidden; }

  .ticket {
    position: fixed; top: auto; left: 0; right: 0; bottom: var(--kb, 0px); z-index: 80;
    width: 100%; max-width: 560px; margin: 0 auto;
    max-height: 92vh;
    max-height: calc(var(--vvh, 100dvh) - 10px);
    overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
    border-radius: 18px 18px 0 0; border-bottom: 0; border-color: var(--line-strong);
    box-shadow: 0 -24px 70px rgba(0, 0, 0, 0.65);
    transform: translateY(104%); visibility: hidden;
    transition: transform 0.26s cubic-bezier(0.2, 0.8, 0.2, 1), visibility 0s linear 0.26s;
  }
  html.sheet-open .ticket { transform: none; visibility: visible; transition: transform 0.26s cubic-bezier(0.2, 0.8, 0.2, 1); }
  .sheet-head {
    display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 3;
    background: var(--panel); padding: 12px 10px 4px 18px; border-radius: 18px 18px 0 0;
  }
  .sheet-head::before { content: ""; position: absolute; top: 6px; left: 50%; width: 38px; height: 4px; margin-left: -19px; border-radius: 2px; background: var(--line-strong); }
  .sheet-head img { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; flex: none; background: var(--panel-3); }
  .sheet-title { font-weight: 600; font-size: 16px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .sheet-price { font-family: var(--mono); font-size: 13.5px; color: var(--ink-dim); margin-left: auto; white-space: nowrap; }
  .sheet-x { flex: none; width: 44px; height: 44px; border: 0; background: none; border-radius: 50%; position: relative; }
  .sheet-x::before, .sheet-x::after { content: ""; position: absolute; left: 13px; right: 13px; top: 21px; height: 2px; background: var(--ink-dim); border-radius: 1px; }
  .sheet-x::before { transform: rotate(45deg); }
  .sheet-x::after { transform: rotate(-45deg); }
  .sides { padding-top: 6px; }
  .t-body { padding-bottom: calc(14px + var(--sb)); }
  /* the two halves of the ticket are one column here, so the button at its foot stays in view however short the
     sheet gets: with the keyboard up, with the address bar showing, with large text */
  .t-col { display: contents; }
  .t-foot { position: sticky; bottom: 0; z-index: 2; margin: 0 -20px; padding: 2px 20px max(8px, var(--sb)); background: linear-gradient(to bottom, rgba(22, 21, 18, 0), var(--panel) 14px); }
  .t-foot + .warn { margin-top: 4px; }
  /* while a sheet is open, messages rise at the top: they never cover the button a thumb is on */
  html.sheet-open .toasts, html.board-open .toasts, html.wallets-open .toasts { bottom: auto; top: calc(var(--st) + 10px); }
  .t-foot .err { margin-top: 8px; }
  .chip { min-height: 40px; font-size: 13.5px; }
  .gear, .gear-max { min-height: 46px; font-size: 22px; }
  .ref-x { min-height: 40px; padding-left: 16px; padding-right: 16px; }
  section.down { padding: 32px 0 48px; }
  .down h1 { font-size: 34px; }
  .lev-note { font-size: 13px; }

  /* the chart's buttons are for fingers here */
  .iv, .tool { height: 40px; }
  .tool-map { height: 40px; }
  .ivs { flex: 1 1 auto; }
  .iv { flex: 1 1 0; min-width: 0; padding: 0; }
  .all-mk { min-height: 48px; }

  /* all markets and the wallet panel become sheets */
  html.board-open, html.board-open body, html.wallets-open, html.wallets-open body { overflow: hidden; }
  .board, .board.wallets {
    left: 0; right: 0; top: auto; bottom: var(--kb, 0px); width: 100%; max-width: 640px; margin: 0 auto;
    max-height: 92vh; max-height: calc(var(--vvh, 100dvh) - 26px);
    border-radius: 18px 18px 0 0; border-bottom: 0;
    box-shadow: 0 -24px 70px rgba(0, 0, 0, 0.65);
    opacity: 1; transform: translateY(104%);
    transition: transform 0.26s cubic-bezier(0.2, 0.8, 0.2, 1), visibility 0s linear 0.26s;
  }
  #board { height: 92vh; height: calc(var(--vvh, 100dvh) - 26px); }       /* one height, so it does not jump while a name is typed */
  html.board-open #board, html.wallets-open #wallets { transform: none; transition: transform 0.26s cubic-bezier(0.2, 0.8, 0.2, 1); }
  /* held sideways, a notch stands at one end of a sheet: its contents keep clear of both ends */
  .board, .board.wallets, .ticket { padding-left: var(--sl); padding-right: var(--sr); }
  .board-head { position: relative; padding-top: 16px; }
  .board-head::before { content: ""; position: absolute; top: 6px; left: 50%; width: 38px; height: 4px; margin-left: -19px; border-radius: 2px; background: var(--line-strong); }
  .board-list { border-radius: 0; padding-bottom: var(--sb); }
  .wallets-body { padding-bottom: calc(20px + var(--sb)); }
  .chip2 { min-height: 40px; padding: 0 15px; }
  /* a row on a small screen: name over handle on the left, price over change on the right */
  .row, .with-vol .row { grid-template-columns: 26px 36px minmax(0, 1fr) auto; grid-template-areas: "rank img who price" "rank img who chg"; gap: 0 10px; min-height: 60px; padding: 8px 16px 8px 10px; }
  .row-rank { grid-area: rank; }
  .row img { grid-area: img; }
  .row-who { grid-area: who; }
  .row-price { grid-area: price; align-self: end; }
  .row-chg { grid-area: chg; align-self: start; }
  .row-spark, .row-vol { display: none; }
  .row-v2 { display: inline; }
}

/* ---------- tablets held upright: three market cards with room for the whole name ---------- */
@media (min-width: 600px) and (max-width: 899px) {
  .lane { grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "img who who" "price price chg" "spark spark spark" "tug tug tug" "leg leg leg"; }
  .lane img { grid-area: img; width: 42px; height: 42px; }
  .lane-who { grid-area: who; padding-right: 34px; }
  .lane-price { grid-area: price; text-align: left; padding-top: 8px; font-size: 32px; }
  .lane-chg { grid-area: chg; grid-column: auto; align-self: end; padding-bottom: 3px; }
  .lane-spark { grid-area: spark; }
  .tug { grid-area: tug; }
  .tug-legend { grid-area: leg; }

  /* positions as cards here too, four across: the table has nine columns and two buttons, more than this width holds */
  #pos-body table, #pos-body tbody, #pos-body td { display: block; }
  #pos-body thead { display: none; }
  #pos-body tr { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px 14px; padding: 14px 16px 16px; border-top: 1px solid var(--line); }
  #pos-body td, #pos-body td:first-child, #pos-body td:last-child { padding: 0; border: 0; text-align: left; white-space: normal; font-size: 14.5px; }
  #pos-body td[data-k]::before { content: attr(data-k); display: block; font-family: var(--body); font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-faint); margin-bottom: 1px; }
  #pos-body td.who { font-size: 17px; align-self: center; grid-column: 1 / 3; }
  #pos-body td.sidec { text-align: right; align-self: center; grid-column: 3 / 5; }
  #pos-body td[data-c="pnl"] { grid-column: span 2; }
  #pos-body td.act, #pos-body tr.waiting td { grid-column: 1 / -1; }
  #pos-body td.act { display: flex; flex-wrap: wrap; gap: 10px; }
  #pos-body td.act .close-btn { flex: 1 1 0; width: auto; min-width: 0; margin: 0; min-height: 44px; font-size: 15px; font-weight: 600; border-radius: 9px; }
  #pos-body td.act .confirming { flex: 1 0 100%; }
  .wait-box .collect-btn { min-height: 44px; }
  .pos-note { padding: 12px 16px 16px; }
}

/* ---------- phones ---------- */
@media (max-width: 599px) {
  .thesis { padding: 20px 0 14px; }
  .thesis p { font-size: 15px; }

  /* the three markets stay side by side as compact tiles */
  .lanes { gap: 8px; }
  .lane { grid-template-columns: 30px minmax(0, 1fr); grid-template-areas: "img who" "price price" "chg chg" "tug tug"; gap: 3px 8px; padding: 10px 10px 11px; border-radius: 11px; }
  .lane img { grid-area: img; width: 30px; height: 30px; }
  .lane-who { grid-area: who; }
  .lane-name { font-size: 14px; }
  .lane-handle, .lane-rank, .lane-spark, .tug-legend { display: none; }
  .lane-price { grid-area: price; text-align: left; font-size: 27px; padding-top: 6px; }
  .lane-chg { grid-area: chg; grid-column: auto; text-align: left; font-size: 12px; }
  .tug { grid-area: tug; height: 7px; margin: 5px 2px 0; }

  .card { border-radius: 12px; }
  .card-pad { padding: 16px; }
  .mk-head { padding: 16px 16px 4px; gap: 12px; }
  .mk-head img { width: 46px; height: 46px; }
  .mk-name { font-size: 18px; }
  .mk-price .big { font-size: 44px; }
  .mk-price .big small { font-size: 18px; }
  .mk-price .chg { font-size: 12.5px; }
  .stats, .stats[data-n="6"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat { padding: 10px 16px; border-top: 1px solid var(--line); }
  .stat:nth-child(odd) { border-right: 1px solid var(--line); }
  .stat:nth-child(even) { border-right: 0; }
  .stat:nth-child(-n+2) { border-top: 0; }
  .stat:last-child:nth-child(odd) { grid-column: 1 / -1; border-right: 0; }
  .chart-bar, .near { padding-left: 16px; padding-right: 16px; }
  .chart-bar { padding-top: 10px; }
  .chart-tools { width: 100%; justify-content: space-between; }
  .chart-legend { left: 8px; top: 10px; font-size: 10.5px; }
  .lg-bar { gap: 0 7px; }
  .lg-note { font-size: 12px; max-width: 250px; }
  #chart { height: 320px; }
  .near { grid-template-columns: 1fr; }
  .lanes { min-height: 118px; }
  .lanes[data-n="4"], .lanes[data-n="5"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .all-mk { margin-top: 8px; padding: 0 12px; }
  .mk-pick { gap: 12px; }
  .board-head { padding-left: 16px; }
  .board-now, .board-find, .board-sort { padding-left: 16px; padding-right: 16px; }
  .wallets-body { padding-left: 16px; padding-right: 16px; }
  .t-body { padding-left: 16px; padding-right: 16px; }
  .t-foot { margin: 0 -16px; padding: 2px 16px max(8px, var(--sb)); }
  .card-head { padding: 14px 16px 8px; }
  .empty { padding: 20px 16px 24px; }

  /* positions turn from a table into cards */
  #pos-body table, #pos-body tbody, #pos-body td { display: block; }
  #pos-body thead { display: none; }
  #pos-body tr { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px 14px; padding: 14px 16px 16px; border-top: 1px solid var(--line); }
  #pos-body td, #pos-body td:first-child, #pos-body td:last-child { padding: 0; border: 0; text-align: left; white-space: normal; font-size: 14.5px; }
  #pos-body td[data-k]::before { content: attr(data-k); display: block; font-family: var(--body); font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-faint); margin-bottom: 1px; }
  #pos-body td.who { font-size: 17px; align-self: center; }
  #pos-body td.sidec { text-align: right; align-self: center; }
  #pos-body td[data-c="pnl"], #pos-body td.act { grid-column: 1 / -1; }
  .close-btn { width: 100%; min-height: 46px; font-size: 15px; font-weight: 600; border-radius: 9px; }
  /* two buttons side by side under each position: add margin, close */
  #pos-body td.act { display: flex; flex-wrap: wrap; gap: 10px; }
  #pos-body td.act .close-btn { flex: 1 1 0; width: auto; min-width: 0; margin: 0; padding-left: 8px; padding-right: 8px; }
  #pos-body td.act .confirming { flex: 1 0 100%; }
  #pos-body td[data-c="wear"] { grid-column: 1 / -1; }
  #pos-body tr.waiting td { grid-column: 1 / -1; }
  .wait-box { flex-direction: column; align-items: stretch; }
  .wait-box .collect-btn { width: 100%; }
  .pos-note { padding: 12px 16px 16px; }

  /* the feed stays a table, tightened */
  .feed table { font-size: 12.5px; }
  .feed th, .feed td { padding-left: 5px; padding-right: 5px; }
  .feed th:first-child, .feed td:first-child { padding-left: 16px; }
  .feed th:last-child, .feed td:last-child { padding-right: 16px; }
  .feed .tag { font-size: 13.5px; padding: 0 5px 1px; }

  .how { grid-template-columns: 1fr; margin-top: 30px; }
  .how div { padding: 18px 0 14px; }
  .how div + div { padding-left: 0; border-left: 0; border-top: 1px solid var(--line); }
  .how h3 { font-size: 25px; }

  .tk-burn { padding: 18px 16px 16px; }
  .flow { padding: 4px 16px 18px; }
  th:first-child, td:first-child { padding-left: 16px; }
  th:last-child, td:last-child { padding-right: 16px; }
  .day td:first-child { font-size: 17px; white-space: normal; min-width: 96px; }
}
@media (max-width: 419px) {
  /* three narrow tiles: the opening count sits closer to the corner, and a count with hours drops its two words */
  .lane-open { left: 6px; max-width: calc(100% - 12px); font-size: 12px; letter-spacing: 0.02em; padding: 0 4px 1px; }
  .lane-open.hours .lane-open-k { display: none; }
  .feed th:nth-child(5), .feed td:nth-child(5) { display: none; }
  .feed th:nth-child(4), .feed td:nth-child(4) { padding-right: 16px; }
  .tb-btn { min-width: 78px; font-size: 21px; padding: 0 10px; }
  .gear, .gear-max { font-size: 20px; }
}
@media (max-width: 359px) {
  .lanes { gap: 6px; }
  .lane { grid-template-columns: minmax(0, 1fr); grid-template-areas: "img" "who" "price" "chg" "tug"; padding: 9px 8px 10px; }
  .lane-name { font-size: 13px; }
  .lane-price { font-size: 23px; padding-top: 3px; }
  .lane-chg { font-size: 11px; }
  .mk-head img { width: 40px; height: 40px; }
  .mk-price .big { font-size: 38px; }
  .mk-price .big small { font-size: 16px; }
  .tb-info img { display: none; }
  .tb-btn { min-width: 68px; font-size: 20px; }
  .amount input { font-size: 30px; }
  .side-btn, .go { font-size: 23px; }
  .feed table { font-size: 12px; }
  .stat-v { font-size: 13px; }
}
@media (max-width: 339px) {
  .feed table { font-size: 11.5px; }
  .feed th, .feed td { padding-left: 3px; padding-right: 3px; }
  .feed th:first-child, .feed td:first-child { padding-left: 10px; }
  .feed th:nth-child(4), .feed td:nth-child(4) { padding-right: 10px; }
  .feed .tag { font-size: 12.5px; padding: 0 4px 1px; }
  .card-head, .mk-head { padding-left: 12px; padding-right: 12px; }
  .stat { padding-left: 12px; padding-right: 12px; }
  .t-body { padding-left: 12px; padding-right: 12px; }
  .t-foot { margin: 0 -12px; padding: 2px 12px max(8px, var(--sb)); }
  .chart-bar, .near { padding-left: 10px; padding-right: 10px; }
  .ivs { gap: 0; }
  .all-mk-find { display: none; }
  .all-mk { justify-content: center; }
  .tool-map .wide { display: none; }
}

/* ---------- a phone held sideways: short and wide ---------- */
@media (max-height: 480px) and (orientation: landscape) and (max-width: 899px) {
  body.view-trade { --tradebar-h: 0px; }
  /* tabs on the left, long and short on the right, one row */
  .tabs { right: 44%; }
  .tradebar { left: 56%; bottom: 0; height: calc(var(--tabs-h) + var(--sb)); padding: 0 max(8px, var(--sr)) var(--sb) 8px; grid-template-columns: 1fr 1fr; gap: 6px; border-left: 1px solid var(--line-strong); }
  .tb-info { display: none; }
  .tb-btn { height: 44px; min-width: 0; font-size: 20px; }
  #chart { height: 230px; }
  .chart-tools { width: auto; }
  .ivs { flex: 0 1 auto; }
  .iv { flex: 0 0 auto; min-width: 44px; }
  .lanes { min-height: 0; }
  .board, .board.wallets { max-width: none; max-height: calc(var(--vvh, 100dvh) - 8px); }
  /* the list of markets on a short, wide screen: the search and the sorts share one row, so more rows show */
  #board { min-height: 0; height: calc(var(--vvh, 100dvh) - 8px); display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto auto minmax(0, 1fr); }
  #board .board-head { grid-column: 1 / -1; }
  #board .board-find { padding-right: 8px; align-self: center; }
  #board .board-sort { padding: 4px 20px 4px 0; flex-wrap: nowrap; align-self: center; }
  #board .board-list { grid-column: 1 / -1; margin-top: 6px; }
  .board-head { padding-top: 12px; padding-bottom: 0; }
  .board-now { display: none; }
  .board-find input { min-height: 42px; }
  .wallet-links { grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 10px 0; }
  .wallet-link { min-height: 46px; font-size: 19px; }
  .wallets-body p { margin-bottom: 8px; font-size: 14px; }
  .ticket { max-width: none; border-radius: 14px 14px 0 0; }
  .sheet-head { padding-top: 10px; }
  .t-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 22px; padding-top: 10px; }
  .t-col { display: block; }
  .t-col .sum { margin-top: 0; padding-top: 0; border-top: 0; }
  .lev { margin-top: 12px; }
  .t-foot { margin: 0; padding: 0 0 max(2px, var(--sb)); background: linear-gradient(to bottom, rgba(22, 21, 18, 0), var(--panel) 12px); }
  .t-foot .err { margin-top: 4px; min-height: 0; }
  .sides { padding-top: 2px; }
  .side-btn { min-height: 44px; padding: 6px 0 7px; font-size: 22px; }
  .gear, .gear-max { min-height: 44px; }
  .go { min-height: 46px; padding: 9px 0 10px; }
  .sum { gap: 5px; }
}

/* fingers need bigger targets than a mouse does */
@media (pointer: coarse) {
  .chip { min-height: 40px; font-size: 13.5px; }
  .gear, .gear-max { min-height: 46px; }
  .close-btn { min-height: 44px; padding-left: 16px; padding-right: 16px; }
  .iv, .tool, .tool-map { height: 40px; }
  .chip2 { min-height: 40px; }
  .confirming { min-height: 44px; }
  .ref-x { min-height: 40px; padding-left: 16px; padding-right: 16px; }
}

/* ---------- text set large in the phone's settings (html.bigtext, see textSize in app.js). The text grows; these
   rules give it room: rows that stood side by side stand under each other, and labels may take a second line. ---------- */
html.bigtext .field-k, html.bigtext .card-head, html.bigtext .sum div, html.bigtext .board-head { flex-wrap: wrap; }
html.bigtext .field-k b { white-space: normal; text-align: right; margin-left: auto; }
html.bigtext .sum dd { white-space: normal; margin-left: auto; }
html.bigtext .feed { max-height: none; }
html.bigtext .near { grid-template-columns: minmax(0, 1fr); }
html.bigtext .row-name, html.bigtext .mk-name { flex-wrap: wrap; }
html.bigtext .chart-tools { flex-wrap: wrap; }
@media (max-width: 899px) {
  html.bigtext .lanes, html.bigtext .lanes[data-n] { grid-template-columns: minmax(0, 1fr); gap: 8px; min-height: 0; }
  html.bigtext .lane { grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "img who price" "img who chg" "tug tug tug"; gap: 2px 10px; }
  html.bigtext .lane img { grid-area: img; }
  html.bigtext .lane-who { grid-area: who; padding-right: 0; }
  html.bigtext .lane-handle { display: block; }
  html.bigtext .lane-price { grid-area: price; padding-top: 0; text-align: right; }
  html.bigtext .lane-chg { grid-area: chg; grid-column: auto; text-align: right; align-self: start; padding-bottom: 0; }
  html.bigtext .lane-spark, html.bigtext .lane-rank, html.bigtext .tug-legend { display: none; }
  html.bigtext .tug { grid-area: tug; }
  html.bigtext .stats, html.bigtext .stats[data-n="6"] { grid-template-columns: minmax(0, 1fr); }
  html.bigtext .stat, html.bigtext .stat:nth-child(odd) { border-right: 0; border-top: 1px solid var(--line); }
  html.bigtext .stat:first-child { border-top: 0; }
  html.bigtext .mk-price { margin-left: 0; text-align: left; }
  html.bigtext .all-mk-find { display: none; }
  html.bigtext .tb-info img { display: none; }
}
@media (max-width: 419px) {
  html.bigtext .nav .word { display: none; }
}
@media (max-width: 279px) {
  .tb-btn { min-width: 58px; font-size: 18px; padding: 0 6px; }
  .tb-name { font-size: 13px; }
  .tool-map .wide { display: none; }
  .mk-price .big { font-size: 34px; }
}
