.leaderboard-layout { display: grid; grid-template-columns: minmax(0, 1fr) 104px; gap: 18px; align-items: stretch; }
.leaderboard-panel { min-width: 0; padding: var(--panel-space); border: 1px solid var(--line-strong); border-radius: var(--radius); background: rgba(11, 11, 11, .9); box-shadow: var(--surface-shadow); }
.leaderboard-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px; }
.stat-switch { display: flex; flex-wrap: wrap; flex-shrink: 0; max-width: 100%; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 12px; background: rgba(0, 0, 0, .2); }
.stat-switch button { padding: 11px 14px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 700; transition: color .2s, background .2s; }
.stat-switch button[aria-pressed="true"] { background: rgba(var(--accent-rgb), .16); color: var(--text); box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), .25); }
.stat-switch button:hover { color: var(--text); }
.leaderboard-scroll { overflow-x: auto; min-height: 439px; }
.leaderboard-dialog-card, .leaderboard-scroll { color-scheme: dark; scrollbar-width: thin; scrollbar-color: var(--muted-2) transparent; }
.leaderboard-table { width: 100%; table-layout: fixed; border-collapse: collapse; font-size: 14px; }
.leaderboard-table th { height: 40px; color: var(--muted); text-align: left; font-size: 11px; font-weight: 500; }
.leaderboard-table :is(th, td) { padding: 9px 12px; border-bottom: 1px solid var(--line); }
.leaderboard-table :is(th, td):last-child { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.leaderboard-table th:first-child { width: 18%; }
.leaderboard-table th:last-child { width: 30%; }
.leaderboard-table tbody tr { height: 57px; transition: background .2s; }
.leaderboard-table tbody tr:not(.leaderboard-placeholder):hover, .leaderboard-table .is-own { background-color: rgba(var(--accent-rgb), .06); }
.leaderboard-table .podium-1 { --podium: 255, 215, 0; }
.leaderboard-table .podium-2 { --podium: 214, 227, 244; }
.leaderboard-table .podium-3 { --podium: 230, 134, 65; }
.leaderboard-table :is(.podium-1, .podium-2, .podium-3) { background-image: linear-gradient(90deg, rgba(var(--podium), .38), rgba(var(--podium), .28) 30px, rgba(var(--podium), .13) 65px, rgba(var(--podium), .035) 105px, rgba(var(--podium), 0) 150px); }
.leaderboard-user { display: flex; align-items: center; gap: 14px; min-width: 0; }
.leaderboard-user img { flex: 0 0 38px; width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 11px; object-fit: cover; }
.leaderboard-user span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.leaderboard-rank { display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-width: 44px; min-height: 30px; border-radius: 10px; color: var(--muted); font-weight: 800; }
.rank-1 { color: #FFD700; background: rgba(255, 215, 0, .16); }
.rank-2 { color: #d6e3f4; background: rgba(214, 227, 244, .12); }
.rank-3 { color: #ef9a5b; background: rgba(230, 134, 65, .16); }
.leaderboard-placeholder { color: var(--muted-2); }
.leaderboard-actions { display: flex; justify-content: center; margin-top: 24px; }
.leaderboard-actions:not(:has(> :not([hidden]))) { display: none; }
.leaderboard-rail { padding-top: 24px; }
.leaderboard-expand { position: sticky; top: calc(var(--header-h) + 8px); display: flex; align-items: center; gap: 8px; padding: 10px 0; border: 0; background: none; color: var(--muted); font-size: 12px; font-weight: 700; transition: color .2s; }
.leaderboard-expand:hover { color: var(--text); }
.leaderboard-expand:focus:not(:focus-visible) { outline: none; }
.leaderboard-expand:focus-visible { outline: 2px solid var(--accent-hover); outline-offset: 4px; border-radius: 4px; }
.leaderboard-expand svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.leaderboard-dialog { position: fixed; width: min(1040px, calc(100% - 24px)); max-height: calc(100dvh - 32px); padding: 0; overflow: visible; border: 0; color: var(--text); background: transparent; }
.leaderboard-dialog-card { width: 100%; max-height: calc(100dvh - 160px); padding: 24px 32px; overflow: auto; background: var(--bg-2); }
.leaderboard-dialog > .leaderboard-actions { position: absolute; top: 100%; left: 0; right: 0; margin-top: 16px; }
.leaderboard-dialog > .leaderboard-actions .secondary-btn { background: var(--panel-solid); box-shadow: 0 8px 24px rgba(0, 0, 0, .3); }
.leaderboard-dialog::backdrop { background: rgba(0, 0, 0, .75); backdrop-filter: blur(8px); }
.leaderboard-dialog h2 { margin: 8px 0 20px; font-family: Unbounded, Inter, sans-serif; font-size: 24px; }
.leaderboard-dialog .leaderboard-panel { border: 0; border-radius: 0; padding: 0; background: none; box-shadow: none; }
.leaderboard-dialog .leaderboard-table tbody tr { height: 44px; }
.leaderboard-dialog .leaderboard-scroll { min-height: 480px; }
.leaderboard-dialog .leaderboard-table :is(th, td) { padding-block: 6px; }
.leaderboard-dialog .leaderboard-user img { flex-basis: 30px; width: 30px; height: 30px; }
.statistics-note[data-ranking-period] { display: block; min-height: 21px; margin: 16px 0; }
.profile-body { display: flex; flex-direction: column; min-height: 100dvh; }
.profile-main { flex: 1; min-height: 100dvh; }
@media (prefers-reduced-motion: no-preference) {
  .profile-main[aria-busy="false"] > .section-pad { animation: profile-arrive .18s ease-out; }
  @keyframes profile-arrive { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
}
.profile-identity { padding: var(--panel-space); border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--panel-solid); box-shadow: var(--surface-shadow); }
.profile-identity-header { display: grid; grid-template-columns: 96px minmax(0, 1fr) auto; align-items: center; gap: 24px; }
.account-avatar { aspect-ratio: 1; overflow: hidden; border: 1px solid var(--line-strong); border-radius: 20px; }
.account-avatar img { width: 100%; height: 100%; object-fit: cover; }
.account-profile-heading { min-width: 0; container-type: inline-size; }
.account-profile h1 { overflow: hidden; margin: 8px 0; font-family: Unbounded, Inter, sans-serif; font-size: clamp(28px, 8cqi, 40px); line-height: 1.2; text-overflow: ellipsis; white-space: nowrap; }
.account-profile h1[data-name-size="dense"] { font-size: clamp(24px, 6cqi, 32px); }
.profile-joined { margin: 0; font-size: 12px; color: var(--muted); }
.profile-identity-content { min-width: 0; }
.profile-biography-editor { min-height: 24px; margin-top: 8px; font-size: 14px; line-height: 24px; }
.profile-biography { color: var(--muted); overflow-wrap: anywhere; white-space: pre-wrap; }
.profile-biography[contenteditable="plaintext-only"] { outline: none; caret-color: var(--text); }
.profile-biography[contenteditable="plaintext-only"]:empty { display: inline-block; min-width: 1ch; }
.profile-edit { display: inline-grid; vertical-align: top; place-items: center; width: 24px; height: 24px; margin-left: 8px; padding: 3px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); }
.profile-edit:hover { background: rgba(255, 255, 255, .05); color: var(--text); }
.profile-edit svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.profile-controls { display: flex; align-self: stretch; flex-direction: column; align-items: flex-end; justify-content: space-between; gap: 18px; }
.profile-highlights { display: grid; color: var(--muted); font-size: 12px; line-height: 24px; text-align: right; }
.profile-highlights a:hover { color: var(--text); }
.profile-access { color: var(--red); font-size: 13px; font-weight: 600; }
.profile-access.is-active { color: var(--green); }
.profile-actions { display: flex; gap: 8px; padding-left: 24px; border-left: 1px solid var(--line); }
.profile-actions :is(.secondary-btn, .ghost-btn), .account-row :is(.secondary-btn, .primary-btn) { min-height: 36px; padding: 9px 14px; font-size: 12px; white-space: nowrap; }
.account-row .primary-btn:disabled { opacity: .6; cursor: not-allowed; box-shadow: none; transform: none; }
.profile-statistics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.profile-statistics .statistic-card { gap: 10px; padding: 0 18px; border: 0; border-right: 1px solid var(--line); border-radius: 0; background: none; box-shadow: none; }
.profile-statistics .statistic-card:first-child { padding-left: 0; }
.profile-statistics .statistic-card:last-child { border-right: 0; }
.profile-statistics .statistic-label { font-size: 11px; }
.profile-statistics .statistic-card strong { font-size: 26px; overflow-wrap: anywhere; }
.profile-results { margin-top: var(--panel-space); padding: var(--panel-space); border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg-2); }
.profile-results h2 { margin: 0 0 16px; font-size: 16px; }
.profile-activity-layout { display: grid; grid-template-columns: minmax(0, 1fr) 176px; gap: 24px; align-items: start; }
.profile-calendar { width: 176px; padding-left: 24px; border-left: 1px solid var(--line); }
.profile-calendar-heading { display: grid; gap: 6px; margin-bottom: 16px; font-size: 12px; }
.profile-calendar-heading span, .profile-calendar-weekdays, .profile-calendar-legend { color: var(--muted); font-size: 10px; }
.profile-calendar-chart { display: grid; gap: 6px; }
.profile-calendar-weekdays, .profile-calendar-grid { display: grid; grid-template-columns: repeat(7, 16px); gap: 4px; }
.profile-calendar-grid { grid-template-rows: repeat(4, 16px); }
.profile-calendar-weekdays { line-height: 16px; text-align: center; }
.profile-calendar-day { position: relative; width: 16px; height: 16px; padding: 0; border: 1px solid rgba(255, 255, 255, .05); border-radius: 2px; background: #202124; }
.profile-calendar-day:focus-visible { outline: 2px solid var(--accent-hover); outline-offset: 2px; }
.profile-calendar-day::after { content: attr(data-tooltip); position: absolute; z-index: 2; bottom: calc(100% + 8px); right: 0; width: max-content; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 7px; background: var(--bg-2); color: var(--text); font-size: 11px; white-space: nowrap; pointer-events: none; visibility: hidden; }
.profile-calendar-day:focus-visible::after { visibility: visible; }
@media (hover: hover) { .profile-calendar-day:hover::after { visibility: visible; } }
.profile-calendar [data-level="1"] { background: color-mix(in srgb, var(--green) 25%, var(--panel-2)); }
.profile-calendar [data-level="2"] { background: color-mix(in srgb, var(--green) 50%, var(--panel-2)); }
.profile-calendar [data-level="3"] { background: color-mix(in srgb, var(--green) 75%, var(--panel-2)); }
.profile-calendar [data-level="4"] { background: var(--green); }
.profile-calendar-legend { display: flex; align-items: center; gap: 4px; margin-top: 12px; }
.profile-calendar-legend i { width: 9px; height: 9px; border-radius: 2px; background: #202124; }
.profile-results-list { margin: 0; padding: 0; list-style: none; }
.profile-results-list li { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.profile-results-list li:first-child { padding-top: 0; }
.profile-results-list li:last-child { padding-bottom: 0; border-bottom: 0; }
.profile-results-list strong { font-size: 13px; font-weight: 600; }
.profile-result-icon { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; background: rgba(var(--accent-rgb), .1); color: var(--accent-hover); }
.profile-result-icon svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.profile-result-details { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.profile-results-list time { color: var(--muted); font-size: 11px; text-align: right; }
.profile-results-empty { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.profile-owner { margin-top: var(--panel-space); padding: 0 var(--panel-space); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--bg-2); box-shadow: var(--surface-shadow); }
.account-row { display: grid; grid-template-columns: 150px minmax(0, 1fr) auto; align-items: center; gap: 24px; padding: 20px 0; border-bottom: 1px solid var(--line); }
.account-row:last-of-type { border-bottom: 0; }
.account-row h2 { margin: 0; font-size: 13px; font-weight: 600; }
.account-row-content { min-width: 0; font-size: 13px; }
.account-row-content strong { font-weight: 600; }
.account-row-content p { margin: 5px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.account-row-content small { display: block; margin-top: 5px; color: var(--muted); font-size: 11px; }
#profile-download .account-row-content { min-height: 60px; display: flex; flex-direction: column; justify-content: center; }
#profile-download[aria-busy="true"] .account-row-content { visibility: hidden; }
[data-download-message]:empty { display: none; }
[data-download-count]:not(:empty)::before { content: ' · '; }
.account-row.has-active-access [data-account-license-value] { color: var(--green); }
.account-row-actions, .download-full-toggle { display: flex; align-items: center; gap: 12px; }
.download-full-toggle { cursor: pointer; color: var(--muted); font-size: 12px; }
.download-full-toggle input { width: 15px; height: 15px; accent-color: var(--accent); }
.profile-switch { position: relative; width: 42px; height: 24px; cursor: pointer; }
.profile-switch input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; }
.profile-switch > span { display: block; height: 100%; border-radius: 99px; background: var(--panel-2); transition: background .2s; pointer-events: none; }
.profile-switch > span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--text); transition: transform .2s; }
.profile-switch input:checked + span { background: var(--accent); }
.profile-switch input:checked + span::after { transform: translateX(18px); }
.profile-switch input:focus-visible + span { outline: 2px solid var(--accent-hover); outline-offset: 3px; }
.profile-switch input:disabled + span { opacity: .5; }
@media (min-width: 1440px) { .leaderboard-layout { margin-right: -122px; } }
@media (max-width: 900px) {
  .profile-identity-header { grid-template-columns: 76px minmax(0, 1fr); gap: 18px; }
  .profile-controls { grid-column: 2; grid-row: auto; align-items: flex-start; gap: 12px; }
  .profile-highlights { text-align: left; }
  .profile-actions { padding: 12px 0 0; border-left: 0; border-top: 1px solid var(--line); }
  .account-row { grid-template-columns: 120px minmax(0, 1fr); gap: 16px; }
  .account-row > :last-child:not(.account-row-content) { grid-column: 2; justify-self: start; }
}
@media (max-width: 760px) {
  .profile-activity-layout { grid-template-columns: minmax(0, 1fr); }
  .profile-calendar { justify-self: start; padding: 20px 0 0; border-left: 0; border-top: 1px solid var(--line); }
  .profile-calendar-day::after { left: 0; right: auto; }
}
@media (max-width: 600px) {
  .leaderboard-layout { grid-template-columns: minmax(0, 1fr) 24px; gap: 8px; }
  .leaderboard-expand span { display: none; }
  .leaderboard-panel, .leaderboard-dialog-card { padding: 18px 12px; border-radius: 16px; }
  .stat-switch button { padding: 10px; }
  .leaderboard-table :is(th, td) { padding: 9px 6px; }
  .leaderboard-user { gap: 8px; }
  .leaderboard-user img { width: 30px; height: 30px; flex-basis: 30px; }
  .leaderboard-rank { min-width: 30px; }
  .profile-identity { padding: 20px; }
  .profile-results { padding: 18px; }
  .profile-results-list li { grid-template-columns: 32px minmax(0, 1fr); }
  .profile-results-list time { grid-column: 2; text-align: left; }
  .profile-owner { padding-inline: 18px; }
  .profile-statistics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 0; }
  .profile-statistics .statistic-card:nth-child(2) { border-right: 0; }
  .profile-statistics .statistic-card:nth-child(3) { padding-left: 0; }
  .account-row { grid-template-columns: 1fr; gap: 12px; }
  .account-row > :last-child:not(.account-row-content) { grid-column: 1; }
}
@media (max-height: 800px) {
  .leaderboard-dialog-card { padding-block: 18px; }
  .leaderboard-dialog .leaderboard-table tbody tr { height: 36px; }
  .leaderboard-dialog .leaderboard-scroll { min-height: 400px; }
  .leaderboard-dialog .leaderboard-table :is(th, td) { padding-block: 3px; }
  .leaderboard-dialog .leaderboard-user img { width: 28px; height: 28px; flex-basis: 28px; }
}
@media (prefers-reduced-motion: reduce) {
  .statistics-marquee { overflow-x: auto; mask-image: none; }
  .statistics-marquee-group[aria-hidden] { display: none; }
}
