/* Give pages with data tables more room on desktop while keeping the usual
   responsive page width on smaller screens. */
body:has(.table-wrap) .page-shell {
  max-width: 1800px;
}

.table-wrap {
  font-family: Manrope, sans-serif;
}

.funky-mvp {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
  width: 340px;
  max-width: 100%;
  padding: 14px 20px 14px 15px;
  border: 1px solid #efd99a;
  border-radius: 15px;
  background: linear-gradient(135deg, #fffaf0, #fff2cf);
  box-shadow: 0 7px 18px rgba(155, 111, 25, .1);
  font-family: inherit;
}

.funky-mvp-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  border-radius: 14px;
  color: #9b6b13;
  background: linear-gradient(145deg, #ffe9a6, #f4c955);
  box-shadow: inset 0 1px 0 #fff9df, 0 4px 10px rgba(155, 111, 25, .16);
}

.funky-mvp-icon svg {
  width: 28px;
  height: 28px;
}

.funky-mvp-copy {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.funky-mvp-label {
  color: #95660f;
  font-size: 12px;
  font-weight: 850;
  letter-spacing: .8px;
  text-transform: uppercase;
}

.funky-mvp-copy a {
  max-width: 100%;
  color: #302719;
  font-size: 18px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.funky-mvp-total {
  color: #7f7258;
  font-size: 14px;
}

html[data-theme="dark"] .funky-mvp {
  border-color: #69572f;
  background: linear-gradient(135deg, #342d20, #40351e);
  box-shadow: 0 7px 18px rgba(0, 0, 0, .18);
}

html[data-theme="dark"] .funky-mvp-icon {
  color: #ffe19a;
  background: linear-gradient(145deg, #725b2b, #57451f);
  box-shadow: inset 0 1px 0 #ffffff20;
}

html[data-theme="dark"] .funky-mvp-label { color: #f1cf7e; }
html[data-theme="dark"] .funky-mvp-copy a { color: #fff4d7; }
html[data-theme="dark"] .funky-mvp-total { color: #c3b38d; }

.profile-stat-section { margin-bottom: 16px; }
.profile-stat-heading { align-items: center; }

.top-series-rating {
  display: grid;
  gap: 1px;
  flex: 0 0 auto;
  padding: 8px 14px;
  border: 1px solid #dcd9ff;
  border-radius: 13px;
  background: linear-gradient(135deg, #f5f4ff, #eeecff);
  text-align: right;
}

.top-series-rating span { color: var(--muted); font-size: 11px; font-weight: 700; }
.top-series-rating strong { color: var(--primary-dark); font-size: 21px; line-height: 1.2; }

.ranking-info{position:relative;flex:0 0 auto;align-self:center}
.ranking-info-trigger{display:inline-flex;min-height:42px;align-items:center;justify-content:center;gap:9px;padding:9px 15px;border:1px solid #b9a58c;border-radius:12px;background:linear-gradient(180deg,#fffaf1,#f2e5d2);box-shadow:0 3px 0 #d4c0a5,0 6px 14px rgba(57,36,24,.08);color:#5c4033;font-size:13px;font-weight:800;cursor:pointer;list-style:none;transition:transform .16s ease,box-shadow .16s ease,border-color .16s ease}
.ranking-info-trigger::-webkit-details-marker{display:none}
.ranking-info-trigger::marker{content:""}
.ranking-info-trigger>span{display:grid;width:20px;height:20px;place-items:center;border-radius:50%;background:#a0522d;color:#fff;font-family:Georgia,serif;font-size:14px;font-weight:800}
.ranking-info-trigger:hover,.ranking-info[open] .ranking-info-trigger{transform:translateY(-1px);border-color:#a0522d;box-shadow:0 4px 0 #d4c0a5,0 9px 17px rgba(57,36,24,.13)}
.ranking-info-trigger:focus-visible{outline:3px solid #a0522d;outline-offset:3px}
.ranking-info-popover{position:absolute;top:calc(100% + 12px);right:0;z-index:8;width:min(360px,calc(100vw - 36px));padding:18px 20px;border:1px solid #d8c4ab;border-radius:16px;background:#fffaf1;box-shadow:0 16px 38px rgba(57,36,24,.2);color:#493427;text-align:left}
.ranking-info-popover::before{position:absolute;top:-7px;right:24px;width:12px;height:12px;border-top:1px solid #d8c4ab;border-left:1px solid #d8c4ab;background:#fffaf1;content:"";transform:rotate(45deg)}
.ranking-info-popover h3{margin:0 0 10px;color:#2c1810;font-size:16px}
.ranking-info-popover p{margin:0;color:#6f5a49;font-size:13px;line-height:1.55}
.ranking-info-popover p+p{margin-top:10px;padding-top:10px;border-top:1px solid #eadfce}
.ranking-info-popover strong{color:#a0522d}

@media(max-width:700px){.ranking-info{align-self:flex-start}.ranking-info-trigger{min-height:39px;padding:8px 12px;font-size:12px}.ranking-info-popover{right:auto;left:0}}

.top-series-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.top-series-card {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: linear-gradient(145deg, var(--surface), #f8f9ff);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.top-series-card:hover {
  transform: translateY(-2px);
  border-color: #c9c5f6;
  box-shadow: 0 8px 20px rgba(57, 48, 130, .09);
}

.top-series-place {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 11px;
  background: #eeecff;
  color: var(--primary-dark);
  font-size: 14px;
  font-weight: 850;
}

.top-series-copy { display: grid; gap: 3px; min-width: 0; flex: 1; }
.top-series-copy strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.top-series-copy small { color: var(--muted); font-size: 10px; line-height: 1.35; }
.top-series-score { color: var(--primary-dark); font-size: 20px; font-weight: 850; white-space: nowrap; }
.top-series-empty { grid-column: 1 / -1; margin: 0; }

.profile-role-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.profile-role-card {
  min-width: 0;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: linear-gradient(145deg, var(--surface), #f8f9ff);
}

.profile-role-heading {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 36px;
  color: var(--ink);
  font-size: 13px;
}
.profile-role-heading img { width: 33px; height: 33px; object-fit: contain; }
.profile-role-record { display: flex; align-items: baseline; gap: 7px; margin-top: 13px; }
.profile-role-record strong { color: var(--ink); font-size: 22px; font-weight: 850; line-height: 1; }
.profile-role-record span { color: var(--green); font-size: 12px; font-weight: 800; white-space: nowrap; }

.profile-role-extra {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 12px;
  padding-top: 9px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 10px;
}
.profile-role-extra strong { color: var(--ink); font-size: 12px; white-space: nowrap; }

.profile-award-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.profile-award-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
  padding: 15px 17px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(145deg, var(--surface), #f8f9ff);
}

.profile-award-card span { color: var(--muted); font-size: 12px; font-weight: 700; }
.profile-award-card strong { color: var(--ink); font: 800 25px Manrope; line-height: 1.2; margin: 5px 0 3px; }
.profile-award-card small { color: var(--muted); font-size: 10px; }

.profile-awards-subsection {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.profile-awards-subsection .section-title { margin-bottom: 14px; }

@media (min-width: 1100px) {
  .profile-stat-layout {
    display: grid;
    grid-template-columns: minmax(320px, 0.9fr) minmax(0, 1.8fr);
    align-items: stretch;
    gap: 16px;
  }

  .profile-stat-layout .profile-stat-section { margin-bottom: 0; }
  .profile-stat-layout .profile-stat-heading { align-items: flex-start; flex-direction: column; }
  .profile-stat-layout .top-series-rating { text-align: left; }
  .profile-stat-layout .top-series-grid { grid-template-columns: 1fr; }
  .profile-stat-layout .profile-role-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

html[data-theme="dark"] .top-series-rating {
  border-color: #414269;
  background: linear-gradient(135deg, #292b46, #24283e);
}
html[data-theme="dark"] .top-series-rating strong,
html[data-theme="dark"] .top-series-score { color: #b7baff; }
html[data-theme="dark"] .top-series-card,
html[data-theme="dark"] .profile-role-card,
html[data-theme="dark"] .profile-award-card {
  border-color: var(--line);
  background: linear-gradient(145deg, var(--surface), #1e2638);
}
html[data-theme="dark"] .top-series-card:hover { border-color: #5a5c91; }
html[data-theme="dark"] .top-series-place { background: #303251; color: #c3c4ff; }

@media (max-width: 700px) {
  .profile-stat-heading { align-items: flex-start; }
  .top-series-rating { width: 100%; text-align: left; }
  .top-series-grid { grid-template-columns: 1fr; gap: 8px; margin-top: 12px; }
  .profile-role-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
  .profile-role-card { padding: 11px; }
  .profile-role-record { flex-wrap: wrap; gap: 4px 7px; }
  .profile-award-grid { gap: 8px; }
  .profile-award-card { padding: 11px; }
  .profile-award-card strong { font-size: 21px; }
  .profile-award-card small { font-size: 9px; }

  .funky-mvp {
    align-self: stretch;
    max-width: 100%;
  }
}

@media (max-width: 700px) {
  .table-wrap {
    -webkit-overflow-scrolling: touch;
  }

  .table-wrap th,
  .table-wrap td {
    padding: 5px 4px;
  }

  .table-wrap th {
    line-height: 1.2;
    white-space: normal;
  }

  .wide-table {
    min-width: 900px;
  }

  .wide-table .sticky-rank-column {
    width: 30px;
    min-width: 30px;
    max-width: 30px;
    padding-right: 4px;
    padding-left: 4px;
  }

  .wide-table .sticky-player-column {
    left: 30px;
    width: max-content;
    min-width: 112px;
    max-width: none;
    overflow: visible;
    text-overflow: clip;
    white-space: nowrap;
  }

  .wide-table .role-stat-heading {
    width: 42px;
    min-width: 42px;
  }

  .wide-table td.role-stat {
    min-width: 42px;
    max-width: 50px;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .entry-table {
    min-width: 820px;
  }

  .entry-table td:nth-child(3) {
    min-width: 76px;
  }

  .entry-table td:nth-child(4) {
    min-width: 68px;
  }

  .entry-table td:nth-child(n + 5) {
    min-width: 48px;
  }

  .entry-table .score-select {
    min-width: 54px;
  }
}
