:root {
  --bg: #f3f4f6;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --line: #e3e6eb;
  --line-strong: #cfd4dc;
  --text: #181a1f;
  --muted: #6b7280;
  --soft: #949ba7;
  --red: #c9152b;
  --red-dark: #9e1021;
  --red-soft: #fff0f2;
  --green: #0a9857;
  --green-soft: #eaf7f0;
  --black: #202227;
  --purple: #7652c7;
  --blue: #2e6ebd;
  --tier-green: #29865d;
  --shadow: 0 12px 36px rgba(25, 28, 34, 0.09);
  --radius: 6px;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: var(--bg);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); }
body { margin: 0; min-width: 320px; min-height: 100vh; overflow-x: hidden; background: var(--bg); }
button, input { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible { outline: 2px solid rgba(201, 21, 43, 0.32); outline-offset: 2px; }
button { cursor: pointer; }
img { display: block; }
[hidden] { display: none !important; }

.app-shell { min-height: 100vh; min-height: 100dvh; }
.app-header {
  position: sticky;
  z-index: 30;
  top: 0;
  display: grid;
  grid-template-columns: minmax(300px, 1fr) auto minmax(210px, 1fr);
  align-items: center;
  height: 66px;
  padding: 0 32px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(14px);
}
.brand-area { display: flex; min-width: 0; align-items: center; gap: 17px; }
.brand { display: inline-flex; width: fit-content; align-items: center; gap: 11px; color: inherit; text-decoration: none; }
.brand-mark { position: relative; display: block; width: 34px; height: 34px; overflow: hidden; flex: 0 0 34px; }
.brand-mark img { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: contain; }
.brand-copy { display: grid; gap: 1px; }
.brand-copy strong { font-size: 13px; letter-spacing: 0; }
.brand-copy small { color: var(--muted); font-size: 11px; }
.league-switch { display: flex; height: 32px; padding: 3px; border: 1px solid var(--line-strong); border-radius: 4px; background: var(--surface-2); }
.league-option { min-width: 48px; padding: 0 9px; border: 0; border-radius: 2px; color: var(--muted); background: transparent; font-size: 10px; font-weight: 850; }
.league-option:hover { color: var(--text); }
.league-option.active { color: #fff; background: var(--black); }
.view-tabs { display: flex; align-self: stretch; gap: 4px; }
.view-tab { position: relative; display: inline-flex; min-width: 112px; align-items: center; justify-content: center; gap: 7px; padding: 0 17px; border: 0; color: var(--muted); background: transparent; font-size: 13px; font-weight: 700; }
.view-tab svg { width: 16px; }
.view-tab::after { position: absolute; right: 17px; bottom: 0; left: 17px; height: 3px; background: transparent; content: ""; }
.view-tab:hover { color: var(--text); }
.view-tab.active { color: var(--red); }
.view-tab.active::after { background: var(--red); }
.mobile-bottom-nav { display: none; }
.header-meta { display: flex; align-items: center; justify-self: end; gap: 8px; color: var(--muted); font-size: 12px; font-weight: 650; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px var(--green-soft); }
main { width: min(1520px, 100%); margin: 0 auto; }

.summary-band { display: flex; min-height: 154px; align-items: flex-end; justify-content: space-between; gap: 40px; padding: 31px 32px 27px; border-bottom: 1px solid var(--line); background: var(--surface); }
.summary-title { max-width: 620px; }
.eyebrow { display: block; margin-bottom: 5px; color: var(--red); font-size: 10px; font-weight: 900; letter-spacing: 0; text-transform: uppercase; }
.summary-title h1 { margin: 0; font-size: clamp(25px, 3vw, 38px); line-height: 1.15; letter-spacing: 0; }
.summary-title p { margin: 8px 0 0; color: var(--muted); font-size: 13px; }
.summary-metrics { display: grid; grid-template-columns: repeat(4, minmax(92px, 1fr)); min-width: min(600px, 50vw); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); }
.metric { display: grid; min-height: 72px; align-content: center; gap: 4px; padding: 12px 17px; border-right: 1px solid var(--line); }
.metric:last-child { border-right: 0; }
.metric span { overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.metric strong { font-size: 21px; font-variant-numeric: tabular-nums; }
.status-metric strong { font-size: 14px; }

.app-view { padding: 22px 32px 34px; }
.filter-bar { display: grid; grid-template-columns: minmax(230px, 1fr) auto auto auto auto; align-items: center; gap: 10px; margin-bottom: 18px; }
.search-field { display: flex; height: 40px; align-items: center; gap: 9px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); }
.search-field { padding: 0 13px; }
.search-field svg { width: 16px; color: var(--muted); }
.search-field input { min-width: 0; flex: 1; border: 0; outline: 0; background: transparent; font-size: 13px; }
.position-filter, .origin-filter, .period-switch { display: flex; height: 40px; padding: 3px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); }
.filter-chip, .period-option { min-width: 54px; border: 0; border-radius: 3px; color: var(--muted); background: transparent; font-size: 12px; font-weight: 700; }
.filter-chip:hover, .period-option:hover { color: var(--text); background: var(--surface-2); }
.filter-chip.active, .period-option.active { color: #fff; background: var(--black); }
.custom-dropdown { position: relative; min-width: 0; }
.filter-dropdown { width: 154px; }
.date-dropdown { width: 214px; }
.custom-dropdown-trigger { display: flex; width: 100%; height: 40px; min-width: 0; align-items: center; gap: 9px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); text-align: left; }
.custom-dropdown-trigger:hover, .custom-dropdown.open .custom-dropdown-trigger { border-color: #aeb4bd; background: var(--surface-2); }
.custom-dropdown-trigger > svg:first-child { width: 17px; min-width: 17px; color: var(--muted); }
.custom-dropdown-logo { width: 26px; height: 26px; flex: 0 0 26px; object-fit: contain; }
.custom-dropdown-value { display: grid; min-width: 0; flex: 1; gap: 1px; }
.custom-dropdown-value small { color: var(--soft); font-size: 8px; font-weight: 800; line-height: 1; }
.custom-dropdown-value strong { overflow: hidden; font-size: 11px; line-height: 1.2; text-overflow: ellipsis; white-space: nowrap; }
.custom-dropdown-chevron { width: 14px; min-width: 14px; color: var(--soft); transition: transform .16s ease; }
.custom-dropdown.open .custom-dropdown-chevron { transform: rotate(180deg); }
.custom-dropdown-menu { position: absolute; z-index: 60; top: calc(100% + 5px); right: 0; width: max(100%, 190px); max-height: 320px; overflow-y: auto; overscroll-behavior: contain; padding: 5px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: #fff; box-shadow: 0 12px 30px rgba(25, 28, 34, .16); }
.custom-dropdown-option { display: grid; grid-template-columns: 28px minmax(0, 1fr) 16px; width: 100%; min-height: 38px; align-items: center; gap: 8px; padding: 5px 7px; border: 0; border-radius: 3px; background: transparent; text-align: left; }
.custom-dropdown-option:hover { background: var(--surface-2); }
.custom-dropdown-option.active { color: var(--red-dark); background: var(--red-soft); font-weight: 800; }
.custom-dropdown-option > img { width: 28px; height: 28px; object-fit: contain; }
.custom-dropdown-option > svg:first-child, .custom-dropdown-option-spacer { width: 17px; height: 17px; justify-self: center; color: var(--muted); }
.custom-dropdown-option > span:nth-child(2) { overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.custom-dropdown-check { width: 14px; color: var(--red); visibility: hidden; }
.custom-dropdown-option.active .custom-dropdown-check { visibility: visible; }

.content-grid { display: grid; grid-template-columns: 244px minmax(0, 1fr); align-items: start; gap: 18px; }
.tier-panel, .ranking-panel, .day-table-panel, .form-board { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.tier-panel { position: sticky; top: 88px; overflow: hidden; }
.panel-heading, .ranking-heading, .section-heading, .board-heading { display: flex; align-items: center; justify-content: space-between; }
.panel-heading { padding: 17px 17px 12px; }
.panel-heading h2, .ranking-heading h2, .section-heading h2, .board-heading h2, .date-toolbar h2 { margin: 0; font-size: 17px; letter-spacing: 0; }
.text-button { border: 0; color: var(--muted); background: transparent; font-size: 11px; }
.text-button:hover { color: var(--red); }
.tier-distribution { padding: 0 11px 14px; }
.tier-row { display: grid; grid-template-columns: 46px minmax(0, 1fr) 30px; align-items: center; gap: 9px; width: 100%; padding: 8px 7px; border: 0; border-radius: 4px; background: transparent; text-align: left; }
.tier-row:hover, .tier-row.active { background: var(--surface-2); }
.tier-code { display: grid; width: 39px; height: 29px; padding: 0; place-items: center; overflow: hidden; border-radius: 4px; color: #fff; font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif; font-size: 26px; font-weight: 900; line-height: .8; }
.tier-code.tier-C { border: 1px solid #ccd1d8; color: #41454c; background: #fff; }
.tier-code.tier-D { color: #41454c; background: #d8dce2; }
.tier-code.tier-U { border: 1px dashed #aeb4bd; color: #747b86; background: #f4f5f7; }
.tier-S { background: var(--purple); }
.tier-A { background: var(--blue); }
.tier-B { background: var(--tier-green); }
.tier-C { background: #fff; }
.tier-D { background: #d8dce2; }
.tier-U { border: 1px dashed #aeb4bd; color: #747b86 !important; background: #f4f5f7; }
.tier-track { height: 5px; overflow: hidden; border-radius: 4px; background: #eceef1; }
.tier-track i { display: block; height: 100%; background: #9da4af; }
.tier-row strong { text-align: right; font-size: 11px; font-variant-numeric: tabular-nums; }
.formula-panel { border-top: 1px solid var(--line); background: var(--surface-2); }
.panel-heading.compact { padding-bottom: 6px; }
.formula-list { margin: 0; padding: 0 17px 13px; }
.formula-list div { display: grid; gap: 2px; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.formula-list dt { color: var(--muted); font-size: 10px; }
.formula-list dd { margin: 0; font-size: 11px; font-weight: 700; line-height: 1.4; }
.formula-note { display: flex; gap: 8px; padding: 12px 15px; color: #3f4953; background: #edf1f4; font-size: 10px; line-height: 1.55; }
.formula-note svg { width: 16px; min-width: 16px; color: var(--green); }

.ranking-panel { min-width: 0; overflow: hidden; }
.ranking-heading { padding: 18px 18px 14px; }
.legend { display: flex; gap: 14px; color: var(--muted); font-size: 10px; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend-bar { width: 3px; height: 11px; border-radius: 2px; }
.legend-bar.positive { background: var(--red); }
.legend-bar.negative { background: var(--green); }
.table-header, .player-row { display: grid; grid-template-columns: minmax(260px, 1.25fr) minmax(185px, .8fr) minmax(155px, .7fr) 148px 28px; align-items: center; gap: 14px; }
.table-header { min-height: 38px; padding: 0 17px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); color: var(--soft); background: var(--surface-2); font-size: 10px; font-weight: 800; }
.player-row { width: 100%; min-height: 82px; padding: 11px 17px; border: 0; border-bottom: 1px solid var(--line); background: #fff; text-align: left; }
.player-row:last-child { border-bottom: 0; }
.player-row:hover { background: #fafbfc; }
.player-identity { display: grid; grid-template-columns: 34px 50px minmax(0, 1fr); align-items: center; gap: 11px; min-width: 0; }
.rank-number { color: var(--soft); font-size: 12px; font-weight: 800; font-variant-numeric: tabular-nums; text-align: center; }
.rank-number.top { color: var(--red); }
.avatar-wrap { position: relative; width: 50px; height: 56px; overflow: hidden; border: 1px solid var(--line); border-radius: 4px; background: #eef0f3; }
.player-avatar { width: 100%; height: 100%; object-fit: cover; object-position: center top; }
.avatar-fallback { display: grid; width: 100%; height: 100%; place-items: center; color: #6e7580; background: #e8eaee; font-size: 15px; font-weight: 900; }
.player-copy { min-width: 0; }
.player-name-line { display: flex; min-width: 0; align-items: flex-start; gap: 6px; }
.player-name { min-width: 0; font-size: 14px; font-weight: 850; line-height: 1.25; overflow-wrap: anywhere; }
.player-name.rating-name-S { color: var(--purple); }
.player-name.rating-name-A { color: var(--blue); }
.player-name.rating-name-B { color: var(--tier-green); }
.player-name.rating-name-C { color: #41454c; }
.player-name.rating-name-D { color: #747b86; }
.player-name.rating-name-U { color: var(--soft); }
.position-badge { flex: 0 0 auto; margin-top: 1px; padding: 2px 5px; border-radius: 3px; color: #5d6470; background: #eef0f3; font-size: 9px; font-weight: 750; }
.sample-badge { flex: 0 0 auto; margin-top: 1px; padding: 2px 5px; border: 1px solid transparent; border-radius: 3px; font-size: 9px; font-weight: 800; }
.sample-badge.official { color: #416153; background: #edf6f1; }
.sample-badge.limited { color: #8a5a10; background: #fff5df; }
.sample-badge.provisional { color: #747b86; border-color: #d8dce2; background: #f7f8f9; }
.player-team, .opponent-line { display: flex; min-width: 0; align-items: center; gap: 5px; margin-top: 3px; color: var(--muted); }
.player-team { font-size: 11px; }
.player-team > span, .opponent-line > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inline-team-logo { width: 20px; height: 20px; flex: 0 0 20px; object-fit: contain; }
.player-row.provisional-sample { background: #fbfbfc; }
.rank-number.provisional { color: #b0b5bd; }
.season-stats { display: grid; grid-template-columns: repeat(5, minmax(28px, 1fr)); gap: 6px; }
.stat-cell { min-width: 0; }
.stat-cell strong { display: block; font-size: 13px; font-variant-numeric: tabular-nums; }
.stat-cell span { display: block; margin-top: 2px; overflow: hidden; color: var(--soft); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.form-spark { display: flex; height: 38px; align-items: center; gap: 3px; }
.form-bar { position: relative; width: 8px; height: 32px; flex: 0 1 10px; border-radius: 2px; background: #f0f1f3; }
.form-bar::after { position: absolute; right: 0; left: 0; height: var(--bar-height); min-height: 2px; border-radius: 2px; background: var(--bar-color); content: ""; }
.form-bar.up::after { bottom: 50%; }
.form-bar.down::after { top: 50%; }
.form-bar.flat::after { top: calc(50% - 1px); }
.rating-cell { display: grid; grid-template-columns: 50px minmax(0, 1fr); align-items: center; gap: 10px; }
.tier-badge { display: inline-flex; width: 50px; height: 46px; padding: 0; align-items: center; justify-content: center; overflow: hidden; border-radius: 5px; color: #fff; font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif; font-size: 35px; font-weight: 900; line-height: .78; }
.tier-letter { display: block; line-height: .78; transform: scaleY(1.15); }
.tier-modifier { display: block; margin-left: 0; font-family: "Arial Black", Impact, sans-serif; font-size: .78em; font-weight: 900; line-height: .78; transform: scaleY(1.15); }
.tier-badge.tier-C { border: 1px solid #ccd1d8; color: #41454c; }
.tier-badge.tier-D { color: #41454c; }
.rating-number { display: block; font-size: 20px; font-weight: 900; font-variant-numeric: tabular-nums; }
.rating-number.rating-pending { color: #858c97; font-size: 14px; }
.rating-delta { display: block; margin-top: 2px; font-size: 12px; font-weight: 850; }
.positive-text { color: var(--red); }
.negative-text { color: var(--green); }
.open-row { color: var(--soft); }
.open-row svg { width: 16px; }
.loading-state, .empty-state { display: grid; min-height: 240px; place-items: center; align-content: center; gap: 11px; color: var(--muted); text-align: center; }
.loading-state strong, .empty-state strong { color: var(--text); font-size: 13px; }
.empty-state svg { width: 25px; }
.empty-state span { font-size: 11px; }
.loading-spinner { width: 24px; height: 24px; border: 2px solid #e4e6e9; border-top-color: var(--red); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.date-toolbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 16px; }
.date-controls, .board-controls { display: flex; align-items: center; gap: 8px; }
.icon-button { display: inline-grid; width: 38px; height: 38px; place-items: center; border: 1px solid var(--line-strong); border-radius: var(--radius); background: #fff; }
.icon-button:hover { border-color: #aeb4bd; background: var(--surface-2); }
.icon-button svg { width: 17px; }
.icon-button:disabled { cursor: not-allowed; opacity: .35; }
.games-strip { display: grid; grid-auto-columns: minmax(320px, 1fr); grid-auto-flow: column; gap: 10px; margin-bottom: 16px; overflow-x: auto; padding-bottom: 3px; }
.game-card { min-height: 106px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
button.game-card { text-align: left; }
button.game-card:hover, button.game-card.active { border-color: #b7bcc5; box-shadow: inset 0 -3px var(--red); }
.game-card-kicker { display: flex; justify-content: space-between; color: var(--soft); font-size: 9px; font-weight: 800; }
.game-score { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 8px; margin-top: 12px; }
.game-team { display: flex; min-width: 0; align-items: center; gap: 7px; font-size: 11px; font-weight: 750; }
.game-team:last-child { flex-direction: row-reverse; text-align: right; }
.game-team img { width: 27px; height: 27px; object-fit: contain; }
.game-team span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.score-text { font-size: 19px; font-weight: 900; font-variant-numeric: tabular-nums; }

@media (min-width: 761px) {
  .game-team span { overflow: visible; line-height: 1.35; overflow-wrap: anywhere; text-overflow: clip; white-space: normal; }
}
.day-table-panel { overflow: hidden; }
.section-heading { padding: 17px; }
.record-count { padding: 5px 8px; border-radius: 3px; color: var(--muted); background: var(--surface-2); font-size: 10px; font-weight: 700; }
.day-table-header, .day-player-row { display: grid; grid-template-columns: minmax(240px, 1.2fr) minmax(225px, 1fr) minmax(145px, .6fr) 110px 132px; align-items: center; gap: 14px; }
.day-table-header { min-height: 38px; padding: 0 17px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); color: var(--soft); background: var(--surface-2); font-size: 10px; font-weight: 800; }
.day-player-row { width: 100%; min-height: 72px; padding: 9px 17px; border: 0; border-bottom: 1px solid var(--line); background: #fff; text-align: left; }
.day-player-row:hover { background: #fafbfc; }
.day-player-row .player-identity { grid-template-columns: 42px minmax(0, 1fr); }
.day-player-row .avatar-wrap { width: 42px; height: 47px; }
.opponent-line { font-size: 10px; }
.box-compact { display: grid; grid-template-columns: repeat(6, minmax(25px, 1fr)); gap: 5px; }
.box-compact span, .shooting-compact span { color: var(--soft); font-size: 8px; }
.box-compact strong, .shooting-compact strong { display: block; margin-top: 2px; font-size: 12px; font-variant-numeric: tabular-nums; }
.shooting-compact { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.gmsc-cell strong { font-size: 15px; }
.gmsc-cell span { display: block; color: var(--soft); font-size: 9px; }
.delta-pill { display: inline-flex; min-width: 88px; min-height: 40px; align-items: center; justify-content: center; padding: 8px 11px; border-radius: 4px; font-size: 17px; font-weight: 900; font-variant-numeric: tabular-nums; }
.delta-pill.up { color: var(--red-dark); background: var(--red-soft); }
.delta-pill.down { color: #fff; background: var(--green); }
.delta-pill.flat { color: var(--muted); background: var(--surface-2); }

.board-period-summary { display: flex; justify-content: space-between; gap: 16px; margin-bottom: 12px; color: var(--muted); font-size: 11px; }
.boards-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-board { overflow: hidden; }
.board-heading { min-height: 78px; padding: 17px; color: #fff; }
.red-board .board-heading { background: var(--red); }
.black-board .board-heading { background: var(--black); }
.board-kicker { display: block; margin-bottom: 4px; font-size: 9px; font-weight: 900; opacity: .7; }
.board-heading > span { font-size: 10px; opacity: .75; }
.board-row { display: grid; grid-template-columns: 28px 45px minmax(120px, 1fr) 224px 70px; align-items: center; gap: 10px; min-height: 80px; padding: 8px 14px; border: 0; border-bottom: 1px solid var(--line); background: #fff; text-align: left; }
.board-row:last-child { border-bottom: 0; }
.board-row:hover { background: var(--surface-2); }
.board-rank { color: var(--soft); font-size: 11px; font-weight: 850; text-align: center; }
.board-avatar { width: 42px; height: 48px; overflow: hidden; border-radius: 4px; background: #eceef1; }
.board-avatar img { width: 100%; height: 100%; object-fit: cover; object-position: center top; }
.board-copy { min-width: 0; }
.board-copy strong { display: block; font-size: 13px; line-height: 1.25; overflow-wrap: anywhere; }
.board-copy span { display: block; margin-top: 3px; overflow: hidden; color: var(--muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.board-ratings { display: grid; grid-template-columns: 96px 14px 96px; align-items: center; gap: 8px; }
.board-ratings > svg { width: 14px; color: var(--soft); }
.board-rating { display: flex; height: 46px; align-items: center; gap: 7px; font-variant-numeric: tabular-nums; }
.board-rating .tier-badge { width: 46px; height: 44px; flex: 0 0 46px; font-size: 31px; }
.board-rating > strong { font-size: 18px; }
.board-change { text-align: right; }
.board-change strong { display: block; font-size: 21px; font-variant-numeric: tabular-nums; }
.board-empty { display: grid; min-height: 180px; place-items: center; color: var(--muted); font-size: 12px; }

.app-footer { display: flex; justify-content: space-between; gap: 20px; padding: 20px 32px 32px; border-top: 1px solid var(--line); color: var(--muted); font-size: 10px; line-height: 1.5; }
.drawer-backdrop { position: fixed; z-index: 80; inset: 0; background: rgba(16, 18, 21, .36); }
.player-drawer { position: fixed; z-index: 90; top: 0; right: 0; width: min(700px, 96vw); height: 100vh; height: 100dvh; overflow-y: auto; overscroll-behavior: contain; border-left: 1px solid var(--line); background: #fff; box-shadow: -18px 0 48px rgba(20, 22, 27, .18); transform: translateX(102%); transition: transform .22s ease; }
.player-drawer.open { transform: translateX(0); }
.drawer-close { position: absolute; z-index: 2; top: 14px; right: 14px; }
.drawer-close-mobile { display: none; }
.drawer-hero { display: grid; grid-template-columns: 104px minmax(0, 1fr) auto; align-items: end; gap: 18px; min-height: 190px; padding: 46px 25px 22px; color: #fff; background: #202329; }
.drawer-avatar { width: 104px; height: 124px; overflow: hidden; border: 1px solid rgba(255,255,255,.18); border-radius: 5px; background: #343840; }
.drawer-avatar img { width: 100%; height: 100%; object-fit: cover; object-position: center top; }
.drawer-team { display: flex; align-items: center; gap: 7px; color: #c6cbd3; font-size: 11px; }
.drawer-team img { width: 38px; height: 38px; object-fit: contain; }
.drawer-name { margin: 7px 0 4px; font-size: 27px; letter-spacing: 0; }
.drawer-alias { display: block; margin-bottom: 4px; color: #d1d5dc; font-size: 11px; }
.drawer-meta { color: #abb1bb; font-size: 11px; }
.drawer-rating { display: flex; align-items: center; gap: 12px; padding-right: 46px; }
.drawer-rating .tier-badge { width: 66px; height: 62px; flex: 0 0 66px; border-radius: 6px; font-size: 47px; }
.drawer-rating strong { font-size: 36px; font-variant-numeric: tabular-nums; }
.drawer-tabs { position: sticky; z-index: 3; top: 0; display: flex; height: 49px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.96); backdrop-filter: blur(10px); }
.drawer-tab { position: relative; min-width: 105px; border: 0; color: var(--muted); background: transparent; font-size: 12px; font-weight: 800; }
.drawer-tab.active { color: var(--red); }
.drawer-tab.active::after { position: absolute; right: 22px; bottom: 0; left: 22px; height: 3px; background: var(--red); content: ""; }
.drawer-body { padding: 21px 25px 36px; }
.drawer-section { margin-bottom: 25px; }
.drawer-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 11px; }
.drawer-section-heading h3 { margin: 0; font-size: 15px; }
.drawer-section-heading span { color: var(--muted); font-size: 10px; }
.key-stats { display: grid; grid-template-columns: repeat(6, 1fr); border: 1px solid var(--line); border-radius: var(--radius); }
.season-key-stats { grid-template-columns: repeat(7, 1fr); }
.key-stat { padding: 13px 9px; border-right: 1px solid var(--line); text-align: center; }
.key-stat:last-child { border-right: 0; }
.key-stat strong { display: block; font-size: 20px; font-variant-numeric: tabular-nums; }
.key-stat span { display: block; margin-top: 4px; color: var(--soft); font-size: 9px; }
.abilities-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px 18px; }
.ability-line { display: grid; grid-template-columns: 55px minmax(0, 1fr) 30px; align-items: center; gap: 8px; }
.ability-line span { color: var(--muted); font-size: 10px; }
.ability-track { height: 6px; border-radius: 4px; background: #e9ebee; }
.ability-track i { display: block; height: 100%; border-radius: 4px; background: var(--red); }
.ability-line strong { text-align: right; font-size: 11px; font-variant-numeric: tabular-nums; }
.data-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.data-table { width: 100%; min-width: 590px; border-collapse: collapse; font-size: 11px; }
.data-table th, .data-table td { padding: 10px 9px; border-bottom: 1px solid var(--line); text-align: right; font-variant-numeric: tabular-nums; }
.data-table th:first-child, .data-table td:first-child { position: sticky; left: 0; text-align: left; background: #fff; }
.data-table th { color: var(--muted); background: var(--surface-2); font-size: 9px; }
.data-table tr:last-child td { border-bottom: 0; }
.stats-heading { min-height: 34px; }
.stats-segmented { display: flex; height: 32px; padding: 3px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface-2); }
.stats-mode-button { min-width: 54px; border: 0; border-radius: 3px; color: var(--muted); background: transparent; font-size: 11px; font-weight: 800; }
.stats-mode-button:hover { color: var(--text); background: #fff; }
.stats-mode-button.active { color: #fff; background: var(--black); }
.season-comparison-table { min-width: 920px; }
.season-comparison-table td:first-child { font-weight: 800; }
.method-card { padding: 14px; border-left: 3px solid var(--red); background: var(--surface-2); }
.method-card strong { display: block; margin-bottom: 6px; font-size: 12px; }
.method-card p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.65; }
.history-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.history-dropdown { width: 154px; }
.history-dropdown .custom-dropdown-trigger { height: 34px; }
.history-dropdown .custom-dropdown-menu { z-index: 20; }
.chart-shell { position: relative; height: 260px; border: 1px solid var(--line); border-radius: var(--radius); background: #fbfbfc; }
.rating-chart { width: 100%; height: 100%; cursor: pointer; touch-action: pan-y; }
.history-list { max-height: 330px; margin-top: 12px; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; border: 1px solid var(--line); border-radius: var(--radius); }
.history-list:focus-visible { outline: 2px solid rgba(201, 21, 43, 0.32); outline-offset: 2px; }
.history-row { display: grid; grid-template-columns: 72px minmax(0, 1fr) minmax(180px, 1.3fr) 88px; align-items: center; gap: 10px; width: 100%; min-height: 58px; padding: 8px 11px; border: 0; border-bottom: 1px solid var(--line); background: #fff; text-align: left; }
.history-row:last-child { border-bottom: 0; }
.history-row:hover, .history-row.active { background: var(--surface-2); }
.history-date { color: var(--muted); font-size: 10px; font-variant-numeric: tabular-nums; }
.history-game strong { display: block; font-size: 11px; }
.history-game span { display: block; margin-top: 3px; color: var(--soft); font-size: 9px; }
.history-box { overflow: hidden; color: var(--muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.history-change { text-align: right; font-size: 17px; font-weight: 900; font-variant-numeric: tabular-nums; }
.chart-tooltip { position: fixed; z-index: 120; width: min(290px, calc(100vw - 20px)); padding: 11px; border: 1px solid #34373d; border-radius: 5px; color: #fff; background: rgba(27,29,33,.97); box-shadow: var(--shadow); pointer-events: none; }
.chart-tooltip strong { display: block; margin-bottom: 4px; font-size: 12px; }
.chart-tooltip span { display: block; color: #bfc4cc; font-size: 11px; line-height: 1.55; }
.chart-tooltip b { color: #fff; }
.toast { position: fixed; z-index: 150; right: 22px; bottom: 22px; display: flex; max-width: 380px; align-items: center; gap: 9px; padding: 12px 14px; border-radius: var(--radius); color: #fff; background: var(--black); box-shadow: var(--shadow); font-size: 11px; opacity: 0; transform: translateY(12px); pointer-events: none; transition: .2s ease; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast svg { width: 17px; color: #ff8794; }

@media (max-width: 1100px), (hover: none) {
  .app-header { grid-template-columns: 1fr auto; padding: 0 20px; }
  .app-header .view-tabs { display: none; }
  .mobile-bottom-nav { position: fixed; z-index: 70; right: 0; bottom: 0; left: 0; display: flex; height: calc(60px + env(safe-area-inset-bottom)); justify-content: space-around; padding: 0 max(8px, env(safe-area-inset-left)) env(safe-area-inset-bottom) max(8px, env(safe-area-inset-right)); border-top: 1px solid var(--line); background: rgba(255,255,255,.97); box-shadow: 0 -6px 20px rgba(25,28,34,.07); backdrop-filter: blur(14px); }
  .mobile-bottom-nav .view-tab { min-width: 0; max-width: 180px; flex: 1; flex-direction: column; gap: 3px; padding: 6px 12px; font-size: 10px; }
  .mobile-bottom-nav .view-tab svg { width: 20px; height: 20px; }
  .mobile-bottom-nav .view-tab.active { background: var(--red-soft); }
  .mobile-bottom-nav .view-tab::after { top: 0; bottom: auto; }
  .header-meta { grid-column: 2; }
  body { padding-bottom: calc(70px + env(safe-area-inset-bottom)); }
  .summary-band { align-items: stretch; flex-direction: column; gap: 20px; }
  .summary-metrics { width: 100%; min-width: 0; }
  .filter-bar { grid-template-columns: minmax(240px, 1fr) auto auto; }
  .position-filter { grid-row: 2; grid-column: 1; width: fit-content; }
  .origin-filter { grid-row: 2; grid-column: 2 / 4; width: fit-content; }
  .content-grid { grid-template-columns: 1fr; }
  .tier-panel { position: static; }
  .tier-distribution { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
  .tier-row { grid-template-columns: 42px 1fr 25px; padding: 6px 4px; }
  .formula-panel { display: none; }
  .boards-grid { grid-template-columns: 1fr; }
  .table-header, .player-row { grid-template-columns: minmax(255px, 1.2fr) minmax(180px, .85fr) minmax(130px, .6fr) 142px 22px; }
  .day-table-header, .day-player-row { grid-template-columns: minmax(230px, 1.2fr) minmax(215px, 1fr) 125px 95px 122px; }
}

@media (max-width: 760px) {
  .app-header { height: 58px; padding: 0 14px; }
  .brand-mark { width: 31px; height: 31px; }
  .brand-area { gap: 9px; }
  .brand { gap: 7px; }
  .brand-copy small, .header-meta span:last-child { display: none; }
  .brand-copy strong { font-size: 11px; }
  .league-switch { height: 30px; }
  .league-option { min-width: 40px; padding: 0 6px; font-size: 9px; }
  .summary-band { min-height: 0; padding: 24px 15px 18px; }
  .summary-title h1 { font-size: 25px; }
  .summary-title p { font-size: 11px; line-height: 1.5; }
  .summary-metrics { grid-template-columns: repeat(2, 1fr); }
  .metric { min-height: 61px; padding: 9px 12px; border-bottom: 1px solid var(--line); }
  .metric:nth-child(2) { border-right: 0; }
  .metric:nth-child(n+3) { border-bottom: 0; }
  .metric strong { font-size: 18px; }
  .app-view { padding: 14px 10px 23px; }
  .filter-bar { grid-template-columns: 1fr 1fr; gap: 8px; }
  .search-field { grid-column: 1 / -1; }
  .position-filter, .origin-filter { grid-row: auto; grid-column: 1 / -1; width: 100%; }
  .filter-chip { flex: 1; }
  .filter-dropdown { width: auto; }
  .tier-panel { overflow-x: auto; }
  .panel-heading { padding: 12px; }
  .tier-distribution { display: flex; width: max-content; min-width: 100%; padding: 0 8px 10px; }
  .tier-row { width: 96px; grid-template-columns: 42px 25px; }
  .tier-track { display: none; }
  .ranking-heading { align-items: flex-start; padding: 14px 12px 10px; }
  .legend { flex-direction: column; gap: 3px; }
  .table-header { display: none; }
  .player-row { grid-template-columns: minmax(0, 1fr) 102px; min-height: 92px; gap: 9px; padding: 10px; }
  .player-row .season-stats { grid-row: 2; grid-column: 1 / -1; padding-left: 93px; }
  .player-row .form-spark, .player-row .open-row { display: none; }
  .player-identity { grid-template-columns: 26px 48px minmax(0, 1fr); gap: 8px; }
  .avatar-wrap { width: 48px; height: 53px; }
  .player-name { font-size: 13px; }
  .rating-cell { grid-template-columns: 44px minmax(0, 1fr); gap: 7px; }
  .tier-badge { width: 44px; height: 42px; font-size: 32px; }
  .rating-number { font-size: 18px; }
  .rating-delta { font-size: 10px; }
  .date-toolbar { align-items: stretch; flex-direction: column; }
  .date-controls, .board-controls { width: 100%; }
  .date-dropdown { width: auto; flex: 1; }
  .board-controls { align-items: stretch; flex-direction: column; }
  .period-switch { width: 100%; }
  .period-option { flex: 1; }
  .games-strip { grid-auto-columns: 250px; }
  .day-table-header { display: none; }
  .day-player-row { grid-template-columns: minmax(0, 1fr) auto; min-height: 108px; gap: 8px; padding: 10px; }
  .day-player-row .box-compact { grid-row: 2; grid-column: 1 / -1; }
  .day-player-row .shooting-compact { grid-row: 3; grid-column: 1 / -1; padding-left: 50px; }
  .day-player-row .gmsc-cell { position: absolute; visibility: hidden; }
  .box-compact { gap: 7px; padding-left: 50px; }
  .boards-grid { grid-template-columns: 1fr; }
  .board-row { grid-template-columns: 22px 42px minmax(0, 1fr) 70px; min-height: 112px; gap: 8px; padding: 8px 10px; }
  .board-ratings { grid-row: 2; grid-column: 3 / 5; justify-content: end; }
  .app-footer { align-items: flex-start; flex-direction: column; padding: 16px 14px 24px; }
  .player-drawer { width: 100vw; }
  .drawer-hero { grid-template-columns: 78px minmax(0, 1fr); gap: 13px; min-height: 164px; padding: 48px 15px 18px; }
  .drawer-avatar { width: 78px; height: 96px; }
  .drawer-team img { width: 34px; height: 34px; }
  .drawer-name { font-size: 21px; }
  .drawer-rating { grid-column: 2; padding: 0; }
  .drawer-rating .tier-badge { width: 58px; height: 54px; flex-basis: 58px; font-size: 41px; }
  .drawer-rating strong { font-size: 29px; }
  .drawer-tabs { overflow-x: auto; }
  .drawer-tab { min-width: 92px; }
  .drawer-body { padding: 17px 14px 30px; }
  .key-stats { grid-template-columns: repeat(3, 1fr); }
  .key-stat { border-bottom: 1px solid var(--line); }
  .key-stat:nth-child(3) { border-right: 0; }
  .key-stat:nth-child(n+4) { border-bottom: 0; }
  .season-key-stats { grid-template-columns: repeat(4, 1fr); }
  .season-key-stats .key-stat { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
  .season-key-stats .key-stat:nth-child(4) { border-right: 0; }
  .season-key-stats .key-stat:nth-child(n+5) { border-bottom: 0; }
  .season-key-stats .key-stat:last-child { border-right: 0; }
  .abilities-grid { grid-template-columns: 1fr; }
  .chart-shell { height: 230px; }
  .history-list { max-height: 290px; }
  .history-row { grid-template-columns: 58px minmax(0, 1fr) 57px; }
  .history-box { grid-row: 2; grid-column: 2 / -1; }

  .app-header { grid-template-columns: minmax(0, 1fr) auto; height: calc(58px + env(safe-area-inset-top)); gap: 8px; padding: env(safe-area-inset-top) 12px 0; }
  .brand-area { min-width: 0; gap: 8px; }
  .brand { min-width: 0; gap: 7px; }
  .brand-copy { min-width: 0; }
  .brand-copy small { display: none; }
  .brand-copy strong { overflow: hidden; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
  .brand-mark { width: 32px; height: 32px; flex: 0 0 32px; }
  .league-switch { height: 32px; flex: 0 0 auto; }
  .league-option { min-width: 42px; min-height: 26px; font-size: 10px; }
  .header-meta { display: flex; grid-column: 2; gap: 6px; color: #505661; font-size: 10px; white-space: nowrap; }
  .header-meta span:last-child { display: inline; }
  .live-dot { width: 6px; height: 6px; box-shadow: 0 0 0 3px var(--green-soft); }

  .summary-band { min-height: 0; gap: 12px; padding: 14px 10px 10px; }
  .summary-title .eyebrow, .summary-title p { display: none; }
  .summary-title h1 { font-size: 20px; line-height: 1.25; }
  .summary-metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .metric { min-height: 52px; padding: 7px 4px; border-right: 1px solid var(--line); border-bottom: 0; text-align: center; }
  .metric:nth-child(2) { border-right: 1px solid var(--line); }
  .metric:last-child { border-right: 0; }
  .metric span { font-size: 8px; }
  .metric strong, .status-metric strong { font-size: 15px; }

  .app-view { padding: 10px 8px 18px; }
  .filter-bar { gap: 6px; margin-bottom: 10px; }
  .search-field, .custom-dropdown-trigger { height: 40px; }
  .position-filter, .origin-filter { height: 38px; }
  .filter-chip { min-width: 46px; font-size: 11px; }
  .custom-dropdown-value strong { font-size: 11px; }
  .custom-dropdown-menu { max-height: min(320px, 55dvh); }
  .custom-dropdown-option { min-height: 44px; }
  #teamDropdown .custom-dropdown-menu { right: auto; left: 0; }

  .tier-panel { border: 0; border-radius: 0; background: transparent; }
  .tier-panel > .panel-heading { display: none; }
  .tier-distribution { padding: 0 0 8px; }
  .tier-row { width: 94px; min-height: 46px; background: #fff; }
  .ranking-panel { border-right: 0; border-left: 0; border-radius: 0; }
  .ranking-heading { min-height: 52px; padding: 10px; }
  .ranking-heading h2 { font-size: 15px; }
  .legend { font-size: 9px; }
  .player-row { min-height: 106px; padding: 9px 8px; }
  .player-row .season-stats { padding-left: 84px; }
  .player-identity { grid-template-columns: 23px 46px minmax(0, 1fr); gap: 7px; }
  .avatar-wrap { width: 46px; height: 52px; }
  .player-team { font-size: 9px; }
  .inline-team-logo { width: 18px; height: 18px; flex-basis: 18px; }
  .season-stats { gap: 4px; }
  .stat-cell strong { font-size: 12px; }

  .date-toolbar { gap: 10px; margin-bottom: 10px; }
  .date-toolbar h2 { font-size: 16px; }
  .date-controls { gap: 6px; }
  .icon-button { width: 42px; height: 42px; }
  .games-strip { grid-auto-columns: minmax(238px, 82vw); gap: 8px; margin-bottom: 10px; scroll-snap-type: x proximity; }
  .game-card { min-height: 94px; scroll-snap-align: start; }
  .day-table-panel { border-right: 0; border-left: 0; border-radius: 0; }
  .section-heading { padding: 12px 9px; }
  .section-heading h2 { font-size: 15px; }
  .day-player-row { min-height: 116px; padding: 9px 8px; }
  .day-player-row .box-compact, .day-player-row .shooting-compact { padding-left: 46px; }
  .box-compact { gap: 4px; }

  .board-controls { gap: 6px; }
  .period-switch { height: 40px; }
  .period-option { min-width: 0; font-size: 11px; }
  .board-period-summary { align-items: flex-start; flex-direction: column; gap: 3px; margin-bottom: 8px; padding: 0 2px; font-size: 9px; }
  .boards-grid { gap: 10px; }
  .form-board { border-right: 0; border-left: 0; border-radius: 0; }
  .board-heading { min-height: 62px; padding: 11px 12px; }
  .board-heading h2 { font-size: 16px; }
  .board-row { min-height: 114px; }

  .app-footer { display: none; }
  .toast { right: 10px; bottom: calc(70px + env(safe-area-inset-bottom)); left: 10px; max-width: none; }

  .player-drawer { border-left: 0; }
  .drawer-close { top: calc(10px + env(safe-area-inset-top)); right: auto; left: 10px; width: 40px; height: 40px; border-color: rgba(255,255,255,.24); color: #fff; background: rgba(20,22,26,.42); }
  .drawer-close:hover { background: rgba(20,22,26,.62); }
  .drawer-close-desktop { display: none; }
  .drawer-close-mobile { display: block; }
  .drawer-hero { min-height: calc(184px + env(safe-area-inset-top)); padding: calc(54px + env(safe-area-inset-top)) 12px 16px; }
  .drawer-rating { gap: 10px; }
  .drawer-rating .tier-badge { width: 60px; height: 56px; flex-basis: 60px; font-size: 43px; }
  .drawer-rating strong { font-size: 30px; }
  .drawer-tabs { height: 48px; }
  .drawer-tab { min-width: 0; flex: 1; }
  .drawer-body { padding: 14px 10px calc(24px + env(safe-area-inset-bottom)); }
  .drawer-section { margin-bottom: 18px; }
  .drawer-section-heading { margin-bottom: 8px; }
  .key-stat { padding: 11px 5px; }
  .key-stat strong { font-size: 18px; }
  .data-table-wrap { overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; }
  .history-toolbar { align-items: stretch; flex-direction: column; }
  .history-dropdown { width: 100%; }
  .chart-shell { height: 216px; }
  .history-row { grid-template-columns: 58px minmax(0, 1fr) 72px; }
  .history-change { font-size: 16px; }
}

@media (max-width: 360px) {
  .brand-copy { display: none; }
  .app-header { padding-right: 9px; padding-left: 9px; }
  .brand-area { gap: 6px; }
  .league-option { min-width: 39px; }
  .header-meta { min-width: 0; font-size: 9px; }
  #headerSeason { overflow: hidden; text-overflow: ellipsis; }
  .summary-title h1 { font-size: 18px; }
  .metric span { font-size: 7px; }
  .custom-dropdown-menu { max-width: calc(100vw - 16px); }
  .board-ratings { max-width: 100%; justify-self: end; transform: scale(.95); transform-origin: right center; }
}
