:root {
  --ink: #10141c;
  --paper: #f3efe6;
  --panel: rgba(255, 252, 245, 0.94);
  --thead-bg: #faf6ee;
  --line: #d4cdc0;
  --muted: #6b6458;
  --accent: #e4572e;
  --accent-deep: #b83c1a;
  --navy: #1a2744;
  --navy-2: #24355a;
  --good: #2f6f4e;
  --side: #152038;
  --shadow: 0 18px 50px rgba(16, 20, 28, 0.12);
  --radius: 14px;
  --font-display: "Bebas Neue", Impact, sans-serif;
  --font-body: "IBM Plex Sans", "PingFang SC", "Noto Sans SC", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
  --side-w: 220px;
  /* Form / combo / table surfaces (overridden in dark theme) */
  --input-bg: #fffdf8;
  --surface: #fffdf8;
  --surface-2: #fffcf5;
  --cell-bg: #fffcf5;
  --thead-group-bg: #f3ebe0;
  --row-hover: rgba(26, 39, 68, 0.08);
  --row-border: rgba(212, 205, 192, 0.7);
  --thead-edge: rgba(196, 186, 168, 0.95);
  --link: #1d4ed8;
  --link-hover: #1e40af;
  /* Opaque surfaces for sticky headers/cols (do not use semi-transparent --panel) */
  --sticky-cell-bg: var(--cell-bg);
  --sticky-head-bg: var(--thead-bg);
  --sticky-foot-bg: var(--thead-bg);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  font-family: var(--font-body);
  background:
    radial-gradient(1200px 600px at 30% -10%, #f7d7c4 0%, transparent 55%),
    radial-gradient(900px 500px at 100% 0%, #c9d6ef 0%, transparent 50%),
    linear-gradient(180deg, #efe8da 0%, var(--paper) 40%, #e7e1d4 100%);
}

.bg-grid {
  pointer-events: none;
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(26, 39, 68, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(26, 39, 68, 0.04) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(180deg, #000 0%, transparent 90%);
  z-index: 0;
}

.shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: var(--side-w) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  height: 100dvh;
  overflow-y: auto;
  background: linear-gradient(180deg, var(--side) 0%, #0f1729 100%);
  color: #f4efe6;
  padding: 1.4rem 1rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
}

.brand {
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
  padding: 0 0.35rem;
}

.brand-mark {
  font-family: var(--font-display);
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  line-height: 1;
  color: #fff;
  background: var(--accent);
  padding: 0.14rem 0.28rem 0.1rem;
  border-radius: 3px;
  flex: 0 0 auto;
  align-self: flex-start;
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  min-width: 0;
}

.brand-name {
  font-family: var(--font-display);
  font-size: 1.85rem;
  letter-spacing: 0.06em;
  line-height: 0.9;
  display: inline-flex;
  gap: 0.28em;
}

.brand-nba {
  color: #f4efe6;
}

.brand-stat {
  color: var(--accent);
}

.brand-tagline {
  font-family: var(--font-body);
  font-size: 0.58rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  line-height: 1.25;
  color: rgba(244, 239, 230, 0.72);
  white-space: nowrap;
}

.nav-group { display: grid; gap: 0.25rem; }

.nav-parent {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 0;
  background: transparent;
  color: #f4efe6;
  font: 600 0.92rem/1.2 var(--font-body);
  padding: 0.55rem 0.55rem;
  border-radius: 10px;
  cursor: pointer;
}

.nav-parent:hover { background: rgba(255, 255, 255, 0.06); }

.nav-parent .chev {
  font-size: 0.75rem;
  opacity: 0.7;
  transition: transform 0.15s ease;
}

.nav-parent[aria-expanded="false"] .chev { transform: rotate(-90deg); }

.nav-children {
  display: grid;
  gap: 0.15rem;
  padding-left: 0.35rem;
}

.nav-children[hidden] { display: none; }

.view[hidden] {
  display: none !important;
}

.nav-link {
  color: rgba(244, 239, 230, 0.72);
  text-decoration: none;
  font-size: 0.9rem;
  padding: 0.5rem 0.7rem;
  border-radius: 10px;
  border-left: 2px solid transparent;
}

.nav-link:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}

.nav-link.active {
  color: #fff;
  background: rgba(228, 87, 46, 0.18);
  border-left-color: var(--accent);
}

.side-auth {
  margin-top: auto;
  display: grid;
  gap: 0.55rem;
  padding: 0.75rem 0.45rem 0.35rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.side-auth-role {
  margin: 0;
  font-size: 0.72rem;
  color: rgba(244, 239, 230, 0.62);
  letter-spacing: 0.02em;
}

.side-auth-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
}

.side-auth-actions[hidden] {
  display: none !important;
}

.side-auth .btn.ghost {
  border-color: rgba(244, 239, 230, 0.35);
  color: #f4efe6;
  background: rgba(255, 255, 255, 0.06);
}

.side-auth .btn.ghost:hover {
  border-color: rgba(244, 239, 230, 0.55);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.side-auth-name {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.82rem;
  font-weight: 600;
  color: #f4efe6;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.side-meta {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  line-height: 1.45;
  color: rgba(244, 239, 230, 0.55);
  padding: 0 0.35rem;
  white-space: pre-wrap;
}

.side-meta:not([hidden]) {
  display: block;
  margin-top: 0.45rem;
  color: #ffb4a8;
}

html.is-native-app .side-app,
body.is-native-app .side-app {
  display: none !important;
}

.side-app {
  margin-top: auto;
  padding: 0.75rem 0.35rem 0.15rem;
  border-top: 1px solid rgba(244, 239, 230, 0.1);
  text-align: center;
}

.side-qr-link {
  display: inline-block;
  padding: 0.4rem;
  border-radius: 12px;
  background: #f4efe6;
  line-height: 0;
}

.side-qr {
  width: 116px;
  height: 116px;
  display: block;
}

.side-app-title {
  margin: 0.55rem 0 0.2rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: #f4efe6;
}

.side-app-hint {
  margin: 0;
  font-size: 0.68rem;
  line-height: 1.4;
  color: rgba(244, 239, 230, 0.5);
}

/* Role-gated controls: guests / viewers see browse-only UI */
body:not(.can-sync) .btn-sync,
body:not(.can-sync) .auth-sync-only,
body:not(.can-edit) .auth-edit-only,
body:not(.can-manage) .auth-manage-only,
.auth-manage-only[hidden] {
  display: none !important;
}

body:not(.can-edit) th.col-sticky-right,
body:not(.can-edit) td.col-sticky-right,
body:not(.can-edit) th[data-col="_actions"],
body:not(.can-edit) th[data-col="_actions_l2"] {
  display: none !important;
}

.auth-dialog {
  width: min(420px, calc(100vw - 2rem));
  border: 0;
  border-radius: 14px;
  padding: 0;
  background: var(--panel, #fff);
  color: inherit;
  box-shadow: 0 24px 60px rgba(15, 23, 41, 0.28);
}

.auth-dialog::backdrop {
  background: rgba(10, 14, 24, 0.55);
}

.auth-dialog-form {
  display: grid;
}

.auth-fields {
  display: grid;
  gap: 0.35rem;
}

.auth-method-seg {
  width: 100%;
  margin: 0 0 0.35rem;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--ink) 4%, transparent);
  padding: 0.18rem;
  gap: 0.18rem;
}
.auth-method-seg .lb-seg-btn {
  flex: 1;
  font: 600 0.72rem/1.2 var(--font-body);
  padding: 0.42rem 0.5rem;
  color: var(--ink);
  opacity: 0.65;
  border: 1px solid transparent;
  border-radius: 8px;
}
.auth-method-seg .lb-seg-btn.is-active {
  opacity: 1;
  color: var(--accent-deep, var(--ink));
  background: var(--panel);
  border-color: color-mix(in srgb, var(--accent) 50%, var(--line));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 24%, transparent);
}
html[data-theme="dark"] .auth-method-seg .lb-seg-btn {
  color: var(--ink);
  opacity: 0.72;
}
html[data-theme="dark"] .auth-method-seg .lb-seg-btn.is-active {
  opacity: 1;
  color: #fff;
  background: var(--accent);
  border-color: var(--accent-deep, var(--accent));
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

.auth-fields label {
  margin-top: 0.45rem;
  font: 600 0.72rem/1.2 var(--font-body);
  color: var(--muted);
  letter-spacing: 0.04em;
}

.auth-fields input {
  width: 100%;
  font: 600 0.72rem/1.2 var(--font-body);
  min-height: 2.1rem;
  padding: 0.38rem 0.55rem;
  border-radius: 10px;
}

.auth-dialog .edit-dialog-head h3 {
  font: 600 1rem/1.2 var(--font-body);
}

.auth-dialog .edit-en {
  font: 400 0.72rem/1.45 var(--font-body);
  color: var(--muted);
}

.auth-field-hint {
  margin: 0.15rem 0 0.35rem;
  font: 400 0.72rem/1.45 var(--font-body);
  color: var(--muted, #6b7280);
}

.auth-field-hint.error {
  color: #b42318;
}

.auth-field-hint.ok {
  color: #067647;
}

#auth-forgot-link {
  margin-right: auto;
}

.auth-dialog-extra {
  display: flex;
  justify-content: center;
  padding: 0.15rem 1.1rem 0.95rem;
}

.auth-dialog-extra[hidden] {
  display: none !important;
}

.auth-footer-link {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 0.15em;
  padding: 0.2rem 0.35rem;
}

.auth-footer-link:hover {
  color: var(--accent-deep);
}

.auth-footer-link[hidden] {
  display: none !important;
}

#acc-tbody select {
  min-width: 7.5rem;
  font: inherit;
}

#sys-panel-users .acc-table-wrap {
  overflow: auto;
  max-width: 100%;
}

#sys-panel-users .acc-table {
  width: max-content;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

#sys-panel-users .acc-table th,
#sys-panel-users .acc-table td {
  white-space: nowrap;
  vertical-align: middle;
}

#sys-panel-users .acc-table .col-sticky-right,
#sys-panel-users .acc-table .acc-actions-col {
  position: sticky;
  right: 0;
  z-index: 5;
  text-align: center;
  white-space: nowrap;
  background: var(--cell-bg);
  box-shadow: -6px 0 8px -6px rgba(40, 32, 20, 0.18);
  padding-left: 0.85rem;
  padding-right: 0.85rem;
}

#sys-panel-users .acc-table thead .col-sticky-right {
  z-index: 7;
  background: var(--thead-bg);
}

#sys-panel-users .acc-table tbody tr:hover td.col-sticky-right {
  background: color-mix(in srgb, var(--accent) 6%, var(--cell-bg));
}

/* Super admin page: sticky ops must stay visible even if can-edit CSS is toggled */
#sys-panel-users .acc-table .col-sticky-right {
  display: table-cell !important;
}

.acc-actions {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.35rem;
}

.acc-role-text,
.acc-active-text {
  display: inline-block;
}

tr.acc-editing .acc-role-text,
tr.acc-editing .acc-active-text,
tr:not(.acc-editing) .acc-role,
tr:not(.acc-editing) .acc-active,
tr:not(.acc-editing) .acc-edit-actions,
tr.acc-editing .acc-view-actions {
  display: none !important;
}

tr.acc-editing .acc-role,
tr.acc-editing .acc-active {
  display: inline-block;
}

.btn.acc-delete,
.btn.danger-text {
  color: #c0392b;
  border-color: rgba(192, 57, 43, 0.35);
}

.btn.acc-delete:hover,
.btn.danger-text:hover {
  color: #922b21;
  border-color: rgba(192, 57, 43, 0.55);
  background: rgba(192, 57, 43, 0.06);
}

.sys-tabs {
  margin: 0 0 1rem;
  display: inline-flex;
}

.sys-tabs[hidden] {
  display: none !important;
}

.sys-tabs .seg-btn {
  text-decoration: none;
}

.sys-panel[hidden] {
  display: none !important;
}

.cron-table .cron-name {
  font-weight: 650;
}

.cron-table .cron-desc {
  font-size: 0.8rem;
  margin-top: 0.15rem;
  line-height: 1.35;
}

.cron-status {
  display: inline-flex;
  align-items: center;
  font-size: 0.82rem;
  font-weight: 650;
}

.cron-status-ok { color: #1f7a4d; }
.cron-status-error { color: #b42318; }
.cron-status-paused { color: var(--muted); }
.cron-status-running { color: #b54708; }

.cron-actions {
  flex-wrap: nowrap;
  gap: 0.35rem;
}

.cron-last {
  font-size: 0.85rem;
  line-height: 1.4;
}

/* 任务列表 / 定时任务：可拖拽列宽、操作列右侧固定、过宽横向滚动 */
#sys-panel-tasks .sys-job-table-wrap,
#sys-panel-cron .sys-job-table-wrap {
  overflow: auto;
  max-width: 100%;
  max-height: min(68vh, 820px);
  padding-right: 10px;
}

#sys-panel-tasks .cron-table.resizable-table,
#sys-panel-cron .cron-table.resizable-table {
  width: max-content;
  min-width: 0;
}

#sys-panel-tasks .resizable-table .cron-last,
#sys-panel-cron .resizable-table .cron-last {
  max-width: none;
}

#sys-panel-tasks .col-sticky-right,
#sys-panel-cron .col-sticky-right {
  position: sticky;
  right: 0;
  z-index: 5;
  text-align: center;
  white-space: nowrap;
  overflow: visible;
  background: var(--cell-bg);
  box-shadow: -6px 0 8px -6px rgba(40, 32, 20, 0.18);
  padding-left: 0.85rem;
  padding-right: 0.85rem;
}

#sys-panel-tasks thead .col-sticky-right,
#sys-panel-cron thead .col-sticky-right {
  z-index: 7;
  background: var(--thead-bg);
}

#sys-panel-tasks tbody tr:hover td.col-sticky-right,
#sys-panel-cron tbody tr:hover td.col-sticky-right {
  background: color-mix(in srgb, var(--accent) 6%, var(--cell-bg));
}

#sys-panel-tasks .col-sticky-right,
#sys-panel-cron .col-sticky-right {
  display: table-cell !important;
}

#sys-panel-tasks .resizable-table.fit-content-cols th,
#sys-panel-tasks .resizable-table.fit-content-cols td,
#sys-panel-cron .resizable-table.fit-content-cols th,
#sys-panel-cron .resizable-table.fit-content-cols td {
  white-space: normal;
  word-break: normal;
  overflow-wrap: break-word;
  line-height: 1.35;
}

#sys-panel-tasks .resizable-table.fit-content-cols .cron-status,
#sys-panel-cron .resizable-table.fit-content-cols .cron-status {
  white-space: nowrap;
}

.role-list {
  display: grid;
  gap: 0.85rem;
}

.role-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.9rem 1rem;
  background: var(--surface);
  color: var(--ink);
  display: grid;
  gap: 0.65rem;
}

.role-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 0.85rem;
}

.role-card-head h3 {
  margin: 0;
  font-size: 1.05rem;
}

.role-card-meta {
  font-size: 0.78rem;
  color: var(--muted, #6b7280);
}

.role-card-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.55rem 0.75rem;
}

.role-card-fields label {
  display: grid;
  gap: 0.25rem;
  font-size: 0.75rem;
  font-weight: 600;
}

.role-perms {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 0.9rem;
}

.role-perms-grouped {
  display: grid;
  gap: 0.85rem;
  flex-wrap: unset;
}

.role-perm-l1 {
  display: grid;
  gap: 0.55rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid color-mix(in srgb, var(--navy) 12%, transparent);
  border-radius: 10px;
  background: color-mix(in srgb, var(--surface-2) 70%, transparent);
}

.role-perm-l1-title {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--ink);
}

.role-perm-l2-list {
  display: grid;
  gap: 0.55rem;
}

.role-perm-l2 {
  display: grid;
  gap: 0.35rem;
  padding-left: 0.35rem;
  border-left: 3px solid color-mix(in srgb, var(--accent, #e4572e) 55%, transparent);
}

.role-perm-l2-title {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 650;
  color: var(--muted);
}

.role-perm-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
}

.role-perm-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.role-perm-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  background: color-mix(in srgb, var(--navy) 12%, var(--surface-2));
  color: var(--ink);
}

.role-perm-chip.is-off {
  opacity: 0.45;
  font-weight: 500;
}

.role-card-view,
.role-card-edit {
  display: grid;
  gap: 0.55rem;
}

.role-card:not(.role-editing) .role-card-edit,
.role-card.role-editing .role-card-view {
  display: none !important;
}

.role-view-line {
  margin: 0;
  font-size: 0.88rem;
  color: var(--ink);
  line-height: 1.45;
}

.role-view-line .muted {
  color: var(--muted);
}

.role-perms label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
  padding: 0.2rem 0.35rem;
  border-radius: 8px;
}

.role-perms label:hover {
  background: rgba(228, 87, 46, 0.06);
}

.role-perms input[type="checkbox"] {
  pointer-events: auto;
}

/* Permission catalog / matrix: view vs edit */
#sys-panel-permissions tr:not(.perm-editing) .perm-edit-only,
#sys-panel-permissions tr.perm-editing .perm-view-only {
  display: none !important;
}

#rbac-table:not(.rbac-editing) .rbac-cell:not(:disabled) {
  pointer-events: none;
}

#rbac-table:not(.rbac-editing) {
  opacity: 0.96;
}

.rbac-matrix th,
.rbac-matrix td {
  text-align: center;
  vertical-align: middle;
  white-space: nowrap;
}

.rbac-matrix th.rbac-sticky,
.rbac-matrix td.rbac-sticky {
  text-align: left;
  position: sticky;
  background: var(--sticky-cell-bg);
  z-index: 2;
}

.rbac-matrix th.rbac-sticky {
  background: var(--sticky-head-bg);
}

.rbac-matrix th.rbac-sticky:nth-child(1),
.rbac-matrix td.rbac-sticky:nth-child(1) {
  left: 0;
  min-width: 5.5rem;
}
.rbac-matrix th.rbac-sticky:nth-child(2),
.rbac-matrix td.rbac-sticky:nth-child(2) {
  left: 5.5rem;
  min-width: 6.5rem;
}
.rbac-matrix th.rbac-sticky:nth-child(3),
.rbac-matrix td.rbac-sticky:nth-child(3) {
  left: 12rem;
  min-width: 7rem;
}
.rbac-matrix th.rbac-sticky:nth-child(4),
.rbac-matrix td.rbac-sticky:nth-child(4) {
  left: 19rem;
  min-width: 11rem;
  box-shadow: 6px 0 8px -6px rgba(0, 0, 0, 0.18);
}

.rbac-matrix .rbac-code {
  font-size: 0.72rem;
}

.rbac-matrix input[type="checkbox"] {
  width: 1.05rem;
  height: 1.05rem;
}

#sys-panel-permissions .table-wrap:has(#rbac-table) {
  overflow: auto;
  max-width: 100%;
}

.content {
  padding: 1.25rem 1.4rem 2.5rem;
  max-width: 1400px;
  position: relative;
}

.side-auth:empty {
  display: none;
}

.top-auth {
  position: absolute;
  top: 1.15rem;
  right: 1.4rem;
  z-index: 120;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.45rem;
  margin: 0;
  pointer-events: none;
}

.top-auth > * {
  pointer-events: auto;
}

.ai-assistant-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  height: 2rem;
  padding: 0 0.7rem 0 0.5rem;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--line) 80%, #cfc8bc);
  background: #fff;
  color: #111;
  font: 650 0.78rem/1 var(--font-body);
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(16, 20, 28, 0.06);
}
html[data-theme="dark"] .ai-assistant-btn {
  background: color-mix(in srgb, var(--panel) 92%, #fff);
  color: var(--ink);
}
.ai-assistant-btn:hover {
  border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
}
.ai-assistant-ico {
  width: 1.05rem;
  height: 1.05rem;
  flex: 0 0 auto;
}
.view-agent {
  display: flex;
  flex-direction: column;
  min-height: 60vh;
  gap: 0.75rem;
}
.agent-toolbar-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.agent-toolbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.agent-history-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.agent-main {
  display: flex;
  gap: 0.75rem;
  align-items: stretch;
  min-height: 0;
}
.agent-chat-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.agent-history-panel {
  width: min(17rem, 38vw);
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 0.55rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  max-height: min(70vh, 720px);
}
.agent-history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
}
.agent-history-list {
  flex: 1;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.agent-history-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.25rem 0.35rem;
  align-items: start;
  padding: 0.35rem 0.4rem;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--surface);
}
.agent-history-item:hover,
.agent-history-item.is-active {
  border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
}
.agent-history-open {
  grid-column: 1;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  width: 100%;
  padding: 0.1rem 0.15rem;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
}
.agent-history-item-title {
  font-size: 0.88rem;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.agent-history-item-meta {
  font-size: 0.72rem;
  color: var(--muted, #6b7280);
}
.agent-history-item-del {
  grid-column: 2;
  grid-row: 1;
  font-size: 0.72rem;
  padding: 0.1rem 0.35rem;
  min-height: 0;
  align-self: start;
}
.agent-history-empty {
  margin: 0.35rem 0 0;
  font-size: 0.85rem;
}
.agent-thread {
  flex: 1;
  min-height: 280px;
  max-height: min(62vh, 640px);
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}
@media (max-width: 720px) {
  .agent-main {
    flex-direction: column;
  }
  .agent-history-panel {
    width: 100%;
    max-height: 11rem;
  }
}
.agent-msg {
  max-width: 46rem;
  padding: 0.65rem 0.8rem;
  border-radius: 12px;
  white-space: pre-wrap;
  line-height: 1.5;
}
.agent-msg.user {
  align-self: flex-end;
  background: color-mix(in srgb, var(--navy) 88%, #000);
  color: #fff;
}
.agent-msg.assistant {
  align-self: flex-start;
  background: var(--surface);
  border: 1px solid var(--line);
}
.agent-badge {
  display: inline-block;
  margin-bottom: 0.35rem;
  padding: 0.08rem 0.45rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 650;
  background: color-mix(in srgb, var(--good) 18%, var(--surface));
}
.agent-badge.network {
  background: color-mix(in srgb, var(--accent) 18%, var(--surface));
}
.agent-compose {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
}
.agent-compose textarea {
  flex: 1;
  resize: vertical;
  min-height: 2.6rem;
  font: inherit;
}

.top-auth-guest,
.top-auth-user {
  display: flex;
  align-items: center;
  gap: 0.32rem;
  padding: 0.1rem 0.28rem 0.1rem 0.32rem;
  min-height: 1.7rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  border: 1px solid var(--line);
  box-shadow: 0 8px 22px rgba(16, 20, 28, 0.08);
  backdrop-filter: blur(8px);
}

.top-auth-guest .btn.sm {
  min-height: 1.45rem;
  padding: 0.15rem 0.55rem;
  font-size: 0.75rem;
}

.top-auth-guest[hidden],
.top-auth-user[hidden] {
  display: none !important;
}

.top-auth-avatar {
  width: 1.45rem;
  height: 1.45rem;
  border-radius: 50%;
  border: 1px solid var(--line);
  padding: 0;
  overflow: hidden;
  cursor: pointer;
  background: color-mix(in srgb, var(--navy) 12%, var(--panel));
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}

.top-auth-avatar:hover {
  border-color: var(--accent);
}

.top-auth-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.top-auth-avatar-fallback {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--navy);
  line-height: 1;
}

.top-auth-name {
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.2;
  padding: 0.05rem 0.4rem 0.05rem 0.08rem;
  cursor: pointer;
  max-width: 10rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.top-auth-name:hover {
  color: var(--accent-deep);
}

.top-auth-user {
  position: relative;
}

.user-menu-pop {
  position: absolute;
  top: calc(100% + 0.4rem);
  right: 0;
  min-width: 11.5rem;
  display: grid;
  gap: 0.15rem;
  padding: 0.55rem 0.4rem 0.4rem;
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: 0 14px 32px rgba(10, 16, 28, 0.18);
  z-index: 130;
}

.user-menu-pop[hidden] {
  display: none !important;
}

.user-menu-meta {
  display: grid;
  gap: 0.15rem;
  padding: 0.2rem 0.65rem 0.55rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 0.25rem;
}

.user-menu-name {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-menu-role {
  font-size: 0.75rem;
  color: var(--muted);
}

.user-menu-item {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  text-align: left;
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  cursor: pointer;
  opacity: 0.9;
}

.user-menu-item:hover {
  background: color-mix(in srgb, var(--ink) 6%, transparent);
  opacity: 1;
}

.user-menu-item.is-danger {
  color: #b42318;
}

#profile-role {
  opacity: 0.85;
  cursor: default;
  background: color-mix(in srgb, var(--line) 35%, var(--panel));
}

.profile-dialog-foot {
  flex-wrap: wrap;
}

html.is-native-app .top-auth {
  display: flex;
  position: sticky;
  top: 0;
  right: auto;
  justify-content: flex-end;
  z-index: 50;
  margin: 0 0 0.45rem;
  pointer-events: none;
}
html.is-native-app .top-auth > .ai-assistant-btn {
  pointer-events: auto;
}
html.is-native-app .top-auth-guest,
html.is-native-app .top-auth-user,
html.is-native-app #theme-menu {
  display: none !important;
}

.page-head {
  margin-bottom: 1rem;
  display: grid;
  gap: 0.25rem;
  padding-right: 11.5rem;
  min-height: 1.85rem;
  align-content: center;
}

.page-head h1 {
  margin: 0;
  font-size: 1.55rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.page-head p {
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 400;
  line-height: 1.35;
}

.page-head-inline {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
}

.page-head-inline h1 {
  font-size: 1.05rem;
  letter-spacing: 0;
}

.page-head-inline p {
  font-size: 0.72rem;
  font-weight: 400;
  color: var(--muted);
  line-height: 1.35;
}

.player-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
}
.player-card-head > div:first-child {
  display: grid;
  gap: 0.25rem;
}
.player-card-head h1 {
  margin-top: 0.2rem;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.65rem 1rem;
}
.player-card-head h1 .pc-id {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.02em;
}
.player-card-sub {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}
.player-card-actions {
  margin-top: 0.15rem;
}
.player-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.15rem 1.25rem 1.3rem;
  display: grid;
  gap: 1rem;
}
.player-card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem 1.5rem;
}
.player-card-field {
  display: grid;
  gap: 0.2rem;
}
.player-card-field .label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.player-card-field .value {
  font-size: 0.95rem;
  color: var(--ink, #1a2744);
  min-height: 1.35em;
}
.player-card-honors {
  border-top: 1px solid var(--line);
  padding-top: 0.85rem;
  margin-top: 0.15rem;
}
.player-card-honors h4 {
  margin: 0 0 0.65rem;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--navy);
}
.pc-fold {
  border-top: 1px solid var(--line);
  padding: 0.15rem 0 0.35rem;
  margin: 0;
}
.pc-fold:first-child {
  border-top: 0;
  padding-top: 0;
}
.pc-fold-sub {
  border-top: 1px dashed rgba(26, 39, 68, 0.12);
  margin-top: 0.35rem;
  padding-top: 0.25rem;
}
.pc-fold-sub:first-child {
  border-top: 0;
  margin-top: 0;
  padding-top: 0;
}
.pc-fold-summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0;
  padding: 0.55rem 0.15rem;
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--navy);
  user-select: none;
}
.pc-fold-summary::-webkit-details-marker {
  display: none;
}
.pc-fold-summary::after {
  content: "";
  width: 0.45rem;
  height: 0.45rem;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(-45deg);
  transition: transform 0.15s ease;
  flex: 0 0 auto;
  margin-left: auto;
  margin-top: -0.1rem;
}
.pc-fold[open] > .pc-fold-summary::after {
  transform: rotate(45deg);
  margin-top: -0.2rem;
}
.pc-fold-sub > .pc-fold-summary {
  font-size: 0.86rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 0.4rem 0.1rem;
}
.pc-fold-body {
  padding: 0 0 0.55rem;
}
.pc-fold-stats {
  display: grid;
  gap: 0.15rem;
}
.pc-honors-list {
  display: grid;
  gap: 0.55rem;
}
.pc-honor-row {
  display: grid;
  grid-template-columns: minmax(7.5rem, 11rem) 1fr;
  gap: 0.35rem 1rem;
  align-items: baseline;
}
.pc-honor-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--navy);
}
.pc-honor-name .pc-honor-count {
  margin-left: 0.35rem;
  font-weight: 500;
  color: var(--muted);
  font-size: 0.78rem;
}
.pc-honor-seasons {
  font-size: 0.84rem;
  color: var(--ink, #1a2744);
  line-height: 1.45;
  font-variant-numeric: tabular-nums;
}
.pc-honors-empty {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
}
.player-card-stats {
  border-top: 1px solid var(--line);
  padding-top: 0.85rem;
  margin-top: 0.15rem;
}
.player-stats-scope {
  margin: 0 0 0.55rem;
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--navy);
}
.player-card-stats + .player-card-stats {
  margin-top: 0.75rem;
}
@media (max-width: 640px) {
  .player-card-grid { grid-template-columns: 1fr; }
  .pc-honor-row { grid-template-columns: 1fr; gap: 0.15rem; }
}

.filters, .results, .team-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}

.filters {
  position: relative;
  z-index: 40;
  padding: 1.05rem 1.1rem 0.85rem;
  margin-bottom: 1rem;
  overflow: visible;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 0.75rem;
  align-items: center;
  overflow: visible;
}

.filter-row + .filter-row { margin-top: 0.85rem; }

.filter-row-query {
  flex-wrap: wrap;
}

.filter-row-query .field {
  min-width: 0;
  flex: 0 1 auto;
}

.filter-row-query .field.field-player {
  flex: 0 0 280px;
  width: 280px;
  min-width: 280px;
  max-width: 320px;
  overflow: visible;
  position: relative;
  z-index: 50;
}

.filter-row-query .field.field-team {
  flex: 0 0 220px;
  width: 220px;
  min-width: 220px;
  max-width: 260px;
}

#view-base-players .filter-row-query .field.field-college,
#view-base-players .filter-row-query .field.field-country {
  flex: 0 1 150px;
  min-width: 120px;
  max-width: 180px;
}

#view-base-draft .filter-row-query .field.field-draft-year {
  flex: 0 0 auto;
  min-width: 12.5rem;
  max-width: none;
}

#view-base-draft .filter-row-query .field.field-draft-year .combo,
#view-base-draft .filter-row-query .field.field-draft-year input {
  width: 11.5rem;
  min-width: 11.5rem;
}

#view-base-draft .filter-row-query .field.field-draft-year .combo-list {
  min-width: 11.5rem;
  width: max-content;
  max-width: 16rem;
}

#view-base-draft .filter-row-query .field.field-draft-round {
  flex: 0 0 auto;
  min-width: 6.5rem;
}

#view-base-draft .filter-row-query .field.field-draft-round select {
  min-width: 6.5rem;
  width: 6.5rem;
}

#view-base-draft .filter-row-query .field.field-draft-pick {
  flex: 0 0 auto;
  min-width: 8.75rem;
}

#view-base-draft .filter-row-query .field.field-draft-pick .combo,
#view-base-draft .filter-row-query .field.field-draft-pick input {
  width: 8.25rem;
  min-width: 8.25rem;
}

#view-base-draft .filter-row-query .field.field-draft-pick .combo-list {
  min-width: 8.25rem;
  width: max-content;
  max-width: 12rem;
}

#view-base-draft .filter-row-query .field.field-player {
  flex: 0 1 12rem;
  min-width: 10rem;
  max-width: 14rem;
}

#view-base-draft .filter-row-query .field.field-college {
  flex: 0 1 16rem;
  min-width: 13rem;
  max-width: 20rem;
}

#view-base-draft .filter-row-query .field.field-country {
  flex: 0 0 auto;
  min-width: 10rem;
  max-width: none;
}

#view-base-draft .filter-row-query .field.field-country input {
  width: 5.5rem;
  min-width: 5.5rem;
  flex: 0 0 5.5rem;
}

#view-base-players .filter-row-query .field.field-name-status {
  flex: 0 0 auto;
  min-width: 7.5rem;
}

#view-base-players .filter-row-query .field.field-name-status select {
  min-width: 7.5rem;
}

.filter-row-query .field.field-player .combo,
.filter-row-query .field.field-player .multi-combo,
.filter-row-query .field.field-player input,
.filter-row-query .field.field-team input {
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.filter-row-query .field.field-player .multi-combo-control input {
  width: auto;
  max-width: none;
  flex: 1 1 7rem;
}

.filter-row-query .season-start,
.filter-row-query .season-end,
.filter-row-query .season-type {
  min-width: 7rem;
}

.check-label {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 42px;
  margin: 0;
  font-size: 0.88rem;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink);
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
}

.check-label input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  flex: 0 0 auto;
  width: 1.05rem;
  height: 1.05rem;
  margin: 0;
  border: 1.5px solid color-mix(in srgb, var(--muted) 55%, var(--line));
  border-radius: 4px;
  background: var(--input-bg);
  box-shadow: inset 0 1px 0 color-mix(in srgb, var(--surface) 35%, transparent);
  cursor: pointer;
  vertical-align: middle;
  transition: background 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}

.check-label input[type="checkbox"]:hover {
  border-color: var(--accent-deep);
}

.check-label input[type="checkbox"]:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 55%, transparent);
  outline-offset: 2px;
}

.check-label input[type="checkbox"]:checked {
  border-color: var(--accent-deep);
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%23fff' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round' d='M3.5 8.5 6.5 11.5 12.5 4.5'/%3E%3C/svg%3E")
      center / 0.78rem 0.78rem no-repeat,
    var(--accent-deep);
  box-shadow: none;
}

.filter-row-spread {
  width: 100%;
  align-items: center;
}

.filter-meta-field {
  margin-left: auto;
  min-width: 0;
}

.filter-meta {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
  line-height: 42px;
}

#s-hint .season-count-num {
  color: #d62828;
  font-weight: 700;
}

.field {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
  flex: 0 1 auto;
}

.field.grow { flex: 1 1 180px; }

.field.field-wide {
  min-width: 280px;
  flex: 0 1 320px;
}

.field.field-wide select {
  width: 100%;
  min-width: 0;
  flex: 1 1 auto;
  padding-right: 2rem;
  text-overflow: clip;
  white-space: nowrap;
}

.field.field-textarea {
  align-items: flex-start;
}

.field.field-textarea > label {
  padding-top: 0.7rem;
}

.field.field-check {
  flex: 0 0 auto;
}

.field.actions {
  flex: 0 0 auto;
}

.field > label:not(.check-label) {
  flex: 0 0 auto;
  margin: 0;
  font-size: 0.86rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: var(--muted);
  white-space: nowrap;
}

.field > input,
.field > select,
.field > textarea,
.field > .combo,
.field > .multi-combo {
  flex: 1 1 auto;
  min-width: 0;
}

.ghost-label { display: none; }

/* Don't reset checkbox/radio — appearance:none without :checked styles makes them unusable */
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="range"]):not([type="hidden"]),
select {
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid var(--line);
  background-color: var(--input-bg);
  color: var(--ink);
  border-radius: 10px;
  padding: 0.62rem 0.75rem;
  font: 500 0.92rem/1.2 var(--font-body);
  min-height: 42px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input[type="checkbox"],
input[type="radio"] {
  appearance: auto;
  -webkit-appearance: auto;
  width: 1.05rem;
  height: 1.05rem;
  min-height: 0;
  margin: 0;
  padding: 0;
  border-radius: 3px;
  accent-color: var(--accent-deep);
  cursor: pointer;
  flex: 0 0 auto;
  vertical-align: middle;
}

input[type="checkbox"]:disabled,
input[type="radio"]:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

/* Native <select>: chevron so it reads as a dropdown, not a text field */
select {
  padding-right: 2.1rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1.5 1.75L6 6.25L10.5 1.75' stroke='%236b6458' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 0.72rem 0.48rem;
  cursor: pointer;
}

input:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(228, 87, 46, 0.18);
}

.range-sep {
  align-self: center;
  padding-bottom: 0;
  color: var(--muted);
  font-family: var(--font-mono);
  font-weight: 500;
}

.btn-row { display: flex; gap: 0.45rem; flex-wrap: wrap; }

.btn {
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.58rem 1rem;
  font: 600 0.88rem/1 var(--font-body);
  cursor: pointer;
  transition: transform 0.12s ease, background 0.15s ease, border-color 0.15s ease;
  min-height: 42px;
}

.btn:active { transform: translateY(1px); }
.btn.sm { min-height: 34px; padding: 0.4rem 0.75rem; font-size: 0.8rem; width: fit-content; }

.btn.primary { background: var(--navy); color: #f7f3ea; }
.btn.primary:hover { background: var(--navy-2); }
.btn.accent { background: var(--accent); color: #fff8f4; }
.btn.accent:hover { background: var(--accent-deep); }
.btn.ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--ink);
}
.btn.ghost:hover { border-color: var(--navy); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

.range-hint {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--good);
}

.filter-status {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem 1.25rem;
  flex-wrap: wrap;
  margin: 0.75rem 0 0;
}

.result-hint {
  margin: 0;
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
}

.result-hint span {
  color: var(--accent);
  font-weight: 500;
}

/* Sit on the last filter row; if width is tight, wrap to next line right-aligned. */
.filter-row > .result-hint.filter-result-inline,
.filter-row-query > .result-hint.filter-result-inline {
  align-self: flex-end;
  margin: 0 0 0 auto;
  padding-bottom: 0.55rem;
  line-height: 1.25;
  text-align: right;
  flex: 0 0 auto;
  min-width: max-content;
}

.sync-hint {
  margin: 0.35rem 0 0;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--navy);
  min-height: 1.1em;
  line-height: 1.35;
  word-break: break-word;
}

.sync-hint.running { color: var(--accent-deep); }
.sync-hint.error { color: #a32020; }

.scoring-sync-dialog-body {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.scoring-sync-season-row {
  display: grid;
  grid-template-columns: auto 1fr auto auto 1fr;
  gap: 0.45rem 0.6rem;
  align-items: center;
}

.scoring-sync-season-row .range-sep {
  color: var(--muted);
  font-size: 0.85rem;
}

.scoring-sync-coverage {
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.scoring-sync-hint {
  margin-top: 0.25rem;
}

#view-games .btn-row .btn-scoring-sync {
  white-space: nowrap;
}

#view-games .btn-row .btn-scoring-progress {
  white-space: nowrap;
}

.scoring-progress-dialog {
  width: min(42rem, 96vw);
  max-height: min(85vh, 40rem);
}

.scoring-progress-form {
  display: flex;
  flex-direction: column;
  max-height: min(85vh, 40rem);
}

.scoring-progress-body {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  min-height: 0;
  overflow: hidden;
}

.scoring-progress-job {
  margin: 0;
}

.scoring-progress-list {
  overflow: auto;
  max-height: min(55vh, 28rem);
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding-right: 0.15rem;
}

.scoring-progress-empty {
  margin: 0.5rem 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.scoring-progress-row {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "meta actions"
    "bar actions";
  gap: 0.25rem 0.75rem;
  align-items: center;
  padding: 0.45rem 0.35rem;
  border-bottom: 1px solid color-mix(in srgb, var(--border, #ccc) 70%, transparent);
}

.scoring-progress-row.is-complete {
  opacity: 0.85;
}

.scoring-progress-row.is-active .scoring-progress-season {
  color: var(--accent-deep, var(--accent));
  font-weight: 600;
}

.scoring-progress-row.is-queued .scoring-progress-season {
  font-weight: 600;
}

.scoring-progress-meta {
  grid-area: meta;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.85rem;
  align-items: baseline;
}

.scoring-progress-season {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.scoring-progress-nums {
  font-size: 0.82rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.scoring-progress-live {
  color: var(--accent-deep, var(--accent));
}

.scoring-progress-bar-wrap {
  grid-area: bar;
  height: 0.45rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--muted) 18%, transparent);
  overflow: hidden;
}

.scoring-progress-bar {
  height: 100%;
  border-radius: inherit;
  background: var(--accent, #2a6);
  transition: width 0.25s ease;
}

.scoring-progress-actions {
  grid-area: actions;
  align-self: center;
  min-width: 4.5rem;
  text-align: right;
}

.scoring-progress-actions .btn[hidden] {
  display: none;
}
.sync-progress:not([hidden]) {
  display: block;
}

.seg-toggle {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--panel);
  min-height: 38px;
}

.seg-toggle[hidden] {
  display: none !important;
}

.seg-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 600;
  padding: 0.45rem 0.95rem;
  cursor: pointer;
  min-width: 4.5rem;
}

.seg-btn + .seg-btn {
  border-left: 1px solid var(--line);
}

.seg-btn.active {
  background: var(--navy);
  color: #f7f4ef;
}

.seg-btn:hover:not(.active) {
  background: var(--row-hover);
  color: var(--ink);
}

html[data-theme="dark"] .seg-btn.active {
  background: color-mix(in srgb, var(--navy) 22%, var(--surface-2));
  color: var(--ink);
}

.honors-board {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
  padding-bottom: 1rem;
  align-items: start;
  text-align: left;
}

.honor-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  min-height: 0;
  text-align: left;
}

.honor-card-wide {
  grid-column: 1 / -1;
}

.honor-card-head {
  display: flex;
  align-items: baseline;
  justify-content: flex-start;
  gap: 0.65rem;
  padding: 0.7rem 0.95rem;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(90deg, rgba(26, 39, 68, 0.07), transparent);
  text-align: left;
}

.honor-card-head h3 {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--navy);
  text-align: left;
}

.honor-card-sub {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--muted);
  white-space: nowrap;
  margin-left: auto;
  text-align: left;
}

.honor-list {
  list-style: none;
  margin: 0;
  padding: 0.35rem 0;
  text-align: left;
}

.honor-list li {
  display: grid;
  grid-template-columns: minmax(7.5rem, max-content) minmax(0, 1fr);
  column-gap: 0.75rem;
  row-gap: 0.25rem;
  align-items: start;
  justify-items: start;
  padding: 0.45rem 0.95rem;
  border-bottom: 1px solid rgba(212, 205, 192, 0.55);
  font-size: 0.92rem;
  text-align: left;
}

.honor-list li:last-child {
  border-bottom: 0;
}

.honor-list li > .honor-award {
  grid-column: 1;
}

.honor-list li > .honor-link,
.honor-list li > .honor-subject,
.honor-list li > .honor-period,
.honor-list li > .honor-conf-block {
  min-width: 0;
}

/* Rows without award label: single full-width column */
.honor-list li.honor-winner-row:not(:has(.honor-award)) {
  grid-template-columns: minmax(0, 1fr);
}

.honor-award {
  font-weight: 600;
  color: var(--navy);
  min-width: 0;
  text-align: left;
  justify-self: start;
}

.honor-who,
.honor-team {
  color: var(--muted);
  font-size: 0.86rem;
}

.honor-en,
.honor-code {
  margin-left: 0;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--muted);
}

.honor-stat {
  margin-left: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent-deep);
  font-variant-numeric: tabular-nums;
}

.honor-period {
  margin-right: 0;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
  text-align: left;
  justify-self: start;
}

.honor-winner-row {
  align-items: start !important;
}

.honor-stat-list > li.honor-stat-row {
  display: grid;
  grid-template-columns: 4.25rem minmax(0, 1.15fr) 3.1rem minmax(0, 1fr);
  column-gap: 0.55rem;
  row-gap: 0.2rem;
  align-items: start;
}

.honor-stat-list .honor-award {
  min-width: 0;
  padding-top: 0.05rem;
}

.honor-stat-col {
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  padding-top: 0.05rem;
  min-width: 0;
}

.honor-stat-col .honor-stat {
  margin-left: 0;
}

.honor-stat-list .honor-link.honor-link-stack,
.honor-stat-list .honor-person-col,
.honor-stat-list .honor-affil-col {
  min-width: 0;
  width: 100%;
}

.honor-subject {
  min-width: 0;
  width: 100%;
  text-align: left;
}

.honor-subject-team {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: flex-start;
  gap: 0.25rem 0.65rem;
  text-align: left;
}

.honor-team-zh {
  font-weight: 600;
  color: var(--ink);
}

.honor-team-en {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--muted);
}

.honor-subject-other {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: flex-start;
  gap: 0.25rem 0.65rem;
  text-align: left;
}

.honor-subject-player .honor-player-row {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  column-gap: 1.1rem;
  row-gap: 0.2rem;
  align-items: start;
  justify-items: start;
  min-width: 0;
  width: 100%;
  text-align: left;
}

.honor-person-col,
.honor-affil-col {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.12rem;
  min-width: 0;
  width: 100%;
  text-align: left;
}

.honor-person-primary {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: flex-start;
  gap: 0.25rem 0.45rem;
  line-height: 1.35;
  text-align: left;
}

.honor-person-secondary {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.3;
  text-align: left;
}

.honor-affil-col {
  color: var(--muted);
}

.honor-affil-primary {
  font-size: 0.86rem;
  line-height: 1.35;
  color: var(--muted);
  text-align: left;
}

.honor-affil-secondary {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  line-height: 1.3;
  color: var(--muted);
  text-align: left;
}

.honor-period-list .honor-period-row,
.honor-list li.honor-period-row {
  display: grid;
  grid-template-columns: 7.25rem minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.55rem 0.85rem;
  align-items: start;
  justify-items: start;
  text-align: left;
}

.honor-period-list .honor-period-row > .honor-period {
  grid-column: 1;
}

.honor-conf-block {
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 0.3rem 0.45rem;
  min-width: 0;
  width: 100%;
  text-align: left;
}

.honor-conf-block .honor-link,
.honor-conf-block > :not(.honor-conf-tag) {
  min-width: 0;
  flex: 1 1 auto;
  text-align: left;
}

.honor-conf-tag {
  flex: 0 0 auto;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--navy);
  min-width: 2rem;
  line-height: 1.45;
  padding-top: 0.05rem;
  text-align: left;
}

.honor-conf-empty {
  color: var(--muted);
  text-align: left;
}

.honor-name-zh {
  font-weight: 600;
  color: var(--ink);
}

.honor-link.honor-link-stack {
  display: block;
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  flex-wrap: unset;
  align-items: unset;
  gap: 0;
  text-align: left;
}

@media (max-width: 900px) {
  .honor-period-list .honor-period-row,
  .honor-list li.honor-period-row {
    grid-template-columns: 1fr;
    gap: 0.35rem;
  }

  .honor-subject-player .honor-player-row {
    grid-template-columns: 1fr;
  }

  .honor-list li {
    grid-template-columns: 1fr;
  }
}

.honor-link {
  color: inherit;
  text-decoration: none;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: flex-start;
  gap: 0.35rem 0.75rem;
  text-align: left;
}

.honor-link:hover {
  color: var(--accent-deep);
}

.empty-block {
  grid-column: 1 / -1;
  margin: 0;
  padding: 1.4rem 0.5rem;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 900px) {
  .honors-board { grid-template-columns: 1fr; }
}

.btn.syncing {
  opacity: 0.75;
  pointer-events: none;
}

.dash-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}

.lb-summary {
  display: none;
}
.lb-filters .lb-filter-top {
  align-items: flex-end;
}
.lb-filters .lb-actions-row {
  margin-top: 0.55rem;
  align-items: center;
}
.lb-seg-field {
  min-width: 0;
}
.lb-seg-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 0.35rem;
}
.lb-seg {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  padding: 0.2rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: color-mix(in srgb, var(--text) 4%, transparent);
}
.lb-seg-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  padding: 0.4rem 0.75rem;
  border-radius: 8px;
  cursor: pointer;
  line-height: 1.2;
}
.lb-seg-btn:hover {
  color: var(--text);
  background: color-mix(in srgb, var(--text) 6%, transparent);
}
.lb-seg-btn.is-active {
  color: var(--accent-deep, var(--text));
  background: var(--panel);
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.08);
}
html[data-theme="dark"] .lb-seg-btn.is-active {
  box-shadow: none;
  background: color-mix(in srgb, var(--text) 12%, transparent);
  color: var(--text);
}
.lb-metric-field {
  flex: 0 0 auto;
}
.lb-metric-field .lb-seg-label {
  margin-bottom: 0.35rem;
}
.lb-metric-combo {
  width: 9.5rem;
  max-width: 10.5rem;
  min-width: 7.5rem;
}
.lb-metric-combo > input {
  width: 100%;
  min-height: 2.35rem;
}
.lb-metric-combo .combo-list {
  max-height: 18rem;
}
.lb-metric-combo .combo-list li.is-selected .combo-name {
  font-weight: 600;
}
.lb-player-field {
  flex: 0 0 auto;
  min-width: 0;
}
.lb-player-field .lb-seg-label {
  margin-bottom: 0.35rem;
}
.lb-player-combo {
  width: 12.5rem;
  max-width: 16rem;
  min-width: 9rem;
}
.lb-player-combo > input {
  width: 100%;
  min-height: 2.35rem;
}
.lb-player-combo .combo-list {
  max-height: 18rem;
  min-width: 14rem;
}
.lb-season-field {
  flex: 0 0 auto;
  min-width: 0;
}
.lb-season-field .lb-seg-label {
  margin-bottom: 0.35rem;
}
.lb-season-combo {
  width: 8.5rem;
  max-width: 10rem;
  min-width: 7rem;
}
.lb-season-combo > input {
  width: 100%;
  min-height: 2.35rem;
}
.lb-season-combo .combo-list {
  max-height: 18rem;
  min-width: 9rem;
}
.lb-season-field.is-disabled {
  opacity: 0.55;
}
.lb-season-field.is-disabled input {
  cursor: not-allowed;
}
.lb-panel {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.lb-panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.35rem 1rem;
  padding: 0.85rem 1rem 0.65rem;
  border-bottom: 1px solid var(--line);
}
.lb-panel-title-row {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
}
.lb-panel-head h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
}
.lb-help-btn {
  flex: 0 0 auto;
  width: 1.35rem;
  height: 1.35rem;
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface, var(--panel));
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.lb-help-btn:hover,
.lb-help-btn:focus-visible {
  color: var(--text);
  border-color: color-mix(in srgb, var(--text) 28%, var(--line));
  outline: none;
}
.lb-panel-hint {
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted);
}
.lb-rules-dialog {
  border: none;
  padding: 0;
  background: transparent;
  max-width: min(28rem, calc(100vw - 2rem));
}
.lb-rules-dialog::backdrop {
  background: rgba(16, 24, 40, 0.45);
}
.lb-rules-inner {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.lb-rules-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--line);
}
.lb-rules-head h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
}
.lb-rules-body {
  padding: 0.9rem 1rem 1.1rem;
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--text);
}
.lb-rules-body p {
  margin: 0 0 0.65rem;
}
.lb-rules-body p:last-child {
  margin-bottom: 0;
}
.lb-rules-body ul {
  margin: 0.15rem 0 0.7rem;
  padding-left: 1.15rem;
}
.lb-rules-body li {
  margin: 0.2rem 0;
}
.lb-rules-meta {
  color: var(--muted);
  font-size: 0.82rem;
}
.lb-table-wrap {
  max-height: min(70vh, 820px);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  padding-left: 0.55rem;
  padding-right: 0.85rem;
  box-sizing: border-box;
  /* Keep clientWidth stable so fitted table width does not trigger a horizontal bar. */
  scrollbar-gutter: stable;
}
.lb-table-wrap .dash-board-table,
.lb-table-wrap .lb-board-table {
  max-width: none;
  border-collapse: collapse;
  table-layout: fixed;
}
.lb-table-wrap th,
.lb-table-wrap td {
  padding: 0.55rem 1.35rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: normal;
  line-height: 1.35;
}
/* Beat .resizable-table.fit-content-cols (normal wrap) so names stay one line. */
.lb-table-wrap .resizable-table.fit-content-cols th,
.lb-table-wrap .resizable-table.fit-content-cols td {
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: normal;
}
.lb-table-wrap th[data-col="rank"],
.lb-table-wrap td.rank {
  padding-left: 1rem;
  padding-right: 1.25rem;
  text-align: center;
  width: 1%;
  white-space: nowrap;
}
.lb-table-wrap th.num,
.lb-table-wrap td.num,
.lb-table-wrap td.val,
.lb-table-wrap th[data-col="season"],
.lb-table-wrap th[data-col="game_date"],
.lb-table-wrap td.mono {
  padding-left: 2rem;
  padding-right: 1.75rem;
}
.lb-table-wrap th[data-col="games"],
.lb-table-wrap td.games-col {
  padding-right: 2.25rem;
}
.lb-table-wrap th[data-col="value"],
.lb-table-wrap td.val {
  padding-left: 2.25rem;
  padding-right: 1.75rem;
}
.lb-table-wrap th[data-col="season"],
.lb-table-wrap td.mono:nth-child(4) {
  padding-right: 2rem;
}
.lb-table-wrap th[data-col="game_date"],
.lb-table-wrap td.mono:nth-child(5) {
  padding-left: 2rem;
}
.lb-table-wrap th.lb-col-spacer,
.lb-table-wrap td.lb-col-spacer {
  padding: 0;
  border-bottom: 1px solid var(--line);
  min-width: 0;
}
.lb-table-wrap th.lb-col-spacer .col-resizer {
  display: none;
}
.lb-table-wrap td.player,
.lb-table-wrap td.name-en-col,
.lb-table-wrap td.match,
.lb-table-wrap td[data-col],
.lb-table-wrap .name-en-col {
  overflow: visible;
  text-overflow: unset;
  white-space: nowrap;
}
.lb-table-wrap td.player a,
.lb-table-wrap td.name-en-col {
  white-space: nowrap;
}
.lb-table-wrap td.num,
.lb-table-wrap th.num,
.lb-table-wrap .rank,
.lb-table-wrap td.val {
  white-space: nowrap;
  overflow-wrap: normal;
}
.lb-table-wrap thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--thead-bg);
  font-size: 0.78rem;
  color: var(--muted);
}
.lb-table-wrap thead th.sortable {
  cursor: pointer;
  user-select: none;
}
.lb-table-wrap thead th.sortable:hover {
  color: var(--text);
}
.lb-table-wrap thead th.sorted {
  color: var(--text);
}
.lb-table-wrap thead th.lb-col-index {
  cursor: default;
  user-select: none;
}
.lb-table-wrap .rank {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}
.lb-table-wrap .name-en-col {
  color: var(--muted);
  font-size: 0.88rem;
}
.lb-table-wrap .val,
.lb-table-wrap th.num,
.lb-table-wrap td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.lb-table-wrap td.val {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--accent-deep);
  font-size: 0.98rem;
}
.lb-table-wrap th[data-col="value"] {
  color: var(--muted);
  font-weight: 600;
}
.lb-table-wrap .match a {
  font-variant-numeric: tabular-nums;
}
.lb-infinite-foot {
  padding: 0.65rem 0.85rem 0.9rem;
  text-align: center;
}
.lb-loading-more {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
}
.lb-loading-more.is-done {
  opacity: 0.75;
}
.lb-loading {
  margin: 1.5rem 1rem;
  color: var(--muted);
}
.lb-loading.error {
  color: #d62828;
}
@media (max-width: 720px) {
  .lb-filter-top {
    flex-direction: column;
    align-items: stretch;
  }
}

.dash-kpi {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem 1.1rem;
  display: grid;
  gap: 0.35rem;
}

.dash-kpi .kpi-label {
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

.dash-kpi strong {
  font-family: var(--font-display);
  font-size: 2.4rem;
  line-height: 1;
  color: var(--navy);
  font-weight: 400;
}

.dash-section-title {
  margin: 0.4rem 0 0.75rem;
  font-size: 1.05rem;
  font-weight: 600;
}

.dash-section-hint {
  margin: -0.45rem 0 0.85rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.dash-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.4rem;
  align-items: start;
}

.dash-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  min-width: 0;
  /* Prevent browser scroll-anchoring from jumping to mid-list after「查看更多」 */
  overflow-anchor: none;
}

.dash-grid,
.dash-grid * {
  overflow-anchor: none;
}

.dash-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  padding: 0.65rem 0.9rem;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(90deg, rgba(26, 39, 68, 0.06), transparent);
}

.dash-card-head h3 {
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  font-size: 0.92rem;
}

.dash-card .dash-more-btn {
  flex: 0 0 auto;
  min-height: 30px;
  padding: 0.25rem 0.65rem;
  font-size: 0.75rem;
}

.dash-card h3 {
  margin: 0;
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.92rem;
  background: linear-gradient(90deg, rgba(26, 39, 68, 0.06), transparent);
}

.dash-card .table-wrap.dash-card-table-wrap {
  max-height: none;
  overflow-x: hidden;
  overflow-y: visible;
  padding-right: 0;
}

/* Expanded: keep ~Top10 height; scroll inside for Top 100 */
.dash-card.is-expanded .table-wrap.dash-card-table-wrap {
  max-height: 36.5rem;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* Sticky header only while the card body scrolls */
.dash-card.is-expanded th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--thead-bg);
  box-shadow: inset 0 -1px 0 var(--thead-edge);
}

/* Collapsed: don't let global sticky <th> fight page scroll */
.dash-card:not(.is-expanded) th {
  position: static;
  top: auto;
  box-shadow: none;
}

/* Keep resize handles positioned without sticky page-scroll fight */
.dash-card:not(.is-expanded) .resizable-table th {
  position: relative;
}

.dash-card table {
  font-size: 0.82rem;
  table-layout: auto;
  width: 100%;
}

.dash-card th,
.dash-card td {
  max-width: none;
  white-space: nowrap;
  word-break: normal;
  overflow-wrap: normal;
  vertical-align: top;
}

.dash-card th {
  cursor: default;
  font-family: var(--font-body);
  font-size: 0.86rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: none;
}

.dash-card th.num {
  font-family: var(--font-body);
  font-size: 0.86rem;
}

.dash-card .rank,
.dash-card th[data-col="rank"],
.dash-card td.rank {
  font-family: var(--font-mono);
  color: var(--muted);
  width: 52px;
  max-width: 52px;
  min-width: 52px;
  padding-left: 0.35rem !important;
  padding-right: 0.65rem !important;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  box-sizing: border-box;
}

.dash-card th[data-col="rank"] .col-resizer {
  display: none;
}

.dash-card .player,
.dash-card th[data-col="player"] {
  width: auto;
  min-width: 0;
  padding-left: 0.15rem;
  padding-right: 0.7rem;
}

.dash-card td.player {
  white-space: normal;
  padding-left: 0.15rem;
  padding-right: 0.7rem;
}

.dash-card[data-scope="career"] .player,
.dash-card[data-scope="career"] th[data-col="player"],
.dash-card[data-scope="career"] td.player {
  padding-left: 0.35rem;
  padding-right: 0.15rem;
}

.dash-card[data-scope="game"] .player,
.dash-card[data-scope="game"] th[data-col="player"],
.dash-card[data-scope="game"] td.player {
  padding-left: 0.25rem;
  padding-right: 0;
}

/* Two complete lines: primary name + en/date — no mid-line wrap */
.dash-card td.player .dash-line,
.dash-card td.player .name-en,
.dash-card td.player .sub {
  white-space: nowrap;
}

.dash-card .dash-line-sep {
  opacity: 0.55;
}

.dash-card .match {
  width: auto;
  min-width: 0;
  font-size: 0.8rem;
  padding-left: 0.1rem;
  padding-right: 0.35rem;
}

.dash-card td.match {
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
  padding-left: 0.1rem;
  padding-right: 0.35rem;
}

.dash-card[data-scope="game"] .match,
.dash-card[data-scope="game"] td.match {
  padding-left: 0;
  padding-right: 0.28rem;
}

.dash-card[data-scope="game"] td.match .dash-line-primary,
.dash-card[data-scope="game"] td.match .dash-game-link {
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.dash-card .match .dash-game-link {
  font-weight: 500;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.dash-card .dash-line {
  line-height: 1.35;
}

.dash-card .dash-line + .dash-line {
  margin-top: 0.1rem;
}

.dash-card .dash-line-primary {
  font-weight: 600;
  color: var(--ink);
}

.dash-card .dash-line-en,
.dash-card .dash-line-meta {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 400;
  font-family: var(--font-body);
}

.dash-card .dash-line-en {
  font-family: var(--font-mono);
  letter-spacing: 0.01em;
}

.dash-card .val,
.dash-card th[data-col="value"] {
  font-family: var(--font-mono);
  font-weight: 500;
  text-align: right;
  color: var(--accent-deep);
  width: 1%;
  white-space: nowrap;
  padding-left: 0.35rem;
  padding-right: 0.45rem;
}

.dash-card[data-scope="career"] .val,
.dash-card[data-scope="career"] th[data-col="value"] {
  padding-left: 0.08rem;
  padding-right: 0.45rem;
}

.dash-card[data-scope="game"] .val,
.dash-card[data-scope="game"] th[data-col="value"] {
  padding-left: 0.15rem;
  padding-right: 0.35rem;
}

.dash-card th.dash-col-spacer,
.dash-card td.dash-col-spacer {
  padding: 0 !important;
  border-bottom: 1px solid var(--line);
  min-width: 0;
  width: auto;
}

.dash-card th.dash-col-spacer .col-resizer {
  display: none;
}

.dash-card th[data-col="value"] {
  font-family: var(--font-body);
  font-size: 0.86rem;
  color: var(--muted);
  font-weight: 600;
}

.dash-card .sub {
  color: var(--muted);
  font-size: 0.72rem;
  white-space: nowrap;
  margin-top: 0.12rem;
  font-family: var(--font-body);
  font-variant-numeric: normal;
}

.dash-card-foot {
  margin: 0;
  padding: 0.45rem 0.9rem 0.65rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.75rem;
}

.name-games {
  color: var(--muted);
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}

.name-en {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 400;
  line-height: 1.25;
  margin-top: 0.1rem;
}

a.table-link .name-en {
  color: var(--muted);
  font-weight: 400;
  border-bottom: none;
}

.combo-name .name-en {
  margin-top: 0.15rem;
}

.name-en-inline {
  color: var(--muted);
  font-size: 0.86rem;
}

a.name-en-link {
  color: var(--muted);
  font-size: 0.86rem;
  text-decoration: none;
  border-bottom: 1px solid transparent;
}
a.name-en-link:hover {
  color: var(--link-hover, var(--navy));
  border-bottom-color: color-mix(in srgb, var(--link, var(--navy)) 35%, transparent);
}

.player-name-cell {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  white-space: nowrap;
}

.player-avatar {
  flex: 0 0 auto;
  width: 36px;
  height: 26px;
  object-fit: cover;
  object-position: center top;
  border-radius: 4px;
  background: #e8e2d6;
  vertical-align: middle;
  display: block;
}

.btn-avatar-preview {
  display: inline-flex;
  padding: 0;
  margin: 0;
  border: none;
  background: transparent;
  cursor: zoom-in;
  border-radius: 4px;
  line-height: 0;
}
.btn-avatar-preview:hover .player-avatar,
.btn-avatar-preview:focus-visible .player-avatar {
  outline: 2px solid rgba(26, 39, 68, 0.35);
  outline-offset: 1px;
}
.btn-avatar-preview:focus-visible {
  outline: none;
}

#view-base-players th.col-avatar,
#view-base-players td.col-avatar,
#view-base-draft th.col-avatar,
#view-base-draft td.col-avatar {
  width: 72px;
  min-width: 72px;
  max-width: 72px;
  padding-left: 18px;
  padding-right: 18px;
  text-align: center;
  vertical-align: middle;
  box-sizing: border-box;
}

#view-base-players td.col-avatar .btn-avatar-preview,
#view-base-players td.col-avatar .player-avatar,
#view-base-draft td.col-avatar .btn-avatar-preview,
#view-base-draft td.col-avatar .player-avatar {
  margin: 0 auto;
}

.player-avatar-default {
  opacity: 1;
  object-fit: cover;
  background: #d6d6d6;
}

#view-base-players a.name-en-link,
#view-base-draft a.name-en-link {
  display: inline;
  white-space: nowrap;
}

/* 选秀表：表头字体统一（勿让 .num 切到 mono / 更大字号） */
#view-base-draft thead th,
#view-base-draft thead th.num {
  font-family: var(--font-body);
  font-size: 0.86rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: none;
}

/* 各列表 / 比赛详情：表头字号与字体统一（数值列 th 不再放大） */
#view-players thead th,
#view-players thead th.num,
#view-games thead th,
#view-games thead th.num,
#view-game thead th,
#view-game thead th.num,
#view-base-teams thead th,
#view-base-teams thead th.num,
#view-base-players thead th,
#view-base-players thead th.num {
  font-family: var(--font-body);
  font-size: 0.86rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: none;
}

/* 球队中文名单行完整显示 */
#view-base-draft th[data-col="team_abbr"],
#view-base-draft td.col-team {
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: keep-all;
  min-width: 9.5rem;
}

.headshot-dialog {
  border: none;
  padding: 0;
  background: transparent;
  max-width: calc(100vw - 2rem);
  max-height: calc(100vh - 2rem);
}
.headshot-dialog::backdrop {
  background: rgba(12, 16, 24, 0.72);
}
.headshot-dialog-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem;
}
#dlg-headshot-img {
  display: block;
  width: min(520px, 88vw);
  height: auto;
  aspect-ratio: 260 / 190;
  object-fit: cover;
  object-position: center top;
  border-radius: 10px;
  background: #e8e2d6;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.35);
}
#dlg-headshot-caption {
  margin: 0;
  color: #f4efe6;
  font-size: 0.95rem;
  text-align: center;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}
#dlg-headshot-close {
  background: rgba(255, 253, 248, 0.92);
}

.player-name-text {
  min-width: 0;
}

#view-base-players .player-name-cell {
  min-width: 0;
  width: max-content;
  max-width: 100%;
}

#view-base-players .player-name-text {
  min-width: max-content;
  overflow: visible;
  font-weight: 400;
}

#view-base-players a.name-en-link {
  font-weight: 400;
}

/* 现役球员名字加粗；退役 / 已离开联盟为常规字重 */
#view-base-players .player-name-text.is-active,
#view-base-players a.name-en-link.is-active {
  font-weight: 700;
}

#view-base-players .resizable-table.fit-content-cols th[data-col="name_zh"],
#view-base-players .resizable-table.fit-content-cols td:nth-child(2) {
  overflow: visible;
}

.foul-out {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.05rem 0.28rem;
  border-radius: 3px;
  background: #c62828;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  vertical-align: middle;
  line-height: 1.35;
}

td.mono {
  font-family: var(--font-mono);
  font-size: 0.82rem;
}

.edit-dialog {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
  width: min(720px, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  overflow: hidden;
}
.edit-dialog::backdrop {
  background: rgba(16, 20, 28, 0.45);
}
.edit-dialog-form {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 2rem);
  gap: 0;
  padding: 0;
  overflow: hidden;
}
.edit-dialog-head {
  flex: 0 0 auto;
  padding: 1.05rem 1.25rem 0.85rem;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.edit-dialog-head h3 {
  margin: 0;
  font-size: 1.05rem;
}
.edit-dialog .edit-en {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}
.edit-dialog-body {
  flex: 1 1 auto;
  overflow: auto;
  padding: 0.9rem 1.25rem 1rem;
  display: grid;
  gap: 0.65rem;
  min-height: 0;
}
.edit-dialog-foot {
  flex: 0 0 auto;
  margin: 0;
  padding: 0.75rem 1.25rem 0.95rem;
  border-top: 1px solid var(--line);
  background: var(--surface);
  box-shadow: 0 -8px 18px rgba(16, 20, 28, 0.06);
}
.edit-dialog label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.edit-dialog input[type="text"],
.edit-dialog input[type="search"] {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.45rem 0.55rem;
  font: inherit;
  background: var(--input-bg);
  color: var(--ink);
}
.edit-fields-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem 1.25rem;
}
.edit-col {
  display: grid;
  gap: 0.45rem;
  align-content: start;
}
.edit-col .anthro-field {
  display: contents;
}
.edit-stats {
  margin-top: 0.35rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 0.55rem;
}
.edit-stats h4 {
  margin: 0.25rem 0 0;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--navy);
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}
.edit-stats-hint {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.02em;
}
.edit-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.45rem;
}
.edit-stat {
  background: rgba(26, 39, 68, 0.04);
  border: 1px solid rgba(212, 205, 192, 0.85);
  border-radius: 8px;
  padding: 0.45rem 0.55rem;
  display: grid;
  gap: 0.15rem;
}
.edit-stat-label {
  font-size: 0.68rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}
.edit-stat-main {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.35rem;
  min-width: 0;
}
.edit-stat strong {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--accent-deep);
  font-variant-numeric: tabular-nums;
}
.stat-rank-link,
.stat-rank-text {
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  padding: 0;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
  cursor: default;
  font-family: inherit;
  line-height: 1.2;
}
.stat-rank-link {
  cursor: pointer;
}
.stat-rank-link:hover {
  color: var(--accent-deep);
  text-decoration: underline;
}
.stat-rank-num {
  color: #d62828;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.stat-rank-text.is-muted {
  opacity: 0.45;
}

.rank-board-dialog {
  border: none;
  padding: 0;
  max-width: min(720px, 96vw);
  width: 96vw;
  max-height: min(88vh, 900px);
  border-radius: 12px;
  background: var(--panel, #fff);
  color: inherit;
  box-shadow: 0 18px 48px rgba(10, 18, 36, 0.28);
}
.rank-board-dialog::backdrop {
  background: rgba(12, 18, 32, 0.45);
}
.rank-board-inner {
  display: flex;
  flex-direction: column;
  max-height: min(88vh, 900px);
  position: relative;
}
.rank-board-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.55rem;
  padding: 0.75rem 0.85rem 0.65rem;
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
  background: var(--panel, #fff);
  z-index: 5;
}
.rank-board-back {
  display: none;
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 1.85rem;
  line-height: 1;
  width: 2rem;
  height: 2rem;
  padding: 0;
  margin: 0;
  cursor: pointer;
  flex: 0 0 auto;
  border-radius: 8px;
}
.rank-board-back:hover,
.rank-board-back:focus-visible {
  background: color-mix(in srgb, var(--ink) 8%, transparent);
}
.rank-board-head-text {
  flex: 1;
  min-width: 0;
}
.rank-board-head h3 {
  margin: 0;
  font-size: 1.05rem;
}
.rank-board-sub {
  margin: 0.2rem 0 0;
  font-size: 0.78rem;
  color: var(--muted);
}
.rank-board-body {
  padding: 0;
  overflow: auto;
  max-height: min(72vh, 720px);
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  isolation: isolate;
}
.rank-board-body .rank-board-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}
.rank-board-body .rank-board-table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--sticky-head-bg, var(--thead-bg, #fff));
  background-clip: padding-box;
  box-shadow: inset 0 -1px 0 var(--thead-edge, var(--line));
}
.rank-board-loading {
  margin: 1.25rem 1rem;
  color: var(--muted);
}
.rank-board-loading.error {
  color: #d62828;
}
.rank-board-table tr.is-rank-focus td {
  background: rgba(214, 40, 40, 0.1);
}
.rank-board-table tr.is-rank-focus td.rank {
  color: #d62828;
  font-weight: 700;
}
.rank-board-rocket {
  display: none;
  position: absolute;
  right: max(0.85rem, env(safe-area-inset-right));
  bottom: max(0.95rem, env(safe-area-inset-bottom));
  z-index: 8;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 999px;
  border: 0;
  appearance: none;
  cursor: pointer;
  color: #f4efe6;
  background: #1a2744;
  box-shadow: 0 8px 22px rgba(10, 16, 28, 0.35);
  align-items: center;
  justify-content: center;
  padding: 0;
}
.rank-board-rocket:hover,
.rank-board-rocket:focus-visible {
  background: #243556;
}
.rank-board-rocket svg {
  display: block;
}

.dialog-actions {
  justify-content: flex-end;
  align-items: center;
  flex-wrap: wrap;
}
.dialog-spacer {
  flex: 1;
  min-width: 0.5rem;
}
@media (max-width: 640px) {
  .edit-fields-grid { grid-template-columns: 1fr; }
  .edit-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .dash-summary { grid-template-columns: 1fr; }
  .dash-grid { grid-template-columns: 1fr; }
}

.results {
  position: relative;
  z-index: 1;
  overflow: hidden;
}

.results-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem 1.15rem;
  border-bottom: 1px solid var(--line);
}

.results-bar h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.results-bar-stack {
  align-items: flex-start;
}

.results-bar .dash-section-hint {
  margin: 0.35rem 0 0;
}

.results-bar h2 span {
  color: var(--accent);
  font-family: var(--font-mono);
  font-weight: 500;
}

.pager {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

.pager-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.75rem 1.15rem;
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  color: var(--ink);
}

.totals-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.65rem 1.35rem;
  padding: 0.7rem 1.15rem;
  border-top: 1px solid var(--line);
  background: var(--sticky-foot-bg);
  font-size: 0.88rem;
  color: var(--ink);
}

.totals-title {
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--navy);
  margin-right: 0.25rem;
}

.totals-item {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.totals-item strong {
  margin-left: 0.3rem;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--ink);
}

.page-size-label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.page-size {
  min-width: 4.5rem;
}

.page-jump-label {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.82rem;
  color: var(--muted);
  font-family: var(--font-body);
}

.page-jump-input {
  width: 3.4rem;
  min-height: 34px;
  padding: 0.3rem 0.35rem;
  text-align: center;
  font: 500 0.82rem/1 var(--font-mono);
  border-radius: 8px;
}

.page-jump-sep {
  color: var(--muted);
  font-family: var(--font-mono);
}

/* Prefer full 位置/国籍 on one line; wrap only after column width cap */
#view-base-draft td.col-position,
#view-base-draft td.col-country {
  overflow-wrap: break-word;
  word-break: normal;
}

.team-logo {
  width: 28px;
  height: 28px;
  object-fit: contain;
  display: block;
  margin: 0 auto;
  background: transparent;
}

.team-logo-default {
  width: 28px;
  height: 28px;
  object-fit: cover;
  border-radius: 3px;
  background: #d6d6d6;
}

#view-base-teams th[data-col="logo"],
#view-base-teams td.col-team-logo {
  width: 44px;
  min-width: 44px;
  max-width: 44px;
  text-align: center;
  vertical-align: middle;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
}

#view-base-teams th[data-col="active"] {
  width: 3.5rem;
  white-space: nowrap;
}

#view-base-teams .team-active-yes {
  color: var(--ink);
  font-weight: 600;
}

#view-base-teams .team-active-no {
  color: var(--muted);
}

#bt-q {
  min-height: auto;
  resize: none;
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
}

.table-wrap {
  overflow: auto;
  max-height: min(68vh, 820px);
  /* Leave room to grab the last column's resize handle */
  padding-right: 10px;
}

/* Keep list headers sticky while the table body scrolls */
#view-players .table-wrap,
#view-games .table-wrap,
#view-base-teams .table-wrap,
#view-base-players .table-wrap,
#view-base-draft .table-wrap {
  overflow: auto;
  max-height: min(68vh, 820px);
}

table {
  width: 100%;
  /* separate + spacing 0: sticky thead works reliably (collapse breaks it in Chromium) */
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.86rem;
}

th, td {
  padding: 0.58rem 0.65rem;
  border-bottom: 1px solid var(--row-border);
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
  text-align: left;
  vertical-align: top;
  max-width: 16rem;
}

td {
  background: var(--cell-bg);
  color: var(--ink);
}

th {
  position: sticky;
  top: 0;
  background: var(--thead-bg);
  font-size: 0.86rem;
  font-weight: 600;
  font-family: var(--font-body);
  letter-spacing: 0.02em;
  text-transform: none;
  color: var(--muted);
  user-select: none;
  z-index: 2;
  max-width: 14rem;
  box-shadow: inset 0 -1px 0 var(--thead-edge);
}

th.sortable { cursor: pointer; }
th.sortable:hover { color: var(--navy); }
th.sorted { color: var(--navy); }
th .sort-ind { font-size: 0.78rem; opacity: 0.85; }
th.col-datetime { letter-spacing: 0.02em; }

/* Numeric body cells: mono + same table size. Headers stay uniform with other th. */
td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
  font-size: 0.86rem;
  white-space: nowrap;
  max-width: 6rem;
}

th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-family: var(--font-body);
  font-size: 0.86rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: none;
  white-space: nowrap;
  max-width: 6rem;
}

td.mono, th[data-col="code"], th[data-col="founded"] {
  white-space: nowrap;
  max-width: 7rem;
  font-variant-numeric: tabular-nums;
}

/* History / long text: wider default; colgroup width wins when table is resizable. */
#view-base-teams th[data-col="history"],
#view-base-teams td.col-team-history {
  min-width: 18rem;
  line-height: 1.45;
}

/* 球员信息：单行完整显示，过宽时横向滚动；操作列右侧悬浮 */
#view-base-players .table-wrap {
  overflow: auto;
  /* Avoid gutter past sticky col — overflowing draft text used to leak there */
  padding-right: 0;
}

#view-base-players .resizable-table.fit-content-cols th,
#view-base-players .resizable-table.fit-content-cols td {
  white-space: nowrap;
  word-break: normal;
  overflow-wrap: normal;
  max-width: none;
  overflow: hidden;
}

#view-base-players .resizable-table th {
  overflow: hidden;
}

/*
  Multi-level header: L1 sticks at top:0; L2 sticks below L1 (--bp-head-l1-h from JS).
  Rowspan L1 cells (姓名/操作等) also use top:0 and cover the full header band.
*/
#view-base-players .bp-multihead thead tr.bp-head-l1 > th {
  position: sticky;
  top: 0;
  z-index: 4;
  vertical-align: middle;
  background: var(--thead-bg);
}

#view-base-players .bp-multihead thead .group-head {
  text-align: center;
  cursor: default;
  border-bottom: 1px solid var(--line);
  background: var(--thead-group-bg);
  color: var(--navy);
  letter-spacing: 0.06em;
  z-index: 4;
}

#view-base-players .bp-multihead thead tr.bp-head-l2 > th {
  position: sticky;
  top: var(--bp-head-l1-h, 2.4rem);
  z-index: 3;
  background: var(--thead-bg);
  font-size: 0.86rem;
  font-family: var(--font-body);
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: none;
  vertical-align: middle;
}

/* 生涯 / 场均二级表头与数值列：加宽左右内边距，拉开列间距 */
#view-base-players .bp-multihead thead .bp-head-l2 th.num,
#view-base-players tbody td.num {
  padding-left: 1.15rem;
  padding-right: 1.15rem;
}

#view-base-players .bp-multihead thead .bp-head-l2 th.num {
  font-size: 0.86rem;
  font-family: var(--font-body);
}

#view-base-players .col-sticky-right {
  position: sticky;
  right: 0;
  z-index: 5;
  text-align: center;
  white-space: nowrap;
  overflow: visible;
  /* 左右各留约半个「编辑」按钮宽度 */
  padding-left: 1.6rem;
  padding-right: 1.6rem;
}

/* Match normal row / header cell backgrounds (opaque for sticky scroll) */
#view-base-players tbody td {
  background: var(--cell-bg);
}

#view-base-players tbody td.col-sticky-right {
  background: var(--cell-bg);
  /* Keep action cells under the sticky header band while scrolling */
  z-index: 4;
  box-shadow: -6px 0 8px -6px rgba(40, 32, 20, 0.18);
}

#view-base-players tbody tr:hover td,
#view-base-players tbody tr:hover td.col-sticky-right {
  background: color-mix(in srgb, var(--accent) 6%, var(--cell-bg));
}

/*
  Actions header must NOT use rowspan+sticky(top+right): Chromium then drops
  vertical stickiness, so 「操作」 scrolls with the body and overlaps L2 headers.
  Split into L1 + L2 cells that each stick on their own top offset.
*/
#view-base-players .bp-multihead thead tr.bp-head-l1 > th.col-sticky-right {
  position: sticky;
  top: 0;
  right: 0;
  z-index: 8;
  background: var(--thead-group-bg);
  box-shadow:
    inset 0 -1px 0 var(--line),
    -6px 0 8px -6px rgba(40, 32, 20, 0.18);
}

#view-base-players .bp-multihead thead tr.bp-head-l2 > th.col-sticky-right {
  position: sticky;
  top: var(--bp-head-l1-h, 2.4rem);
  right: 0;
  z-index: 7;
  background: var(--thead-bg);
  padding-top: 0;
  padding-bottom: 0;
  line-height: 0;
  font-size: 0;
  color: transparent;
  box-shadow:
    inset 0 -1px 0 var(--thead-edge),
    -6px 0 8px -6px rgba(40, 32, 20, 0.18);
}

#view-base-players thead .col-sticky-right {
  z-index: 7;
  background: var(--thead-bg);
}

/* 比赛统计：单行完整显示，过宽横向滚动 */
#view-games .table-wrap {
  overflow: auto;
}

#view-games .resizable-table.fit-content-cols th,
#view-games .resizable-table.fit-content-cols td {
  white-space: nowrap;
  word-break: normal;
  overflow-wrap: normal;
  max-width: none;
}

/* Explicit col widths drive size; table grows and scrolls — resize does not steal from neighbors.
   Do not use min-width:100% — leftover space would stretch (usually the last col) and block resize. */
.resizable-table {
  table-layout: fixed;
  width: max-content;
  min-width: 0;
}

.resizable-table th {
  /* sticky (not relative): keep header fixed while .table-wrap scrolls;
     sticky still positions .col-resizer absolute children. */
  position: sticky;
  top: 0;
  z-index: 2;
  max-width: none;
  overflow: visible;
}

.resizable-table th,
.resizable-table td {
  max-width: none;
}

/* Prefer full single-line cell text; wrap only when column hits its capped width. */
.resizable-table.fit-content-cols th,
.resizable-table.fit-content-cols td {
  white-space: normal;
  word-break: normal;
  overflow-wrap: break-word;
  line-height: 1.35;
}

.resizable-table.fit-content-cols th.num,
.resizable-table.fit-content-cols td.num {
  white-space: nowrap;
  overflow-wrap: normal;
}

.col-resizer {
  position: absolute;
  top: 0;
  right: -4px;
  width: 10px;
  height: 100%;
  cursor: col-resize;
  user-select: none;
  z-index: 3;
}

.col-resizer:hover,
.col-resizer:active {
  background: rgba(228, 87, 46, 0.35);
}

tbody tr:hover td { background: rgba(228, 87, 46, 0.06); }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--row-hover); }

#d-game-grid tr.dash-game-row {
  cursor: pointer;
}
#d-game-grid tr.dash-game-row:hover td {
  background: rgba(26, 39, 68, 0.08);
}
#d-game-grid .dash-game-link {
  display: inline-block;
  max-width: 100%;
}

a.table-link {
  color: var(--link);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid transparent;
}
a.table-link:hover {
  color: var(--link-hover);
  border-bottom-color: currentColor;
}

/* Games list matchup: teams + lose score normal; win score bold */
#view-games .col-matchup a.table-link {
  font-weight: 400;
}
#view-games .col-matchup .mu-team,
#view-games .col-matchup .mu-sep,
#view-games .col-matchup .mu-pts {
  font-weight: 400;
}
#view-games .col-matchup .mu-pts.is-win {
  font-weight: 700;
}

.col-matchup .game-canceled,
.game-canceled {
  margin-top: 0.15rem;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: #9a9a9a;
  line-height: 1.2;
}

.game-canceled-sub {
  color: #9a9a9a;
}

.combo {
  position: relative;
  z-index: 8;
  overflow: visible;
}

/* Searchable combo: chevron cue (same affordance as <select>) */
.combo::after {
  content: "";
  position: absolute;
  right: 0.85rem;
  top: 50%;
  width: 0.72rem;
  height: 0.48rem;
  margin-top: -0.12rem;
  transform: translateY(-50%);
  pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1.5 1.75L6 6.25L10.5 1.75' stroke='%236b6458' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")
    center / contain no-repeat;
  opacity: 0.9;
}
html[data-theme="dark"] .combo::after,
html[data-theme="dark"] .multi-combo::after {
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1.5 1.75L6 6.25L10.5 1.75' stroke='%239aa8bf' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")
    center / contain no-repeat;
  opacity: 0.95;
}

.combo > input {
  width: 100%;
  padding-right: 2.1rem;
}

.multi-combo {
  position: relative;
  z-index: 50;
  overflow: visible;
  min-width: 220px;
}

.multi-combo::after {
  content: "";
  position: absolute;
  right: 0.85rem;
  top: 50%;
  width: 0.72rem;
  height: 0.48rem;
  margin-top: -0.12rem;
  transform: translateY(-50%);
  pointer-events: none;
  z-index: 2;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1.5 1.75L6 6.25L10.5 1.75' stroke='%236b6458' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")
    center / contain no-repeat;
  opacity: 0.9;
}

.multi-combo-control {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  min-height: 42px;
  padding: 0.28rem 2.1rem 0.28rem 0.55rem;
  background: var(--input-bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
}

.multi-combo-control:focus-within {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
  box-shadow: 0 0 0 3px rgba(228, 87, 46, 0.12);
}

.multi-combo-tags {
  display: contents;
}

.multi-combo-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  max-width: 10rem;
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
  background: color-mix(in srgb, var(--navy) 12%, var(--input-bg));
  color: var(--ink);
  font-size: 0.78rem;
  line-height: 1.3;
}

.multi-combo-tag span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.multi-combo-tag button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  font-size: 0.9rem;
  line-height: 1;
}

.multi-combo-tag button:hover {
  color: var(--accent);
}

.multi-combo-more {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.35rem;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  line-height: 1.3;
  user-select: none;
}

.multi-combo-clear {
  appearance: none;
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 0.15rem 0.35rem;
  font: 500 0.75rem/1.2 var(--font-body);
  border-radius: 5px;
  white-space: nowrap;
}

.multi-combo-clear:hover {
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}

.multi-combo-control input {
  flex: 1 1 7rem;
  min-width: 6rem;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  padding: 0.25rem 0.15rem !important;
  min-height: 1.6rem;
}

.multi-combo-list .combo-action {
  justify-content: flex-start;
  font-weight: 600;
  color: var(--ink);
  border-bottom: 1px solid var(--line);
  font-size: 0.82rem;
}

.multi-combo-list li[data-idx] {
  justify-content: flex-start;
  gap: 0.45rem;
}

.multi-combo-list .combo-check {
  width: 1rem;
  min-width: 1rem;
  color: var(--accent);
  font-weight: 700;
  flex: 0 0 auto;
  text-align: center;
}

.multi-combo-list .combo-name {
  flex: 1 1 auto;
  min-width: 0;
  text-align: left;
}

.multi-combo-list .combo-name .combo-main {
  display: block;
  line-height: 1.25;
}

.multi-combo-list .combo-name .combo-sub,
.multi-combo-list .combo-name .name-en.combo-sub {
  display: block;
  margin-top: 0.12rem;
  font-size: 0.82em;
  color: var(--muted);
  font-weight: 400;
}

.field-team-multi .multi-combo {
  min-width: min(28rem, 100%);
}

.multi-combo-list li.is-selected .combo-name {
  font-weight: 600;
}

.combo-list {
  position: absolute;
  z-index: 100;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  margin: 0;
  padding: 0.35rem 0;
  list-style: none;
  max-height: min(320px, 50vh);
  overflow: auto;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 12px 28px rgba(16, 20, 28, 0.18);
}

.combo-list li {
  margin: 0;
  padding: 0.55rem 0.85rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: baseline;
  color: var(--ink);
}

.combo-list li:hover,
.combo-list li.active {
  background: var(--row-hover);
}

.combo-list .combo-name {
  font-weight: 600;
  color: var(--ink);
}

.combo-list .combo-team {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--muted);
  flex-shrink: 0;
}

.combo-list .combo-empty {
  color: var(--muted);
  font-style: italic;
  cursor: default;
}

.combo-list .combo-empty:hover {
  background: transparent;
}

tr.empty td {
  text-align: center;
  color: var(--muted);
  padding: 2.5rem 1rem;
  font-style: italic;
}

.game-panels {
  display: grid;
  gap: 1rem;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

#view-game .game-line-score,
#view-game .game-panels {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.game-line-score {
  margin: 0 0 0.85rem;
}

.game-line-score-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel, var(--card, transparent));
  max-width: 100%;
  min-width: 0;
}

.game-line-score-table {
  table-layout: fixed;
  width: 100%;
  /* team 10rem + tot 10rem + periods * 3rem min → scroll when container narrower */
  min-width: calc(20rem + var(--gls-period-count, 0) * 3rem);
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.game-line-score-table th,
.game-line-score-table td {
  padding: 0.45rem 0.65rem;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.game-line-score-table tbody tr:last-child th,
.game-line-score-table tbody tr:last-child td {
  border-bottom: none;
}

.game-line-score-table thead th {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  text-align: right;
}

.game-line-score-table thead th.gls-team,
.game-line-score-table .gls-team {
  text-align: left;
  font-weight: 600;
  color: var(--text);
  width: 10rem;
  max-width: 10rem;
  min-width: 10rem;
  padding-left: 0.55rem;
  padding-right: 0.45rem;
  overflow: hidden;
  text-overflow: ellipsis;
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--sticky-cell-bg);
  box-shadow: 2px 0 0 var(--line);
}

.game-line-score-table thead th.gls-team {
  z-index: 3;
  background: var(--sticky-head-bg);
}

html[data-theme="dark"] .game-line-score-table thead th.gls-team,
html[data-theme="dark"] .game-line-score-table .gls-team {
  background: var(--sticky-cell-bg);
}

html[data-theme="dark"] .game-line-score-table thead th.gls-team {
  background: var(--sticky-head-bg);
}

.game-line-score-table td.num,
.game-line-score-table th.num {
  text-align: right;
}

.game-line-score-table .gls-period {
  min-width: 3rem;
}

.game-line-score-table .gls-tot {
  width: 10rem;
  max-width: 10rem;
  min-width: 10rem;
  font-weight: 700;
  color: var(--accent);
  position: sticky;
  right: 0;
  z-index: 2;
  background: var(--sticky-cell-bg);
  box-shadow: -2px 0 0 var(--line);
}

.game-line-score-table thead th.gls-tot {
  z-index: 3;
  background: var(--sticky-head-bg);
}

html[data-theme="dark"] .game-line-score-table .gls-tot {
  background: var(--sticky-cell-bg);
}

html[data-theme="dark"] .game-line-score-table thead th.gls-tot {
  background: var(--sticky-head-bg);
}

.page-head.game-detail-head {
  /* Leave room for top-auth, but less than default 11.5rem so 得分详情 sits further right */
  padding-right: 6.75rem;
}

.game-detail-head .game-detail-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
  margin-top: 0.35rem;
  width: 100%;
}

.game-detail-title-main {
  min-width: 0;
  flex: 1;
}

.game-detail-title-main h1 {
  margin: 0;
}

.game-detail-title-main #game-sub {
  margin: 0.25rem 0 0;
}

.game-scoring-link {
  flex-shrink: 0;
  align-self: center;
  margin-left: auto;
  white-space: nowrap;
  /* Match 「← 返回比赛列表」 (.btn.sm) size; keep right alignment only */
  font-size: 0.8rem;
  font-weight: inherit;
  min-height: 34px;
  padding: 0.4rem 0.75rem;
}

.gs-chart-card {
  margin: 0.75rem 0 1rem;
  padding: 0.75rem 0.85rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel, #faf6ee);
}

.gs-chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.gs-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.gs-legend-swatch {
  width: 1.1rem;
  height: 0.22rem;
  border-radius: 1px;
}

.gs-legend-swatch.is-away { background: var(--gs-away, #c45c26); }
.gs-legend-swatch.is-home { background: var(--gs-home, #2a6fbb); }

.gs-chart-wrap {
  width: 100%;
  overflow: hidden;
}

.gs-chart {
  display: block;
  width: 100%;
  height: auto;
  max-height: 260px;
}

.gs-chart .gs-grid {
  stroke: var(--line);
  stroke-width: 1;
  opacity: 0.55;
}

.gs-chart .gs-axis-label {
  fill: var(--muted);
  font-size: 11px;
}

.gs-chart .gs-line-away {
  fill: none;
  stroke: var(--gs-away, #c45c26);
  stroke-width: 2.2;
}

.gs-chart .gs-line-home {
  fill: none;
  stroke: var(--gs-home, #2a6fbb);
  stroke-width: 2.2;
}

.gs-filter {
  display: flex;
  justify-content: flex-start;
  align-items: stretch;
  flex-wrap: wrap;
  gap: 0.45rem 0.65rem;
  margin: 0.35rem 0 0.65rem;
  width: 100%;
  box-sizing: border-box;
}

.gs-filter-kw {
  flex: 1 1 0;
  min-width: 0;
  width: auto;
  display: flex;
  align-items: stretch;
  gap: 0;
  min-height: 2.15rem;
  box-sizing: border-box;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--input-bg, var(--panel));
}

.gs-filter-kw:focus-within {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
}

.gs-filter-q {
  flex: 1 1 0;
  width: auto;
  min-width: 0;
  max-width: none;
  min-height: 0;
  box-sizing: border-box;
  border: none;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  padding: 0.35rem 0.45rem 0.35rem 0.65rem;
  line-height: 1.2;
}

.gs-filter-kw-mode {
  flex: 0 0 auto;
  width: 4.75rem;
  min-height: 0;
  align-self: stretch;
  box-sizing: border-box;
  border: none;
  border-left: 1px solid var(--line);
  border-radius: 0;
  background-color: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 0.25rem 1.35rem 0.25rem 0.45rem;
  line-height: 1.2;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%23666' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.45rem center;
  background-size: 0.55rem 0.35rem;
}

.gs-filter-q::placeholder {
  color: var(--muted);
  font-weight: 400;
}

.gs-filter-q:focus,
.gs-filter-kw-mode:focus {
  outline: none;
}

html[data-theme="dark"] .gs-filter-kw-mode {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%23aaa' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E");
}

.gs-seg.seg-toggle {
  flex: 1 1 0;
  min-width: 0;
  width: auto;
  min-height: 2.15rem;
  display: inline-flex;
}

.gs-seg .seg-btn {
  flex: 1 1 0;
  min-width: 0;
  padding: 0.35rem 0.55rem;
  font-size: 0.8rem;
  color: var(--ink);
  white-space: nowrap;
}

.gs-seg .seg-btn.active,
.gs-seg .seg-btn[aria-pressed="true"] {
  background: var(--accent);
  color: #fff8f4;
}

.gs-seg .seg-btn:hover:not(.active) {
  background: var(--row-hover);
  color: var(--ink);
}

html[data-theme="dark"] .gs-seg .seg-btn.active,
html[data-theme="dark"] .gs-seg .seg-btn[aria-pressed="true"] {
  background: var(--accent);
  color: #fff8f4;
}

.gs-event.is-miss .gs-event-score {
  color: var(--ink);
  font-weight: 500;
}

.gs-events {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.gs-event {
  display: grid;
  grid-template-columns: 5.5rem 1fr auto;
  gap: 0.5rem 0.75rem;
  align-items: baseline;
  padding: 0.55rem 0.65rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.9rem;
}

.gs-event-time {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.gs-event-main {
  min-width: 0;
}

.gs-event-player {
  font-weight: 600;
}

.gs-event-desc {
  color: var(--muted);
  font-size: 0.8rem;
  margin-top: 0.15rem;
}

.gs-event-score {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  text-align: right;
}

.gs-event-pts {
  display: inline-block;
  margin-left: 0.35rem;
  color: #dc2626;
  font-size: 0.8rem;
  font-weight: 600;
}

.gs-event-pts.is-made,
.gs-score-hl {
  color: #ea580c;
  font-weight: 700;
}

.gs-event.is-miss .gs-event-pts {
  color: var(--muted);
  font-weight: 500;
  opacity: 0.85;
}

.gs-event.is-miss {
  opacity: 0.88;
}

@media (max-width: 640px) {
  .gs-event {
    grid-template-columns: 1fr auto;
  }
  .gs-event-time {
    grid-column: 1 / -1;
  }
}

.team-card {
  overflow: visible;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.team-card .game-detail-wrap {
  overflow-x: auto;
  overflow-y: visible;
  max-width: 100%;
  max-height: none;
  min-width: 0;
  -webkit-overflow-scrolling: touch;
}

.game-detail-table th.col-sticky-player,
.game-detail-table td.col-sticky-player {
  position: sticky;
  left: 0;
  z-index: 3;
  background: var(--sticky-cell-bg);
  box-shadow: 2px 0 0 var(--line);
  min-width: 7.5rem;
  max-width: 11rem;
}

.game-detail-table thead th.col-sticky-player {
  z-index: 5;
  top: 0;
  background: var(--sticky-head-bg);
}

html[data-theme="dark"] .game-detail-table th.col-sticky-player,
html[data-theme="dark"] .game-detail-table td.col-sticky-player {
  background: var(--sticky-cell-bg);
}

html[data-theme="dark"] .game-detail-table thead th.col-sticky-player {
  background: var(--sticky-head-bg);
}

.game-detail-table tbody tr:hover td.col-sticky-player {
  background: color-mix(in srgb, var(--accent) 6%, var(--sticky-cell-bg));
}

.game-detail-table tfoot .totals-row td {
  padding: 0.55rem 0.5rem;
  border-top: 1px solid var(--line);
  background: var(--sticky-foot-bg);
  font: 600 0.78rem/1.2 var(--font-body);
  vertical-align: middle;
}

.game-detail-table tfoot .totals-label {
  font-weight: 700;
  color: var(--navy);
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.game-detail-table tfoot .totals-cell {
  font-family: var(--font-mono);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.game-detail-table tfoot td.col-sticky-player {
  background: var(--sticky-foot-bg);
}

html[data-theme="dark"] .game-detail-table tfoot td.col-sticky-player {
  background: var(--sticky-foot-bg);
}

.team-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0.85rem 1.1rem;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(90deg, rgba(26, 39, 68, 0.06), transparent);
}

.team-head h2 {
  margin: 0;
  font-size: 1.15rem;
  letter-spacing: 0.04em;
}

.team-head .score {
  font-family: var(--font-display);
  font-size: 2rem;
  color: var(--accent);
  line-height: 1;
}

/* —— 赛季统计 —— */
.season-board {
  display: flex;
  flex-direction: column;
  gap: 1.6rem;
  margin-top: 0.4rem;
}

.season-section h2 {
  margin: 0 0 0.75rem;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--navy);
}

.season-standings .team-name.table-link {
  color: inherit;
  text-decoration: none;
  font-weight: 600;
}
.season-standings .team-name.table-link:hover {
  color: var(--accent);
  text-decoration: underline;
}

#view-team-schedule .ts-win {
  color: var(--accent, #c45c26);
  font-weight: 600;
}
#view-team-schedule .ts-loss {
  color: var(--muted);
}

.season-standings {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.season-standings-col h3 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
  color: var(--navy);
}

.season-table-wrap {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  /* Show full conference standings — no inner scroll */
  max-height: none;
  overflow: visible;
  padding-right: 10px;
}

#view-season .season-table-wrap.table-wrap {
  max-height: none;
  overflow-x: auto;
  overflow-y: visible;
}

.season-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.season-table th,
.season-table td {
  padding: 0.42rem 0.55rem;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
  text-align: left;
  white-space: nowrap;
}

.season-table th {
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  background: color-mix(in srgb, var(--navy) 6%, var(--panel));
  font-weight: 600;
}

.season-table th.col-rank,
.season-table td.col-rank {
  white-space: nowrap;
  letter-spacing: 0.02em;
  text-transform: none;
  text-align: left;
  padding-right: 0.85rem;
  box-sizing: border-box;
}

.season-table th.col-rank {
  font-size: 0.8rem;
}

.season-table td.num,
.season-table th:not(:nth-child(2)) {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.season-table th.col-rank,
.season-table td.col-rank {
  text-align: left;
}

.season-table td.team {
  padding-left: 0.65rem;
}

.season-table .mono { font-family: var(--font-mono); font-size: 0.82rem; }
.season-table .pos { color: var(--good); }
.season-table .neg { color: var(--accent-deep); }

.season-table tr.is-playoff td {
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}

.season-table tr.is-playin td {
  background: color-mix(in srgb, #5b9bd5 16%, transparent);
}

.season-table tr.is-playoff td.col-rank {
  color: #d32f2f;
  font-weight: 700;
}

.season-table tr.is-playin td.col-rank {
  color: #e67e22;
  font-weight: 700;
}

.season-table .team {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
  white-space: normal;
}

.season-table .season-team-logo {
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  margin: 0;
}

.season-seed {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.15rem;
  height: 1.15rem;
  padding: 0 0.2rem;
  border-radius: 3px;
  background: #1c2a44;
  color: #f4efe6;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  line-height: 1;
}

.season-table .team-text {
  display: flex;
  flex-direction: column;
  gap: 0.08rem;
  min-width: 0;
  line-height: 1.25;
}

.season-table .team-line1 {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  min-width: 0;
}

.season-table .team-name {
  color: var(--ink);
  font-weight: 600;
  font-size: 0.88rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.season-table .team-code {
  font-family: var(--font-mono);
  font-weight: 400;
  font-size: 0.78rem;
  color: var(--muted);
  flex: 0 0 auto;
}

.season-table .team-name-en {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 400;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.2;
}

.season-bracket {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

.po-bracket {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  --po-gap: 0.55rem;
  --po-card-w: 300px;
  /* 半决赛略宽于单场、明显窄于两场之和，仍居中落在上一轮两组之间 */
  --po-semi-w: calc(var(--po-card-w) * 1.22);
  --po-playin-card-w: 300px;
  --po-playin-gap: 2.75rem;
  --po-track-w: calc(var(--po-card-w) * 4 + var(--po-gap) * 3);
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 0.25rem;
}

.po-connector-layer {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 3;
  overflow: visible;
}

.po-bracket-vertical .po-row {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  align-items: center;
  position: relative;
  z-index: 1;
}

.po-row-title {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--navy);
  align-self: stretch;
}

/* West R1/R2: title under matches so connector gap mirrors East */
.po-row.is-title-below .po-row-title {
  text-align: center;
  margin-top: 0.15rem;
}

.po-connectors {
  position: relative;
  height: 2.4rem;
  margin: 0;
  pointer-events: none;
  width: var(--po-track-w);
  max-width: none;
  flex: 0 0 auto;
  align-self: center;
  overflow: visible;
  z-index: 0;
}

/* 东决/西决 → 总决赛：两侧预留等高间距 */
.po-connectors[data-to="finals"] {
  height: 3rem;
}

.po-connector-layer .po-line,
.po-connector-svg .po-line {
  fill: none;
  stroke-width: 2;
  stroke-linecap: square;
  stroke-linejoin: miter;
  vector-effect: non-scaling-stroke;
}

.po-connector-layer .po-line.is-advance,
.po-connector-svg .po-line.is-advance {
  stroke: var(--accent-deep);
}

.po-connector-layer .po-line.is-pending,
.po-connector-svg .po-line.is-pending {
  stroke: color-mix(in srgb, var(--line) 85%, var(--muted));
  stroke-dasharray: 4 3;
}

.po-connector-layer .po-line.is-muted,
.po-connector-svg .po-line.is-muted,
.po-connector-layer .po-line.is-eliminated,
.po-connector-svg .po-line.is-eliminated {
  stroke: #9a948a;
  stroke-width: 2;
}

html[data-theme="dark"] .po-connector-layer .po-line.is-muted,
html[data-theme="dark"] .po-connector-svg .po-line.is-muted,
html[data-theme="dark"] .po-connector-layer .po-line.is-eliminated,
html[data-theme="dark"] .po-connector-svg .po-line.is-eliminated {
  stroke: #6b6570;
}

.po-playin-wrap,
.po-row {
  overflow: visible;
}

/* 附加赛：居左；与季后赛拉开间距并用浅蓝底区分 */
.po-row.po-row-playin {
  width: var(--po-track-w);
  max-width: none;
  margin-inline: auto;
  align-items: stretch;
  padding: 0.9rem 0.85rem;
  border-radius: 12px;
  box-sizing: border-box;
  background: color-mix(in srgb, #6ba3d9 16%, var(--panel));
  border: 1px solid color-mix(in srgb, #6ba3d9 28%, var(--line));
}

.po-row.po-row-playin[data-po-key="e-pi"] {
  margin-bottom: 2rem;
}

.po-row.po-row-playin[data-po-key="w-pi"] {
  margin-top: 2rem;
}

html[data-theme="dark"] .po-row.po-row-playin {
  background: color-mix(in srgb, #5a8ec4 22%, var(--panel));
  border-color: color-mix(in srgb, #5a8ec4 35%, var(--line));
}

/* 附加赛：7v8 / 9v10 纵向，决赛在右侧 */
.po-playin-wrap {
  display: grid;
  grid-template-columns: var(--po-playin-card-w) var(--po-playin-gap) var(--po-playin-card-w);
  align-items: center;
  justify-content: start;
  gap: 0;
  width: max-content;
  max-width: none;
  margin-inline: 0;
  position: relative;
  z-index: 1;
}

.po-playin-first {
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  justify-content: center;
  gap: 1rem;
  width: var(--po-playin-card-w);
  grid-column: 1;
}

.po-playin-first .po-match {
  width: 100%;
  flex: 0 0 auto;
}

.po-connectors-playin {
  grid-column: 2;
  height: 100%;
  min-height: 4rem;
  width: 100%;
  margin: 0;
  overflow: visible;
  z-index: 0;
}

.po-playin-final {
  display: flex;
  justify-content: center;
  align-items: center;
  width: var(--po-playin-card-w);
  grid-column: 3;
}

.po-playin-final .po-match {
  width: 100%;
  flex: 0 0 auto;
}

.po-row-matches {
  display: grid;
  gap: var(--po-gap);
  align-items: stretch;
  width: var(--po-track-w);
  max-width: none;
  margin-inline: auto;
  box-sizing: border-box;
  justify-content: center;
}

.po-row-matches .po-match {
  width: var(--po-card-w);
  max-width: var(--po-card-w);
  box-sizing: border-box;
  justify-self: center;
}

/* 季后赛首轮：4 场固定同一行 */
.po-row-matches.is-four {
  grid-template-columns: repeat(4, var(--po-card-w));
}

/* 分区半决赛：缩窄并对准上一轮两组中间 */
.po-row-matches.is-two {
  grid-template-columns: repeat(4, var(--po-card-w));
}
.po-row-matches.is-two .po-match:nth-child(1) {
  grid-column: 1 / span 2;
  width: var(--po-semi-w);
  max-width: var(--po-semi-w);
  justify-self: center;
}
.po-row-matches.is-two .po-match:nth-child(2) {
  grid-column: 3 / span 2;
  width: var(--po-semi-w);
  max-width: var(--po-semi-w);
  justify-self: center;
}

.po-row-matches.is-three {
  grid-template-columns: repeat(3, var(--po-card-w));
  width: calc(var(--po-card-w) * 3 + var(--po-gap) * 2);
}

/* 分区决赛：整行居中 */
.po-row-matches.is-one {
  grid-template-columns: repeat(4, var(--po-card-w));
}
.po-row-matches.is-one .po-match {
  grid-column: 1 / -1;
}

.po-row.is-finals {
  border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--line));
  border-radius: 12px;
  padding: 0.55rem 0.85rem 0.85rem;
  background:
    linear-gradient(
      135deg,
      color-mix(in srgb, var(--accent) 10%, var(--panel)),
      color-mix(in srgb, var(--accent) 4%, var(--panel)) 60%
    );
  width: calc(var(--po-card-w) + 2rem);
  max-width: none;
  align-self: center;
  box-sizing: border-box;
  gap: 0.2rem;
}

.po-row.is-finals .po-row-title {
  color: var(--accent-deep);
  text-align: center;
  order: 3;
  margin-top: 0.35rem;
}

/* 东决/西决标题在对阵框左侧，不占纵向间距 */
.po-row.po-row-conf-final {
  position: relative;
  width: var(--po-track-w);
  margin-inline: auto;
  align-items: stretch;
}

.po-row.po-row-conf-final .po-row-title {
  position: absolute;
  right: calc(100% + 0.65rem);
  top: 50%;
  transform: translateY(-50%);
  margin: 0;
  white-space: nowrap;
  text-align: right;
  align-self: auto;
}

.po-row.po-row-conf-final .po-row-matches {
  width: 100%;
  margin-inline: 0;
}

/* 奥布莱恩杯：大框内、小对阵框外，大比分正上方居中 */
.po-obrien-wrap {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  width: 100%;
  margin: 0.15rem 0 0.25rem;
  pointer-events: none;
  order: 1;
}

.po-row.is-finals .po-row-matches {
  order: 2;
}

.po-obrien-cup {
  width: 2.35rem;
  height: auto;
  display: block;
  filter: drop-shadow(0 2px 4px rgba(16, 20, 28, 0.18));
}

.po-row.is-finals .po-match {
  background: color-mix(in srgb, var(--panel) 92%, var(--accent));
}

.po-row.is-finals .po-row-matches {
  width: 100%;
  grid-template-columns: 1fr;
}

.po-row.is-finals .po-row-matches .po-match {
  width: 100%;
  max-width: none;
  grid-column: auto;
}

@media (max-width: 1100px) {
  .po-bracket {
    --po-card-w: 280px;
    --po-playin-card-w: 320px;
  }
}

@media (max-width: 780px) {
  .po-bracket {
    --po-card-w: 260px;
    --po-playin-card-w: 300px;
  }
}

.po-conf h3,
.po-finals-wrap h3 {
  margin: 0 0 0.55rem;
  font-size: 1.05rem;
  color: var(--navy);
}

.po-tree {
  display: grid;
  grid-template-columns: 1.2fr 1fr 0.85fr;
  gap: 0.75rem;
  align-items: stretch;
}

.po-col h4 {
  margin: 0 0 0.4rem;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: var(--muted);
  text-align: center;
}

.po-col-stack {
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  gap: 0.55rem;
  min-height: 100%;
}

.po-col[data-round="2"] .po-col-stack {
  gap: 1.4rem;
}

.po-col[data-round="3"] .po-col-stack {
  justify-content: center;
}

.po-match {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  grid-template-areas: "a score b";
  gap: 0.2rem 0.4rem;
  align-items: center;
  width: 100%;
  margin: 0;
  padding: 0.4rem 0.45rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  position: relative;
  overflow: visible;
}

.po-match-sub {
  display: none;
}

.po-match-tag {
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--muted);
  line-height: 1.1;
  margin-top: 0.12rem;
}

.po-match .po-side-a {
  grid-area: a;
}

.po-match .po-big {
  grid-area: score;
}

.po-match .po-side-b {
  grid-area: b;
}

.po-match:hover,
.po-match:focus-visible {
  border-color: color-mix(in srgb, var(--accent) 50%, var(--line));
  box-shadow: 0 8px 22px rgba(16, 20, 28, 0.08);
  outline: none;
}

.po-match-empty {
  opacity: 0.35;
  cursor: default;
  pointer-events: none;
  justify-items: center;
}

/* 球队块：logo 与中文名同一行；排名/中文/简称三行 */
.po-team-block {
  display: grid;
  column-gap: 0.35rem;
  row-gap: 0.04rem;
  align-items: center;
  min-width: 0;
}

.po-side-a.po-team-block {
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas:
    ". seed"
    "logo name"
    ". code";
  justify-items: start;
}

.po-side-b.po-team-block {
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "seed ."
    "name logo"
    "code .";
  justify-items: end;
  text-align: right;
}

.po-team-block .po-logo-slot {
  grid-area: logo;
  display: flex;
  align-items: center;
  justify-content: center;
}

.po-team-block .po-seed {
  grid-area: seed;
}

.po-team-block .po-name {
  grid-area: name;
}

.po-team-block .po-code {
  grid-area: code;
}

.po-side-text {
  display: flex;
  flex-direction: column;
  gap: 0.08rem;
  min-width: 0;
}

.po-team-logo {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  margin: 0;
}

.po-side.is-winner .po-name {
  color: var(--good);
  font-weight: 600;
}

.po-side.is-eliminated {
  opacity: 0.55;
}

.po-side.is-eliminated .po-name {
  color: var(--muted);
  font-weight: 500;
}

.po-match.has-result::after {
  display: none;
}

.po-seed {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--muted);
  line-height: 1.1;
}

.po-seed-empty {
  visibility: hidden;
}

.po-name {
  font-size: 0.8rem;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.2;
  max-width: 100%;
}

.po-code {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--muted);
  line-height: 1.1;
}

.po-big {
  display: inline-flex;
  flex-direction: column;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  gap: 0;
  font-family: var(--font-display);
  font-size: 1.2rem;
  letter-spacing: 0.02em;
  color: var(--accent-deep);
  line-height: 1;
  padding: 0 0.1rem;
  white-space: nowrap;
}

.po-big-line {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 0.08rem;
}

.po-big-n {
  font-variant-numeric: tabular-nums;
}

.po-big-sep {
  font-size: 0.85em;
  opacity: 0.85;
}

.po-finals-wrap {
  border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--line));
  border-radius: 12px;
  padding: 0.85rem 1rem 1rem;
  background:
    linear-gradient(
      135deg,
      color-mix(in srgb, var(--accent) 10%, var(--panel)),
      color-mix(in srgb, var(--accent) 4%, var(--panel)) 60%
    );
}

.po-finals-wrap .po-match {
  background: color-mix(in srgb, var(--panel) 92%, var(--accent));
}

.series-dialog {
  border: none;
  border-radius: 14px;
  padding: 0;
  max-width: min(560px, calc(100vw - 1.5rem));
  width: 100%;
  background: var(--panel);
  color: var(--ink);
  box-shadow: var(--shadow);
}

.series-dialog::backdrop {
  background: rgba(16, 20, 28, 0.45);
}

.series-dialog-inner {
  display: flex;
  flex-direction: column;
  max-height: min(80vh, 720px);
}

.series-dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1.1rem 0.75rem;
  border-bottom: 1px solid var(--line);
}

.series-dialog-head h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.55rem;
  letter-spacing: 0.04em;
  color: var(--navy);
}

.series-dialog-sub {
  margin: 0.25rem 0 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.series-dialog-body {
  padding: 0.85rem 1.1rem 1.15rem;
  overflow: auto;
}

.player-pk-dialog {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
  width: min(860px, calc(100vw - 1.5rem));
  height: min(92vh, 920px);
  max-height: calc(100vh - 1.5rem);
  overflow: hidden;
}
.player-pk-dialog::backdrop {
  background: rgba(16, 20, 28, 0.45);
}
.player-pk-inner {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  height: 100%;
}
.player-pk-head {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1.2rem 0.8rem;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.player-pk-head h3 {
  margin: 0;
  font-size: 1.08rem;
}
.player-pk-sub {
  margin: 0.3rem 0 0;
  font-size: 0.82rem;
  color: var(--muted);
}
.player-pk-sub.is-error {
  color: #c62828;
}
.player-pk-pickers {
  flex: 0 0 auto;
  display: grid;
  gap: 0.45rem;
  padding: 0.75rem 1.2rem 0.8rem;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  position: relative;
  z-index: 5;
  overflow: auto;
}
.player-pk-pickers[hidden] {
  display: none;
}
.player-pk-picker-label {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.04em;
}
.player-pk-picker-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.65rem;
  align-items: end;
}
.player-pk-pickers .field {
  min-width: 0;
  display: grid;
  gap: 0.35rem;
}
.player-pk-pickers.is-picking-a #pk-field-b,
.player-pk-pickers.is-picking-b #pk-field-a {
  display: none;
}
.player-pk-pickers .field > label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}
.player-pk-pickers .combo {
  z-index: 8;
}
.player-pk-pickers .combo:focus-within {
  z-index: 40;
}
.player-pk-pickers .combo-list {
  position: relative;
  top: auto;
  left: auto;
  right: auto;
  z-index: 50;
  max-height: 220px;
  margin-top: 4px;
}
.player-pk-pickers .combo-list li.is-selected .combo-name {
  color: var(--accent-deep);
}
.player-pk-pickers input[type="search"] {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.5rem 2.1rem 0.5rem 0.65rem;
  font: inherit;
  background: var(--input-bg);
  color: var(--ink);
}
.player-pk-pickers .combo::after {
  top: 1.15rem;
  transform: none;
  margin-top: 0;
}
.player-pk-body {
  flex: 1 1 auto;
  overflow: auto;
  padding: 0;
  min-height: 12rem;
  background: var(--surface);
}
.player-pk-empty {
  margin: 0;
  padding: 2.4rem 1.2rem;
  text-align: center;
  color: var(--muted);
  font-style: italic;
}
.pk-table {
  width: 100%;
  border-collapse: collapse;
}
.pk-table th,
.pk-table td {
  padding: 0.55rem 0.8rem;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.pk-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--thead-bg);
  box-shadow: 0 1px 0 var(--line);
  text-align: center;
  font-weight: 600;
}
.pk-table thead th.pk-metric {
  text-align: left;
  width: 26%;
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
}
.pk-head-player {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  min-width: 0;
}
.pk-head-player .player-avatar {
  width: 52px;
  height: 38px;
}
.pk-head-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--navy);
  line-height: 1.25;
  word-break: break-word;
}
.pk-head-en {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted);
}
.pk-head-loading {
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 500;
}
.pk-switch-btn {
  margin-top: 0.2rem;
}
.pk-section td {
  background: var(--thead-group-bg);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--navy);
  padding: 0.5rem 0.8rem;
}
.pk-table td.pk-metric {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 600;
}
.pk-table td.pk-val {
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.92rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.pk-table td.pk-val.is-pk-win {
  color: #c62828;
  font-weight: 800;
}
.pk-table td.pk-val.is-bio {
  font-family: var(--font-body);
  font-weight: 500;
}
.pk-table tbody tr:hover td {
  background: var(--row-hover);
}
.pk-table tbody tr.pk-section td,
.pk-table tbody tr.pk-section:hover td {
  background: var(--thead-group-bg);
}
@media (max-width: 640px) {
  .player-pk-picker-row {
    grid-template-columns: 1fr;
  }
  .pk-table th,
  .pk-table td {
    padding: 0.45rem 0.5rem;
  }
  .pk-head-player .player-avatar {
    width: 40px;
    height: 29px;
  }
}

.series-game-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.series-game-list li {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: color-mix(in srgb, var(--ink) 4%, var(--panel));
}

.series-game-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
}

.series-game-n {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted);
}

.series-game-date {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted);
}

.series-game-teams {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  text-decoration: none;
  color: inherit;
}

a.series-game-teams:hover .series-game-pts:not(.is-loser) {
  text-decoration: underline;
}

.series-game-row {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 0.45rem 0.55rem;
  min-width: 0;
}

.series-game-logo {
  width: 24px;
  height: 24px;
  margin: 0;
}

.series-game-team-name {
  font-weight: 600;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.series-game-series-tag {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
}

.series-game-pts {
  font-family: var(--font-display);
  font-size: 1.15rem;
  letter-spacing: 0.03em;
  color: var(--accent-deep);
  font-weight: 600;
  min-width: 2.2rem;
  text-align: right;
  white-space: nowrap;
}

.series-game-row.is-loser .series-game-team-name {
  color: var(--muted);
  font-weight: 500;
}

.series-game-pts.is-loser {
  color: var(--muted);
  font-weight: 500;
}

@media (max-width: 900px) {
  html, body {
    height: 100%;
    overflow: hidden;
  }
  .bg-grid { position: fixed; }
  .shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
    height: 100dvh;
    height: 100svh;
    min-height: 0;
    overflow: hidden;
  }
  .sidebar {
    position: relative;
    top: auto;
    z-index: 30;
    height: auto;
    max-height: none;
    overflow: hidden;
    flex-direction: column;
    align-items: stretch;
    gap: 0.45rem;
    padding: 0.55rem 0.7rem 0.6rem;
    padding-top: max(0.45rem, env(safe-area-inset-top));
    border-right: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 10px 28px rgba(8, 12, 24, 0.35);
  }
  .brand {
    order: 1;
    padding: 0;
    align-items: center;
    gap: 0.35rem;
  }
  .brand-name { font-size: 1.35rem; }
  .brand-tagline { display: none; }
  .nav {
    order: 0; /* secondary menus pinned at the very top */
    width: 100%;
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.28rem;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 0.1rem;
  }
  .nav::-webkit-scrollbar { display: none; }
  .nav-group { display: contents; }
  .nav-group[hidden] { display: none !important; }
  .nav-parent { display: none !important; }
  .nav-children,
  .nav-children[hidden] {
    display: contents !important;
  }
  .nav-link {
    flex: 0 0 auto;
    font-size: 0.78rem;
    padding: 0.38rem 0.58rem;
    border-left: 0;
    border-radius: 999px;
    white-space: nowrap;
    background: rgba(255, 255, 255, 0.05);
  }
  .nav-link.active {
    border-left-color: transparent;
    background: rgba(228, 87, 46, 0.28);
  }
  .side-auth {
    order: 2;
    margin-top: 0;
    width: 100%;
    border-top: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem 0.55rem;
  }
  .side-auth-role {
    margin: 0;
    font-size: 0.72rem;
    opacity: 0.85;
  }
  .side-auth-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-left: auto;
  }
  .side-app {
    order: 3;
    margin-top: 0;
    width: 100%;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 0.5rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.55rem;
    text-align: left;
  }
  html.is-native-app .side-app,
  body.is-native-app .side-app {
    display: none !important;
  }
  .side-qr { width: 56px; height: 56px; }
  .side-app-title, .side-app-hint { margin: 0; }
  .side-meta {
    order: 4;
    margin-top: 0;
    width: 100%;
  }
  .content {
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding: 0.85rem 0.8rem calc(1.4rem + env(safe-area-inset-bottom));
  }
  .top-auth {
    top: 0.75rem;
    right: 0.8rem;
  }
  .page-head {
    padding-right: 9.5rem;
    min-height: 1.7rem;
  }
  .field, .field.grow {
    min-width: min(100%, 280px);
    flex: 1 1 auto;
  }
  .field.actions {
    flex: 1 1 auto;
  }
  .range-sep { display: none; }
  .dash-summary { grid-template-columns: 1fr 1fr; }
  .season-standings,
  .bracket-cols,
  .po-tree {
    grid-template-columns: 1fr;
  }
  .season-table .team-code { display: none; }
  .po-col-stack { gap: 0.45rem !important; }
}


/* ——— App chrome (native shell / ?app=1) ——— */
.app-chrome,
.app-tabbar {
  display: none;
}

html.is-native-app,
html.is-native-app body {
  height: 100%;
  overflow: hidden;
}

html.is-native-app .bg-grid { position: fixed; }

html.is-native-app .shell {
  grid-template-columns: 1fr;
  grid-template-rows: auto minmax(0, 1fr) auto;
  height: 100dvh;
  height: 100svh;
  min-height: 0;
  overflow: hidden;
}

html.is-native-app .sidebar {
  display: none !important;
}

html.is-native-app .app-chrome {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  z-index: 40;
  background: linear-gradient(180deg, var(--side) 0%, #0f1729 100%);
  color: #f4efe6;
  padding: 0.45rem 0.7rem 0.55rem;
  padding-top: max(0.4rem, env(safe-area-inset-top));
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 10px 28px rgba(8, 12, 24, 0.28);
}

html.is-native-app .app-top {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

html.is-native-app .app-logo {
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
  flex: 0 0 auto;
  padding: 0;
  max-width: 42%;
}

html.is-native-app .app-logo .brand-mark {
  font-size: 0.72rem;
  padding: 0.12rem 0.22rem 0.08rem;
}

html.is-native-app .app-logo .brand-name {
  font-size: 1.35rem;
  letter-spacing: 0.05em;
  line-height: 0.9;
}

html.is-native-app .app-logo .brand-tagline {
  display: none;
}

html.is-native-app .app-search {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
}

html.is-native-app .app-search input {
  width: 100%;
  min-height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: #f4efe6;
  padding: 0.45rem 0.9rem;
  font: inherit;
  font-size: 0.9rem;
  outline: none;
}

html.is-native-app .app-search input::placeholder {
  color: rgba(244, 239, 230, 0.45);
}

html.is-native-app .app-search input:focus {
  border-color: rgba(228, 87, 46, 0.65);
  background: rgba(255, 255, 255, 0.12);
}

html.is-native-app .app-search-list {
  position: absolute;
  z-index: 80;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  margin: 0;
  padding: 0.35rem 0;
  list-style: none;
  max-height: min(52vh, 360px);
  overflow: auto;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 16px 36px rgba(16, 20, 28, 0.22);
}

html.is-native-app .app-search-list li {
  margin: 0;
  padding: 0.65rem 0.9rem;
  cursor: pointer;
  display: grid;
  gap: 0.15rem;
}

html.is-native-app .app-search-list li:hover,
html.is-native-app .app-search-list li.active {
  background: var(--row-hover);
}

html.is-native-app .app-search-list .hit-title {
  font-weight: 600;
  font-size: 0.92rem;
}

html.is-native-app .app-search-list .hit-sub {
  font-size: 0.75rem;
  color: var(--muted);
}

html.is-native-app .app-search-list .hit-kind {
  display: inline-block;
  margin-right: 0.35rem;
  padding: 0.05rem 0.35rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 600;
  background: rgba(26, 39, 68, 0.08);
  color: var(--navy);
}

html.is-native-app .app-search-list .hit-kind.team {
  background: rgba(228, 87, 46, 0.12);
  color: var(--accent-deep);
}

html.is-native-app .app-search-list .hit-empty {
  color: var(--muted);
  font-style: italic;
  cursor: default;
}

html.is-native-app .app-subnav {
  min-width: 0;
}

html.is-native-app .app-subnav-track {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.3rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 0.05rem;
}

html.is-native-app .app-subnav-track::-webkit-scrollbar { display: none; }
html.is-native-app .app-subnav-track[hidden] { display: none !important; }

html.is-native-app .app-subnav-link {
  flex: 0 0 auto;
  color: rgba(244, 239, 230, 0.78);
  text-decoration: none;
  font-size: 0.8rem;
  padding: 0.4rem 0.7rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  white-space: nowrap;
}

html.is-native-app .app-subnav-link.active {
  color: #fff;
  background: rgba(228, 87, 46, 0.3);
}

html.is-native-app body.app-tab-me .app-subnav {
  display: none;
}

html.is-native-app .content {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 0.75rem 0.75rem 1rem;
}

/* App list views: scroll with page (no fixed inner table height) */
html.is-native-app #view-players:not([hidden]),
html.is-native-app #view-games:not([hidden]),
html.is-native-app #view-base-teams:not([hidden]),
html.is-native-app #view-base-players:not([hidden]),
html.is-native-app #view-base-draft:not([hidden]) {
  display: block;
  min-height: 0;
}

html.is-native-app #view-players:not([hidden]) .results,
html.is-native-app #view-games:not([hidden]) .results,
html.is-native-app #view-base-teams:not([hidden]) .results,
html.is-native-app #view-base-players:not([hidden]) .results,
html.is-native-app #view-base-draft:not([hidden]) .results {
  display: block;
  overflow: visible;
}

html.is-native-app #view-players:not([hidden]) .table-wrap,
html.is-native-app #view-games:not([hidden]) .table-wrap,
html.is-native-app #view-base-teams:not([hidden]) .table-wrap,
html.is-native-app #view-base-players:not([hidden]) .table-wrap,
html.is-native-app #view-base-draft:not([hidden]) .table-wrap {
  max-height: none;
  overflow-x: auto;
  overflow-y: visible;
}

html.is-native-app #view-players:not([hidden]) .pager-bar,
html.is-native-app #view-games:not([hidden]) .pager-bar,
html.is-native-app #view-base-teams:not([hidden]) .pager-bar,
html.is-native-app #view-base-players:not([hidden]) .pager-bar,
html.is-native-app #view-base-draft:not([hidden]) .pager-bar {
  margin-top: 0;
}

html.is-native-app .app-tabbar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  z-index: 40;
  background: #0f1729;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0.28rem 0.35rem calc(0.28rem + env(safe-area-inset-bottom));
}

html.is-native-app .app-tab {
  appearance: none;
  border: 0;
  background: transparent;
  color: rgba(244, 239, 230, 0.55);
  display: grid;
  justify-items: center;
  gap: 0.18rem;
  padding: 0.35rem 0.2rem;
  font: inherit;
  cursor: pointer;
}

html.is-native-app .app-tab[aria-selected="true"] {
  color: #fff;
}

html.is-native-app .app-tab-label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

html.is-native-app .app-tab-ico {
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 0.35rem;
  background: rgba(255, 255, 255, 0.12);
  position: relative;
}

html.is-native-app .app-tab[aria-selected="true"] .app-tab-ico {
  background: rgba(228, 87, 46, 0.85);
}

html.is-native-app .app-tab-ico-stats {
  background-image: linear-gradient(180deg, transparent 35%, rgba(255,255,255,0.85) 35%, rgba(255,255,255,0.85) 45%, transparent 45%),
    linear-gradient(180deg, transparent 55%, rgba(255,255,255,0.7) 55%, rgba(255,255,255,0.7) 70%, transparent 70%),
    linear-gradient(180deg, transparent 25%, rgba(255,255,255,0.95) 25%, rgba(255,255,255,0.95) 80%, transparent 80%);
  background-size: 18% 100%, 18% 100%, 18% 100%;
  background-position: 22% 0, 50% 0, 78% 0;
  background-repeat: no-repeat;
}

html.is-native-app .app-tab-ico-base {
  box-shadow: inset 0 0 0 2px rgba(255,255,255,0.75);
  background-image: linear-gradient(rgba(255,255,255,0.75), rgba(255,255,255,0.75));
  background-size: 70% 2px;
  background-position: center;
  background-repeat: no-repeat;
}

html.is-native-app .app-tab-ico-me {
  border-radius: 999px;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,0.75);
  background-image: radial-gradient(circle at 50% 38%, rgba(255,255,255,0.9) 0 22%, transparent 23%),
    radial-gradient(circle at 50% 88%, rgba(255,255,255,0.85) 0 34%, transparent 35%);
}

/* Mobile-friendly filters inside App */
html.is-native-app .filters {
  display: grid;
  gap: 0.65rem;
  padding: 0.75rem;
  border-radius: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

html.is-native-app .filter-row,
html.is-native-app .filter-row-spread {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.65rem;
}

html.is-native-app .field,
html.is-native-app .field.grow,
html.is-native-app .field.actions {
  min-width: 0;
  width: 100%;
  flex: none;
}

html.is-native-app .field label {
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

html.is-native-app .field input,
html.is-native-app .field select,
html.is-native-app .field textarea {
  min-height: 44px;
  width: 100%;
  border-radius: 12px;
  font-size: 1rem;
}

html.is-native-app .btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

html.is-native-app .btn-row .btn {
  flex: 1 1 auto;
  min-height: 44px;
}

html.is-native-app .range-sep { display: none; }

html.is-native-app .table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 12px;
}

html.is-native-app table.data {
  font-size: 0.82rem;
}

html.is-native-app .page-head {
  padding-right: 0;
  min-height: 0;
}

html.is-native-app .page-head h1 {
  font-size: 1.2rem;
}

html.is-native-app .page-head p,
html.is-native-app .page-head-inline p {
  font-size: 0.72rem;
}

html.is-native-app .dash-summary {
  grid-template-columns: 1fr 1fr;
}

/* ——— App 16:9 content density ———
   Portrait ~9:16 / Landscape 16:9：压缩壳层、筛选多列、内容区按 16:9 有效宽度排布 */
html.is-native-app {
  --app-content-max: 100%;
}

html.is-native-app .content > .view:not([hidden]) {
  width: 100%;
  max-width: var(--app-content-max);
  margin-inline: auto;
}

/* 竖屏：收紧纵向间距，筛选在够宽时两列 */
@media (orientation: portrait) {
  html.is-native-app .app-chrome {
    gap: 0.35rem;
    padding: 0.35rem 0.65rem 0.4rem;
    padding-top: max(0.28rem, env(safe-area-inset-top));
  }

  html.is-native-app .app-logo .brand-name {
    font-size: 1.2rem;
  }

  html.is-native-app .app-search input {
    min-height: 34px;
    padding: 0.35rem 0.75rem;
    font-size: 0.85rem;
  }

  html.is-native-app .app-subnav-link {
    font-size: 0.74rem;
    padding: 0.32rem 0.58rem;
  }

  html.is-native-app .content {
    padding: 0.55rem 0.65rem 0.75rem;
  }

  html.is-native-app .page-head {
    margin-bottom: 0.45rem;
  }

  html.is-native-app .page-head h1 {
    font-size: 1.08rem;
  }

  html.is-native-app .page-head p,
  html.is-native-app .page-head-inline p {
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 0.68rem;
  }

  html.is-native-app .filters {
    gap: 0.45rem;
    padding: 0.55rem 0.65rem;
  }

  html.is-native-app .field input,
  html.is-native-app .field select,
  html.is-native-app .field textarea,
  html.is-native-app .btn-row .btn {
    min-height: 40px;
  }
}

@media (orientation: portrait) and (min-width: 360px) {
  html.is-native-app .filter-row,
  html.is-native-app .filter-row-spread {
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem 0.55rem;
  }

  html.is-native-app .filter-row > .field.actions,
  html.is-native-app .filter-row-spread > .field.actions,
  html.is-native-app .filter-row > .field.grow,
  html.is-native-app .filter-row-spread > .field.field-wide,
  html.is-native-app .filter-row > .field.field-wide {
    grid-column: 1 / -1;
  }

  html.is-native-app .filter-row-query {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem 0.55rem;
  }

  html.is-native-app .filter-row-query .field.actions,
  html.is-native-app .filter-row-query .field.field-player,
  html.is-native-app .filter-row-query .field.field-team {
    grid-column: 1 / -1;
  }
}

/* 横屏 / 宽于 16:9：内容最大宽度按高度换算 16:9，筛选多列 */
@media (orientation: landscape), (min-aspect-ratio: 16/9) {
  html.is-native-app {
    --app-content-max: min(100%, calc(100dvh * 16 / 9));
  }

  html.is-native-app .shell {
    grid-template-rows: auto minmax(0, 1fr) auto;
  }

  html.is-native-app .app-chrome {
    gap: 0.28rem;
    padding: 0.28rem 0.7rem 0.32rem;
    padding-top: max(0.2rem, env(safe-area-inset-top));
    padding-left: max(0.7rem, env(safe-area-inset-left));
    padding-right: max(0.7rem, env(safe-area-inset-right));
  }

  html.is-native-app .app-logo .brand-name {
    font-size: 1.15rem;
  }

  html.is-native-app .app-search input {
    min-height: 32px;
    font-size: 0.82rem;
  }

  html.is-native-app .app-subnav-link {
    font-size: 0.72rem;
    padding: 0.28rem 0.55rem;
  }

  html.is-native-app .content {
    padding: 0.45rem 0.75rem 0.55rem;
    padding-left: max(0.75rem, env(safe-area-inset-left));
    padding-right: max(0.75rem, env(safe-area-inset-right));
  }

  html.is-native-app .page-head-inline {
    display: flex;
    align-items: baseline;
    gap: 0.65rem;
    margin-bottom: 0.35rem;
  }

  html.is-native-app .page-head h1 {
    font-size: 1.05rem;
    margin: 0;
  }

  html.is-native-app .page-head p,
  html.is-native-app .page-head-inline p {
    display: none;
  }

  html.is-native-app .filters {
    gap: 0.4rem;
    padding: 0.5rem 0.65rem;
  }

  html.is-native-app .filter-row,
  html.is-native-app .filter-row-spread,
  html.is-native-app .filter-row-query {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.4rem 0.55rem;
  }

  html.is-native-app .filter-row > .field.actions,
  html.is-native-app .filter-row-spread > .field.actions,
  html.is-native-app .filter-row-query > .field.actions {
    grid-column: auto;
    align-self: end;
  }

  html.is-native-app .field input,
  html.is-native-app .field select,
  html.is-native-app .field textarea,
  html.is-native-app .btn-row .btn {
    min-height: 36px;
    font-size: 0.9rem;
  }

  html.is-native-app .dash-summary {
    grid-template-columns: 1fr 1fr;
    max-width: 28rem;
  }

  html.is-native-app .dash-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.55rem;
  }

  html.is-native-app .app-tabbar {
    padding: 0.12rem 0.35rem calc(0.12rem + env(safe-area-inset-bottom));
  }

  html.is-native-app .app-tab {
    padding: 0.2rem 0.15rem;
    gap: 0.1rem;
  }

  html.is-native-app .app-tab-ico {
    width: 1.1rem;
    height: 1.1rem;
  }

  html.is-native-app .app-tab-label {
    font-size: 0.62rem;
  }

  html.is-native-app table.data {
    font-size: 0.78rem;
  }

  html.is-native-app .me-card {
    padding: 0.75rem 0.85rem;
  }
}

/* 矮横屏（典型手机 16:9 landscape）：进一步压缩壳，优先列表区 */
@media (orientation: landscape) and (max-height: 480px) {
  html.is-native-app .app-logo .brand-text {
    display: none;
  }

  html.is-native-app .app-chrome {
    padding-bottom: 0.2rem;
  }

  html.is-native-app .app-subnav-link {
    padding: 0.22rem 0.48rem;
  }

  html.is-native-app .content {
    padding-top: 0.3rem;
    padding-bottom: 0.35rem;
  }

  html.is-native-app .filters {
    padding: 0.4rem 0.5rem;
  }

  html.is-native-app .results-bar h2 {
    font-size: 0.95rem;
  }
}

/* Me page */
.view-me:not([hidden]) {
  display: grid;
  gap: 0.85rem;
}

.me-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 1rem 1.05rem;
  display: grid;
  gap: 0.45rem;
}

.me-card[hidden] {
  display: none !important;
}

.me-card-kicker {
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

.me-card-title {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 600;
}

.me-card-desc {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

html.is-native-app #me-env-back-gate {
  flex: 1 1 auto;
}

.me-meta {
  margin: 0.25rem 0 0;
  display: grid;
  gap: 0.45rem;
}

.me-meta > div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--line);
}

.me-meta dt {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.me-meta dd {
  margin: 0;
  font-weight: 600;
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

.me-hint {
  margin: 0.25rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.me-hint .btn-link,
.btn-link.me-apk-dl {
  display: inline;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent-deep, var(--accent));
  font: inherit;
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.me-hint.error { color: var(--danger, #a33); }

.me-env-seg-field {
  margin: 0.75rem 0 0.5rem;
}

.me-env-base-field {
  display: grid;
  gap: 0.35rem;
  margin: 0.65rem 0 0.35rem;
}

.me-env-base-input {
  width: 100%;
  box-sizing: border-box;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border, #c8d0dc);
  border-radius: 8px;
  background: var(--surface, #fff);
  color: inherit;
  font: inherit;
  font-size: 0.92rem;
}

html[data-theme="dark"] .me-env-base-input {
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(0, 0, 0, 0.25);
}

.me-card-title-sm {
  font-size: 1rem;
}

.me-profile {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.me-profile-text {
  min-width: 0;
  display: grid;
  gap: 0.15rem;
}

.me-avatar-btn {
  appearance: none;
  border: 0;
  padding: 0;
  width: 64px;
  height: 64px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--navy);
  color: #fff;
  cursor: pointer;
  flex: 0 0 auto;
  position: relative;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.18);
}

.me-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.me-avatar-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 1.35rem;
  letter-spacing: 0.02em;
}

.theme-switch {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.25rem;
  margin-top: 0.65rem;
  padding: 0.2rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.theme-menu {
  position: relative;
  flex: 0 0 auto;
}

.theme-menu-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  color: var(--ink);
  font: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.22rem 0.58rem 0.22rem 0.45rem;
  min-height: 1.7rem;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(16, 20, 28, 0.08);
  backdrop-filter: blur(8px);
  line-height: 1.2;
}

.theme-menu-btn:hover {
  border-color: color-mix(in srgb, var(--ink) 22%, var(--line));
}

.theme-menu-ico {
  width: 0.82rem;
  height: 0.82rem;
  border-radius: 50%;
  flex: 0 0 auto;
  background: radial-gradient(circle at 30% 30%, #f6e7c1, #c9a227 55%, #5b4630);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
}

.theme-menu-ico[data-theme-pref="light"] {
  background: radial-gradient(circle at 35% 30%, #fff7d6, #f0c14b 45%, #e0a800);
}
.theme-menu-ico[data-theme-pref="dark"] {
  background: radial-gradient(circle at 65% 35%, #d7e3f7, #4a5d7a 40%, #1a2233 70%);
}
.theme-menu-ico[data-theme-pref="system"] {
  background: linear-gradient(90deg, #f0c14b 50%, #2a3548 50%);
  border-radius: 50%;
}

.theme-menu-pop {
  position: absolute;
  top: calc(100% + 0.4rem);
  right: 0;
  min-width: 8.5rem;
  display: grid;
  gap: 0.15rem;
  padding: 0.35rem;
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: 0 14px 32px rgba(10, 16, 28, 0.18);
  z-index: 130;
}

.theme-menu-pop[hidden] {
  display: none !important;
}

.theme-menu-pop .theme-opt {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  text-align: left;
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  cursor: pointer;
  opacity: 0.85;
}

.theme-menu-pop .theme-opt:hover {
  background: color-mix(in srgb, var(--ink) 6%, transparent);
  opacity: 1;
}

.theme-menu-pop .theme-opt.is-active {
  opacity: 1;
  background: color-mix(in srgb, #e4572e 18%, transparent);
  color: var(--accent-deep, #e4572e);
}

.theme-switch-me {
  margin-top: 0.35rem;
  background: rgba(26, 39, 68, 0.06);
  border-color: var(--line);
}

.theme-opt {
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.45rem 0.35rem;
  border-radius: 999px;
  cursor: pointer;
  opacity: 0.72;
}

.side-auth .theme-opt {
  color: rgba(244, 239, 230, 0.85);
}

.theme-switch-me .theme-opt {
  color: var(--ink);
}

.theme-opt.is-active {
  opacity: 1;
  background: rgba(228, 87, 46, 0.9);
  color: #fff;
}

.side-auth .theme-opt.is-active,
.theme-switch-me .theme-opt.is-active {
  color: #fff;
}

/* ——— Dark theme ——— */
html[data-theme="dark"] {
  color-scheme: dark;
  --ink: #e8eef8;
  --paper: #0d1422;
  --panel: rgba(22, 30, 48, 0.94);
  --thead-bg: #161e30;
  --line: rgba(180, 198, 230, 0.16);
  --muted: #9aa8bf;
  --accent: #f06a45;
  --accent-deep: #d4522b;
  --navy: #dce6f7;
  --navy-2: #c5d2ea;
  --good: #4d9a70;
  --side: #0a101c;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  --danger: #ff8b8b;
  --input-bg: rgba(8, 12, 22, 0.72);
  --surface: #161e30;
  --surface-2: #121a2a;
  --cell-bg: #121a2a;
  --thead-group-bg: #1a2438;
  --row-hover: rgba(255, 255, 255, 0.07);
  --row-border: rgba(180, 198, 230, 0.12);
  --thead-edge: rgba(180, 198, 230, 0.18);
  --link: #8eb7ff;
  --link-hover: #b4d0ff;
  --sticky-cell-bg: var(--cell-bg);
  --sticky-head-bg: var(--thead-bg);
  --sticky-foot-bg: var(--thead-bg);
}

html[data-theme="dark"],
html[data-theme="dark"] body {
  color: var(--ink);
  background:
    radial-gradient(1000px 520px at 20% -10%, rgba(228, 87, 46, 0.18) 0%, transparent 55%),
    radial-gradient(900px 480px at 100% 0%, rgba(70, 110, 180, 0.22) 0%, transparent 50%),
    linear-gradient(180deg, #10182a 0%, var(--paper) 42%, #0a101a 100%);
}

html[data-theme="dark"] .bg-grid {
  background-image:
    linear-gradient(rgba(180, 198, 230, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(180, 198, 230, 0.05) 1px, transparent 1px);
}

html[data-theme="dark"] .btn.primary {
  background: #3d5a8c;
  color: #f4efe6;
}

html[data-theme="dark"] .btn.primary:hover {
  background: #4a6aa3;
}

html[data-theme="dark"] .btn.ghost {
  color: var(--ink);
  border-color: var(--line);
}

html[data-theme="dark"] .field input,
html[data-theme="dark"] .field select,
html[data-theme="dark"] .field textarea,
html[data-theme="dark"] .auth-fields input,
html[data-theme="dark"] .edit-dialog input,
html[data-theme="dark"] .edit-dialog select,
html[data-theme="dark"] .edit-dialog textarea,
html[data-theme="dark"] .combo > input,
html[data-theme="dark"] .multi-combo-control input,
html[data-theme="dark"] input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="range"]):not([type="hidden"]),
html[data-theme="dark"] select,
html[data-theme="dark"] textarea {
  background: var(--input-bg);
  background-color: var(--input-bg);
  color: var(--ink);
  border-color: var(--line);
  caret-color: var(--ink);
}

/* Prevent browser autofill from forcing light “白底蓝字” in dark mode */
html[data-theme="dark"] input:-webkit-autofill,
html[data-theme="dark"] input:-webkit-autofill:hover,
html[data-theme="dark"] input:-webkit-autofill:focus,
html[data-theme="dark"] select:-webkit-autofill,
html[data-theme="dark"] textarea:-webkit-autofill {
  -webkit-text-fill-color: var(--ink);
  caret-color: var(--ink);
  box-shadow: 0 0 0 1000px #121a2a inset;
  transition: background-color 99999s ease-out;
}

html[data-theme="dark"] .combo-list,
html[data-theme="dark"] .multi-combo-list,
html[data-theme="dark"] .multi-combo-control {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
}

html[data-theme="dark"] .combo-list li,
html[data-theme="dark"] .combo-list .combo-name,
html[data-theme="dark"] .multi-combo-list .combo-name,
html[data-theme="dark"] .multi-combo-list .combo-action {
  color: var(--ink);
}

html[data-theme="dark"] .combo-list li:hover,
html[data-theme="dark"] .combo-list li.active,
html[data-theme="dark"] .multi-combo-list li:hover,
html[data-theme="dark"] .multi-combo-list li.active {
  background: var(--row-hover);
}

html[data-theme="dark"] .multi-combo-tag {
  background: color-mix(in srgb, var(--navy) 18%, var(--surface-2));
  color: var(--ink);
}

html[data-theme="dark"] .lb-metric-combo > input {
  background: var(--input-bg);
  color: var(--ink);
}

html[data-theme="dark"] table.data th,
html[data-theme="dark"] th {
  background: var(--thead-bg);
  color: var(--muted);
  box-shadow: inset 0 -1px 0 var(--thead-edge);
}

html[data-theme="dark"] table.data td,
html[data-theme="dark"] td {
  background: var(--cell-bg);
  color: var(--ink);
}

html[data-theme="dark"] table.data tbody tr:hover td,
html[data-theme="dark"] tbody tr:hover td {
  background: color-mix(in srgb, var(--accent) 10%, var(--cell-bg));
}

html[data-theme="dark"] .table-link,
html[data-theme="dark"] a.table-link,
html[data-theme="dark"] a.name-en-link:hover {
  color: var(--link);
}

html[data-theme="dark"] a.table-link:hover {
  color: var(--link-hover);
}

html[data-theme="dark"] #view-base-players .bp-multihead thead .group-head,
html[data-theme="dark"] #view-base-players .bp-multihead thead tr.bp-head-l1 > th.col-sticky-right {
  background: var(--thead-group-bg);
  color: var(--navy);
}

html[data-theme="dark"] #view-base-players tbody td.col-sticky-right,
html[data-theme="dark"] #sys-panel-users .acc-table .col-sticky-right {
  background: var(--cell-bg);
  box-shadow: -6px 0 8px -6px rgba(0, 0, 0, 0.45);
}

html[data-theme="dark"] .pager-bar,
html[data-theme="dark"] .results-bar {
  background: color-mix(in srgb, var(--surface-2) 88%, transparent);
  color: var(--ink);
  border-color: var(--line);
}

html[data-theme="dark"] .totals-bar {
  background: var(--sticky-foot-bg);
  color: var(--ink);
  border-color: var(--line);
}

/* System admin: users / roles / permissions */
html[data-theme="dark"] #view-system .filters,
html[data-theme="dark"] #view-system .results,
html[data-theme="dark"] .sys-panel .filters,
html[data-theme="dark"] .sys-panel .results {
  background: var(--panel);
  color: var(--ink);
  border-color: var(--line);
}

html[data-theme="dark"] #sys-panel-users .acc-table th,
html[data-theme="dark"] #sys-panel-permissions th,
html[data-theme="dark"] #rbac-table th {
  background: var(--thead-bg);
  color: var(--muted);
}

html[data-theme="dark"] #sys-panel-users .acc-table td,
html[data-theme="dark"] #sys-panel-permissions td,
html[data-theme="dark"] #rbac-table td {
  background: var(--cell-bg);
  color: var(--ink);
}

html[data-theme="dark"] #sys-panel-users .acc-table thead .col-sticky-right {
  background: var(--thead-bg);
}

html[data-theme="dark"] #sys-panel-tasks .col-sticky-right,
html[data-theme="dark"] #sys-panel-cron .col-sticky-right {
  background: var(--cell-bg);
  box-shadow: -6px 0 8px -6px rgba(0, 0, 0, 0.45);
}

html[data-theme="dark"] #sys-panel-tasks thead .col-sticky-right,
html[data-theme="dark"] #sys-panel-cron thead .col-sticky-right {
  background: var(--thead-bg);
}

html[data-theme="dark"] #acc-tbody select,
html[data-theme="dark"] .role-card-fields input,
html[data-theme="dark"] .sys-panel .filters input,
html[data-theme="dark"] .sys-panel .filters select {
  background: var(--input-bg);
  color: var(--ink);
  border-color: var(--line);
}

html[data-theme="dark"] .role-card {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line);
}

html[data-theme="dark"] .role-perm-chip {
  background: color-mix(in srgb, var(--navy) 16%, var(--surface-2));
  color: var(--ink);
}

html[data-theme="dark"] .role-perms label:hover {
  background: var(--row-hover);
}

html[data-theme="dark"] .role-perm-l1 {
  border-color: color-mix(in srgb, var(--ink) 14%, transparent);
  background: color-mix(in srgb, var(--surface-2) 80%, transparent);
}

html[data-theme="dark"] .check-label input[type="checkbox"] {
  background: var(--input-bg);
  border-color: var(--line);
  box-shadow: none;
}

html[data-theme="dark"] .btn.acc-delete,
html[data-theme="dark"] .btn.danger-text {
  color: #ff8b8b;
  border-color: rgba(255, 139, 139, 0.4);
}

html[data-theme="dark"] .btn.acc-delete:hover,
html[data-theme="dark"] .btn.danger-text:hover {
  color: #ffb4b4;
  background: rgba(255, 139, 139, 0.1);
}

html[data-theme="dark"] .pager,
html[data-theme="dark"] .page-size-label,
html[data-theme="dark"] .page-jump-label,
html[data-theme="dark"] .page-jump-sep {
  color: var(--muted);
}

html[data-theme="dark"] .pager-bar .btn,
html[data-theme="dark"] .pager .btn {
  color: var(--ink);
  border-color: var(--line);
  background: color-mix(in srgb, var(--surface) 80%, transparent);
}

html[data-theme="dark"] .auth-dialog,
html[data-theme="dark"] .edit-dialog,
html[data-theme="dark"] .rank-board-dialog {
  background: var(--panel);
  color: var(--ink);
}

html[data-theme="dark"] .theme-switch-me {
  background: rgba(255, 255, 255, 0.06);
}

html[data-theme="dark"] .me-avatar-btn {
  background: #2a3d63;
}

html.is-native-app[data-theme="dark"] .app-search input {
  background: rgba(255, 255, 255, 0.08);
  color: #f4efe6;
}

html.is-native-app[data-theme="dark"] .app-search-list {
  background: #182236;
  color: var(--ink);
  border-color: var(--line);
}

html.is-native-app[data-theme="dark"] .app-search-list li:hover,
html.is-native-app[data-theme="dark"] .app-search-list li.active {
  background: rgba(255, 255, 255, 0.06);
}

html[data-theme="dark"] .season-table th {
  background: rgba(8, 12, 22, 0.55);
  color: var(--muted);
}

html[data-theme="dark"] .season-table td {
  color: var(--ink);
}

html[data-theme="dark"] .season-table tr.is-playoff td {
  background: color-mix(in srgb, var(--accent) 16%, rgba(8, 12, 22, 0.35));
}

html[data-theme="dark"] .season-table tr.is-playin td {
  background: color-mix(in srgb, #5b9bd5 20%, rgba(8, 12, 22, 0.35));
}

html[data-theme="dark"] .season-table tr.is-playoff td.col-rank {
  color: #ff6b6b;
}

html[data-theme="dark"] .season-table tr.is-playin td.col-rank {
  color: #ffa64d;
}

html[data-theme="dark"] .season-seed {
  background: #3d5a8c;
  color: #f4efe6;
}

html[data-theme="dark"] .series-dialog,
html[data-theme="dark"] .player-pk-dialog {
  background: var(--panel);
  color: var(--ink);
}

html[data-theme="dark"] .player-pk-head,
html[data-theme="dark"] .player-pk-pickers,
html[data-theme="dark"] .player-pk-body,
html[data-theme="dark"] .pk-table thead th {
  background: var(--panel);
}

html[data-theme="dark"] .player-pk-sub.is-error,
html[data-theme="dark"] .pk-table td.pk-val.is-pk-win {
  color: #ff6b6b;
}

/* —— Mobile-only UX (html.is-native-app); PC unchanged —— */
.label-mobile { display: none; }
.label-desktop { display: inline; }
.lb-mobile-layout { display: none; }

html.is-native-app .app-subnav-dashboard,
html.is-native-app .me-register-btn,
html.is-native-app .lb-career-type-btn {
  display: none !important;
}
html.is-native-app .lb-metric-field,
html.is-native-app .lb-player-field,
html.is-native-app .lb-actions-row,
html.is-native-app #me-change-avatar {
  display: none !important;
}

html.is-native-app .label-desktop { display: none; }
html.is-native-app .label-mobile { display: inline; }
html.is-native-app .label-mobile-end {
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 500;
}

html.is-native-app .lb-filters .lb-filter-top {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem 0.55rem;
  align-items: stretch;
}
html.is-native-app .lb-filters .lb-seg-label {
  display: none !important;
}
html.is-native-app .lb-filters .lb-scope-field,
html.is-native-app .lb-filters .lb-stype-field,
html.is-native-app .lb-filters .lb-season-field {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  min-width: 0;
  width: 100%;
  margin: 0;
}
html.is-native-app .lb-filters .lb-row2 {
  display: contents;
}
html.is-native-app .lb-filters .lb-scope-field {
  grid-column: 1 / -1;
  order: 1;
}
html.is-native-app .lb-filters .lb-scope-field .lb-seg {
  display: flex;
  flex-wrap: nowrap;
  width: 100%;
  box-sizing: border-box;
  gap: 0.2rem;
  padding: 0.2rem;
}
html.is-native-app .lb-filters .lb-stype-field {
  grid-column: 1;
  order: 2;
}
html.is-native-app .lb-filters .lb-season-field {
  grid-column: 2;
  order: 2;
  display: flex !important;
}
html.is-native-app .lb-filters .lb-stype-field .lb-seg {
  width: 100%;
  padding: 0.2rem;
  box-sizing: border-box;
}
html.is-native-app .lb-filters .lb-seg-btn {
  flex: 1 1 0;
  min-width: 0;
  min-height: 2.1rem;
  font: 600 0.72rem/1.2 var(--font-body);
  padding: 0.38rem 0.2rem;
  white-space: nowrap;
}
html.is-native-app .lb-filters .lb-scope-field .lb-seg-btn {
  flex: 1 1 0;
  width: auto;
  min-width: 0;
  padding: 0.36rem 0.12rem;
  border: 0;
  background: transparent;
  border-radius: 8px;
}
html.is-native-app .lb-filters .lb-scope-field .lb-seg-btn.is-active {
  background: color-mix(in srgb, var(--text) 12%, transparent);
  color: var(--text);
}
html.is-native-app .lb-season-field.is-disabled {
  opacity: 0.55;
}
html.is-native-app .lb-season-combo > input,
html.is-native-app #lb-season {
  font: 600 0.72rem/1.2 var(--font-body) !important;
  letter-spacing: 0;
  min-height: 2.1rem;
  padding: 0.38rem 0.55rem;
}
html.is-native-app .lb-season-combo {
  width: 100%;
  max-width: none;
  min-width: 0;
}

html.is-native-app .lb-mobile-layout {
  display: flex !important;
  gap: 0;
  min-height: 0;
  flex: 1;
  margin: 0 -0.15rem;
  border-top: 1px solid color-mix(in srgb, var(--line) 80%, transparent);
  overflow: hidden;
}
/* Desktop single-board panel (历史总得分…) — App uses multi-board layout instead */
html.is-native-app .lb-panel-desktop {
  display: none !important;
}
html.is-native-app #view-leaderboard:not([hidden]) {
  display: flex;
  flex-direction: column;
  min-height: 0;
}
html.is-native-app .lb-anchors {
  flex: 0 0 4.6rem;
  max-width: 4.6rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  border-right: 1px solid color-mix(in srgb, var(--line) 80%, transparent);
  padding: 0.35rem 0.2rem 1.2rem;
  background: color-mix(in srgb, var(--panel) 92%, var(--ink) 4%);
}
html.is-native-app .lb-anchor-btn {
  display: block;
  width: 100%;
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: 600 0.72rem/1.25 var(--font-body);
  text-align: left;
  padding: 0.45rem 0.35rem;
  border-radius: 6px;
  cursor: pointer;
}
html.is-native-app .lb-anchor-btn.is-active {
  color: var(--ink);
  background: color-mix(in srgb, var(--accent) 16%, transparent);
}
html.is-native-app .lb-boards-scroll {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 0.35rem 0.55rem 1.4rem;
}
html.is-native-app .lb-board-section {
  scroll-margin-top: 0.35rem;
  margin: 0 0 1.15rem;
  padding: 0 0 0.85rem;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
  position: relative;
  isolation: isolate;
  overflow: hidden; /* keep section contents from painting over the next board */
}
html.is-native-app .lb-board-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin: 0 0 0.4rem;
  padding: 0;
}
html.is-native-app .lb-board-section-head h3 {
  margin: 0;
  font: 600 0.78rem/1.25 var(--font-body);
  letter-spacing: 0;
}
html.is-native-app .lb-board-section .lb-more-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--accent);
  font: 600 0.72rem/1.2 var(--font-body);
  padding: 0.2rem 0;
  cursor: pointer;
}
html.is-native-app .lb-board-section table.lb-board-table {
  width: 100%;
  font-size: 0.78rem;
}
html.is-native-app .lb-board-section .name-en-col,
html.is-native-app .lb-board-section .lb-col-spacer {
  display: none;
}

html.is-native-app #view-players .field-season-start,
html.is-native-app #view-players .field-season-end,
html.is-native-app #view-players .range-sep,
html.is-native-app #view-players .field-check,
html.is-native-app #view-games .field-season-start,
html.is-native-app #view-games .field-season-end,
html.is-native-app #view-games .range-sep,
html.is-native-app #view-games .field-check,
html.is-native-app .field-season-type-desktop,
html.is-native-app .page-head-desc-desktop {
  display: none !important;
}

.field-season-range-mobile,
.field-season-type-mobile {
  display: none;
}

html.is-native-app .field-season-range-mobile,
html.is-native-app .field-season-type-mobile {
  display: block;
}

html.is-native-app #view-players .filters,
html.is-native-app #view-games .filters {
  gap: 0.28rem;
  padding: 0.4rem 0.55rem;
}

html.is-native-app #view-players .filter-row-query,
html.is-native-app #view-games .filter-row-query {
  display: flex !important;
  flex-direction: column;
  gap: 0.28rem !important;
  align-items: stretch;
  justify-content: flex-start;
}

html.is-native-app #view-players .filter-row-query .field-player,
html.is-native-app #view-players .filter-row-query .field-team {
  display: inline-flex;
  flex: 1 1 0;
  min-width: 0;
  width: auto !important;
  max-width: none !important;
}

/* Player + team on one row */
html.is-native-app #view-players .filter-row-query {
  display: grid !important;
  grid-template-columns: 1fr 1fr;
  gap: 0.28rem !important;
}
html.is-native-app #view-players .filter-row-query .field-season-range-mobile {
  grid-column: 1;
}
html.is-native-app #view-players .filter-row-query .field-season-type-mobile {
  grid-column: 2;
}
html.is-native-app #view-players .filter-row-query .field.actions,
html.is-native-app #view-players .filter-row-query > .result-hint {
  grid-column: 1 / -1;
}
html.is-native-app #view-players .filter-row-query .field-player {
  grid-column: 1;
}
html.is-native-app #view-players .filter-row-query .field-team {
  grid-column: 2;
}

html.is-native-app #view-players .filters label,
html.is-native-app #view-games .filters label {
  display: none;
}

html.is-native-app #view-players .field,
html.is-native-app #view-games .field {
  margin: 0;
  width: 100%;
  /* Desktop row flex-basis (280px/220px) must not become vertical height in column layout */
  flex: 0 0 auto !important;
  min-width: 0 !important;
  max-width: none !important;
  height: auto;
  min-height: 0;
  align-items: stretch;
}

html.is-native-app #view-players .filter-row-query .field-player,
html.is-native-app #view-players .filter-row-query .field-team,
html.is-native-app #view-games .filter-row-query .field-team,
html.is-native-app #view-players .field-season-range-mobile,
html.is-native-app #view-games .field-season-range-mobile,
html.is-native-app #view-players .field-season-type-mobile,
html.is-native-app #view-games .field-season-type-mobile {
  width: 100%;
  min-width: 0;
}

html.is-native-app #view-players .filter-row-query .field.field-player .combo,
html.is-native-app #view-players .filter-row-query .field.field-player input,
html.is-native-app #view-players .filter-row-query .field.field-team input,
html.is-native-app #view-games .filter-row-query .field.field-team input {
  width: 100%;
  min-width: 0;
}

html.is-native-app #view-players .filter-status,
html.is-native-app #view-games .filter-status {
  margin: 0.2rem 0 0;
}

html.is-native-app #view-players .filter-row-query > .result-hint.filter-result-inline,
html.is-native-app #view-games .filter-row-query > .result-hint.filter-result-inline {
  padding-bottom: 0;
  margin: 0;
  align-self: flex-end;
}

html.is-native-app #view-games .filter-row-query {
  display: grid !important;
  grid-template-columns: 1fr 1fr;
  gap: 0.28rem !important;
}
html.is-native-app #view-games .filter-row-query .field-season-range-mobile {
  grid-column: 1;
}
html.is-native-app #view-games .filter-row-query .field-season-type-mobile {
  grid-column: 2;
}
html.is-native-app #view-games .filter-row-query .field-team,
html.is-native-app #view-games .filter-row-query .field.actions,
html.is-native-app #view-games .filter-row-query > .result-hint {
  grid-column: 1 / -1;
}
html.is-native-app #view-players .season-range-trigger,
html.is-native-app #view-games .season-range-trigger,
html.is-native-app #view-players .filters input,
html.is-native-app #view-games .filters input {
  min-height: 2.1rem !important;
}
html.is-native-app #view-players .field-season-type-mobile .lb-seg-btn,
html.is-native-app #view-games .field-season-type-mobile .lb-seg-btn {
  min-height: 2.1rem;
  padding: 0.32rem 0.25rem;
}

html.is-native-app .field-season-range-mobile {
  position: relative;
}
html.is-native-app .field-season-range-mobile.is-open {
  z-index: 70;
}
html.is-native-app .season-range-trigger {
  width: 100%;
  text-align: left;
  font: 600 0.72rem/1.2 var(--font-body) !important;
  letter-spacing: 0;
  min-height: 2.1rem;
  padding: 0.38rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
html.is-native-app .season-range-panel {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 0.28rem);
  z-index: 71;
  margin-top: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  padding: 0.28rem;
  max-height: min(12rem, 48vh);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 0.16rem;
  box-shadow: 0 12px 28px rgba(16, 20, 28, 0.16);
}
/* display:flex above must not defeat HTML [hidden] */
html.is-native-app .season-range-panel[hidden] {
  display: none !important;
}
html.is-native-app .season-range-all {
  width: 100%;
  border: 0;
  background: color-mix(in srgb, var(--text) 6%, transparent);
  font: 600 0.72rem/1.15 var(--font-body);
  padding: 0.28rem 0.4rem;
  border-radius: 6px;
  cursor: pointer;
  color: var(--ink);
}
html.is-native-app .season-range-all.is-active {
  background: var(--accent);
  color: #fff;
}
html.is-native-app .season-range-dual {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.22rem;
  min-height: 0;
  flex: 0 0 auto;
  max-height: 9.5rem;
}
html.is-native-app .season-range-col {
  overflow-y: auto;
  max-height: 9.5rem;
  border: 1px solid color-mix(in srgb, var(--line) 80%, transparent);
  border-radius: 8px;
  padding: 0.06rem;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}
html.is-native-app .season-range-opt {
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  font: 600 0.72rem/1.15 var(--font-body);
  padding: 0.18rem 0.28rem;
  margin: 0;
  border-radius: 4px;
  cursor: pointer;
  color: var(--ink);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
html.is-native-app .season-range-opt.is-active {
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  color: var(--accent-deep, var(--accent));
  font-weight: 700;
}

/* App unified dropdown + table typography (match stats filters) */
html.is-native-app .combo-list,
html.is-native-app .combo-list li,
html.is-native-app .combo-list .combo-name,
html.is-native-app .combo-list .combo-team,
html.is-native-app .multi-combo-list,
html.is-native-app .multi-combo-list li,
html.is-native-app .multi-combo-list .combo-name,
html.is-native-app .lb-season-combo .combo-list,
html.is-native-app .lb-season-combo .combo-list li,
html.is-native-app .lb-season-combo .combo-list .combo-name {
  font: 600 0.72rem/1.2 var(--font-body) !important;
}
html.is-native-app .combo-list .combo-team {
  font-family: var(--font-body) !important;
  font-size: inherit !important;
}
html.is-native-app #view-season .season-section,
html.is-native-app #view-season .season-section table,
html.is-native-app #view-players table.data,
html.is-native-app #view-games table.data,
html.is-native-app #view-base-teams table,
html.is-native-app #view-base-players table,
html.is-native-app #view-base-draft table {
  font-size: 0.78rem;
}

/* Me page: hide 主题 title; unify hint/kicker sizes */
html.is-native-app #view-me .me-card:has(.theme-switch-me) > .me-card-title-sm {
  display: none;
}
html.is-native-app #view-me .me-card-kicker,
html.is-native-app #view-me .me-meta dt,
html.is-native-app #view-me .me-hint,
html.is-native-app #view-me .lb-seg-label {
  font: 600 0.72rem/1.2 var(--font-body);
}
html.is-native-app #view-me .me-card-desc {
  font: 400 0.72rem/1.45 var(--font-body);
  color: var(--muted);
}
html.is-native-app #view-me .me-meta dd {
  font: 600 0.72rem/1.2 var(--font-mono);
}
html.is-native-app .auth-dialog .btn,
html.is-native-app .auth-dialog .auth-footer-link,
html.is-native-app .auth-dialog #auth-form-hint {
  font: 600 0.72rem/1.2 var(--font-body);
}
html.is-native-app .auth-dialog #auth-form-hint {
  font-weight: 400;
}
html.is-native-app .field-season-type-mobile .lb-seg {
  width: 100%;
  display: flex;
}
html.is-native-app .field-season-type-mobile .lb-seg-btn {
  flex: 1;
  font: 600 0.72rem/1.2 var(--font-body);
  padding: 0.38rem 0.35rem;
}
html.is-native-app .btn-search,
html.is-native-app #s-reload,
html.is-native-app #h-search,
html.is-native-app #bt-search,
html.is-native-app #bp-search,
html.is-native-app #bd-search {
  display: none !important;
}
html.is-native-app #view-season .filters select,
html.is-native-app #view-honors .filters select,
html.is-native-app #view-honors .seg-btn,
html.is-native-app #view-players .filters input,
html.is-native-app #view-games .filters input,
html.is-native-app #view-base-teams .filters input,
html.is-native-app #view-base-teams .filters select,
html.is-native-app #view-base-players .filters input,
html.is-native-app #view-base-players .filters select,
html.is-native-app #view-base-draft .filters input,
html.is-native-app #view-base-draft .filters select {
  font: 600 0.72rem/1.2 var(--font-body) !important;
}
html.is-native-app #view-season .filters label,
html.is-native-app #view-honors .filters label,
html.is-native-app #view-players .filters label,
html.is-native-app #view-games .filters label,
html.is-native-app #view-base-teams .filters label,
html.is-native-app #view-base-players .filters label,
html.is-native-app #view-base-draft .filters label {
  font: 600 0.72rem/1.2 var(--font-body);
}

/* Base data App filters: compact rows + hide round/country on draft */
html.is-native-app #view-base-teams .filters label,
html.is-native-app #view-base-players .filters label,
html.is-native-app #view-base-draft .filters label {
  display: none;
}
html.is-native-app #view-base-players .filter-row-query,
html.is-native-app #view-base-draft .filter-row-query {
  display: grid !important;
  grid-template-columns: 1fr 1fr;
  gap: 0.28rem !important;
  align-items: stretch;
}
html.is-native-app #view-base-players .filter-row-query .field,
html.is-native-app #view-base-draft .filter-row-query .field {
  margin: 0;
  width: 100%;
  min-width: 0;
  max-width: none !important;
  flex: unset !important;
}
html.is-native-app #view-base-players .filter-row-query .field-player,
html.is-native-app #view-base-players .filter-row-query .field.actions,
html.is-native-app #view-base-players .filter-row-query > .result-hint,
html.is-native-app #view-base-draft .filter-row-query .field.actions,
html.is-native-app #view-base-draft .filter-row-query > .result-hint {
  grid-column: 1 / -1;
}
html.is-native-app #view-base-players .filter-row-query .field-college {
  grid-column: 1;
}
html.is-native-app #view-base-players .filter-row-query .field-country {
  grid-column: 2;
}
html.is-native-app #view-base-draft .filter-row-query .field-draft-year {
  grid-column: 1;
}
html.is-native-app #view-base-draft .filter-row-query .field-draft-pick {
  grid-column: 2;
}
html.is-native-app #view-base-draft .filter-row-query .field-player {
  grid-column: 1;
}
html.is-native-app #view-base-draft .filter-row-query .field-college {
  grid-column: 2;
}
html.is-native-app #view-base-draft .filter-row-query .field-draft-round,
html.is-native-app #view-base-draft .filter-row-query .field-country {
  display: none !important;
}
html.is-native-app #view-base-draft .filter-row-query .field.field-draft-year,
html.is-native-app #view-base-draft .filter-row-query .field.field-draft-pick,
html.is-native-app #view-base-draft .filter-row-query .field.field-player,
html.is-native-app #view-base-draft .filter-row-query .field.field-college {
  min-width: 0 !important;
  max-width: none;
}
html.is-native-app #view-base-draft .filter-row-query .field.field-draft-year .combo,
html.is-native-app #view-base-draft .filter-row-query .field.field-draft-year input,
html.is-native-app #view-base-draft .filter-row-query .field.field-draft-pick .combo,
html.is-native-app #view-base-draft .filter-row-query .field.field-draft-pick input {
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100%;
  box-sizing: border-box;
}
html.is-native-app #view-base-draft .filter-row-query .field.field-draft-year .combo-list,
html.is-native-app #view-base-draft .filter-row-query .field.field-draft-pick .combo-list {
  min-width: 0;
  width: 100%;
  max-width: 100%;
}
html.is-native-app #view-base-teams .filters input,
html.is-native-app #view-base-players .filters input,
html.is-native-app #view-base-draft .filters input,
html.is-native-app #view-base-draft .filters select {
  min-width: 0;
  width: 100%;
  max-width: 100%;
  text-overflow: ellipsis;
}

html.is-native-app .po-bracket-thumb-wrap {
  position: relative;
  max-height: 220px;
  overflow: hidden;
  border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--line) 80%, transparent);
  cursor: zoom-in;
  -webkit-tap-highlight-color: transparent;
}
html.is-native-app .po-bracket-thumb-wrap .po-bracket {
  transform: scale(0.42);
  transform-origin: top left;
  width: 238%;
  pointer-events: none;
}
html.is-native-app .po-bracket-thumb-hint {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 0.55rem 0.7rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: #f4efe6;
  background: linear-gradient(180deg, transparent, rgba(10, 16, 28, 0.78));
  pointer-events: none;
}

html.is-native-app #h-board {
  display: flex;
  flex-direction: column;
  gap: 0;
}
html.is-native-app #h-board .honor-row {
  display: grid;
  grid-template-columns: 6.8rem minmax(0, 1fr);
  column-gap: 1.2rem;
  align-items: start;
  justify-items: start;
  padding: 0.55rem 0.15rem;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}
html.is-native-app #h-board .honor-row:last-child {
  border-bottom: 0;
}
html.is-native-app #h-board .honor-award-name {
  font: 700 0.82rem/1.35 var(--font-body);
  color: var(--ink);
  word-break: break-word;
  text-align: left;
  justify-self: start;
}
html.is-native-app #h-board .honor-recipients {
  min-width: 0;
  width: 100%;
  font: 500 0.8rem/1.4 var(--font-body);
  text-align: left;
  justify-self: start;
}
html.is-native-app #h-board .honor-recipients .honor-recipient,
html.is-native-app #h-board .honor-recipients .honor-link,
html.is-native-app #h-board .honor-recipients .honor-subject,
html.is-native-app #h-board .honor-recipients .honor-list,
html.is-native-app #h-board .honor-recipients .honor-list li {
  text-align: left;
  justify-self: start;
  justify-content: flex-start;
}
html.is-native-app #h-board .honor-subject-player .honor-player-row {
  grid-template-columns: minmax(0, 1fr);
}
html.is-native-app #h-board .honor-recipient + .honor-recipient {
  margin-top: 0.28rem;
}
html.is-native-app #h-board .honor-recipients .honor-list {
  padding: 0;
  margin: 0;
}
html.is-native-app #h-board .honor-recipients .honor-list li {
  padding: 0.15rem 0;
  border-bottom: 0;
  grid-template-columns: minmax(0, 1fr);
}

.bracket-lightbox {
  border: 0;
  padding: 0;
  max-width: min(100vw, 960px);
  width: 100%;
  max-height: 92vh;
  background: var(--panel);
  color: var(--ink);
  border-radius: 12px;
}
.bracket-lightbox::backdrop {
  background: rgba(8, 12, 22, 0.55);
}
.bracket-lightbox-inner {
  display: flex;
  flex-direction: column;
  max-height: 92vh;
}
.bracket-lightbox-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 80%, transparent);
}
.bracket-lightbox-head h3 {
  margin: 0;
  font-size: 1rem;
}
.bracket-lightbox-body {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0.75rem;
  min-height: 40vh;
}
html.is-native-app .rank-board-dialog {
  width: 100vw;
  max-width: 100vw;
  height: 100%;
  max-height: 100%;
  height: 100dvh;
  max-height: 100dvh;
  margin: 0;
  border-radius: 0;
  inset: 0;
}
html.is-native-app .rank-board-dialog::backdrop {
  background: var(--panel, #0f1729);
}
html.is-native-app .rank-board-inner {
  height: 100%;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--panel, #0f1729);
}
html.is-native-app .rank-board-head {
  padding: max(0.45rem, env(safe-area-inset-top)) 0.65rem 0.45rem 0.35rem;
  background: var(--panel, #0f1729);
  border-bottom-color: color-mix(in srgb, var(--line) 70%, transparent);
}
html.is-native-app .rank-board-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
}
html.is-native-app .rank-board-close-desktop {
  display: none !important;
}
html.is-native-app .rank-board-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  max-height: none;
  padding: 0 0.35rem calc(4.2rem + env(safe-area-inset-bottom));
  background: var(--panel, #0f1729);
}
html.is-native-app .rank-board-body .rank-board-table thead th {
  background: var(--thead-bg, #161e30);
  color: var(--muted);
  z-index: 4;
}
html.is-native-app .rank-board-rocket {
  display: inline-flex;
}
html.is-native-app .rank-board-rocket:not([hidden]) {
  display: inline-flex;
}

.auth-otp-row {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  margin-top: 0.35rem;
}
.auth-otp-code {
  flex: 1;
  min-width: 0;
}
.auth-otp-row .btn {
  flex: 0 0 auto;
  white-space: nowrap;
}

/* Leaderboard dual-pane scroll on App */
html.is-native-app body.app-route-leaderboard .content {
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding-bottom: 0.35rem;
}
html.is-native-app body.app-route-leaderboard #view-leaderboard:not([hidden]) {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  max-width: none;
}
html.is-native-app body.app-route-leaderboard #view-leaderboard .page-head {
  flex: 0 0 auto;
}
html.is-native-app body.app-route-leaderboard #view-leaderboard .lb-filters {
  flex: 0 0 auto;
}
html.is-native-app body.app-route-leaderboard #view-leaderboard .lb-mobile-layout {
  flex: 1;
  min-height: 0;
  height: auto;
}

/* Mobile leaderboard row: rank | name+PRA | metric value */
html.is-native-app .lb-m-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}
html.is-native-app .lb-m-row {
  display: grid;
  /* Rank column left-aligned so "1" lines up with section title */
  grid-template-columns: 1.35rem minmax(0, 1fr) auto;
  gap: 0.35rem 0.45rem;
  align-items: start;
  padding: 0.42rem 0;
  margin: 0;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 55%, transparent);
  position: relative;
  z-index: 0;
}
html.is-native-app .lb-m-rank {
  font: 600 0.72rem/1.35 var(--font-body);
  color: var(--muted);
  text-align: left;
  font-variant-numeric: tabular-nums;
  padding-top: 0.08rem;
}
html.is-native-app .lb-m-main {
  min-width: 0;
}
html.is-native-app .lb-m-name {
  font: 600 0.72rem/1.3 var(--font-body);
  color: var(--ink);
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.2rem 0.35rem;
}
html.is-native-app .lb-m-name a {
  color: inherit;
  text-decoration: none;
}
html.is-native-app .lb-m-season {
  font: 500 0.68rem/1.2 var(--font-body);
  color: var(--muted);
}
html.is-native-app .lb-m-pra {
  margin-top: 0.12rem;
  font: 400 0.64rem/1.3 var(--font-body);
  color: var(--muted);
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
}
html.is-native-app .lb-m-pra strong {
  color: var(--muted);
  font-weight: 400;
}
html.is-native-app .lb-m-val {
  font: 600 0.72rem/1.35 var(--font-body);
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  text-align: right;
  white-space: nowrap;
  padding-left: 0.2rem;
  padding-top: 0.08rem;
}
html.is-native-app .lb-board-section .table-wrap.lb-table-wrap {
  overflow: visible !important;
  max-height: none !important;
  height: auto !important;
  border: 0;
  background: transparent;
  padding: 0 !important;
  margin: 0;
}

html.is-native-app .rank-board-body .rank-board-table th,
html.is-native-app .rank-board-body .rank-board-table td {
  padding: 0.55rem 0.5rem;
  vertical-align: middle;
}
html.is-native-app .rank-board-body .rank-board-table thead th {
  /* Opaque sticky band so scrolled rows cannot bleed through */
  background-color: var(--thead-bg, #161e30) !important;
  background-image: none !important;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  transform: translateZ(0);
}
html[data-theme="dark"] .rank-board-body .rank-board-table thead th,
html.is-native-app[data-theme="dark"] .rank-board-body .rank-board-table thead th {
  background-color: var(--thead-bg, #161e30) !important;
}

/* App: player totals in table footer (scrolls with columns) */
html.is-native-app #view-players .totals-bar {
  display: none;
}
html.is-native-app #view-players table tfoot .totals-row td {
  padding: 0.55rem 0.5rem;
  border-top: 1px solid var(--line);
  background: var(--sticky-foot-bg);
  font: 600 0.78rem/1.2 var(--font-body);
  vertical-align: middle;
}
html.is-native-app #view-players table tfoot .totals-label {
  font-weight: 700;
  color: var(--navy);
  letter-spacing: 0.04em;
  white-space: nowrap;
}
html.is-native-app #view-players table tfoot .totals-cell {
  font-family: var(--font-mono);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* App: hide season range count hint */
html.is-native-app #view-players .filter-status,
html.is-native-app #view-games .filter-status {
  display: none;
}

/* App: compact pager — icons + single row */
html.is-native-app .pager-bar {
  --pager-ctl-h: 1.85rem;
  --pager-ctl-font: 600 0.72rem/1.2 var(--font-body);
  --pager-ctl-pad-y: 0.2rem;
  --pager-ctl-pad-x: 0.3rem;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  padding: 0.55rem 0.75rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
html.is-native-app .pager-bar .page-size-label {
  flex: 0 0 auto;
  font: var(--pager-ctl-font);
  color: var(--muted);
  gap: 0.25rem;
  white-space: nowrap;
}
html.is-native-app .pager-bar .page-size,
html.is-native-app .pager-bar .page-jump-input {
  appearance: none !important;
  -webkit-appearance: none !important;
  box-sizing: border-box !important;
  height: var(--pager-ctl-h) !important;
  min-height: var(--pager-ctl-h) !important;
  max-height: var(--pager-ctl-h) !important;
  padding: 0 var(--pager-ctl-pad-x) !important;
  font: var(--pager-ctl-font) !important;
  line-height: calc(var(--pager-ctl-h) - 2px) !important;
  border-radius: 8px !important;
  border-width: 1px !important;
}
html.is-native-app .pager-bar .page-size {
  min-width: 0;
  width: 3.1rem;
  padding-right: 1.45rem !important;
  background-position: right 0.35rem center;
  background-size: 0.6rem 0.4rem;
}
html.is-native-app .pager-bar .pager {
  flex: 1 1 auto;
  min-width: min-content;
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.28rem;
}
html.is-native-app .pager-bar .page-jump-label {
  flex-wrap: nowrap;
  white-space: nowrap;
  font: var(--pager-ctl-font);
  color: var(--muted);
  gap: 0.2rem;
}
html.is-native-app .pager-bar .page-jump-input {
  width: 2.75rem;
  min-width: 2.75rem;
  text-align: center;
}
html.is-native-app .pager-bar .page-jump-input::-webkit-inner-spin-button,
html.is-native-app .pager-bar .page-jump-input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
html.is-native-app .pager-bar .page-jump-sep,
html.is-native-app .pager-bar #p-page-total,
html.is-native-app .pager-bar #g-page-total,
html.is-native-app .pager-bar #bt-page-total,
html.is-native-app .pager-bar #bp-page-total,
html.is-native-app .pager-bar #bd-page-total {
  font: var(--pager-ctl-font);
  color: var(--muted);
}
html.is-native-app .pager-bar .btn.sm[id$="-page-go"] {
  height: var(--pager-ctl-h);
  min-height: var(--pager-ctl-h);
  padding: 0 0.45rem;
  font: var(--pager-ctl-font);
  white-space: nowrap;
}
html.is-native-app .pager-nav-btn {
  flex: 0 0 auto;
  min-width: 1.85rem;
  width: 1.85rem;
  height: 1.85rem;
  padding: 0;
  font-size: 0;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
html.is-native-app .pager-nav-prev::before {
  content: "‹";
  font: 700 1.2rem/1 var(--font-body);
  color: var(--ink);
}
html.is-native-app .pager-nav-next::before {
  content: "›";
  font: 700 1.2rem/1 var(--font-body);
  color: var(--ink);
}
html.is-native-app .pager-nav-btn:disabled::before {
  opacity: 0.35;
}

/* App: season standings typography aligned with data tables */
html.is-native-app #view-season .season-table .team-name {
  font-size: inherit;
  font-weight: 700;
}
html.is-native-app #view-season .season-table .team-name-en {
  font-size: inherit;
  font-weight: 400;
}
html.is-native-app #view-season .season-table .mono {
  font-size: inherit;
}
html.is-native-app #view-season .season-table .team-code {
  font-size: inherit;
}

/* App: compact base-data filters (teams/players/draft) */
html.is-native-app #view-base-teams .page-head p,
html.is-native-app #view-base-players .page-head p,
html.is-native-app #view-base-draft .page-head p {
  display: none;
}

html.is-native-app #view-base-teams .filters,
html.is-native-app #view-base-players .filters,
html.is-native-app #view-base-draft .filters {
  padding: 0.4rem 0.55rem;
  margin-bottom: 0.45rem;
  gap: 0.28rem;
}

html.is-native-app #view-base-teams .filter-row {
  display: grid !important;
  grid-template-columns: 1fr auto;
  gap: 0.28rem !important;
  align-items: center;
}

html.is-native-app #view-base-teams .filter-row .field.grow {
  grid-column: 1;
  margin: 0;
}

html.is-native-app #view-base-teams .filter-row > .result-hint.filter-result-inline {
  grid-column: 2;
  margin: 0;
  padding: 0;
  align-self: center;
}

html.is-native-app #view-base-teams .filter-row .field.actions,
html.is-native-app #view-base-players .filter-row-query .field.actions,
html.is-native-app #view-base-draft .filter-row-query .field.actions {
  display: none !important;
}

html.is-native-app #view-base-players .filter-row-query > .result-hint.filter-result-inline,
html.is-native-app #view-base-draft .filter-row-query > .result-hint.filter-result-inline {
  margin: 0;
  padding: 0;
}

html.is-native-app #view-base-teams .filters input,
html.is-native-app #view-base-players .filters input,
html.is-native-app #view-base-draft .filters input,
html.is-native-app #view-base-draft .filters select {
  min-height: 2.1rem !important;
}

html.is-native-app #view-base-teams .multi-combo-control,
html.is-native-app #view-base-players .multi-combo-control {
  min-height: 2.1rem;
}

html.is-native-app #bt-hint:empty,
html.is-native-app #bp-hint:empty,
html.is-native-app #bd-hint:empty {
  display: none;
  margin: 0;
  min-height: 0;
}

html.is-native-app #view-players .filters,
html.is-native-app #view-games .filters {
  margin-bottom: 0.45rem;
}

/* App: season standings — W-L breathing room, no horizontal scroll */
html.is-native-app #view-season .season-table-wrap.table-wrap {
  overflow-x: hidden;
  padding-right: 0;
}

html.is-native-app #view-season .season-table th[data-col="wl"],
html.is-native-app #view-season .season-table td:nth-child(3) {
  padding-right: 1em;
}

/* App: draft list — year column left inset matches other list tables */
html.is-native-app #view-base-draft th[data-col="draft_year"],
html.is-native-app #view-base-draft tbody td:first-child {
  padding-left: 0.5rem;
  padding-right: 0.35rem;
  width: 2.6rem;
  min-width: 2.6rem;
  max-width: 3rem;
}

/* App: season stats / honors — collapsed trigger, dropdown newest-first */
.season-select-trigger {
  display: none;
}
html.is-native-app #view-season .field-season-select,
html.is-native-app #view-honors .field-season-select {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: 100%;
  min-width: 0;
}
html.is-native-app #view-season .field-season-select.is-open,
html.is-native-app #view-honors .field-season-select.is-open {
  z-index: 70;
}
html.is-native-app #view-season .field-season-select > select,
html.is-native-app #view-honors .field-season-select > select {
  display: none !important;
}
html.is-native-app #view-season .field-season-select > label,
html.is-native-app #view-honors .field-season-select > label {
  display: none;
}
html.is-native-app #view-season .season-select-trigger,
html.is-native-app #view-honors .season-select-trigger {
  display: block;
  width: 100%;
  text-align: left;
  font: 600 0.72rem/1.2 var(--font-body) !important;
  letter-spacing: 0;
  min-height: 2.1rem;
  padding: 0.38rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
html.is-native-app #view-season .season-list-col,
html.is-native-app #view-honors .season-list-col {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 0.28rem);
  z-index: 71;
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  max-height: min(12rem, 40vh);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0.2rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  width: 100%;
  box-sizing: border-box;
  box-shadow: 0 12px 28px rgba(16, 20, 28, 0.16);
}
html.is-native-app #view-season .season-list-col[hidden],
html.is-native-app #view-honors .season-list-col[hidden] {
  display: none !important;
}
html.is-native-app #view-season .season-list-opt,
html.is-native-app #view-honors .season-list-opt {
  appearance: none;
  border: 0;
  background: transparent;
  text-align: left;
  width: 100%;
  padding: 0.38rem 0.55rem;
  border-radius: 8px;
  font: 600 0.72rem/1.2 var(--font-body);
  color: var(--ink);
  cursor: pointer;
  touch-action: manipulation;
}
html.is-native-app #view-season .season-list-opt.is-active,
html.is-native-app #view-honors .season-list-opt.is-active {
  background: var(--accent);
  color: #fff;
}
html.is-native-app #view-season .filters,
html.is-native-app #view-honors .filters {
  padding: 0.4rem 0.55rem;
  gap: 0.28rem;
}

/* App: auth dialog input + placeholder match page filter font */
html.is-native-app .auth-dialog .auth-fields input,
html.is-native-app .auth-dialog .auth-fields input::placeholder {
  font-family: var(--font-body) !important;
  font-size: 0.72rem !important;
  line-height: 1.2 !important;
}
html.is-native-app .auth-dialog .auth-fields input {
  font-weight: 600 !important;
  min-height: 2.1rem !important;
}
html.is-native-app .auth-dialog .auth-fields input::placeholder {
  font-weight: 400 !important;
  opacity: 0.65;
  color: var(--muted);
}
