@media (max-width: 1023px) {
  .shell { padding: 12px 12px 44px; }

  .table-wrap { overflow-x: auto; }
  .ptable thead th { position: static; border-radius: 0; }

  .ptable th:nth-child(5), .ptable td:nth-child(5),
  .ptable th:nth-child(10), .ptable td:nth-child(10),
  .ptable th:nth-child(11), .ptable td:nth-child(11) { display: none; }
}

@media (max-width: 767px) {
  .shell { padding: 10px 8px 40px; }

  .fo-input-row { flex-wrap: wrap; }
  .searchbar { flex-basis: 100%; }
  .fo-input-row .btn { flex: 1; }

  .level-filter { width: 100%; }
  .level-filter input[type="range"] { flex: 1; }

  .filterbar-actions { width: 100%; justify-self: stretch; }
  .filterbar-actions .btn-ghost { flex: 1; justify-content: center; }
  .select-wrap { flex: 1 1 45%; }

  .ptable th:nth-child(4), .ptable td:nth-child(4),
  .ptable th:nth-child(8), .ptable td:nth-child(8) { display: none; }

  .table-wrap { padding: 10px; }
  .ptable { min-width: 0; }
  .ptable thead { display: none; }
  .ptable, .ptable tbody, .prow, .pdetail, .prow td, .pdetail td { display: block; }

  .prow {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    column-gap: 8px;
    row-gap: 6px;
    margin-bottom: 10px;
    padding: 10px 12px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
  }
  .ptable tbody .prow td { padding: 0; border-bottom: 0; }
  .prow .pos-cell { grid-column: 1; grid-row: 1 / 3; align-self: center; justify-self: start; }
  .prow .pinfo-cell { grid-column: 2 / 6; grid-row: 1; }
  .prow .ovr-cell {
    grid-column: 6;
    grid-row: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 1px;
  }
  .prow .ovr-cell::before {
    content: "OVR";
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .06em;
    color: var(--muted);
  }
  .prow .ovr { font-size: 14px; font-weight: 600; }
  .prow .team-cell { grid-column: 2 / 6; grid-row: 2; }
  .ptable .prow td.year-cell {
    display: block;
    grid-column: 6;
    grid-row: 2;
    justify-self: end;
    text-align: right;
  }
  .ptable .prow td.num {
    display: flex;
    grid-column: span 2;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    padding: 7px 4px;
    background: var(--panel-2);
    border: 1px solid var(--line-soft);
    border-radius: var(--radius-sm);
    text-align: center;
  }
  .prow td.num::before {
    content: attr(data-stat);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .06em;
    color: var(--muted);
  }

  .pdetail { margin-bottom: 10px; }
  .prow.open + .pdetail { margin-top: -1px; }
  .ptable tbody .prow.open {
    background: color-mix(in srgb, var(--accent-soft) 45%, var(--panel));
    border-left: 3px solid var(--c, var(--line));
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    margin-bottom: 0;
  }
  .ptable .pdetail td {
    padding: 12px 14px 14px;
    border: 1px solid var(--line);
    border-left: 3px solid var(--c, var(--line));
    border-radius: var(--radius-lg);
  }
  .prow.open + .pdetail td { border-top-left-radius: 0; border-top-right-radius: 0; }
  .pdetail .detail-head { grid-template-columns: 44px 1fr; gap: 6px 10px; margin-bottom: 12px; }
  .pdetail .detail-head .pthumb { width: 44px; height: 44px; font-size: 13px; }
  .pdetail .detail-controls { gap: 8px 10px; }
  .pdetail .level-box .level-slider { width: 96px; }

  .advanced { padding: 10px; }

  .statlist { grid-template-columns: 1fr; }
}

@media (min-width: 1440px) {
  .shell,
  .wiki-layout { max-width: 1240px; }
  .topnav-inner,
  .footer-grid { max-width: 1240px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}
