.th-loading {
  margin: 40px 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}

.th-hero {
  position: relative;
  margin: 14px 0 18px;
  padding: 22px 24px 20px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--card-bg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.th-hero::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  background: var(--brand-gradient);
  opacity: 0.75;
}

.th-kicker {
  margin: 0 0 4px;
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.th-hero-title {
  margin: 0 0 8px;
  font-size: 25px;
  font-weight: 800;
  letter-spacing: 0.01em;
  color: var(--text);
}

.th-hero-lede {
  margin: 0 0 14px;
  max-width: 62ch;
  font-size: 13.5px;
  line-height: 1.75;
  color: var(--text-muted);
}

.th-windows {
  display: flex;
  gap: 8px;
  padding: 5px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-alt, rgba(127, 127, 127, 0.05));
  width: fit-content;
}

.th-window {
  padding: 7px 22px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-decoration: none;
  color: var(--text-muted);
  transition: color 0.15s ease, background 0.15s ease;
}

.th-window:hover {
  color: var(--text);
}

.th-window.is-active {
  color: var(--on-accent, #fff);
  background: var(--brand-gradient);
  box-shadow: 0 3px 10px rgba(94, 70, 24, 0.24);
}

.th-panel {
  margin-bottom: 26px;
  transition: opacity 0.15s ease;
}

.th-panel.is-loading {
  opacity: 0.55;
}

.th-panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 12px;
  margin: 0 0 10px;
}

.th-panel-title {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
}

.th-panel-meta {
  margin: 0;
  font-size: 12.5px;
  color: var(--text-faint);
}

.th-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--card-bg);
}

.th-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  font-size: 13.5px;
  font-variant-numeric: tabular-nums;
}

.th-table th,
.th-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: right;
  white-space: nowrap;
}

.th-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--card-bg);
}

.th-table th.th-col-name,
.th-table td.th-col-name {
  text-align: left;
  white-space: normal;
  min-width: 140px;
}

.th-table th.th-col-rank,
.th-table td.th-col-rank {
  text-align: center;
  width: 46px;
  color: var(--text-faint);
}

.th-table tbody tr:last-child th,
.th-table tbody tr:last-child td {
  border-bottom: 0;
}

.th-table tbody tr.is-strong {
  background: var(--up-bg);
}

.th-table tbody tr.is-weak {
  background: var(--down-bg);
}

.th-name-link {
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px dashed var(--border-strong);
}

.th-name-link:hover {
  color: var(--accent-text, var(--accent));
}

.th-bar {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.th-bar-track {
  display: inline-flex;
  width: 84px;
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(127, 127, 127, 0.18);
}

.th-bar-up {
  height: 100%;
  background: var(--up);
}

.th-bar-down {
  height: 100%;
  background: var(--down);
}

.th-bar-text {
  font-size: 12px;
  color: var(--text-muted);
}

.th-up {
  color: var(--up);
  font-weight: 700;
}

.th-down {
  color: var(--down);
  font-weight: 700;
}

.th-flat {
  color: var(--text-muted);
}

.th-sub {
  display: block;
  margin-top: 2px;
  font-size: 11.5px;
  font-weight: 400;
  color: var(--text-faint);
}

.th-peer {
  font-size: 12.5px;
  color: var(--text-muted);
}

.th-peer-name {
  color: var(--text);
}

.th-empty {
  margin: 24px 0;
  padding: 18px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13.5px;
}

.th-foot {
  margin: 8px 0 24px;
}

.th-fine {
  margin: 0 0 6px;
  font-size: 12px;
  line-height: 1.7;
  color: var(--text-faint);
}

.th-table th.th-col-median,
.th-table td.th-col-median {
  min-width: 76px;
}

/* PRO 牆（5／20 日窗口）：模糊佔位列＋lockbar＋解鎖 CTA，與 rankings 同語彙 */
.th-row--lock td {
  pointer-events: none;
}

.th-mask {
  display: block;
  height: 9px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--border), var(--border-strong), var(--border));
  filter: blur(1.2px);
}

.th-mask--name { min-width: 56px; max-width: 120px; }
.th-mask--val { width: 62px; }

.th-lockbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 12px 0 0;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  background: var(--accent-bg);
  border: 1px solid var(--border);
}

.th-lockbar-ico {
  font-size: 12px;
  line-height: 1;
}

.th-ctawrap {
  margin-top: 16px;
  text-align: center;
}

.th-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 26px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-decoration: none;
  color: var(--on-accent, #fff);
  background: var(--brand-gradient);
  box-shadow: 0 4px 14px rgba(94, 70, 24, 0.26);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.th-cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 7px 18px rgba(94, 70, 24, 0.32);
}

.th-cta-ico {
  font-size: 13px;
  line-height: 1;
}

.th-tab-pro {
  margin-left: 5px;
  padding: 1px 5px;
  border-radius: 6px;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.06em;
  vertical-align: 1px;
  color: var(--on-accent, #fff);
  background: var(--brand-gradient);
}

@media (prefers-reduced-motion: reduce) {
  .th-cta {
    transition: none;
  }
  .th-cta:hover {
    transform: none;
  }
}

@media (max-width: 560px) {
  .th-mask--val {
    width: 44px;
  }
  .th-cta {
    padding: 10px 18px;
    font-size: 12.5px;
  }
}

.th-scroll-hint {
  margin: 6px 0 0;
  font-size: 11.5px;
  color: var(--text-faint);
}

@media (min-width: 641px) {
  .th-scroll-hint {
    display: none;
  }
}

@media (max-width: 640px) {
  .th-hero {
    padding: 18px 16px 16px;
  }
  .th-hero-title {
    font-size: 21px;
  }
  .th-window {
    padding: 7px 16px;
    font-size: 13px;
  }
  /* 手機只留「#／族群／中位／廣度」四欄，390px 一屏內零橫向捲動。 */
  .th-table {
    min-width: 0;
    width: 100%;
    font-size: 12.5px;
  }
  .th-table th:nth-child(n + 5),
  .th-table td:nth-child(n + 5) {
    display: none;
  }
  .th-table th,
  .th-table td {
    padding: 9px 7px;
  }
  .th-table th.th-col-name,
  .th-table td.th-col-name {
    min-width: 78px;
  }
  .th-table th.th-col-rank,
  .th-table td.th-col-rank {
    width: 28px;
  }
  .th-bar-track {
    width: 56px;
  }
}


.th-card {
  margin: 0 0 16px;
  padding: 14px 16px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--card-bg);
  box-shadow: var(--shadow-card);
}

.th-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
  margin: 0 0 10px;
}

.th-card-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
}

.th-card-sub {
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--text-faint);
}

.th-tm-svg {
  display: block;
  width: 100%;
  height: auto;
  font-family: inherit;
}

/* 桌機橫式與手機直式兩份 SVG，同時只畫一份。 */
.th-vis-mb,
.th-tm-mbnote {
  display: none;
}

.th-tm .th-fine {
  margin: 10px 0 0;
}

.th-tm-tile rect {
  transition: fill-opacity 0.15s ease, stroke 0.15s ease;
}

.th-tm-tile:hover rect,
.th-tm-tile:focus-visible rect {
  stroke: var(--text-muted);
  stroke-width: 2;
}

.th-tm-nm,
.th-tm-pc {
  fill: var(--text);
  stroke: var(--card-bg);
  stroke-width: 3px;
  stroke-linejoin: round;
  paint-order: stroke;
  pointer-events: none;
}

.th-tm-nm {
  font-weight: 700;
}

.th-tm-pc {
  font-weight: 600;
}

.th-tm-svg--dt .th-tm-nm { font-size: 13px; }
.th-tm-svg--dt .th-tm-pc { font-size: 11px; }
.th-tm-svg--mb .th-tm-nm { font-size: 22px; stroke-width: 4px; }
.th-tm-svg--mb .th-tm-pc { font-size: 18px; stroke-width: 4px; }

@media (max-width: 640px) {
  .th-card {
    padding: 12px 12px 10px;
  }
  .th-card-title {
    font-size: 14px;
  }
  .th-vis-dt {
    display: none;
  }
  .th-vis-mb {
    display: block;
  }
  .th-tm-mbnote {
    display: block;
    margin: 4px 0 0;
  }
}

/* 呈現切換：SSR 兩個 pane 都直出，切換只換容器 class。 */
.th-views {
  display: flex;
  gap: 6px;
  width: fit-content;
  margin: 0 0 12px;
  padding: 4px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-alt, rgba(127, 127, 127, 0.05));
}

html:not(.th-js) .th-views {
  display: none;
}

.th-view {
  padding: 6px 16px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease, transform 0.12s ease;
}

.th-view:hover {
  color: var(--text);
}

.th-view:active {
  transform: scale(0.96);
}

.th-view.is-active {
  color: var(--on-accent, #fff);
  background: var(--brand-gradient);
  box-shadow: 0 3px 10px rgba(94, 70, 24, 0.24);
}

.th-viewbox.th-view-table .th-pane--viz,
.th-viewbox.th-view-viz .th-pane--table {
  display: none;
}

.thb-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 560px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.thb-canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  touch-action: manipulation;
}

.thb-skeleton {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 20px;
  text-align: center;
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-muted);
}

.thb-card {
  position: absolute;
  z-index: 2;
  min-width: 152px;
  max-width: 214px;
  padding: 8px 10px;
  background: var(--card-bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-pop);
  font-size: 12px;
  line-height: 1.5;
  pointer-events: none;
}

.thb-card.is-pinned {
  pointer-events: auto;
}

.thb-card[hidden] {
  display: none;
}

.thb-card-name {
  font-weight: 800;
  font-size: 13px;
  color: var(--text);
  margin-bottom: 4px;
}

.thb-card-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.thb-card-k {
  color: var(--text-muted);
}

.thb-card-v {
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.thb-up {
  color: var(--up);
}

.thb-down {
  color: var(--down);
}

.thb-card-warn {
  margin-top: 5px;
  padding-top: 5px;
  border-top: 1px solid var(--border);
  color: var(--danger);
  font-weight: 700;
}

.thb-card-go {
  display: block;
  margin-top: 6px;
  padding-top: 5px;
  border-top: 1px solid var(--border);
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
}

.thb-card-go:hover {
  text-decoration: underline;
}

.thb-retry {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 3;
  max-width: 86%;
  margin: 0;
  padding: 10px 14px;
  background: var(--card-bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-pop);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
  cursor: pointer;
}

.thb-retry[hidden] {
  display: none;
}

.thb-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}

.thb-transport {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.thb-play,
.thb-step {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 12px;
  line-height: 1;
  letter-spacing: -0.5px;
  cursor: pointer;
  transition: background 0.15s var(--ease), color 0.15s var(--ease),
    border-color 0.15s var(--ease);
}

.thb-play {
  border-radius: 50%;
  background: var(--accent-bg);
  border-color: var(--accent);
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
}

.thb-play:hover:not(:disabled),
.thb-step:hover:not(:disabled) {
  background: var(--card-bg-hover);
  color: var(--text);
}

.thb-play:hover:not(:disabled) {
  color: var(--accent);
}

.thb-play:disabled,
.thb-step:disabled {
  opacity: 0.4;
  cursor: default;
}

.thb-play:focus-visible,
.thb-step:focus-visible,
.thb-speed:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.thb-seek {
  flex: 1 1 auto;
  min-width: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.thb-seek:disabled {
  opacity: 0.45;
  cursor: default;
}

.thb-daylabel {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.thb-daydate {
  color: var(--text);
}

.thb-daycount {
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
}

.thb-speeds {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.thb-speed {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 700;
  min-height: 30px;
  padding: 5px 11px;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}

.thb-speed:hover {
  color: var(--text);
}

.thb-speed.is-active {
  background: var(--accent-bg);
  color: var(--accent);
}

.thb-speed-x {
  margin-left: 4px;
  font-size: 10.5px;
  font-weight: 700;
  opacity: 0.75;
  font-variant-numeric: tabular-nums;
}

.thb-legend {
  margin: 9px 0 0;
  font-size: 11.5px;
  line-height: 1.7;
  color: var(--text-muted);
}

.thb-ring {
  display: inline-block;
  width: 10px;
  height: 10px;
  vertical-align: -1px;
  margin: 0 3px;
  border: 2px solid var(--danger);
  border-radius: 50%;
}

.thb-note {
  margin: 6px 0 0;
  font-size: 11px;
  color: var(--text-faint);
}

.thb-lockgrid {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
}

.thb-lockq {
  display: flex;
  padding: 8px;
}

.thb-lockq:nth-child(1) {
  justify-content: flex-start;
  align-items: flex-start;
  background: rgba(var(--up-rgb), 0.17);
}

.thb-lockq:nth-child(2) {
  justify-content: flex-end;
  align-items: flex-start;
  background: rgba(var(--up-rgb), 0.28);
}

.thb-lockq:nth-child(3) {
  justify-content: flex-start;
  align-items: flex-end;
  background: rgba(var(--down-rgb), 0.25);
}

.thb-lockq:nth-child(4) {
  justify-content: flex-end;
  align-items: flex-end;
  background: rgba(var(--down-rgb), 0.15);
}

.thb-lockchip {
  padding: 6px 13px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.thb-lockchip--up {
  background: var(--up);
  border: 1px solid var(--up);
  color: #fff;
}

.thb-lockchip--down {
  background: var(--down);
  border: 1px solid var(--down);
  color: #fff;
}

.thb-lockchip--div {
  background: rgb(250, 200, 55);
  border: 1px solid rgb(196, 152, 34);
  color: #3a2606;
}

.thb-veil {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.thb-veil .th-lockbar {
  margin: 0;
  background: var(--card-bg);
}

.thb-veil .th-ctawrap {
  margin-top: 10px;
}

@media (prefers-reduced-motion: reduce) {
  .th-view,
  .thb-play,
  .thb-step,
  .thb-speed {
    transition: none;
  }
  .th-view:active {
    transform: none;
  }
}

@media (max-width: 640px) {
  .th-views {
    margin-bottom: 10px;
  }
  .th-view {
    padding: 6px 13px;
    font-size: 12px;
  }
  .thb-stage {
    aspect-ratio: 3 / 4;
    max-height: 68vh;
  }
  .thb-controls {
    flex-wrap: wrap;
    gap: 8px;
  }
  .thb-daylabel {
    order: -1;
    flex-basis: 100%;
    justify-content: flex-end;
    font-size: 11px;
  }
  .thb-play,
  .thb-step {
    width: 42px;
    height: 42px;
  }
  .thb-seek {
    flex: 1 1 64px;
  }
  .thb-speeds {
    flex: 1 1 100%;
    justify-content: stretch;
  }
  .thb-speed {
    flex: 1 1 0;
    min-height: 40px;
    padding: 5px 6px;
    text-align: center;
  }
  .thb-card {
    min-width: 132px;
    max-width: 172px;
    font-size: 11.5px;
  }
  .thb-lockchip {
    font-size: 13px;
    padding: 5px 10px;
  }
}

.thb-pickerwrap {
  position: relative;
  flex: 0 0 auto;
}

.thb-pickerbtn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 6px 13px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s var(--ease), color 0.15s var(--ease),
    border-color 0.15s var(--ease);
}

.thb-pickerbtn:hover {
  color: var(--text);
}

.thb-pickerbtn.is-active {
  background: var(--accent-bg);
  border-color: var(--accent);
  color: var(--accent);
}

.thb-pickerbtn:focus-visible,
.thb-picker-act:focus-visible,
.thb-picker-close:focus-visible,
.thb-picker-q:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.thb-picker {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  z-index: 30;
  width: 272px;
  max-height: 348px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-card);
}

.thb-picker[hidden] {
  display: none;
}

.thb-picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.thb-picker-title {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text);
}

.thb-picker-close {
  appearance: none;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
}

.thb-picker-close:hover {
  background: var(--card-bg-hover);
  color: var(--text);
}

.thb-picker-q {
  appearance: none;
  width: 100%;
  min-height: 34px;
  padding: 6px 10px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
  font-size: 12.5px;
}

.thb-picker-acts {
  display: flex;
  gap: 6px;
}

.thb-picker-act {
  appearance: none;
  flex: 1 1 0;
  min-height: 32px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.thb-picker-act:hover {
  background: var(--card-bg-hover);
  color: var(--text);
}

.thb-picker-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.thb-picker-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px;
  border-radius: 7px;
  font-size: 12.5px;
  color: var(--text);
  cursor: pointer;
}

.thb-picker-row[hidden] {
  display: none;
}

.thb-picker-row:hover {
  background: var(--card-bg-hover);
}

.thb-picker-cb {
  flex: 0 0 auto;
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
  cursor: pointer;
}

.thb-picker-nm {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.thb-picker-empty {
  margin: 0;
  padding: 6px 2px;
  font-size: 12px;
  color: var(--text-faint);
}

.thb-picker-empty[hidden] {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .thb-pickerbtn {
    transition: none;
  }
}

@media (max-width: 640px) {
  .thb-pickerwrap {
    flex: 1 1 100%;
  }
  .thb-pickerbtn {
    width: 100%;
    min-height: 40px;
  }
  .thb-picker {
    position: fixed;
    right: 0;
    left: 0;
    bottom: 0;
    width: auto;
    max-height: 72vh;
    padding: 12px 14px 16px;
    border-width: 1px 0 0;
    border-radius: 14px 14px 0 0;
  }
  .thb-picker-close {
    width: 44px;
    height: 44px;
    font-size: 15px;
  }
  .thb-picker-q {
    min-height: 42px;
    font-size: 15px;
  }
  .thb-picker-act {
    min-height: 42px;
    font-size: 13px;
  }
  .thb-picker-row {
    padding: 10px 6px;
    font-size: 14px;
  }
  .thb-picker-cb {
    width: 20px;
    height: 20px;
  }
}

.thb-pickerwrap2 {
  position: relative;
  flex: 0 0 auto;
}

.thb-pickerbtn2 {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 6px 14px;
  background: var(--bg-2);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s var(--ease), color 0.15s var(--ease),
    border-color 0.15s var(--ease);
}

.thb-pickerbtn2:hover {
  color: var(--text);
  border-color: var(--accent);
}

.thb-pickerbtn2.is-active {
  background: var(--accent-bg);
  border-color: var(--accent);
  color: var(--accent);
}

.thb-pkicon {
  flex: 0 0 auto;
  display: block;
  width: 15px;
  height: 15px;
}

.thb-pkbadge {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.thb-pkbadge[hidden] {
  display: none;
}

.thb-pickerbtn2:focus-visible,
.thb-picker2-act:focus-visible,
.thb-picker2-close:focus-visible,
.thb-picker2-chipx:focus-visible,
.thb-picker2-q:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.thb-picker2 {
  position: absolute;
  right: 0;
  bottom: calc(100% + 10px);
  z-index: 30;
  width: 300px;
  max-height: min(66vh, 470px);
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 12px;
  background: var(--card-bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-pop);
  opacity: 0;
  transform: scale(0.97) translateY(6px);
  transform-origin: 100% 100%;
  transition: opacity 0.12s var(--ease), transform 0.12s var(--ease);
}

.thb-picker2.is-in {
  opacity: 1;
  transform: none;
}

.thb-picker2[hidden] {
  display: none;
}

.thb-picker2-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.thb-picker2-title {
  flex: 0 0 auto;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.thb-picker2-count {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.thb-picker2-close {
  appearance: none;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
}

.thb-picker2-close:hover {
  background: var(--card-bg-hover);
  color: var(--text);
}

.thb-picker2-q {
  appearance: none;
  flex: 0 0 auto;
  width: 100%;
  min-height: 36px;
  padding: 6px 11px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--text);
  font-family: inherit;
  font-size: 12.5px;
}

.thb-picker2-chips {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 88px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.thb-picker2-chips[hidden] {
  display: none;
}

.thb-picker2-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  max-width: 100%;
  padding: 3px 4px 3px 9px;
  background: var(--accent-bg);
  border: 1px solid var(--accent);
  border-radius: 999px;
  color: var(--accent);
  font-size: 11.5px;
  font-weight: 700;
}

.thb-picker2-chipnm {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.thb-picker2-chipx {
  appearance: none;
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 999px;
  color: inherit;
  font-family: inherit;
  font-size: 10px;
  line-height: 1;
  cursor: pointer;
}

.thb-picker2-chipx:hover {
  background: var(--accent);
  color: #fff;
}

.thb-picker2-acts {
  flex: 0 0 auto;
  display: flex;
  gap: 6px;
}

.thb-picker2-act {
  appearance: none;
  flex: 1 1 0;
  min-height: 32px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.thb-picker2-act:hover {
  background: var(--card-bg-hover);
  color: var(--text);
}

.thb-picker2-list {
  flex: 1 1 auto;
  min-height: 0;
  max-height: 60vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.thb-picker2-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 8px 7px 9px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 12.5px;
  color: var(--text);
  cursor: pointer;
  transition: background 0.12s var(--ease);
}

.thb-picker2-row[hidden] {
  display: none;
}

.thb-picker2-row:hover {
  background: var(--card-bg-hover);
}

.thb-picker2-row.is-on {
  background: var(--accent-bg);
  border-color: var(--border-strong);
}

.thb-picker2-row.is-on::before {
  content: "";
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
}

.thb-picker2-cb {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}

.thb-picker2-tick {
  flex: 0 0 auto;
  width: 17px;
  height: 17px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-2);
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  color: var(--accent);
}

.thb-picker2-tickmark {
  width: 11px;
  height: 11px;
  opacity: 0;
  transform: scale(0.7);
  transition: opacity 0.12s var(--ease), transform 0.12s var(--ease);
}

.thb-picker2-cb:checked + .thb-picker2-tick {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.thb-picker2-cb:checked + .thb-picker2-tick .thb-picker2-tickmark {
  opacity: 1;
  transform: none;
}

.thb-picker2-cb:focus-visible + .thb-picker2-tick {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.thb-picker2-rank {
  flex: 0 0 auto;
  width: 17px;
  text-align: right;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}

.thb-picker2-nm {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
}

.thb-picker2-pct {
  flex: 0 0 auto;
  min-width: 52px;
  text-align: right;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.thb-picker2-pct.thb-up {
  color: var(--up);
}

.thb-picker2-pct.thb-down {
  color: var(--down);
}

.thb-picker2-amt {
  flex: 0 0 auto;
  min-width: 54px;
  text-align: right;
  font-size: 11px;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}

.thb-picker2-empty {
  flex: 0 0 auto;
  margin: 0;
  padding: 6px 2px;
  font-size: 12px;
  color: var(--text-faint);
}

.thb-picker2-empty[hidden] {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .thb-pickerbtn2,
  .thb-picker2,
  .thb-picker2-row,
  .thb-picker2-tickmark {
    transition: none;
  }
  .thb-picker2 {
    opacity: 1;
    transform: none;
  }
}

@media (max-width: 640px) {
  .thb-pickerwrap2 {
    order: -1;
    flex: 1 1 100%;
  }
  .thb-pickerbtn2 {
    width: 100%;
    min-height: 46px;
    justify-content: center;
    gap: 9px;
    background: var(--accent-bg);
    border-color: var(--accent);
    color: var(--accent);
    font-size: 14px;
  }
  .thb-pkicon {
    width: 17px;
    height: 17px;
  }
  .thb-pkbadge {
    min-width: 22px;
    height: 22px;
    font-size: 12px;
  }
  .thb-picker2 {
    position: fixed;
    right: 0;
    left: 0;
    bottom: 0;
    width: auto;
    max-height: 78vh;
    padding: 12px 14px 18px;
    border-width: 1px 0 0;
    border-radius: 16px 16px 0 0;
    transform: translateY(10px);
    transform-origin: 50% 100%;
  }
  .thb-picker2.is-in {
    transform: none;
  }
  .thb-picker2-close {
    width: 44px;
    height: 44px;
    font-size: 15px;
  }
  .thb-picker2-q {
    min-height: 44px;
    font-size: 15px;
  }
  .thb-picker2-act {
    min-height: 44px;
    font-size: 13px;
  }
  .thb-picker2-chip {
    padding: 4px 5px 4px 10px;
    font-size: 12.5px;
  }
  .thb-picker2-chipx {
    width: 22px;
    height: 22px;
  }
  .thb-picker2-list {
    max-height: 48vh;
    gap: 3px;
  }
  .thb-picker2-row {
    padding: 11px 8px 11px 10px;
    font-size: 14px;
  }
  .thb-picker2-tick {
    width: 21px;
    height: 21px;
  }
  .thb-picker2-tickmark {
    width: 13px;
    height: 13px;
  }
  .thb-picker2-pct {
    min-width: 56px;
    font-size: 13px;
  }
  .thb-picker2-amt {
    min-width: 56px;
    font-size: 11.5px;
  }
}
