body.profile-page,
body.app-page {
  width: 100%;
  max-width: none;
  min-height: 100vh;
  margin: 0;
  padding: 0 0 72px;
  background:
    radial-gradient(circle at 85% 5%, rgba(75, 142, 240, 0.08), transparent 32rem),
    var(--bg);
  color: var(--ink);
  font-family: var(--sans);
}

.profile-page > *,
.app-page > * { max-width: var(--shell); margin-left: auto; margin-right: auto; }

.profile-page > nav,
.profile-page > footer,
.app-page > nav,
.app-page > footer {
  width: 100%;
  max-width: none;
}

.profile-page > footer,
.app-page > footer { margin-top: 72px; }

.profile-page .profile-header-row,
.app-page .app-header-row {
  margin-top: 28px;
  min-height: 60px;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--rule);
}

.app-page .app-header-title {
  margin: 0;
  padding: 14px 0 18px;
  color: var(--ink);
  font-size: clamp(28px, 4vw, 44px);
  font-weight: 600;
  letter-spacing: -0.03em;
}

.profile-page .admin-section,
.app-page .admin-section,
.app-page .controls-block {
  border: 1px solid var(--rule);
  border-radius: 0;
  background: var(--panel-gradient);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
}

.profile-page .admin-section,
.app-page .admin-section { padding: 28px; }

.profile-page .profile-hero-shell {
  max-width: none;
  background:
    linear-gradient(115deg, rgba(75, 142, 240, 0.11), transparent 44%),
    var(--panel-gradient);
}

.profile-page .profile-kicker {
  color: var(--accent);
  font-family: var(--mono);
}

.profile-page #profileUsername {
  color: var(--ink);
  font-family: var(--sans);
  font-size: clamp(34px, 5vw, 56px);
  letter-spacing: -0.035em;
}

.profile-page .profile-hero-summary-card,
.profile-page .profile-meta-pill,
.app-page .chart-container,
.profile-page .chart-container,
.profile-page .radar-settings-panel {
  border: 1px solid var(--rule);
  border-radius: 0;
  background: var(--bg);
  box-shadow: none;
}

.profile-page h3,
.app-page h2,
.app-page h3 { color: var(--ink); font-family: var(--sans); }

.app-page > h2 {
  margin-top: 36px;
  margin-bottom: 14px;
  font-size: 24px;
}

.profile-page .text-secondary,
.app-page .text-secondary { color: var(--ink-2); }

.profile-page input,
.app-page input[type="text"],
.app-page select {
  border: 1px solid var(--rule-mid);
  border-radius: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
}

.profile-page input:focus,
.app-page input:focus,
.app-page select:focus {
  border-color: var(--accent);
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  background: var(--bg);
}

.profile-page .tabs button,
.profile-page .season-filter button,
.app-page .tabs button,
.app-page .season-filter button,
.app-page .dropbtn {
  border: 1px solid var(--rule-mid);
  border-radius: 0;
  background: var(--bg);
  color: var(--ink-2);
  font-family: var(--sans);
}

.profile-page .tabs button.active,
.profile-page .season-filter button.active,
.app-page .tabs button.active,
.app-page .season-filter button.active {
  border-color: var(--action-border);
  background: var(--action-gradient);
  color: var(--action-text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 2px 5px rgba(0, 0, 0, 0.24);
}

.app-page .dropbtn:hover,
.profile-page .tabs button:hover,
.app-page .tabs button:hover { border-color: var(--accent); color: var(--ink); }

.app-page #graphsControlsStack {
  max-width: var(--shell);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.app-page #graphsControlsStack .controls-block {
  padding: 18px;
  border-radius: 0;
  margin: 0;
}
.app-page #graphsControlsStack .controls-block:first-child,
.app-page #filterByUsernameSection { grid-column: 1 / -1; }

.app-page .app-empty-state {
  max-width: var(--shell);
  margin-top: 20px;
  padding: clamp(28px, 6vw, 64px) 24px;
  text-align: center;
  border: 1px dashed rgba(75, 142, 240, 0.5);
  background: radial-gradient(circle at top, rgba(75, 142, 240, 0.12), transparent 58%), rgba(8, 14, 24, 0.72);
}

.app-page .app-empty-state[hidden],
.app-page #appDataSections[hidden] { display: none; }

.profile-page .profile-social-link {
  border-color: var(--action-border);
  background: var(--accent-bg);
  color: var(--accent);
}

.profile-page .profile-filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}

.profile-page .profile-filter-row select {
  min-width: 190px;
}

.profile-page {
  --profile-table-accent: #0d7377;
}

.profile-page .profile-filter-summary {
  margin-top: 8px;
}

.profile-page .profile-empty-state {
  padding: clamp(28px, 6vw, 64px) 24px;
  text-align: center;
  border: 1px dashed rgba(75, 142, 240, 0.5);
  background:
    radial-gradient(circle at top, rgba(75, 142, 240, 0.12), transparent 58%),
    rgba(8, 14, 24, 0.72);
}

.profile-page .profile-empty-state[hidden],
.profile-page .profile-data-section[hidden] {
  display: none;
}

.profile-page .profile-empty-state h3 {
  margin: 0 0 8px;
}

.profile-page .profile-empty-state p {
  margin: 0;
}

.profile-page .profile-season-notice {
  margin-top: 8px;
}

.profile-page .profile-records-container {
  margin-top: 20px;
}

.profile-page .profile-error-container {
  display: none;
  margin: 20px 0;
  font-size: 16px;
}

.profile-page .profile-alias-history-list {
  margin-top: 10px;
}

.profile-page .profile-alias-history-item {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  padding-bottom: 6px;
}

.profile-page .profile-team-analysis {
  display: none;
  margin-bottom: 20px;
}

.profile-page .profile-dimension-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.profile-page .profile-dimension-card {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--rule);
  background: var(--bg);
}

.profile-page .profile-dimension-card h4 {
  margin: 0 0 10px;
  color: var(--profile-table-accent);
}

.profile-page .profile-records-block > h3,
.profile-page #profileHighsTitle,
.profile-page .profile-dimension-table th,
.profile-page .metrics-table th,
.profile-page .admin-table th {
  color: var(--profile-table-accent);
}

.profile-page .profile-table-scroll {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.profile-page .profile-dimension-table {
  min-width: 900px;
}

.profile-page #profileTotalsSection .chart-container {
  min-height: 285px;
  max-height: 305px;
  overflow: hidden;
}

.profile-page #profileTotalsSection .chart-container canvas {
  max-height: 260px;
}

.profile-page .profile-records-block {
  margin-bottom: 24px;
}

.profile-page .profile-average-grid {
  margin-top: 12px;
}

.profile-page .profile-average-summary {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 0.95rem;
}

.profile-page .profile-average-card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.profile-page .profile-average-card {
  min-width: 0;
  padding: 15px;
  border: 1px solid var(--rule);
  background:
    linear-gradient(135deg, rgba(13, 71, 155, 0.16), transparent 54%),
    var(--bg);
}

.profile-page .profile-average-label,
.profile-page .profile-average-detail {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
}

.profile-page .profile-average-value {
  display: block;
  margin: 6px 0;
  color: var(--ink);
  font-size: clamp(1.35rem, 2.4vw, 2rem);
  line-height: 1;
}

.profile-page .profile-average-card-wins .profile-average-value {
  color: #0dff00;
}

.profile-page .profile-average-card-deaths .profile-average-value {
  color: #f97316;
}

.profile-page .profile-record-badge-grid {
  gap: 14px;
  padding: 0;
  overflow: visible;
}

.profile-page .profile-record-badge-grid .chart-container,
.profile-page .section-title .charts .chart-container:has(.badge-img) {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  min-height: 0;
}

.profile-page .profile-record-badge-grid .badge-img,
.profile-page .section-title .charts .chart-container:has(.badge-img) .badge-img {
  width: 100%;
  max-width: 100%;
  border-radius: 0;
}

.profile-page .profile-matched-record-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.profile-page .profile-matched-record-card {
  position: relative;
  display: flex;
  min-height: 128px;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  overflow: hidden;
  padding: 15px;
  border: 1px solid var(--rule);
  background:
    linear-gradient(135deg, rgba(13, 71, 155, 0.16), transparent 54%),
    var(--bg);
}

.profile-page .profile-matched-record-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--profile-table-accent);
}

.profile-page .profile-matched-record-card-eliminations::before { background: #22d3ee; }
.profile-page .profile-matched-record-card-kills::before { background: #f59e0b; }
.profile-page .profile-matched-record-card-assists::before { background: #a78bfa; }
.profile-page .profile-matched-record-card-deaths::before { background: #f97316; }
.profile-page .profile-matched-record-card-damage::before { background: #ef4444; }

.profile-page .profile-matched-record-label,
.profile-page .profile-matched-record-count,
.profile-page .profile-matched-record-dates {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
}

.profile-page .profile-matched-record-label {
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.profile-page .profile-matched-record-value {
  display: block;
  color: var(--ink);
  font-size: clamp(1.35rem, 2.4vw, 2rem);
  line-height: 1;
}

.app-page .app-modal-content {
  width: min(500px, 90vw);
  padding: 24px;
  border: 1px solid var(--rule-mid);
  border-radius: 0;
  background: var(--panel-gradient);
  color: var(--ink);
}

.app-page .app-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.7);
}

.app-page .app-modal-content #modalTitle {
  margin: 0;
  color: var(--accent);
}

.app-page .app-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

.app-page .app-modal-content #modalInput {
  width: 100%;
  margin: 0;
  border: 1px solid var(--rule-mid);
  border-radius: 0;
  background: var(--bg);
  color: var(--ink);
}

.app-page .app-modal-input-container {
  display: none;
  margin: 15px 0;
}

.app-page .app-modal-actions #modalConfirm {
  border: 1px solid var(--action-border);
  border-radius: 0;
  background: var(--action-gradient);
  color: var(--action-text);
}

.app-page .app-modal-actions #modalCancel {
  border: 1px solid var(--rule-mid);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
}

.profile-page .dropdown-list,
.app-page .dropdown-list {
  border-color: var(--rule-mid);
  border-radius: 0;
  background: var(--surface);
}

.profile-page .global-auth-hamburger,
.app-page .global-auth-hamburger {
  border: 1px solid var(--action-border);
  border-radius: 0;
  background: var(--action-gradient);
  color: var(--action-text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 2px 5px rgba(0, 0, 0, 0.24);
}

@media (max-width: 700px) {
  body.profile-page,
  body.app-page { padding: 0 0 48px; }
  .profile-page > :not(nav):not(footer):not(script),
  .app-page > :not(nav):not(footer):not(script) { width: calc(100% - 28px); }
  .app-page #graphsControlsStack { grid-template-columns: 1fr; }
  .app-page #graphsControlsStack .controls-block,
  .app-page #filterByUsernameSection { grid-column: 1; }
  .profile-page .admin-section,
  .app-page .admin-section { padding: 20px; }
  .profile-page .profile-header-row,
  .app-page .app-header-row { min-height: 52px; }
  .profile-page .profile-hero-summary-grid { grid-template-columns: 1fr 1fr; }
  .profile-page .profile-dimension-grid { grid-template-columns: 1fr; }
  .profile-page .profile-average-card-grid,
  .profile-page .profile-matched-record-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .profile-page .profile-filter-row {
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .profile-page .profile-filter-row select { width: 100%; }
  .profile-page .tabs,
  .app-page .tabs {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    max-width: 100%;
    padding-bottom: 6px;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
  }
  .profile-page .tabs button,
  .app-page .tabs button {
    flex: 0 0 auto;
    width: auto;
    min-width: 104px;
    min-height: 44px;
    white-space: nowrap;
  }
  .app-page .charts,
  .profile-page .charts { grid-template-columns: 1fr; }

  .profile-page input:not([type="checkbox"]):not([type="radio"]),
  .profile-page select,
  .app-page input:not([type="checkbox"]):not([type="radio"]),
  .app-page select {
    min-height: 44px;
    font-size: 16px;
  }

  .profile-page .dashboard-table-scroll,
  .app-page .dashboard-table-scroll,
  .profile-page .metrics-content,
  .app-page .metrics-content {
    max-width: 100%;
    overscroll-behavior-inline: contain;
    -webkit-overflow-scrolling: touch;
  }

  .app-page .app-modal-content {
    width: min(94vw, 500px);
    max-height: calc(100dvh - 24px);
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .app-page .app-modal-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .app-page .app-modal-actions .dropbtn {
    width: 100%;
    min-height: 44px;
  }
}

@media (max-width: 420px) {
  .profile-page .profile-hero-summary-grid { grid-template-columns: 1fr; }
  .profile-page .profile-average-card-grid,
  .profile-page .profile-matched-record-grid { grid-template-columns: 1fr; }

  .profile-page .admin-section,
  .app-page .admin-section { padding: 14px; }
}

@media (max-width: 560px) {
  .profile-page .charts,
  .app-page .charts {
    display: grid;
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: min(88vw, 420px);
    gap: 10px;
    max-width: 100%;
    padding-bottom: 8px;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scroll-snap-type: inline mandatory;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
  }

  .profile-page .charts > .chart-container,
  .app-page .charts > .chart-container {
    width: 100%;
    scroll-snap-align: start;
    scroll-snap-stop: always;
  }

  .app-page #appSelectedUsers [data-remove-user],
  .app-page .app-search-wrap,
  .profile-page .profile-search-wrap {
    width: 100%;
  }
}
.profile-owner-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.profile-owner-actions[hidden] {
  display: none;
}

.profile-owner-actions .dropbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  text-decoration: none;
}

.app-record-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.app-record-card,
.app-breakdown-card {
  border: 1px solid rgba(75, 142, 240, 0.28);
  border-radius: 14px;
  background: rgba(10, 19, 35, 0.72);
  padding: 14px;
}

.app-record-label,
.app-record-meta {
  color: #9ca3af;
}

.app-record-value {
  margin: 6px 0;
  color: #f8fafc;
  font-size: 1.7rem;
  font-weight: 800;
}

.app-breakdown-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.app-breakdown-card h4 {
  margin-top: 0;
}

.app-breakdown-table {
  overflow-x: auto;
}

.app-breakdown-table table {
  width: 100%;
  border-collapse: collapse;
}

.app-breakdown-table th,
.app-breakdown-table td {
  padding: 9px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  text-align: right;
  white-space: nowrap;
}

.app-breakdown-table th:first-child,
.app-breakdown-table td:first-child {
  text-align: left;
}
