/* Hallmark · shape: app screen (exchange-app pattern: home, market, trade, history, assets) · genre: modern-minimal · theme: custom, keyed to the CRYPFORD logo (navy #0A2463, red #E8412C, Montserrat 800)
 * nav: bottom dock under 60rem, top bar above · signature: the trade screen, H75's position where an order form would be, beside the live public book · states: loading, empty, error, stale, full · v2.0.0 */
/* Hallmark · pre-emit critique: P4 H4 E4 S4 R4 V4 · weakest: S, the order-form slot holds read-only facts; made it read as facts (no inputs, no fake submit) */
/* waive 46a: every figure is the user's own paper record or Bitget's public market data; nothing is invented */
/* waive 54: the wordmark keeps the logo's letter spacing; it is the logo, not a label */
@import url("./tokens.css");
@import url("./base.css");

:root {
  color-scheme: dark;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Segoe UI", sans-serif;
  --font-logo: "Montserrat", var(--font-display);
  --font-body: var(--font-display);
  --font-outlier: var(--font-display);
  --display-weight: 700; --tracking-display: 0;

  --color-paper: oklch(10% 0.003 260); --color-paper-2: oklch(21% 0.004 260); --color-paper-3: oklch(14.5% 0.003 260);
  --color-ink: oklch(97% 0.002 260); --color-ink-2: oklch(86% 0.004 260); --color-muted: oklch(64% 0.006 260);
  --color-rule: oklch(22% 0.004 260); --color-rule-2: oklch(32% 0.005 260);
  --color-buy: oklch(67% 0.17 256); --color-sell: oklch(65% 0.21 25);
  --color-buy-strong: oklch(57% 0.2 258); --color-sell-strong: oklch(58% 0.22 25);
  --color-buy-soft: oklch(24% 0.07 258); --color-sell-soft: oklch(24% 0.08 25);
  --color-ok: var(--color-buy); --color-bad: var(--color-sell); --color-ok-soft: var(--color-buy-soft); --color-bad-soft: var(--color-sell-soft);
  --color-accent: var(--color-buy); --color-accent-ink: oklch(15% 0.03 266); --color-accent-soft: var(--color-buy-soft); --color-focus: oklch(78% 0.12 260);
  --color-primary: var(--color-ink); --color-primary-ink: var(--color-paper);
  --color-brand-navy: oklch(56% 0.15 263); --color-brand-red: oklch(62% 0.2 33); --color-on-strong: oklch(99% 0.004 266);
  --radius-card: 12px; --radius-pill: 8px;
  --top-h: 64px; --dock-h: 64px; --app-max: 1240px;
}
@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --color-paper: oklch(99.6% 0.001 260); --color-paper-2: oklch(95.8% 0.002 260); --color-paper-3: oklch(98% 0.001 260);
    --color-ink: oklch(18% 0.003 260); --color-ink-2: oklch(32% 0.004 260); --color-muted: oklch(52% 0.006 260);
    --color-rule: oklch(91% 0.003 260); --color-rule-2: oklch(82% 0.004 260);
    --color-buy: oklch(52% 0.2 258); --color-sell: oklch(55% 0.22 25);
    --color-buy-strong: oklch(53% 0.2 258); --color-sell-strong: oklch(57% 0.22 25);
    --color-buy-soft: oklch(94% 0.03 258); --color-sell-soft: oklch(95% 0.03 25);
    --color-accent-ink: oklch(99% 0.004 266); --color-focus: oklch(45% 0.17 262);
    --color-primary: oklch(18% 0.003 260); --color-primary-ink: oklch(99% 0.004 266);
    --color-brand-navy: oklch(27.5% 0.115 264); --color-brand-red: oklch(62% 0.2 33);
  }
}

html { font-size: 87.5%; }
body { min-height: 100dvh; line-height: 1.5; }
.measured { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }
.up { color: var(--color-buy); } .down { color: var(--color-sell); }
.muted { color: var(--color-muted); }
.mark-navy { stroke: var(--color-brand-navy); } .mark-red { stroke: var(--color-brand-red); } .mark-bar { fill: var(--color-brand-navy); }

/* ---- 上の帯（PC）---- */
.top { position: sticky; top: 0; z-index: var(--z-sticky-nav); background: var(--color-paper); border-bottom: var(--rule-hair) solid var(--color-rule); }
.top__in { max-width: var(--app-max); margin-inline: auto; padding-inline: var(--space-lg); height: var(--top-h); display: flex; align-items: center; gap: var(--space-xl); }
.brand { display: flex; align-items: center; gap: var(--space-xs); text-decoration: none; color: var(--color-ink); flex: none; }
.brand .mark { height: 24px; width: auto; }
.wordmark { font-family: var(--font-logo); font-weight: 800; letter-spacing: 0.1em; font-size: var(--text-md); }
.nav { display: flex; gap: var(--space-lg); }
.nav__a { display: flex; align-items: center; min-height: var(--top-h); color: var(--color-muted); text-decoration: none; font-weight: 600; font-size: var(--text-sm); transition: color var(--dur-short) var(--ease-out), box-shadow var(--dur-short) var(--ease-out); }
.nav__a:hover { color: var(--color-ink); }
.nav__a[aria-current="page"] { color: var(--color-ink); box-shadow: inset 0 -2px 0 var(--color-ink); }
.nav__a:active { color: var(--color-ink-2); }
.top .icon-btn { margin-left: auto; }

/* ---- 下の帯（スマホ）---- */
.dock { display: none; }

/* ---- 共通の部品 ---- */
main { max-width: var(--app-max); margin-inline: auto; padding: var(--space-lg) var(--space-lg) var(--space-2xl); }
.view { display: block; }
.view[hidden] { display: none; }
.icon-btn { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: var(--radius-pill); background: transparent; color: var(--color-ink); cursor: pointer; text-decoration: none; transition: background-color var(--dur-short) var(--ease-out); }
.icon-btn svg { width: 24px; height: 24px; }
.icon-btn:hover { background: var(--color-paper-2); }
.icon-btn:active { background: var(--color-rule); }
.icon-btn--solid { background: var(--color-ink); color: var(--color-paper); }
.icon-btn--solid:hover { background: var(--color-ink-2); }
.icon-btn[aria-current="page"] { background: var(--color-paper-2); }
.only-s { display: none; }

.appbar { display: flex; align-items: center; gap: var(--space-sm); min-height: 56px; }
.pill { flex: 1; min-width: 0; display: flex; align-items: center; gap: var(--space-xs); height: 48px; padding: 0 var(--space-md); border-radius: var(--radius-card); background: var(--color-paper-2); color: var(--color-muted); text-decoration: none; font-weight: 500; transition: background-color var(--dur-short) var(--ease-out); }
.pill svg { width: 20px; height: 20px; flex: none; }
.pill span:not(.pill__px) { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pill__px { margin-left: auto; color: var(--color-ink); font-weight: 600; }
.pill:hover { background: var(--color-rule); }
.pill:active { background: var(--color-rule-2); }

.page-hd { display: flex; align-items: center; gap: var(--space-xs); min-height: 56px; margin-bottom: var(--space-md); }
.page-hd h1 { font-size: var(--text-xl); max-width: none; }

/* ---- ホーム ---- */
.hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--space-xl); align-items: center; padding: var(--space-xl) 0; border-bottom: var(--rule-hair) solid var(--color-rule); }
.hero__art { order: 2; display: grid; place-items: center; }
.hero__art .mark { width: min(100%, 320px); height: auto; }
.hero__k { color: var(--color-muted); font-weight: 600; font-size: var(--text-sm); }
.hero__h { font-size: clamp(1.9rem, 1.4rem + 1.8vw, 2.6rem); line-height: 1.1; margin-top: var(--space-xs); max-width: none; }
.hero__p { margin-top: var(--space-md); color: var(--color-ink-2); }
.btn-xl { display: grid; place-items: center; height: 56px; margin-top: var(--space-lg); max-width: 26rem; border-radius: var(--radius-card); background: var(--color-primary); color: var(--color-primary-ink); text-decoration: none; font-weight: 700; font-size: var(--text-md); transition: opacity var(--dur-short) var(--ease-out); }
.btn-xl:hover { opacity: 0.9; }
.btn-xl:active { opacity: 0.8; }

.promo { display: flex; gap: var(--space-md); align-items: flex-start; padding: var(--space-lg) 0; border-bottom: var(--rule-hair) solid var(--color-rule); color: var(--color-ink); text-decoration: none; }
.promo__icon { flex: none; display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; background: var(--color-paper-2); color: var(--color-ink-2); }
.promo__icon svg { width: 28px; height: 28px; }
.promo__body { display: grid; gap: var(--space-2xs); min-width: 0; flex: 1; }
.promo__k { color: var(--color-muted); font-size: var(--text-sm); }
.promo__t { font-weight: 600; font-size: var(--text-lg); line-height: 1.35; }
.promo__more { display: inline-flex; align-items: center; gap: var(--space-xs); margin-top: var(--space-xs); color: var(--color-ink-2); font-size: var(--text-sm); }
.promo__more svg { width: 18px; height: 18px; transition: transform var(--dur-short) var(--ease-out); }
.promo:hover .promo__more svg { transform: translateX(4px); }
.promo__n { color: var(--color-muted); font-size: var(--text-sm); align-self: flex-end; }

.strip { display: grid; gap: var(--space-2xs); padding: var(--space-lg) 0; border-bottom: var(--rule-hair) solid var(--color-rule); color: var(--color-ink); text-decoration: none; }
.strip__k { color: var(--color-muted); font-size: var(--text-sm); }
.strip__v { font-size: var(--text-lg); font-weight: 600; }
.strip:hover .strip__v { color: var(--color-ink-2); }

.sec-h { margin: var(--space-xl) 0 var(--space-xs); font-size: var(--text-xl); max-width: none; }
.links { list-style: none; margin: 0 0 var(--space-lg); padding: 0; }
.links a { display: flex; align-items: center; gap: var(--space-md); padding: var(--space-md) 0; border-bottom: var(--rule-hair) solid var(--color-rule); color: var(--color-ink); text-decoration: none; }
.links a > svg { width: 24px; height: 24px; flex: none; color: var(--color-muted); }
.links a > svg:last-child { width: 18px; height: 18px; margin-left: auto; }
.links a > span { display: grid; gap: var(--space-3xs); min-width: 0; }
.links strong { font-weight: 600; }
.links small { color: var(--color-muted); font-size: var(--text-sm); }
.links a:hover strong { color: var(--color-ink-2); }

/* ---- 市場 ---- */
.subtabs { display: flex; gap: var(--space-lg); border-bottom: var(--rule-hair) solid var(--color-rule); margin-top: var(--space-xs); }
.subtabs span { padding: var(--space-xs) 0; font-weight: 600; box-shadow: inset 0 -2px 0 var(--color-ink); }
.mk__hd, .mk__row { display: grid; grid-template-columns: minmax(0, 1fr) auto 88px; gap: var(--space-md); align-items: center; }
.mk__hd { padding: var(--space-md) 0 var(--space-xs); color: var(--color-muted); font-size: var(--text-xs); }
.mk__hd span:nth-child(2) { text-align: right; } .mk__hd span:last-child { text-align: right; }
.mk__list { list-style: none; margin: 0; padding: 0; }
.mk__row { position: relative; padding: var(--space-md) 0; border-bottom: var(--rule-hair) solid var(--color-rule); }
.mk__name { display: grid; gap: var(--space-3xs); min-width: 0; }
.mk__sym { display: flex; align-items: center; gap: var(--space-xs); }
.mk__sym strong { font-weight: 700; font-size: var(--text-md); }
.mk__sym .muted { font-size: var(--text-sm); }
.mk__sym a { color: inherit; text-decoration: none; }
.mk__sym a::after { content: ""; position: absolute; inset: 0; }
.mk__row:has(a):hover { background: var(--color-paper-3); }
.mk__vol { font-size: var(--text-xs); min-height: 1lh; }
.mk__px { text-align: right; font-weight: 600; }
.mk__chg { display: grid; place-items: center; height: 36px; border-radius: 6px; background: var(--color-paper-2); color: var(--color-ink); font-weight: 600; font-size: var(--text-sm); }
.mk__chg.is-up { background: var(--color-buy-strong); color: var(--color-on-strong); }
.mk__chg.is-down { background: var(--color-sell-strong); color: var(--color-on-strong); }
.tag { display: inline-grid; place-items: center; height: 20px; padding: 0 var(--space-2xs); border-radius: 4px; background: var(--color-paper-2); color: var(--color-ink-2); font-size: var(--text-xs); font-weight: 600; }

/* ---- 取引 ---- */
.trade { display: grid; grid-template-columns: minmax(0, 1fr) 300px 320px; grid-template-areas: "head head head" "pos pos pos" "chart book sig" "pane pane pane"; gap: var(--space-lg) var(--space-lg); align-items: start; }
.t-head { grid-area: head; display: flex; align-items: center; justify-content: space-between; }
.sym h1 { font-size: var(--text-2xl); max-width: none; }
.sym p { display: flex; gap: var(--space-xs); margin-top: var(--space-2xs); font-size: var(--text-sm); font-weight: 500; }
.t-head .icon-btn { display: none; }
.t-sig { grid-area: sig; display: grid; gap: var(--space-xs); }
.t-book { grid-area: book; }
.t-chart { grid-area: chart; min-width: 0; }
.t-pane { grid-area: pane; min-width: 0; }
.chartbar { display: none; }

.chips { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 40px; gap: var(--space-xs); }
.chip { display: grid; place-items: center; height: 32px; border-radius: 6px; background: var(--color-paper-2); font-size: var(--text-sm); font-weight: 600; }
.chip--sell { color: var(--color-sell); } .chip--buy { color: var(--color-buy); }
.sides { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-2xs); padding: var(--space-2xs); border-radius: var(--radius-pill); background: var(--color-paper-2); }
.side { display: grid; place-items: center; height: 40px; border-radius: 6px; color: var(--color-muted); font-weight: 600; }
.side--buy.is-on { background: var(--color-buy-strong); color: var(--color-on-strong); }
.side--sell.is-on { background: var(--color-sell-strong); color: var(--color-on-strong); }
.fld { display: grid; gap: var(--space-3xs); padding: var(--space-xs) var(--space-sm); border-radius: var(--radius-pill); background: var(--color-paper-2); }
.fld__k { color: var(--color-muted); font-size: var(--text-xs); }
.fld__v { font-weight: 600; }
.fld__v small { color: var(--color-muted); font-size: var(--text-xs); margin-left: var(--space-2xs); font-weight: 500; }
.kv { display: grid; gap: var(--space-2xs); margin: var(--space-2xs) 0 0; font-size: var(--text-sm); }
.kv div { display: flex; justify-content: space-between; gap: var(--space-xs); }
.kv dt { color: var(--color-muted); }
.kv dd { margin: 0; font-weight: 500; text-align: right; }
.kv small { color: var(--color-muted); }
.cta { display: grid; place-items: center; height: 48px; margin-top: var(--space-xs); border-radius: var(--radius-pill); background: var(--color-paper-2); color: var(--color-ink); text-decoration: none; font-weight: 700; transition: opacity var(--dur-short) var(--ease-out); }
.cta--sell { background: var(--color-sell-strong); color: var(--color-on-strong); }
.cta--buy { background: var(--color-buy-strong); color: var(--color-on-strong); }
.cta:hover { opacity: 0.9; } .cta:active { opacity: 0.8; }

/* 板 */
.book { font-size: var(--text-sm); }
.book__fund { display: grid; justify-items: end; gap: var(--space-3xs); font-size: var(--text-xs); text-align: right; }
.book__fund .measured { color: var(--color-ink); }
.book__hd { display: flex; justify-content: space-between; padding: var(--space-xs) 0 var(--space-2xs); color: var(--color-muted); font-size: var(--text-xs); line-height: 1.3; }
.book__hd span:last-child { text-align: right; }
.book__side { list-style: none; margin: 0; padding: 0; min-height: 24px; }
.book__side li { position: relative; isolation: isolate; display: flex; justify-content: space-between; align-items: center; height: 24px; }
.book__side .bp, .book__side .bs { position: relative; z-index: 1; }
.book__side .bs { color: var(--color-ink-2); }
.book__side--ask .bp { color: var(--color-sell); } .book__side--bid .bp { color: var(--color-buy); }
.bb { position: absolute; top: 1px; bottom: 1px; right: 0; width: 100%; z-index: 0; transform-origin: right center; transform: scaleX(0); transition: transform var(--dur-short) var(--ease-out); }
.book__side--ask .bb { background: var(--color-sell-soft); } .book__side--bid .bb { background: var(--color-buy-soft); }
.book__none { color: var(--color-muted); font-size: var(--text-xs); }
.book__mid { display: grid; gap: var(--space-3xs); padding: var(--space-xs) 0; }
.book__mid-px { font-size: var(--text-xl); font-weight: 700; line-height: 1.1; }
.book__mid-px.up { color: var(--color-buy); } .book__mid-px.down { color: var(--color-sell); }
.book__mid .muted { font-size: var(--text-xs); }
.book__ratio { display: flex; align-items: center; gap: var(--space-xs); margin-top: var(--space-xs); font-size: var(--text-xs); font-weight: 600; }
.ratio { flex: 1; height: 4px; border-radius: 2px; background: var(--color-sell); overflow: hidden; }
.ratio i { display: block; height: 100%; background: var(--color-buy); transform-origin: left center; transform: scaleX(0.5); transition: transform var(--dur-short) var(--ease-out); }
.seg.seg--prec { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: var(--space-xs); width: 100%; }
.seg.seg--prec button { min-height: 32px; padding: 0; font-size: var(--text-xs); }

/* 下の表のタブ */
.ptabs { display: flex; gap: var(--space-lg); border-bottom: var(--rule-hair) solid var(--color-rule); overflow-x: auto; scrollbar-width: none; }
.ptabs button { flex: none; min-height: 48px; padding: 0; border: 0; background: transparent; color: var(--color-muted); font-weight: 600; font-size: var(--text-md); cursor: pointer; transition: color var(--dur-short) var(--ease-out), box-shadow var(--dur-short) var(--ease-out); }
.ptabs button:hover { color: var(--color-ink-2); }
.ptabs button[aria-selected="true"] { color: var(--color-ink); box-shadow: inset 0 -2px 0 var(--color-ink); }
.ptabs button:active { color: var(--color-ink); }
.ptabs button:focus-visible { outline-offset: -2px; }
#pane-body { padding-top: var(--space-lg); }
.lead-num { font-size: var(--text-lg); font-weight: 600; }
.lbl { color: var(--color-muted); font-size: var(--text-sm); font-weight: 600; }

/* ---- 資産 ---- */
.wallet { display: grid; gap: var(--space-2xs); padding-bottom: var(--space-lg); margin-bottom: var(--space-lg); border-bottom: var(--rule-hair) solid var(--color-rule); }
.wallet__k { color: var(--color-muted); font-size: var(--text-sm); }
.wallet__v { font-size: clamp(2rem, 1.6rem + 1.6vw, 2.75rem); font-weight: 700; line-height: 1.1; }
.wallet__s { font-size: var(--text-sm); color: var(--color-ink-2); }

/* ---- 面・表・グラフ ---- */
.cols { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: var(--space-lg); align-items: start; }
.stack { display: grid; gap: var(--space-lg); min-width: 0; }
.panel { color: var(--color-ink); background: var(--color-paper-3); border: var(--rule-hair) solid var(--color-rule); border-radius: var(--radius-card); padding: var(--space-lg); min-width: 0; }
.panel > h2 { margin-bottom: var(--space-md); font-size: var(--text-lg); font-weight: 700; }
.panel__sub { color: var(--color-muted); font-size: var(--text-sm); margin-top: calc(var(--space-xs) * -1); margin-bottom: var(--space-md); }
.note { color: var(--color-muted); font-size: var(--text-sm); line-height: 1.65; }
.note + .note { margin-top: var(--space-xs); }

.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-md) var(--space-lg); margin: var(--space-lg) 0 0; }
.facts div { min-width: 0; }
.facts dt { color: var(--color-muted); font-size: var(--text-sm); }
.facts dd { margin: var(--space-3xs) 0 0; font-variant-numeric: tabular-nums; font-size: var(--text-lg); font-weight: 600; }
.facts dd small { font-size: var(--text-sm); color: var(--color-muted); font-weight: 500; }
.facts--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.changes { margin: var(--space-md) 0 0; padding: var(--space-sm) var(--space-md); border-left: 2px solid var(--color-ink-2); background: var(--color-paper-2); border-radius: 0 var(--radius-pill) var(--radius-pill) 0; }
.changes p + p { margin-top: var(--space-2xs); }

.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
th { text-align: left; font-weight: 500; color: var(--color-muted); padding: 0 var(--space-sm) var(--space-xs); white-space: nowrap; border-bottom: var(--rule-hair) solid var(--color-rule-2); }
td { padding: var(--space-sm); border-bottom: var(--rule-hair) solid var(--color-rule); vertical-align: baseline; }
th:first-child, td:first-child { padding-left: 0; } th:last-child, td:last-child { padding-right: 0; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.n { font-weight: 500; }
td.p { font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 600; }
tr:last-child td { border-bottom: 0; }

.ladder td { padding-block: var(--space-xs); }
.ladder tr.is-now td { background: var(--color-paper-2); font-weight: 600; }
.ladder tr.is-now td:first-child { box-shadow: inset 2px 0 0 var(--color-ink); padding-left: var(--space-sm); }
.ladder tr.is-stop td.p { color: var(--color-sell); }
.ladder tr.is-flip td { font-weight: 600; }
.ladder .what { color: var(--color-ink-2); white-space: nowrap; }
.ladder .what em { font-style: normal; color: var(--color-muted); font-size: var(--text-xs); margin-left: var(--space-2xs); }
.what-sub { display: none; }

details.more { border-top: var(--rule-hair) solid var(--color-rule); margin-top: var(--space-lg); padding-top: var(--space-sm); }
details.more > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: var(--space-xs); min-height: 44px; color: var(--color-ink-2); font-weight: 600; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary svg { width: 18px; height: 18px; transition: transform var(--dur-short) var(--ease-out); }
details.more[open] > summary svg { transform: rotate(180deg); }
details.more > summary:hover { color: var(--color-ink); }
details.more > summary:focus-visible { outline-offset: 4px; }

.chart { width: 100%; height: auto; display: block; }
.chart .grid line { stroke: var(--color-rule); stroke-width: 1; }
.chart .axis text, .chart text { fill: var(--color-muted); font-family: var(--font-body); font-size: 11px; }
.chart .line { fill: none; stroke: var(--color-ink-2); stroke-width: 1.5; }
.chart .line--accent { stroke: var(--color-buy); }
.chart .wick { stroke: var(--color-muted); stroke-width: 1; }
.chart .c-up { fill: var(--color-buy); } .chart .c-down { fill: var(--color-sell); }
.chart .lvl { stroke-width: 1; stroke-dasharray: 4 3; }
.chart .lvl--now { stroke: var(--color-ink); stroke-dasharray: none; }
.chart .lvl--stop { stroke: var(--color-sell); }
.chart .lvl--flip { stroke: var(--color-sell); stroke-width: 2; stroke-dasharray: none; }
.chart .lvl--entry { stroke: var(--color-ink-2); }
.chart .lvl--add { stroke: var(--color-buy); }
.chart .lbl { font-size: 11px; }
.chart .lbl--now { fill: var(--color-ink); font-weight: 600; }
.chart .bar-y { fill: var(--color-rule-2); } .chart .bar-y--last { fill: var(--color-ink-2); }
.legend { display: flex; flex-wrap: wrap; gap: var(--space-xs) var(--space-md); margin-top: var(--space-sm); font-size: var(--text-sm); color: var(--color-muted); }
.legend span { display: inline-flex; align-items: center; gap: var(--space-xs); }
.legend i { display: inline-block; width: 16px; height: 0; border-top: 2px solid var(--color-muted); }
.legend .k-now { border-color: var(--color-ink); } .legend .k-stop { border-top-style: dashed; border-color: var(--color-sell); }
.legend .k-entry { border-top-style: dashed; border-color: var(--color-ink-2); } .legend .k-add { border-top-style: dashed; border-color: var(--color-buy); }

.seg { display: inline-flex; flex-wrap: wrap; gap: var(--space-2xs); padding: var(--space-3xs); background: var(--color-paper-2); border-radius: var(--radius-pill); }
.seg button { min-height: 36px; padding: 0 var(--space-sm); border: 0; border-radius: 6px; background: transparent; color: var(--color-muted); font-size: var(--text-sm); font-weight: 600; cursor: pointer; transition: background-color var(--dur-micro) var(--ease-out), color var(--dur-micro) var(--ease-out); }
.seg button:hover { color: var(--color-ink); }
.seg button[aria-pressed="true"] { background: var(--color-paper); color: var(--color-ink); }
.seg button:active { background: var(--color-rule); }
.seg button:focus-visible { outline-offset: 0; }
.toolbar { display: flex; flex-wrap: wrap; gap: var(--space-xs); align-items: center; justify-content: space-between; margin-bottom: var(--space-md); }

.btn { display: inline-flex; align-items: center; gap: var(--space-xs); min-height: 44px; padding: 0 var(--space-md); border: var(--rule-hair) solid var(--color-rule-2); border-radius: var(--radius-pill); background: var(--color-paper-2); color: var(--color-ink); font-weight: 600; font-size: var(--text-sm); cursor: pointer; text-decoration: none; transition: background-color var(--dur-short) var(--ease-out), border-color var(--dur-short) var(--ease-out); }
.btn svg { width: 16px; height: 16px; }
.btn:hover { background: var(--color-rule); border-color: var(--color-muted); }
.btn:active { background: var(--color-paper); }
.btn--primary { background: var(--color-primary); border-color: var(--color-primary); color: var(--color-primary-ink); }
.btn--primary:hover { background: var(--color-primary); border-color: var(--color-primary); opacity: 0.9; }
.btn:disabled, .btn[aria-busy="true"] { opacity: 0.55; cursor: not-allowed; color: var(--color-ink); }
.row-actions { display: flex; flex-wrap: wrap; gap: var(--space-xs); margin-top: var(--space-md); }

.alert { display: flex; gap: var(--space-sm); align-items: flex-start; margin-bottom: var(--space-md); padding: var(--space-sm) var(--space-md); border: var(--rule-hair) solid var(--color-sell); background: var(--color-sell-soft); border-radius: var(--radius-pill); font-size: var(--text-sm); }
.alert svg { width: 18px; height: 18px; flex: none; margin-top: var(--space-3xs); stroke: var(--color-sell); }
.alert strong { font-weight: 700; }
.empty { padding: var(--space-xl) 0; color: var(--color-muted); }
.empty h2 { color: var(--color-ink); margin-bottom: var(--space-xs); }

.sk-wrap { display: grid; gap: var(--space-md); padding: var(--space-xl) 0; }
.sk { display: block; background: var(--color-paper-2); border-radius: 6px; height: 1em; }
.sk--big { height: 2.6rem; width: 70%; }
.sk--line { width: 100%; }

.events { list-style: none; margin: 0; padding: 0; }
.events li { padding: var(--space-sm) 0; border-bottom: var(--rule-hair) solid var(--color-rule); display: grid; grid-template-columns: 7.5rem minmax(0, 1fr); gap: var(--space-2xs) var(--space-md); }
.events li:last-child { border-bottom: 0; }
.events time { font-size: var(--text-sm); color: var(--color-muted); font-variant-numeric: tabular-nums; }
.events strong { font-weight: 600; }
.events p { color: var(--color-muted); font-size: var(--text-sm); margin-top: var(--space-2xs); overflow-wrap: anywhere; }

dl.rules { margin: 0; display: grid; gap: var(--space-md); }
dl.rules dt { font-weight: 600; }
dl.rules dd { margin: var(--space-2xs) 0 0; color: var(--color-muted); font-size: var(--text-sm); line-height: 1.65; }

.foot { margin-top: var(--space-xl); color: var(--color-muted); font-size: var(--text-xs); line-height: 1.6; padding-top: var(--space-md); border-top: var(--rule-hair) solid var(--color-rule); }

/* ---- ログイン ---- */
.login { min-height: 100dvh; display: grid; place-items: center; padding: var(--space-lg) var(--space-md); }
.login__box { width: 100%; max-width: 22rem; display: grid; gap: var(--space-lg); }
.login__brand { display: grid; justify-items: center; gap: var(--space-md); margin-bottom: var(--space-lg); }
.login__brand .mark { width: 96px; height: auto; }
.login__word { font-family: var(--font-logo); font-weight: 800; letter-spacing: 0.1em; font-size: 1.6rem; line-height: 1; color: var(--color-ink); }
.login__box svg.logo-full { width: 176px; height: auto; }
.logo-full .word { fill: var(--color-brand-navy); }
.field { display: grid; gap: var(--space-xs); }
.field label { font-size: var(--text-sm); font-weight: 600; color: var(--color-ink-2); }
.field input { font-size: 16px; min-height: 48px; padding: 0 var(--space-md); border: var(--rule-hair) solid var(--color-rule-2); border-radius: var(--radius-pill); background: var(--color-paper-2); color: var(--color-ink); }
.field input:hover { border-color: var(--color-muted); }
.field input:focus-visible { outline: 2px solid var(--color-focus); outline-offset: -1px; }
.field input[aria-invalid="true"] { border-color: var(--color-sell); }
.field .msg { min-height: 1lh; font-size: var(--text-sm); color: var(--color-sell); }
.login .btn { width: 100%; justify-content: center; min-height: 52px; font-size: var(--text-md); }
@media (prefers-color-scheme: dark) { .logo-full .word { fill: var(--color-ink); } }

/* 間隔（CSP で style 属性を使わないため） */
[data-mt="0"] { margin-top: 0; } [data-mt="sm"] { margin-top: var(--space-xs); } [data-mt="md"] { margin-top: var(--space-md); } [data-mt="lg"] { margin-top: var(--space-lg); }
[data-mb="lg"] { margin-bottom: var(--space-lg); } [data-minline] { min-height: 1lh; }
.tbl-label { min-width: 10rem; }

/* ---- タブレット・スマホ ---- */
@media (max-width: 59.99rem) {
  .top { display: none; }
  .only-s { display: grid; }
  main { padding: calc(env(safe-area-inset-top) + var(--space-xs)) var(--space-md) calc(var(--dock-h) + env(safe-area-inset-bottom) + var(--space-xl)); }
  .dock { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); position: fixed; inset: auto 0 0 0; z-index: var(--z-sticky-nav); background: var(--color-paper); border-top: var(--rule-hair) solid var(--color-rule); padding-bottom: env(safe-area-inset-bottom); }
  .dock__a { display: grid; justify-items: center; align-content: center; gap: var(--space-2xs); min-height: var(--dock-h); color: var(--color-muted); text-decoration: none; font-size: var(--text-xs); font-weight: 500; transition: color var(--dur-short) var(--ease-out); }
  .dock__a svg { width: 24px; height: 24px; }
  .dock__a:hover { color: var(--color-ink-2); }
  .dock__a[aria-current="page"] { color: var(--color-ink); font-weight: 700; }
  .dock__a:active { color: var(--color-ink); }

  .hero { grid-template-columns: minmax(0, 1fr); gap: var(--space-lg); padding: var(--space-lg) 0 var(--space-xl); }
  .hero__art { order: 0; padding: var(--space-lg) 0; }
  .hero__art .mark { width: min(64%, 260px); }
  .btn-xl { max-width: none; }

  .trade { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); grid-template-areas: "head head" "pos pos" "sig book" "bar bar" "chart chart" "pane pane"; gap: var(--space-md); }
  .t-head .icon-btn { display: grid; }
  .chartbar { grid-area: bar; display: flex; align-items: center; justify-content: space-between; min-height: 52px; padding: 0; border: 0; border-block: var(--rule-hair) solid var(--color-rule); background: transparent; color: var(--color-ink); font-weight: 600; font-size: var(--text-md); cursor: pointer; }
  .chartbar svg { width: 20px; height: 20px; transform: rotate(180deg); transition: transform var(--dur-short) var(--ease-out); }
  .chartbar[aria-expanded="true"] svg { transform: none; }
  .chartbar:hover { color: var(--color-ink-2); }
  .chartbar:active { color: var(--color-muted); }

  .cols { grid-template-columns: minmax(0, 1fr); }
  .panel { background: transparent; border: 0; border-radius: 0; padding: 0 0 var(--space-lg); border-bottom: var(--rule-hair) solid var(--color-rule); }
  .facts--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 40rem) {
  .appbar { gap: var(--space-xs); }
  .pill { padding: 0 var(--space-sm); }
  .pill__sub { display: none; }
  .hero__h { font-size: 2rem; }
  .hero__art .mark { width: min(52%, 200px); }
  .sym h1 { font-size: var(--text-xl); }
  .trade { column-gap: var(--space-sm); }
  .chips { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 32px; gap: var(--space-2xs); }
  .chip { font-size: var(--text-xs); }
  .fld { padding: var(--space-xs); }
  .fld__v { font-size: var(--text-sm); }
  .kv { font-size: var(--text-xs); }
  .kv div { flex-direction: column; gap: 0; }
  .kv dd { text-align: left; }
  .cta { font-size: var(--text-sm); }
  .book { font-size: var(--text-xs); }
  .book__side li { height: 22px; }
  .book__mid-px { font-size: var(--text-lg); }
  .facts dd { font-size: var(--text-md); }
  .events li { grid-template-columns: minmax(0, 1fr); }
  .ladder .what { display: none; }
  .ladder .what-sub { display: block; margin-top: var(--space-3xs); font-size: var(--text-xs); color: var(--color-muted); white-space: normal; font-weight: 500; }
  .ladder .what-sub em { display: block; font-style: normal; font-weight: 600; color: var(--color-ink-2); }
  .ladder tr.is-now .what-sub, .ladder tr.is-flip .what-sub { color: var(--color-ink-2); }
  .ladder td, .ladder th { padding-inline: var(--space-xs); }
  .ladder td.n { font-size: var(--text-md); }
  .hide-s { display: none; }
  .tbl-label { min-width: 0; }
  .chart .axis text, .chart text, .chart .lbl { font-size: 10px; }
  .mk__hd, .mk__row { grid-template-columns: minmax(0, 1fr) auto 80px; gap: var(--space-sm); }
}

/* ---- 売り・買いを一目で ---- */
.side-tag { display: inline-grid; place-items: center; min-height: 22px; padding: 0 var(--space-xs); border-radius: 4px; font-size: var(--text-sm); font-weight: 700; line-height: 1; vertical-align: middle; background: var(--color-paper-2); color: var(--color-ink-2); }
.side-tag--sell { background: var(--color-sell-strong); color: var(--color-on-strong); }
.side-tag--buy { background: var(--color-buy-strong); color: var(--color-on-strong); }
.side-tag--lg { min-height: 1.3em; padding: 0 0.3em; font-size: 1em; border-radius: 6px; }
.hero__h .side-tag--lg { margin-right: 0.15em; }
.t-pos { grid-area: pos; display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-xs) var(--space-md); padding: var(--space-sm) var(--space-md); border-radius: var(--radius-pill); background: var(--color-paper-2); border-left: 4px solid var(--color-rule-2); }
.t-pos--sell { border-left-color: var(--color-sell); background: var(--color-sell-soft); }
.t-pos--buy { border-left-color: var(--color-buy); background: var(--color-buy-soft); }
.t-pos__k { color: var(--color-muted); font-size: var(--text-xs); width: 100%; }
.t-pos__amt { font-weight: 700; font-size: var(--text-lg); }
.t-pos__x, .t-pos__pnl { font-size: var(--text-sm); font-weight: 600; }
.t-pos .side-tag { font-size: var(--text-md); min-height: 28px; padding: 0 var(--space-sm); }
.poscard { display: grid; gap: var(--space-md); padding: var(--space-md); border-radius: var(--radius-card); background: var(--color-paper-3); border: var(--rule-hair) solid var(--color-rule); }
.poscard__hd { display: flex; align-items: center; gap: var(--space-xs); flex-wrap: wrap; }
.poscard__hd strong { font-size: var(--text-md); font-weight: 700; }
.poscard__hd .muted { font-size: var(--text-sm); }
.poscard__x { font-size: var(--text-xs); font-weight: 600; padding: 2px var(--space-2xs); border-radius: 4px; background: var(--color-paper-2); }
.poscard dl { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-md) var(--space-sm); margin: 0; }
.poscard dt { color: var(--color-muted); font-size: var(--text-xs); }
.poscard dd { margin: var(--space-3xs) 0 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.poscard dd.big { font-size: var(--text-lg); }
