/* Cards & Profile elements */
.card-head {
  padding: 21px 22px;
  display: flex;
  gap: 15px;
  align-items: center;
  border-bottom: 1px solid var(--line);
}

.profile-icon {
  width: 60px;
  height: 60px;
  border-radius: 16px;
  object-fit: cover;
  background: var(--panel2);
  border: 1px solid var(--line);
}

.identity {
  min-width: 0;
  flex: 1;
}

.region, .server {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-weight: 850;
  letter-spacing: 0.08em;
}

.region {
  padding: 5px 8px;
  font-size: 0.66rem;
}

.server {
  min-width: 48px;
  padding: 4px 7px;
  font-size: 0.64rem;
  color: var(--account-color, var(--muted));
  border-color: color-mix(in srgb, var(--account-color, var(--line)) 48%, transparent);
}

.server.eune {
  color: var(--account-color, var(--blue));
  border-color: color-mix(in srgb, var(--account-color, var(--blue)) 48%, transparent);
}

.server.euw {
  color: var(--account-color, var(--violet));
  border-color: color-mix(in srgb, var(--account-color, var(--violet)) 48%, transparent);
}

.account-badge {
  background: rgba(255, 255, 255, 0.035);
  transition: 0.15s;
  color: var(--account-color);
  border-color: var(--account-color);
}

.account-badge.smurf-filter {
  min-width: auto;
  color: var(--account-color);
  border-color: var(--account-color);
}

.account-badge.off {
  color: var(--muted);
  opacity: 0.58;
  background: rgba(0, 0, 0, 0.12);
  border-color: var(--line);
}

#profiles .card,
#profiles .card.account-color-0,
#profiles .card.account-color-1,
#profiles .card.account-color-2,
#profiles .card.account-color-3 {
  border: 1px solid var(--line) !important;
}

.account-kind {
  display: inline-flex;
  margin-left: 7px;
  padding: 3px 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.58rem;
  font-weight: 850;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  vertical-align: middle;
}

.server.account-color-0,
.server.account-color-1,
.server.account-color-2,
.server.account-color-3 {
  color: var(--account-color) !important;
  border-color: color-mix(in srgb, var(--account-color) 48%, transparent);
}

.name {
  margin-top: 7px;
  font-size: 1.5rem;
  font-weight: 860;
  letter-spacing: -0.035em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stats {
  padding: 17px 22px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  min-height: 128px;
  align-items: stretch;
}

.stat, .summary-stat, .analytic-card {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card-surface, var(--panel2));
}

.stat {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  min-height: 110px;
}

.stat.cutoff {
  border-color: var(--accent);
  background: var(--card-surface, var(--panel2));
}

.stat.goal-picker-stat {
  position: relative;
  cursor: pointer;
  user-select: none;
  transition: border-color 0.15s, background 0.15s;
}

.stat.goal-picker-stat:hover {
  background: var(--card-surface, var(--panel2));
  border-color: var(--accent);
}

.stat.goal-picker-stat[aria-expanded="true"] {
  z-index: 80;
  border-color: var(--accent);
}

#profiles .card:has([aria-expanded="true"]),
#profiles .card.has-open-dropdown {
  z-index: 70;
  overflow: visible !important;
}

.goal-caret {
  display: inline-block;
  font-size: 0.72rem;
  margin-left: 4px;
  color: var(--accent);
  transition: transform 0.18s ease;
}

.stat.goal-picker-stat[aria-expanded="true"] .goal-caret {
  transform: rotate(180deg);
}

.goal-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 100;
  max-height: 240px;
  overflow-y: auto;
  border-radius: 12px;
  background: var(--panel2);
  border: 1px solid var(--line);
  box-shadow: var(--shadow), 0 12px 36px rgba(0, 0, 0, 0.45);
  padding: 6px;
  display: none;
  flex-direction: column;
  gap: 4px;
}

.goal-dropdown[hidden] {
  display: none !important;
}

.stat.goal-picker-stat[aria-expanded="true"] .goal-dropdown {
  display: flex;
}

.goal-dropdown-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 0.82rem;
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.goal-dropdown-item:hover {
  background: var(--card-surface, var(--panel2));
  color: var(--accent);
}

.goal-dropdown-item.active {
  background: transparent;
  color: var(--text);
  font-weight: inherit;
  border: 1px solid var(--line);
  box-shadow: none;
}

.goal-item-title {
  font-weight: 700;
}

.goal-item-sub {
  font-size: 0.75rem;
  color: var(--muted);
}

.goal-dropdown-item.active .goal-item-sub {
  color: var(--muted);
}

.label {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.09em;
}

.main-value {
  margin-top: 6px;
  font-size: 1.1rem;
  font-weight: 850;
}

.meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.75rem;
}

.gold,
.accent {
  color: var(--accent);
}

.links {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  padding: 0 22px 21px;
}

.link {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.035);
  font-size: 0.78rem;
  font-weight: 780;
}

.link:hover {
  background: rgba(255, 255, 255, 0.075);
}

.section-head {
  padding: 20px 22px 15px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
}

.section-head h2 {
  margin: 4px 0 0;
  font-size: 1.27rem;
  letter-spacing: -0.025em;
}

.section-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.range-switch {
  display: flex;
  flex-wrap: wrap;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--card-surface, var(--panel2));
}

.range-button {
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  padding: 7px 10px;
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 800;
  white-space: nowrap;
}

.range-button.active {
  background: var(--control-active-bg, rgba(255, 255, 255, 0.09));
  color: var(--control-active-text, var(--text));
}

.history-range-switch {
  display: flex;
  flex-wrap: wrap;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--card-surface, var(--panel2));
}

/* Summary Grid & Tiles */
.summary-grid {
  padding: 0 22px 19px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 9px;
}

.summary-value {
  margin-top: 6px;
  font-size: 1.12rem;
  font-weight: 850;
}

.summary-stat {
  position: relative;
}

.summary-edit-button, .summary-filter-chip {
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  padding: 7px 10px;
  cursor: pointer;
  font-size: 0.7rem;
  font-weight: 800;
}

.summary-edit-button:hover, .summary-filter-chip:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.summary-filter-chip {
  border-color: rgba(111, 168, 255, 0.22);
  background: rgba(111, 168, 255, 0.07);
  color: rgba(190, 214, 255, 0.96);
}

.drill-button {
  appearance: none;
  width: 100%;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: 0.15s;
}

.champion-stat.drill-button,
.role-stat.drill-button,
.side-row.drill-button {
  border-color: var(--line);
}

.drill-button:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(111, 168, 255, 0.26);
}

.drill-button.drill-active {
  border-color: rgba(111, 168, 255, 0.48);
  background: rgba(111, 168, 255, 0.09);
  box-shadow: 0 0 0 2px rgba(111, 168, 255, 0.06) inset;
}

.summary-editor-backdrop[hidden] {
  display: none;
}

.summary-editor-backdrop {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.summary-editor-modal {
  width: min(650px, 100%);
  max-height: min(78dvh, 760px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--scroll-thumb) var(--scroll-track);
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  padding: 22px;
}

.summary-editor-modal::-webkit-scrollbar {
  width: 6px;
}

.summary-editor-modal::-webkit-scrollbar-track {
  background: var(--scroll-track);
}

.summary-editor-modal::-webkit-scrollbar-thumb {
  background: var(--scroll-thumb);
  border-radius: 3px;
}

.summary-editor-modal::-webkit-scrollbar-thumb:hover {
  background: var(--scroll-thumb-hover);
}

.summary-editor-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.summary-editor-head h3 {
  margin: 0;
  color: var(--text);
  font-size: 1.15rem;
  font-weight: 800;
}

.summary-editor-head p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.5;
}

.summary-editor-close {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--control-bg, rgba(255, 255, 255, 0.05));
  color: var(--text);
  width: 34px;
  height: 34px;
  cursor: pointer;
  font-size: 1.2rem;
  line-height: 1;
  transition: background 0.15s, border-color 0.15s;
}

.summary-editor-close:hover {
  background: var(--panel2);
  border-color: var(--accent);
}

.summary-editor-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 16px;
}

.summary-editor-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--control-bg, rgba(255, 255, 255, 0.03));
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s;
}

.summary-editor-option:hover {
  background: var(--panel2);
  border-color: var(--accent);
}

.summary-editor-option input {
  accent-color: var(--accent);
  cursor: pointer;
  width: 16px;
  height: 16px;
}

.summary-editor-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
  flex-wrap: wrap;
}

.summary-editor-actions button {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--control-bg, rgba(255, 255, 255, 0.05));
  color: var(--text);
  padding: 9px 14px;
  cursor: pointer;
  font-weight: 750;
  transition: all 0.15s;
}

.summary-editor-actions button:hover {
  background: var(--panel2);
  border-color: var(--line);
}

.summary-editor-actions .primary {
  border-color: var(--control-active-border, var(--accent));
  background: var(--control-active-bg, var(--accent));
  color: var(--control-active-text, #080c12);
  font-weight: 850;
}

.summary-editor-actions .primary:hover {
  opacity: 0.92;
}

/* Champions, Roles, Sides */
.champions {
  padding: 0 22px 20px;
}

.roles, .sides {
  padding: 0;
}

.roles-sides-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  padding: 0 22px 20px;
}

.roles {
  flex: 1 1 320px;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.sides {
  flex: 1 1 200px;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.roles-sides-row .role-grid {
  display: grid;
  grid-template-columns: repeat(var(--role-cols, 4), minmax(0, 1fr));
  gap: 9px;
  flex: 1;
}

.roles-sides-row .side-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  margin-top: 0;
  flex: 1;
}

.roles-sides-row .role-stat,
.roles-sides-row .side-row {
  min-height: 56px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: stretch;
  text-align: left;
  gap: 0;
  box-sizing: border-box;
  margin-top: 0;
  border-radius: 12px;
  background: var(--card-surface, var(--panel2));
}

.roles-sides-row .role-stat .side-meta,
.roles-sides-row .side-row .side-meta {
  margin-top: 4px;
}

.summary-tiles-wrap {
  margin-top: 2px;
}

.summary-tiles-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px 9px;
}

.summary-tiles-head .subhead {
  margin: 0;
}

.subhead {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 0.69rem;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 2px 0 9px;
}

.champion-grid, .role-grid, .item-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 9px;
}

.champion-stat, .item-stat {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card-surface, var(--panel2));
  min-width: 0;
}

.role-stat {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: stretch;
  text-align: left;
  gap: 0;
  min-height: 56px;
  box-sizing: border-box;
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
}

.champion-stat img, .item-stat img, .mini-champ {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  object-fit: cover;
  background: var(--panel2);
  border: 1px solid var(--line);
  flex: 0 0 38px;
}

.item-stat img {
  border-radius: 9px;
}

.champion-info {
  min-width: 0;
}

.champion-name-small {
  font-size: 0.82rem;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.champion-meta {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.67rem;
  line-height: 1.45;
}

.champion-meta-line {
  display: block;
}

/* Analytics */
.analytics {
  padding: 0 16px 18px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 8px;
}

.analytics .analytic-card {
  padding: 11px;
}

/* Sub-tiles inside Analytics share their parent surface instead of stacking
   another tinted layer, which otherwise looks artificially dimmed. */
.analytics .champion-stat,
.analytics .item-stat,
.analytics .rune-stat,
.analytics .role-stat,
.analytics .side-row,
.analytics .recommendation,
.analytics .worst-wrap {
  background: transparent !important;
}

.analytic-title {
  font-size: 0.76rem;
  font-weight: 840;
  line-height: 1.28;
}

.analytic-desc {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.64rem;
  line-height: 1.35;
}

.analytics .item-grid {
  grid-template-columns: 1fr;
}

.analytics .item-stat,
.analytics .worst-wrap,
.analytics .recommendation,
.analytics .rune-stat {
  padding: 7px;
  gap: 7px;
}

.analytics .item-stat {
  background: rgba(0, 0, 0, 0.10);
  border-radius: 11px;
}

.analytics .champion-stat img,
.analytics .item-stat img,
.analytics .mini-champ {
  width: 31px;
  height: 31px;
  flex-basis: 31px;
}

.analytics .rune-stat img {
  width: 31px;
  height: 31px;
  flex-basis: 31px;
}

.analytics .champion-name-small,
.analytics .worst-name,
.analytics .recommendation-name,
.analytics .rune-stat-name {
  font-size: 0.75rem;
}

.analytics .champion-meta,
.analytics .worst-meta,
.analytics .recommendation-meta,
.analytics .rune-stat-meta {
  font-size: 0.61rem;
  line-height: 1.35;
}

.worst-list, .recommendation-list {
  display: grid;
  gap: 6px;
  margin-top: 9px;
}

.worst-wrap, .recommendation {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(0, 0, 0, 0.10);
}

.recommendation {
  display: block;
}

.worst-name, .recommendation-name {
  font-size: 0.92rem;
  font-weight: 850;
}

.worst-meta, .recommendation-meta {
  color: var(--muted);
  font-size: 0.7rem;
  margin-top: 3px;
}

/* Hall of Fame */
.inter-grid {
  padding: 0 22px 22px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.inter-card {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card-surface, var(--panel2));
}

.inter-rank {
  color: var(--accent);
  font-size: 0.66rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.inter-rank .server-pill {
  margin-left: 4px;
  vertical-align: middle;
  text-transform: none;
  letter-spacing: 0.05em;
}

.inter-player {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}

.inter-champion {
  width: 42px;
  height: 42px;
  border-radius: 11px;
  object-fit: cover;
  background: var(--panel2);
  border: 1px solid var(--line);
  flex: 0 0 42px;
}

.inter-player-text {
  min-width: 0;
}

.inter-name {
  font-size: 0.93rem;
  font-weight: 850;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.inter-champ-name {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.68rem;
}

.inter-meta {
  margin-top: 9px;
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1.65;
}

.inter-kda {
  color: var(--accent);
  font-weight: 850;
}

.inter-match-meta {
  color: var(--muted);
  font-size: 0.68rem;
  letter-spacing: 0.01em;
}

.inter-controls {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
}

/* Reusable background image preview */
.image-preview-trigger {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--control-border, var(--line));
  border-radius: 9px;
  background: var(--panel, #111821);
  color: var(--text);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
  cursor: pointer;
}

.image-preview-trigger:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.image-preview-trigger:focus-visible,
.image-lightbox-close:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.image-preview-trigger svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

.image-lightbox {
  width: min(1200px, calc(100vw - 24px));
  max-width: none;
  max-height: calc(100dvh - 24px);
  margin: auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  overflow: visible;
}

.image-lightbox::backdrop {
  background: rgba(2, 6, 12, 0.82);
  backdrop-filter: blur(4px);
}

.image-lightbox-panel {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  max-height: calc(100dvh - 24px);
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel, #111821);
  box-shadow: var(--shadow, 0 18px 60px rgba(0, 0, 0, 0.45));
  overflow: hidden;
}

.image-lightbox-title {
  margin: 0;
  padding: 7px 54px 15px 4px;
  color: var(--text);
  font-size: 1rem;
  line-height: 1.25;
}

.image-lightbox-close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid var(--control-border, var(--line));
  border-radius: 10px;
  background: var(--panel2);
  color: var(--text);
  font: inherit;
  font-size: 1.55rem;
  line-height: 1;
  cursor: pointer;
}

.image-lightbox-close:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.image-lightbox-stage {
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 180px;
  max-height: calc(100dvh - 96px);
  border-radius: 11px;
  background: var(--panel2);
  overflow: hidden;
}

.image-lightbox-image {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: calc(100dvh - 96px);
  object-fit: contain;
}

.image-lightbox-image[hidden],
.image-lightbox-status[hidden] {
  display: none;
}

.image-lightbox-canvas {
  width: auto;
  height: auto;
}

.image-lightbox-status {
  margin: 0;
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

.image-lightbox-error {
  color: var(--danger, #fb7185);
}

[data-theme="comic"] .image-preview-trigger,
[data-theme="comic"] .image-lightbox-panel,
[data-theme="comic"] .image-lightbox-close {
  border: 3px solid #111;
  box-shadow: 4px 4px 0 #111;
}

@media (max-width: 560px) {
  .image-lightbox {
    width: calc(100vw - 12px);
    max-height: calc(100dvh - 12px);
  }

  .image-lightbox-panel {
    max-height: calc(100dvh - 12px);
    padding: 8px;
    border-radius: 12px;
  }

  .image-lightbox-stage,
  .image-lightbox-image {
    max-height: calc(100dvh - 78px);
  }
}
