/* ==========================================================================
   M3 Colour in UI — module styles. Every class starts with .m3-
   Chrome uses tokens only. Taught colours arrive inline from JS as custom
   properties (--m3-*, --d-*, component tokens) that these rules read.
   ========================================================================== */

/* ---- shared ------------------------------------------------------------- */

.m3-mark {
  display: inline-flex; align-items: flex-start; gap: 6px;
  padding: 5px 10px 5px 7px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font-size: var(--fs-sm);
  font-weight: 500;
  line-height: 1.35;
  align-self: flex-start;
  max-width: 100%;
}
.m3-mark .icon { flex: none; margin-top: 2px; font-size: 0.875rem; }
.m3-mark.is-pass .icon { color: var(--good); }
.m3-mark.is-fail { border-style: dashed; border-color: var(--bad); }
.m3-mark.is-fail .icon { color: var(--bad); }

.m3-note {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--s2);
  align-items: start;
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--ink-2);
  max-width: var(--measure);
}
.m3-note > .icon { margin-top: 4px; }

.m3-stage { display: block; width: 100%; min-width: 0; container-type: inline-size; }
.m3-stage--pad {
  padding: var(--s5) var(--s4);
  border-radius: var(--radius);
  background: var(--surface-2);
}
.m3-stage--clip { overflow: hidden; border-radius: 10px; }

.m3-split {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: var(--s5);
  align-items: start;
  min-width: 0;
}
.m3-split--even { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.m3-split--tokens { grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); }
.m3-split > * { min-width: 0; }
@media (max-width: 1000px) {
  .m3-split { grid-template-columns: minmax(0, 1fr); }
}

.m3-toolbar {
  display: flex; flex-wrap: wrap; align-items: flex-end;
  gap: var(--s4) var(--s6);
  padding: var(--s4);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.m3-count { display: flex; align-items: baseline; gap: var(--s2); margin-left: auto; max-width: 240px; }
.m3-count .big-number { min-width: 1.3em; text-align: right; }


/* single-choice buttons */
.m3-choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s2); }
.m3-choice {
  display: flex; align-items: center; gap: var(--s2);
  min-height: 40px; min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font-size: var(--fs-sm);
  text-align: left;
}
.m3-choice:hover { background: var(--surface-2); }
.m3-choice::before {
  content: ""; flex: none;
  width: 12px; height: 12px;
  border: 1.5px solid var(--ink-2);
  border-radius: 50%;
}
.m3-choice[aria-pressed="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); font-weight: 600; }
.m3-choice[aria-pressed="true"]::before { border-color: var(--ink); background: var(--ink); box-shadow: inset 0 0 0 2px var(--surface); }
.m3-choice > span { min-width: 0; overflow-wrap: anywhere; }

/* order game */
.m3-order { display: grid; gap: var(--s2); margin: 0; padding: 0; list-style: none; }
.m3-order__row {
  display: grid;
  grid-template-columns: minmax(96px, 132px) minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--s3);
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.m3-order__row.is-right { border-color: var(--good); }
.m3-order__row.is-wrong { border-color: var(--bad); border-style: dashed; }
.m3-order__slot { display: flex; align-items: center; gap: var(--s2); font-size: var(--fs-sm); font-weight: 600; line-height: 1.25; }
.m3-order__n {
  display: grid; place-items: center; flex: none;
  width: 22px; height: 22px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  font-size: var(--fs-micro);
}
.m3-order__item { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; min-width: 0; }
.m3-order__chip { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.m3-order__verdict { display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-xs); font-weight: 600; white-space: nowrap; }
.m3-order__verdict.is-right .icon { color: var(--good); }
.m3-order__verdict.is-wrong .icon { color: var(--bad); }
.m3-order__moves { display: flex; gap: 4px; }
.m3-order__move {
  display: grid; place-items: center;
  width: 34px; height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
}
.m3-order__move:hover:not(:disabled) { background: var(--surface-2); }
.m3-order__move:disabled { opacity: 0.3; cursor: default; }
@media (max-width: 560px) {
  .m3-order__row { grid-template-columns: minmax(0, 1fr) auto; gap: var(--s2) var(--s3); }
  .m3-order__slot { grid-column: 1 / -1; }
}

/* ---- 3.1  60-30-10 ------------------------------------------------------ */

.m3-rs {
  display: grid;
  grid-template-columns: 124px minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--m3-dom);
  color: var(--m3-on-dom);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 12.5px;
  line-height: 1.35;
  text-align: left;
}
.m3-rs [data-role="sec"] { background: var(--m3-sec); color: var(--m3-on-sec); }
.m3-rs [data-role="acc"] { background: var(--m3-acc); color: var(--m3-on-acc); }
.m3-rs [data-role="acc"] [data-role="acc"] { background: var(--m3-on-acc); color: var(--m3-acc); }
.m3-rs [data-role="acc"] [data-role="sec"] [data-role="acc"] { background: var(--m3-acc); color: var(--m3-on-acc); }

.m3-rs__side {
  display: flex; flex-direction: column; gap: 14px;
  min-width: 0;
  padding: 14px 9px;
  border-right: 1px solid color-mix(in srgb, currentColor 12%, transparent);
}
.m3-rs__brand { display: flex; align-items: center; gap: 8px; padding: 0 4px; font-size: 13.5px; font-weight: 700; }
.m3-rs__logo { display: grid; place-items: center; flex: none; width: 24px; height: 24px; border-radius: 7px; font-size: 12px; font-weight: 800; }
.m3-rs__logo[data-role="off"] { box-shadow: inset 0 0 0 1.5px currentColor; }
.m3-rs__nav { display: flex; flex-direction: column; gap: 2px; }
.m3-rs__navitem { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 7px; color: color-mix(in srgb, currentColor 72%, transparent); }
.m3-rs__navitem .icon { flex: none; width: 15px; height: 15px; }
.m3-rs__navitem[data-role] { font-weight: 650; }
.m3-rs__navitem[data-role="off"] { background: color-mix(in srgb, currentColor 11%, transparent); color: inherit; }
.m3-rs__promo { display: flex; flex-direction: column; gap: 1px; margin-top: auto; padding: 10px; border-radius: 9px; font-size: 11.5px; }
.m3-rs__promo[data-role="off"] { box-shadow: inset 0 0 0 1px color-mix(in srgb, currentColor 16%, transparent); }

.m3-rs__main { display: flex; flex-direction: column; gap: 10px; min-width: 0; padding: 12px; }
.m3-rs__header { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border-radius: 10px; }
.m3-rs__title { font-size: 16px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.2; }
.m3-rs__sub { font-size: 11.5px; opacity: 0.72; }
.m3-rs__cta { display: inline-flex; align-items: center; gap: 5px; flex: none; height: 32px; padding: 0 12px; border-radius: 7px; font-weight: 650; white-space: nowrap; }
.m3-rs__cta .icon { width: 13px; height: 13px; }
.m3-rs__cta[data-role="off"] { box-shadow: inset 0 0 0 1px color-mix(in srgb, currentColor 36%, transparent); }
.m3-rs__stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.m3-rs__stat { display: flex; flex-direction: column; gap: 1px; min-width: 0; padding: 10px 12px; border-radius: 10px; }
.m3-rs__stat[data-role="off"], .m3-rs__panel[data-role="off"] { box-shadow: inset 0 0 0 1px color-mix(in srgb, currentColor 13%, transparent); }
.m3-rs__statlabel { font-size: 11.5px; opacity: 0.72; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m3-rs__statvalue { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.15; }
.m3-rs__cols { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 10px; }
.m3-rs__panel { display: flex; flex-direction: column; gap: 8px; min-width: 0; padding: 12px; border-radius: 10px; }
.m3-rs__paneltitle { font-weight: 650; }
.m3-rs__bars { display: flex; align-items: flex-end; gap: 7px; flex: 1; min-height: 96px; }
.m3-rs__bar { flex: 1; border-radius: 4px 4px 0 0; }
.m3-rs__bar[data-role="off"] { background: color-mix(in srgb, currentColor 22%, transparent); }
.m3-rs__row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 0 0; border-top: 1px solid color-mix(in srgb, currentColor 12%, transparent); }
.m3-rs__rowtext { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m3-rs__tag { flex: none; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.m3-rs__tag[data-role="off"] { background: color-mix(in srgb, currentColor 10%, transparent); }

.m3-rs.is-clickable :is(.m3-rs__side, .m3-rs__header, .m3-rs__stat, .m3-rs__panel) { cursor: pointer; }
.m3-rs.is-clickable :is(.m3-rs__side, .m3-rs__header, .m3-rs__stat, .m3-rs__panel):hover {
  outline: 2px dashed color-mix(in srgb, currentColor 55%, transparent);
  outline-offset: -3px;
}

@container (max-width: 480px) {
  .m3-rs { grid-template-columns: 42px minmax(0, 1fr); font-size: 12px; }
  .m3-rs__side { align-items: center; padding: 12px 5px; }
  .m3-rs__brand { padding: 0; }
  .m3-rs__brandname, .m3-rs__navitem > span, .m3-rs__promo { display: none; }
  .m3-rs__navitem { padding: 7px; }
  .m3-rs__main { padding: 10px; gap: 8px; }
  .m3-rs__header { padding: 8px 10px; }
  .m3-rs__title { font-size: 14.5px; }
  .m3-rs__stats { gap: 6px; }
  .m3-rs__stat { padding: 8px; }
  .m3-rs__statvalue { font-size: 17px; }
  .m3-rs__cols { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .m3-rs__bars { min-height: 64px; }
}

.m3-prop { display: grid; gap: 6px; }
.m3-prop__bar {
  display: flex; height: 24px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
}
.m3-prop__seg { flex: 0 0 auto; min-width: 0; }
.m3-prop__seg + .m3-prop__seg { border-left: 1px solid var(--line-strong); }
.m3-prop__seg--dom { background: var(--m3-dom); }
.m3-prop__seg--sec { background: var(--m3-sec); }
.m3-prop__seg--acc { background: var(--m3-acc); }
.m3-prop__legend { display: flex; flex-wrap: wrap; gap: 2px 14px; margin-bottom: var(--s2); font-size: var(--fs-sm); }
.m3-prop__item { display: inline-flex; align-items: center; gap: 6px; }
.m3-prop__dot { width: 11px; height: 11px; border: 1px solid var(--line-strong); border-radius: 2px; }
.m3-prop__num { font-weight: 600; }
.m3-prop__aim {
  display: flex; height: 20px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  color: var(--ink-2);
}
.m3-prop__aim span { display: grid; place-items: center; flex: 0 0 auto; min-width: 0; }
.m3-prop__aim span + span { border-left: 1px dashed var(--line-strong); }

.m3-paint { display: grid; gap: var(--s2); }
.m3-paint__row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px var(--s3); }
.m3-paint__label { font-size: var(--fs-sm); font-weight: 600; }

/* ---- 3.2  one primary action -------------------------------------------- */

/* "Everything accent": every control borrows the primary fill. */
.m3-loud .mock :is(.mock-btn, .mock-nav-item, .mock-link, .mock-icon-btn, .mock-pill, .mock-chip, .mock-select) {
  border-color: transparent;
  background: var(--m-primary);
  color: var(--m-on-primary);
}
.m3-loud .mock :is(.mock-btn, .mock-nav-item, .mock-link, .mock-icon-btn):hover { background: var(--m-primary-hover); color: var(--m-on-primary); }
.m3-loud .mock .mock-link { padding: 5px 10px; border-radius: 7px; text-decoration: none; }
.m3-loud .mock .mock-nav-item { font-weight: 600; }
.m3-loud .mock .mock-bar--muted, .m3-loud .mock .mock-legend-dot--muted { background: var(--m-primary); }
.m3-loud .mock .mock-stat-value { color: var(--m-on-primary-soft); }

/* "One action": the accent is kept for the single filled button. */
.m3-calm .mock :is(.mock-bar--primary, .mock-legend-dot--primary) { background: color-mix(in srgb, var(--m-text) 58%, var(--m-surface)); }
.m3-calm .mock .mock-badge { background: var(--m-surface-2); color: var(--m-text); }

.m3-pa.is-squint { filter: blur(7px); }

.m3-race__head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--s3); }
.m3-race__prompt { font-family: var(--font-display); font-size: var(--fs-lg); font-weight: 650; letter-spacing: -0.02em; line-height: 1.2; }
.m3-race__clock { font-size: 1.75rem; font-weight: 600; line-height: 1; }
.m3-race__arena { display: grid; min-height: 300px; min-width: 0; }
.m3-race__cover {
  display: grid; justify-items: center; align-content: center; gap: var(--s3);
  padding: var(--s6) var(--s4);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface-2);
  text-align: center;
}
.m3-race__cover p { max-width: 40ch; }
.m3-race__cover > .icon { color: var(--ink-2); }
.mock .m3-missed { outline: 2px dashed var(--m-danger); outline-offset: 2px; }
.m3-race__results { display: grid; gap: var(--s2); }
.m3-race__results:empty { display: none; }
.m3-race__row {
  display: grid;
  grid-template-columns: 136px minmax(0, 1fr) 52px 64px;
  align-items: center;
  gap: var(--s3);
  font-size: var(--fs-sm);
}
.m3-race__name { font-weight: 600; }
.m3-race__track { height: 12px; overflow: hidden; border-radius: 3px; background: var(--surface-2); }
.m3-race__fill { display: block; height: 100%; background: var(--ink-2); }
.m3-race__fill.is-clean { background: var(--accent); }
.m3-race__time { text-align: right; font-weight: 600; }
@media (max-width: 560px) {
  .m3-race__row { grid-template-columns: minmax(0, 1fr) auto auto; }
  .m3-race__track { grid-column: 1 / -1; grid-row: 2; }
}

/* ---- 3.3  states --------------------------------------------------------- */

.m3-states {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(62px, 1fr));
  gap: var(--s3) 0;
  padding: var(--s4) var(--s2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--m3-page);
  color: var(--m3-page-ink);
}
.m3-state { display: grid; justify-items: center; align-content: start; gap: 6px; min-width: 0; padding: 4px; text-align: center; }
.m3-state__btn { display: grid; place-items: center; min-height: 50px; }
.m3-fakebtn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 36px; padding: 0 12px;
  border-radius: 8px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 12.5px; font-weight: 600; line-height: 1;
  white-space: nowrap;
}
.m3-state__name { font-size: var(--fs-sm); font-weight: 600; line-height: 1.2; }
.m3-state__meta { font-size: var(--fs-micro); line-height: 1.3; opacity: 0.78; overflow-wrap: anywhere; }

.m3-livebox {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s3);
  padding: var(--s4);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--m3-page);
  color: var(--m3-page-ink);
}
.m3-livebox__hint { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-sm); }
.m3-livebtn {
  appearance: none;
  height: 40px; padding: 0 18px;
  border: 0; border-radius: 8px;
  background: var(--m3-b);
  color: var(--m3-bi);
  font-size: 0.9375rem; font-weight: 650;
}
.m3-livebtn:hover { background: var(--m3-bh); }
.m3-livebtn:active { background: var(--m3-ba); }
.m3-livebtn:focus-visible { outline: 2px solid var(--m3-bf); outline-offset: 2px; border-radius: 8px; }
.m3-livebtn:disabled { background: var(--m3-bd); color: var(--m3-bdi); cursor: not-allowed; }

.m3-ladder {
  position: relative;
  height: 14px;
  margin: 6px 9px 22px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
}
.m3-ladder__mark { position: absolute; top: 50%; display: grid; justify-items: center; transform: translate(-50%, -50%); }
.m3-ladder__mark i {
  width: 16px; height: 16px;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: var(--m3-dot);
  box-shadow: 0 0 0 1px var(--ink);
}
.m3-ladder__mark span { position: absolute; top: 21px; font-size: var(--fs-micro); font-weight: 600; }

/* ---- 3.4  surfaces and depth -------------------------------------------- */

.m3-depth {
  perspective: 1100px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--d-bg);
  color: var(--d-text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 13px;
  line-height: 1.35;
  text-align: left;
}
.m3-depth__page {
  position: relative;
  padding: 14px 18px 72px;
  background: var(--d-bg);
  transform-style: preserve-3d;
}
.m3-depth.is-tilted .m3-depth__page {
  transform: rotateX(54deg) rotateZ(-24deg) scale(0.8);
  box-shadow: 0 0 0 1px var(--d-border);
}
.m3-depth__tag { display: block; margin-bottom: 6px; font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--d-muted); }
.m3-depth__head { display: flex; align-items: baseline; gap: 8px; margin: 6px 0 12px; }
.m3-depth__head strong { font-size: 17px; letter-spacing: -0.01em; }
.m3-depth__head span { font-size: 12px; color: var(--d-muted); }
.m3-depth__card {
  position: relative;
  padding: 10px 14px 4px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: var(--d-surface);
}
.m3-depth.is-tilted .m3-depth__card { transform: translateZ(46px); }
.m3-depth__menu {
  position: absolute; right: 30px; top: 150px;
  display: flex; flex-direction: column;
  width: 158px;
  padding: 8px 6px 6px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: var(--d-raised);
}
.m3-depth__menu .m3-depth__tag { margin: 0 8px 4px; }
.m3-depth.is-tilted .m3-depth__menu { transform: translateZ(100px); }
.m3-depth[data-sep="border"] :is(.m3-depth__card, .m3-depth__menu) { border-color: var(--d-border); }
.m3-depth[data-sep="shadow"] .m3-depth__card { box-shadow: var(--d-s1); }
.m3-depth[data-sep="shadow"] .m3-depth__menu { box-shadow: var(--d-s2); }
.m3-depth__row { display: flex; align-items: center; gap: 10px; padding: 10px 0; }
.m3-depth__row + .m3-depth__row { border-top: 1px solid color-mix(in srgb, var(--d-text) 9%, transparent); }
.m3-depth__dot { flex: none; width: 28px; height: 28px; border-radius: 8px; background: color-mix(in srgb, var(--d-text) 10%, transparent); }
.m3-depth__rowtext { display: flex; flex: 1; flex-direction: column; min-width: 0; }
.m3-depth__rowtext strong { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m3-depth__rowtext span { font-size: 11.5px; color: var(--d-muted); }
.m3-depth__more { display: grid; place-items: center; flex: none; width: 28px; height: 28px; border-radius: 7px; color: var(--d-muted); }
.m3-depth__more.is-open { background: color-mix(in srgb, var(--d-text) 11%, transparent); color: var(--d-text); }
.m3-depth__item { padding: 7px 9px; border-radius: 6px; font-size: 12.5px; }
.m3-depth__item.is-current { background: color-mix(in srgb, var(--d-text) 9%, transparent); }

@container (max-width: 420px) {
  .m3-depth__page { padding-inline: 12px; }
  .m3-depth__menu { right: 16px; width: 140px; }
}

.m3-layers { display: grid; gap: 6px; padding-top: var(--s3); border-top: 1px solid var(--line); }
.m3-layers__row { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 10px; font-size: var(--fs-sm); }
.m3-layers__chip { flex: none; width: 20px; height: 20px; border: 1px solid var(--line-strong); border-radius: 3px; }
.m3-layers__name { flex: 1; font-weight: 600; }
.m3-layers__row .caption { flex-basis: 100%; padding-left: 30px; font-size: var(--fs-xs); }

.m3-greychip { display: inline-flex; align-items: center; gap: 10px; }
.m3-greychip i { flex: none; width: 54px; height: 34px; border: 1px solid var(--line-strong); border-radius: var(--radius); }
.m3-greychip > span { display: grid; line-height: 1.25; }
.m3-greychip strong { font-size: var(--fs-sm); }
.m3-greychip .mono { font-size: var(--fs-xs); color: var(--ink-2); }

.m3-nest { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); }
.m3-nest__box { position: relative; min-height: 52px; padding: 28px 14px 14px; border-radius: 8px; }
.m3-nest > .m3-nest__box { border-radius: 0; padding-bottom: 20px; }
.m3-nest__label { position: absolute; top: 8px; left: 14px; font-size: 0.625rem; letter-spacing: 0.06em; text-transform: uppercase; }

/* ---- 3.6  design tokens -------------------------------------------------- */

.m3-tk-panel { padding: var(--s4); }
.m3-tk {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0 clamp(16px, 7%, 44px);
  align-items: start;
}
.m3-tk__lines { position: absolute; inset: 0; overflow: visible; pointer-events: none; }
.m3-tk__lines path { fill: none; stroke: var(--line-strong); stroke-width: 1.25; }
.m3-tk__lines path.is-hot { stroke: var(--ink); stroke-width: 2; }
.m3-tk__col { position: relative; z-index: 1; display: flex; flex-direction: column; gap: var(--s2); min-width: 0; }
.m3-tk__head { display: grid; gap: 1px; align-content: start; min-height: 44px; }
.m3-tk__head .caption { font-size: var(--fs-xs); }
.m3-tk__chip {
  display: flex; align-items: center; gap: 7px;
  width: 100%; min-width: 0; min-height: 34px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font-size: var(--fs-micro);
  line-height: 1.2;
  text-align: left;
}
.m3-tk__chip .mono { min-width: 0; overflow-wrap: anywhere; }
.m3-tk__sw { flex: none; width: 14px; height: 14px; border: 1px solid var(--line-strong); border-radius: 3px; }
.m3-tk__chip.is-button { border-color: var(--line-strong); cursor: pointer; }
.m3-tk__chip.is-button:hover { background: var(--surface-2); }
.m3-tk__chip.is-hot { border-color: var(--ink); }
.m3-tk__chip.is-button[aria-pressed="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); font-weight: 700; }
@media (max-width: 480px) {
  .m3-tk-panel { padding: var(--s3) var(--s2); }
  .m3-tk { gap: 0 14px; }
  .m3-tk__chip { gap: 5px; padding: 4px 5px; font-size: 0.625rem; }
  .m3-tk__sw { width: 10px; height: 10px; }
}

.m3-tkui {
  display: grid; gap: 12px;
  width: 100%; max-width: 380px;
  margin: 0 auto;
  padding: 16px;
  border-radius: 12px;
  background: var(--page-bg);
  color: var(--card-text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 13px;
  line-height: 1.45;
  text-align: left;
}
.m3-tkui__bar { display: flex; align-items: center; gap: 8px; font-weight: 650; }
.m3-tkui__bar .m3-tkui__link { margin-left: auto; }
.m3-tkui__logo { width: 18px; height: 18px; border-radius: 5px; background: var(--color-primary); }
.m3-tkui__card {
  display: grid; gap: 6px;
  padding: 18px;
  border: 1px solid var(--card-border);
  border-radius: 12px;
  background: var(--card-bg);
  color: var(--card-text);
}
.m3-tkui__title { font-size: 16px; letter-spacing: -0.01em; }
.m3-tkui__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-top: 8px; }
.m3-tkui__btn {
  display: inline-flex; align-items: center;
  height: 36px; padding: 0 14px;
  border-radius: 8px;
  background: var(--button-bg);
  color: var(--button-text);
  font-weight: 650;
}
.m3-tkui__link { color: var(--link-text); font-weight: 650; text-decoration: underline; text-underline-offset: 3px; }

.m3-trace {
  padding: var(--s2) var(--s3);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: var(--fs-xs);
  line-height: 1.5;
  overflow-wrap: anywhere;
  max-width: none;
}

/* ---- 3.7  charts --------------------------------------------------------- */

.m3-charthost, .m3-qchart { min-width: 0; }
.mock.m3-bars .mock-chart-bar { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--m-text) 16%, transparent); }

.m3-use { font-family: var(--font-display); font-size: var(--fs-md); font-weight: 650; letter-spacing: -0.015em; line-height: 1.25; }
.m3-ends { display: flex; justify-content: space-between; }
.m3-lprofile {
  display: block;
  width: 100%; max-width: 300px; height: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}
.m3-lprofile polyline { fill: none; stroke: var(--ink-2); stroke-width: 1.5; }
.m3-lprofile circle { stroke: var(--ink); stroke-width: 1; }

.m3-question { display: grid; gap: var(--s3); min-width: 0; padding: var(--s4); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.m3-question .sb-scale { width: 100%; }

/* ---- motion -------------------------------------------------------------- */

@media (prefers-reduced-motion: no-preference) {
  .m3-rs [data-group], .m3-tkui__btn, .m3-tkui__link, .m3-tkui__logo { transition: background-color 0.18s, color 0.18s; }
  .m3-prop__seg { transition: flex-basis 0.2s; }
  .m3-pa { transition: filter 0.25s; }
  .m3-depth__page, .m3-depth__card, .m3-depth__menu { transition: transform 0.45s ease, background-color 0.15s; }
  .m3-ladder__mark { transition: left 0.15s; }
}
