:root {
  --bg: #08111d;
  --panel: rgba(15, 23, 42, 0.95);
  --panel-strong: rgba(18, 34, 56, 0.96);
  --border: rgba(255, 255, 255, 0.12);
  --text: #f4f7ff;
  --muted: #9fb5d4;
  --accent: #2f6fff;
  --accent-strong: #ff7a00;
  --success: #4cd964;
  --danger: #ff5b5b;
  --shadow: 0 24px 90px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--text);
  background: radial-gradient(circle at top left, rgba(95, 141, 247, 0.18), transparent 24%),
              radial-gradient(circle at bottom right, rgba(255, 159, 67, 0.14), transparent 20%),
              linear-gradient(180deg, #050a12 0%, #091623 48%, #07111b 100%);
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, rgba(95, 141, 247, 0.08), rgba(255, 159, 67, 0.06));
  pointer-events: none;
  z-index: -1;
}

.app-shell {
  width: 100%;
  margin: 0;
  padding: 18px clamp(16px, 3vw, 48px) 48px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.app-header {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  text-align: center;
  padding: 22px 20px;
  border-radius: 16px;
  background: rgba(16, 28, 48, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.app-header h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3rem);
  letter-spacing: -0.04em;
}

.app-header p {
  margin: 0;
  color: var(--muted);
  max-width: 760px;
  line-height: 1.7;
  font-size: 1rem;
}

.navbar {
  display: flex;
  align-items: stretch;
  gap: 20px;
  padding: 12px 16px;
  border-radius: 16px;
  background: rgba(13, 25, 42, 0.97);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 20px 70px rgba(0, 0, 0, 0.24);
  position: sticky;
  top: 12px;
  z-index: 100;
  backdrop-filter: blur(16px);
}

.navbar ul {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav-group {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
}

.nav-group-label {
  color: #7891b4;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0 8px;
}

.nav-group-links {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.navbar li {
  width: auto;
}

.navbar a {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  width: auto;
  padding: 9px 13px;
  border-radius: 10px;
  color: var(--text);
  text-decoration: none;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid transparent;
  transition: transform 0.24s ease, border-color 0.24s ease, background 0.24s ease, box-shadow 0.24s ease;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.navbar a:hover,
.navbar a.active {
  background: linear-gradient(135deg, rgba(95, 141, 247, 0.24), rgba(255, 159, 67, 0.18));
  border-color: rgba(255, 255, 255, 0.16);
  transform: translateY(-2px);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.18);
}

.container {
  width: 100%;
  border-radius: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0;
  display: grid;
  gap: 18px;
}

.section {
  background: rgba(8, 14, 24, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 22px;
  padding: 24px 26px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.18);
}

.section h2 {
  margin-top: 0;
  font-size: 1.5rem;
  letter-spacing: -0.03em;
}

.section p,
.section label,
.message,
.result,
.navbar a,
.history-item,
.match-item,
.top-hero-card,
.info-card {
  color: var(--text);
}

label {
  display: block;
  margin: 16px 0 8px;
  font-size: 0.98rem;
  color: var(--muted);
}

input,
select,
textarea {
  width: 100%;
  min-height: 46px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(9, 16, 28, 0.9);
  color: var(--text);
  font-size: 1rem;
  transition: border-color 0.24s ease, background 0.24s ease;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: rgba(95, 141, 247, 0.6);
  background: rgba(15, 23, 42, 0.98);
  box-shadow: 0 0 0 4px rgba(95, 141, 247, 0.12);
}

button {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  padding: 10px 14px;
  cursor: pointer;
  font-size: 0.92rem;
  font-weight: 600;
  color: #e8eefb;
  background: rgba(255, 255, 255, 0.06);
  transition: transform 0.2s ease, filter 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease, border-color 0.2s ease;
  box-shadow: none;
}

button:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
  border-color: rgba(255, 255, 255, 0.24);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.2);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  box-shadow: none;
  background: rgba(255, 255, 255, 0.04);
}

.minimal-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: none;
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 0.9rem;
  font-weight: 600;
}

.minimal-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.2);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  min-width: 40px;
  line-height: 1;
}

.icon-btn__glyph {
  font-size: 16px;
  width: 18px;
  text-align: center;
  opacity: 0.95;
}

.icon-btn__text {
  font-size: 0.86rem;
  letter-spacing: 0.01em;
}

.icon-only {
  width: 40px;
  min-width: 40px;
  padding: 8px;
}

.icon-only .icon-btn__text {
  display: none;
}

.field-action-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  margin-top: 8px;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 10px;
}

.match-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 12px;
}

.save-match-button {
  min-width: 100px;
  padding: 10px 14px;
  font-size: 0.92rem;
}

.mmr-input {
  width: 140px;
}

#mmrSection button {
  padding: 12px 16px;
  font-size: 1rem;
}

.match-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  background: rgba(255, 255, 255, 0.06);
}

.match-badge.ranked {
  color: #9ae34f;
  background: rgba(73, 137, 61, 0.18);
  border: 1px solid rgba(73, 137, 61, 0.28);
}

.match-badge.unranked {
  color: #64b5ff;
  background: rgba(58, 111, 177, 0.16);
  border: 1px solid rgba(58, 111, 177, 0.28);
}

.match-badge.battle-cup {
  color: #c8a0ff;
  background: rgba(160, 100, 255, 0.16);
  border: 1px solid rgba(160, 100, 255, 0.28);
}

.result,
.message {
  font-size: 0.98rem;
  line-height: 1.7;
  margin-top: 16px;
  color: var(--muted);
}

.message {
  color: var(--muted);
}

.highlight {
  color: var(--accent-strong);
  font-weight: 700;
}


.hidden {
  display: none !important;
}


.rank-info {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 18px;
  align-items: center;
  margin: 20px 0;
}

.rank-item {
  background: rgba(255, 255, 255, 0.03);
  padding: 18px;
  border-radius: 20px;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.rank-item div {
  margin: 8px 0;
}

.rank-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 54px;
  height: 54px;
  margin: 0 auto;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 1.75rem;
  font-weight: 700;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.16);
  animation: pulseArrow 1.4s ease-in-out infinite;
}

@keyframes pulseArrow {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.08);
    opacity: 0.92;
  }
}

.rank-image {
  width: 100px;
  height: auto;
  border-radius: 16px;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.22);
}

.chart-container {
  position: relative;
  width: 100%;
  min-height: 320px;
  margin-top: 16px;
  border-radius: 24px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 16px;
}

.chart-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.chart-toolbar-label {
  color: var(--muted);
  font-size: 0.92rem;
  letter-spacing: 0.01em;
}

.chart-toggle-group {
  display: inline-flex;
  padding: 4px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(8, 14, 24, 0.88);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03);
}

.chart-toggle-btn {
  border: 0;
  padding: 9px 12px;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 38px;
}

.chart-toggle-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
}

.chart-toggle-btn.active {
  color: var(--text);
  background: linear-gradient(135deg, rgba(47, 111, 255, 0.38), rgba(255, 122, 0, 0.3));
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.24);
}

.chart-icon-btn {
  width: 38px;
  min-width: 38px;
  padding: 7px 8px;
  font-size: 1.15rem;
  line-height: 1;
}

.chart-icon-btn span {
  display: block;
  transform: translateY(-1px);
}

.save-filter-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 82px;
  color: #b7f7d0;
  border: 1px solid rgba(74, 222, 128, 0.34);
  background: rgba(34, 197, 94, 0.12);
  font-size: 0.82rem;
}

.save-filter-btn:hover,
.save-filter-btn.active {
  color: #f0fff5;
  border-color: rgba(74, 222, 128, 0.7);
  background: rgba(34, 197, 94, 0.28);
  box-shadow: 0 8px 22px rgba(34, 197, 94, 0.16);
}

.save-filter-btn .save-filter-icon {
  font-size: 1rem;
  transform: none;
}

.save-filter-btn .save-filter-label {
  display: inline;
  transform: none;
}

.history-item,
.match-item,
.top-hero-card,
.info-card,
.history-actions {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.16);
}

.history-item {
  padding: 16px;
  margin-bottom: 12px;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.history-item:hover,
.match-item:hover,
.top-hero-card:hover,
.history-actions:hover {
  transform: translateY(-2px);
  border-color: rgba(95, 141, 247, 0.35);
  background: rgba(255, 255, 255, 0.04);
}

.history-actions {
  padding: 22px;
  margin-top: 16px;
}

.section-content {
  display: block;
}

.section-content.hidden {
  display: none;
}

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-top: 22px;
  flex-wrap: wrap;
}

.pagination button {
  min-width: 120px;
}

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

.rank-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 20px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.16);
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.rank-card:hover {
  transform: translateY(-4px);
  border-color: rgba(95, 141, 247, 0.3);
  background: rgba(255, 255, 255, 0.05);
}

.rank-card .rank-image {
  width: 72px;
  height: 72px;
  border-radius: 24px;
  object-fit: contain;
  background: rgba(255, 255, 255, 0.08);
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.rank-card .rank-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  text-align: center;
  line-height: 1.2;
}

.rank-card .rank-range {
  font-size: 0.95rem;
  color: var(--accent-strong);
  font-weight: 600;
}

.rank-card .rank-tier {
  font-size: 0.88rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.rank-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-bottom: 18px;
}

.rank-toolbar label {
  color: var(--muted);
  font-size: 0.95rem;
  min-width: 80px;
}

#rankFilter {
  width: 220px;
  min-width: 180px;
  background: rgba(9, 16, 28, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text);
  border-radius: 16px;
  padding: 12px 14px;
}

.rank-group {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 18px 38px rgba(0, 0, 0, 0.14);
}

.rank-group-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.04em;
  text-align: center;
}

.rank-list {
  display: grid;
  gap: 12px;
}

.rank-entry {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 16px;
  align-items: center;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.rank-entry .rank-entry-image {
  width: 50px;
  height: 50px;
  object-fit: contain;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.08);
  padding: 10px;
}

.rank-entry .rank-entry-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
}

.rank-entry .rank-entry-range {
  font-size: 0.9rem;
  color: var(--accent-strong);
  font-weight: 600;
}

.rank-entry .rank-entry-label {
  font-size: 0.8rem;
  color: var(--muted);
}

.rank-group.herald .rank-group-title {
  color: #f9a825;
}

.rank-group.guardian .rank-group-title {
  color: #42a5f5;
}

.rank-group.crusader .rank-group-title {
  color: #ab47bc;
}

.rank-group.archon .rank-group-title {
  color: #26a69a;
}

.rank-group.legend .rank-group-title {
  color: #ef5350;
}

.rank-group.ancient .rank-group-title {
  color: #5c6bc0;
}

.rank-group.divine .rank-group-title {
  color: #ff7043;
}

.rank-group.immortal .rank-group-title {
  color: #8e24aa;
}

.grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.info-card {
  padding: 18px;
  border-radius: 20px;
}

footer {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px 0;
  color: var(--muted);
  font-size: 0.94rem;
  text-align: center;
}

@media (max-width: 1024px) {
  .rank-grid {
    grid-template-columns: repeat(2, minmax(220px, 1fr));
  }

  .stratz-position-board {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .navbar {
    grid-template-columns: 1fr;
    flex-direction: column;
    gap: 12px;
  }

  .container {
    padding: 20px;
  }

  .button-row {
    flex-direction: column;
  }

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

  .stratz-position-board {
    grid-template-columns: 1fr;
  }
}

.match-item {
  padding: 16px;
  border: 2px solid #333;
  border-radius: 8px;
  margin-bottom: 12px;
  background: #181818;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.match-item.win {
  border-color: #4caf50;
  background: rgba(76, 175, 80, 0.1);
}
.match-item.loss {
  border-color: #f44336;
  background: rgba(244, 67, 54, 0.1);
}
.match-item:hover {
  border-color: #ff9800;
}
.hero-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-width: 80px;
}
.hero-image {
  width: 50%;
  height: 50%;
  border-radius: 8px;
  object-fit: cover;
  border: 3px solid #ff9800;
  box-shadow: 0 0 15px rgba(255, 152, 0, 0.3);
  transition: all 0.3s;
}
.hero-image:hover {
  border-color: #ffb74d;
  box-shadow: 0 0 25px rgba(255, 152, 0, 0.6);
  transform: scale(1.05);
}
.hero-name {
  font-size: 14px;
  text-align: center;
  color: #cfcfcf;
  font-weight: bold;
  max-width: 100px;
  word-wrap: break-word;
}
.match-stats {
  flex: 1;
  min-width: 200px;
}
.match-result {
  font-size: 18px;
  font-weight: bold;
  margin-bottom: 8px;
}
.match-result.win {
  color: #4caf50;
}
.match-result.loss {
  color: #f44336;
}
.stats-row {
  display: flex;
  gap: 16px;
  font-size: 14px;
  color: #cfcfcf;
  margin: 4px 0;
}
.stat-item {
  display: flex;
  gap: 4px;
}
.stats-row {
  display: flex;
  gap: 16px;
  font-size: 14px;
  color: #cfcfcf;
  margin: 4px 0;
}
.stat-label {
  color: #aab4c3;
}
.top-hero-card {
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 8px;
  padding: 12px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}
.top-hero-card:hover {
  border-color: #ff9800;
  transform: translateY(-2px);
}
.top-hero-image {
  /* Stesse proporzioni del ritratto (16:9): niente teste tagliate quando la card si allarga. */
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  object-fit: cover;
  object-position: center top;
  margin-bottom: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.top-hero-name {
  font-size: 12px;
  font-weight: bold;
  color: #cfcfcf;
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.top-hero-stats {
  font-size: 11px;
  color: #aab4c3;
  margin: 4px 0;
}
.top-hero-winrate {
  font-weight: bold;
  color: #4caf50;
  font-size: 13px;
  margin-top: 6px;
}

.meta-controls {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin-top: 14px;
  align-items: end;
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.meta-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  padding: 12px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: center;
}

.meta-rank {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  background: rgba(47, 111, 255, 0.2);
  color: #d6e5ff;
  border: 1px solid rgba(47, 111, 255, 0.4);
}

.meta-hero-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.meta-hero-row img {
  width: 46px;
  height: 46px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.meta-hero-name {
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
}

.meta-hero-sub {
  font-size: 12px;
  color: #9fb5d4;
  margin-top: 2px;
}

.meta-stats {
  margin-top: 8px;
  font-size: 12px;
  color: #c9d8ef;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.meta-highlight {
  color: #6be97d;
  font-weight: 700;
}

.meta-groups {
  display: grid;
  gap: 18px;
  margin-top: 16px;
}

.meta-role-board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.stratz-position-board {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: start;
}

.stratz-position-board .meta-role-section {
  min-width: 0;
}

.stratz-position-board .meta-grid {
  grid-template-columns: 1fr;
}

.meta-role-section {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 12px;
}

.meta-group-title {
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #9fb5d4;
  margin-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  padding-bottom: 6px;
}

.meta-tag {
  display: inline-block;
  margin-left: 8px;
  font-size: 11px;
  color: #9fb5d4;
  border: 1px solid rgba(159, 181, 212, 0.4);
  border-radius: 999px;
  padding: 2px 7px;
}

.meta-account {
  margin-top: 6px;
  font-size: 11px;
  color: #ffc66d;
}

.meta-rank-hint {
  margin-top: 5px;
  font-size: 11px;
  color: #9fb5d4;
}

.meta-expand-btn {
  margin-top: 10px;
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.04);
  color: #d9e6ff;
  border-radius: 10px;
  padding: 8px 10px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
}

.meta-expand-btn:hover {
  border-color: rgba(47, 111, 255, 0.5);
  background: rgba(47, 111, 255, 0.15);
}

@media (max-width: 760px) {
  .meta-role-board {
    grid-template-columns: 1fr;
  }
}

/* ------------------------------------------------------------------ */
/* Componenti aggiunti: feedback di caricamento, errori, toast         */
/* ------------------------------------------------------------------ */
:focus-visible {
  outline: 2px solid #8cc7ff;
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.muted-text {
  color: #aab4c3;
}

.hint-text {
  color: var(--muted);
  font-size: 13px;
  margin: 10px 0 0;
}

.link-subtle {
  color: #8cc7ff;
  text-decoration: none;
  border-bottom: 1px solid rgba(140, 199, 255, 0.4);
}

.link-subtle:hover {
  border-bottom-color: #8cc7ff;
}

.btn-spinner,
button.is-loading::after {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: -2px;
}

.btn-spinner {
  margin-right: 8px;
}

button.is-loading::after {
  content: "";
  margin-left: 8px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.skeleton {
  border-radius: 14px;
  margin-top: 12px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.04) 25%, rgba(255, 255, 255, 0.09) 50%, rgba(255, 255, 255, 0.04) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}

.skeleton-row { height: 44px; }
.skeleton-match { height: 120px; }
.skeleton-card { height: 150px; }

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.error-state {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 12px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid rgba(255, 91, 91, 0.35);
  background: rgba(255, 91, 91, 0.08);
  color: #ffb4b4;
}

.toast-container {
  position: fixed;
  right: 16px;
  bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 1000;
  max-width: min(420px, calc(100vw - 32px));
}

.toast {
  padding: 12px 16px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.98);
  border: 1px solid var(--border);
  color: var(--text);
  box-shadow: var(--shadow);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.toast-success { border-color: rgba(76, 217, 100, 0.5); }
.toast-error { border-color: rgba(255, 91, 91, 0.6); }
.toast-hide { opacity: 0; transform: translateY(8px); }

.pagination-info {
  align-self: center;
  color: var(--muted);
  font-size: 13px;
}

/* Simulatore rank */
.rank-item-label {
  font-size: 14px;
  color: #aab4c3;
  margin-bottom: 8px;
}

.rank-item-range {
  font-size: 12px;
  color: #aab4c3;
}

.rank-targets {
  margin-top: 16px;
  padding: 12px 14px;
  background: #1a1a1a;
  border-radius: 10px;
  display: grid;
  gap: 8px;
}

.rank-target {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
  align-items: baseline;
}

.rank-target-estimate {
  font-size: 13px;
  font-weight: 600;
}

.rank-targets-note {
  font-size: 12px;
  color: #aab4c3;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 8px;
}

@media (max-width: 520px) {
  .rank-target {
    grid-template-columns: 1fr auto;
  }
  .rank-target-estimate {
    grid-column: 1 / -1;
  }
}

/* Match salvati e MMR multiplo */
.saved-match {
  flex-direction: column;
  align-items: stretch;
  padding: 16px;
  gap: 12px;
}

.saved-match-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.saved-match-hero {
  display: flex;
  align-items: center;
  gap: 12px;
}

.saved-match-hero-name {
  font-weight: 700;
  color: #fff;
}

.saved-match-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12px;
  color: #aab4c3;
}

.saved-match-summary {
  min-width: 120px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  font-size: 12px;
}

.saved-match-kda {
  color: #cfcfcf;
}

.saved-match-kda span {
  color: var(--muted);
}

.mmr-input.is-dirty {
  border-color: rgba(255, 152, 0, 0.75);
  box-shadow: 0 0 0 3px rgba(255, 152, 0, 0.15);
}

.match-note {
  font-size: 12px;
}

.match-note-bc { color: #c8a0ff; }
.match-note-unranked { color: #ffb36b; }
.match-note-saved { color: var(--muted); font-size: 13px; }

.bulk-mmr-bar {
  position: sticky;
  bottom: 12px;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255, 152, 0, 0.5);
  background: rgba(40, 26, 6, 0.96);
  color: #ffd08a;
  font-weight: 600;
}

.bulk-mmr-actions {
  display: flex;
  gap: 8px;
}

.picks-toggle {
  background: rgba(255, 255, 255, 0.08);
  color: #ccc;
}

.match-links {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.match-link {
  flex: 1;
  padding: 6px 12px;
  color: #fff;
  text-align: center;
  text-decoration: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
}

.match-link-dotabuff { background: #922b21; }
.match-link-opendota { background: #1f4788; }
.match-link:hover { filter: brightness(1.15); }

/* Pick Radiant/Dire */
.picks-teams {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  padding: 10px 0 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  margin-top: 4px;
}

.picks-team {
  flex: 1;
  min-width: 0;
}

.picks-team-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}

.picks-team-radiant .picks-team-title { color: #4caf50; }
.picks-team-dire .picks-team-title { color: #f44336; }

.picks-team-heroes {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pick-hero {
  position: relative;
  border-radius: 6px;
  overflow: hidden;
  flex-shrink: 0;
  border: 2px solid transparent;
}

.picks-team-radiant .pick-hero { border-color: rgba(76, 175, 80, 0.33); }
.picks-team-dire .pick-hero { border-color: rgba(244, 67, 54, 0.33); }

.pick-hero.is-highlighted {
  border-color: #ff9800;
  box-shadow: 0 0 12px rgba(255, 152, 0, 0.55);
}

.pick-hero img,
.pick-hero-fallback {
  width: 44px;
  height: 44px;
  display: block;
  object-fit: cover;
}

.pick-hero-fallback {
  background: #222;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  color: #aaa;
}

.pick-hero-badge {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(255, 152, 0, 0.85);
  font-size: 8px;
  font-weight: 700;
  text-align: center;
  color: #fff;
  padding: 1px 0;
}

.picks-loading,
.picks-error {
  font-size: 12px;
  padding: 6px 0;
}

.picks-loading { color: var(--muted); }
.picks-error { color: #ff8a80; }

button.top-hero-card {
  width: 100%;
  font: inherit;
  color: inherit;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ------------------------------------------------------------------ */
/* Storico: toolbar periodo, riepilogo, lista                          */
/* ------------------------------------------------------------------ */
.history-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 6px 0 12px;
}

.history-toolbar #refreshHistory {
  margin-left: auto;
}

.history-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin: 12px 0 4px;
}

.history-summary:empty {
  display: none;
}

.summary-card {
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  min-width: 0;
}

.summary-card-label {
  font-size: 12px;
  color: #aab4c3;
}

.summary-card-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin-top: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.summary-card-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.history-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 20px;
}

.history-list-header h3 {
  margin: 0;
}

.inline-select-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: #aab4c3;
  font-size: 13px;
  white-space: nowrap;
}

.inline-select {
  width: auto;
  min-width: 70px;
  min-height: 40px;
  padding: 7px 28px 7px 9px;
  border-radius: 10px;
}

.history-row {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr 1.4fr;
  align-items: center;
  gap: 10px;
  padding: 10px 8px;
  border-bottom: 1px solid #333;
  margin-bottom: 0;
  border-radius: 0;
  box-shadow: none;
}

.history-row-date {
  color: #cfcfcf;
  min-width: 0;
}

.history-row-mmr {
  color: #cfcfcf;
  text-align: center;
  font-weight: 600;
  min-width: 0;
}

.history-row-rank {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
}

.history-gap {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
}

.history-row-match {
  min-width: 0;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
}

.history-row-match img,
.history-row-noimg {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.16);
}

.history-row-noimg {
  border: none;
}

.history-row-hero {
  min-width: 0;
  overflow: hidden;
  color: #9fb5d4;
  font-size: 12px;
}

.history-row-hero > div {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-row-kda {
  font-size: 11px;
  opacity: 0.9;
}

.history-row-link {
  justify-self: end;
  font-size: 12px;
  white-space: nowrap;
}

@media (max-width: 640px) {
  .history-row {
    grid-template-columns: 1fr 1fr;
  }
  .history-row-match {
    grid-column: 1 / -1;
  }
  .history-toolbar #refreshHistory {
    margin-left: 0;
  }
}

/* ------------------------------------------------------------------ */
/* Match: filtri e statistiche                                         */
/* ------------------------------------------------------------------ */
.filters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-top: 18px;
  align-items: end;
}

.filters-grid label {
  margin: 0 0 8px;
}

.filters-actions {
  display: flex;
  align-items: flex-end;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin: 16px 0;
}

.stat-card {
  background: #1a1a1a;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid #333;
}

.stat-card-label {
  font-size: 12px;
  color: #aab4c3;
}

.stat-card-value {
  font-size: 24px;
  font-weight: 700;
  color: #cfcfcf;
}

.stat-card-value-sm {
  font-size: 18px;
}

.stats-subtitle {
  margin: 20px 0 12px;
}

.stats-subtitle .muted-text {
  font-size: 13px;
  font-weight: 400;
}

.top-heroes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

.top-hero-card.is-selected {
  border-color: #ff9800;
  box-shadow: 0 0 0 2px rgba(255, 152, 0, 0.35);
}

.mmr-hint-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.mmr-hint-row .hint-text {
  flex: 1;
  min-width: 240px;
}

.pagination-row {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 12px;
}

/* ------------------------------------------------------------------ */
/* Rank Checker: rank attuale                                          */
/* ------------------------------------------------------------------ */
.rank-current {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  margin-bottom: 16px;
  border-radius: 16px;
  border: 1px solid rgba(255, 152, 0, 0.45);
  background: rgba(255, 152, 0, 0.07);
}

.rank-current-image {
  width: 64px;
  height: 64px;
  object-fit: contain;
}

.rank-current-body {
  flex: 1;
  min-width: 0;
}

.rank-current-title {
  font-weight: 600;
}

.rank-current-sub {
  font-size: 13px;
  color: var(--muted);
  margin-top: 6px;
}

.rank-progress {
  height: 8px;
  margin-top: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.rank-progress-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2f6fff, #ff9800);
}

.rank-entry.is-current {
  border-color: #ff9800 !important;
  box-shadow: 0 0 0 2px rgba(255, 152, 0, 0.35);
  background: rgba(255, 152, 0, 0.08);
}

.rank-entry-badge {
  display: inline-block;
  margin-top: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  color: #1a1206;
  background: #ff9800;
}

/* ------------------------------------------------------------------ */
/* Meta: filtri avanzati                                               */
/* ------------------------------------------------------------------ */
.meta-controls-actions {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.meta-advanced {
  margin-top: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 8px 12px 12px;
  background: rgba(255, 255, 255, 0.02);
}

.meta-advanced summary {
  cursor: pointer;
  color: var(--muted);
  font-weight: 600;
  padding: 4px 0;
}

.meta-advanced[open] summary {
  color: var(--text);
}

/* ------------------------------------------------------------------ */
/* Report vittorie/sconfitte per periodo                               */
/* ------------------------------------------------------------------ */
.record-report {
  margin-top: 20px;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.record-report-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.record-report-header h3 {
  margin: 0;
}

.record-report-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
}

.checkbox-label input {
  width: auto;
  min-height: 0;
  accent-color: #ff9800;
}

.record-row {
  display: grid;
  grid-template-columns: minmax(150px, 1.4fr) 60px minmax(140px, 2fr) 70px 70px;
  align-items: center;
  gap: 12px;
  padding: 9px 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 14px;
}

.record-row-head {
  font-size: 12px;
  color: #aab4c3;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.record-label {
  display: flex;
  flex-direction: column;
  min-width: 0;
  font-weight: 600;
}

.record-sub {
  font-size: 11px;
  font-weight: 400;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.record-games,
.record-winrate,
.record-mmr {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.record-winrate,
.record-mmr {
  font-weight: 700;
}

.record-bar-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.record-bar {
  display: flex;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
}

.record-bar-win { background: #4caf50; }
.record-bar-loss { background: #f44336; }

.record-wl {
  font-size: 12px;
  white-space: nowrap;
}

.is-positive { color: #4cd964; }
.is-negative { color: #ff6b6b; }

.record-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 10px;
  font-size: 13px;
  color: #cfcfcf;
}

@media (max-width: 640px) {
  .record-row {
    grid-template-columns: 1fr auto auto;
  }
  .record-row-head {
    display: none;
  }
  .record-bar-cell {
    grid-column: 1 / -1;
    order: 5;
  }
  .record-games {
    display: none;
  }
}

/* ------------------------------------------------------------------ */
/* Navbar: icone e barra di navigazione in basso su mobile             */
/* ------------------------------------------------------------------ */
.navbar a {
  gap: 6px;
}

.nav-icon {
  font-size: 1rem;
  line-height: 1;
}

@media (max-width: 760px) {
  body {
    padding-bottom: 84px;
  }

  .navbar {
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    flex-direction: row;
    gap: 0;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    border-radius: 16px 16px 0 0;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .navbar::-webkit-scrollbar {
    display: none;
  }

  .nav-group {
    flex-direction: row;
    flex-shrink: 0;
  }

  .nav-group-label {
    display: none;
  }

  .nav-group-links {
    flex-wrap: nowrap;
    gap: 2px;
  }

  .navbar a {
    flex-direction: column;
    min-height: 56px;
    min-width: 66px;
    padding: 6px 8px;
    gap: 3px;
    font-size: 11px;
    background: transparent;
  }

  .navbar a.active {
    background: rgba(47, 111, 255, 0.22);
  }

  .nav-icon {
    font-size: 1.25rem;
  }

  .toast-container {
    bottom: 96px;
  }

  .bulk-mmr-bar {
    bottom: 84px;
  }
}

/* ------------------------------------------------------------------ */
/* Toast con azione                                                   */
/* ------------------------------------------------------------------ */
.toast-with-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.toast-action {
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 152, 0, 0.6);
  background: rgba(255, 152, 0, 0.15);
  color: #ffd08a;
  font-weight: 700;
  white-space: nowrap;
}

/* ------------------------------------------------------------------ */
/* Riepilogo                                                          */
/* ------------------------------------------------------------------ */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
  margin-top: 12px;
}

.dash-card {
  padding: 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  min-width: 0;
}

.dash-card:empty {
  display: none;
}

.dash-rank {
  grid-column: span 2;
}

.dash-wide {
  grid-column: 1 / -1;
}

@media (max-width: 640px) {
  .dash-rank {
    grid-column: 1 / -1;
  }
}

.dash-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #9fb5d4;
  margin-bottom: 10px;
}

.dash-title-link {
  text-transform: none;
  letter-spacing: 0;
  font-weight: 600;
}

.dash-rank-body {
  display: flex;
  align-items: center;
  gap: 16px;
}

.dash-big {
  font-size: 26px;
  font-weight: 800;
  color: var(--text);
}

.dash-streak {
  margin-top: 10px;
  font-weight: 600;
}

.dash-cta {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(47, 111, 255, 0.45), rgba(255, 122, 0, 0.35));
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.dash-cta:hover {
  filter: brightness(1.1);
}

.dash-match {
  display: grid;
  grid-template-columns: 36px 1fr auto auto 56px;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin-top: 8px;
  padding: 8px 12px;
  text-align: left;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-left: 3px solid transparent;
}

.dash-match.win { border-left-color: #4caf50; }
.dash-match.loss { border-left-color: #f44336; }

.dash-match img,
.dash-match .history-row-noimg {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  object-fit: cover;
}

.dash-match-hero {
  display: flex;
  flex-direction: column;
  min-width: 0;
  font-weight: 700;
  text-transform: capitalize;
}

.dash-match-sub {
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
  text-transform: none;
}

.dash-match-kda {
  font-variant-numeric: tabular-nums;
  color: #cfcfcf;
}

.dash-match.win .dash-match-result { color: #4cd964; }
.dash-match.loss .dash-match-result { color: #ff6b6b; }

.dash-match-mmr {
  text-align: right;
  font-weight: 700;
  color: #ffb36b;
}

@media (max-width: 520px) {
  .dash-match {
    grid-template-columns: 36px 1fr auto;
  }
  .dash-match-kda,
  .dash-match-mmr {
    display: none;
  }
}

/* Primi passi */
.onboarding {
  margin: 8px 0 4px;
  padding: 16px;
  border-radius: 18px;
  border: 1px solid rgba(47, 111, 255, 0.45);
  background: rgba(47, 111, 255, 0.08);
}

.onboarding-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.onboarding-step {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.onboarding-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.3);
  color: #08111d;
  font-weight: 800;
  flex-shrink: 0;
}

.onboarding-step.is-done .onboarding-check {
  background: #4cd964;
  border-color: #4cd964;
}

.onboarding-step.is-done .onboarding-text {
  opacity: 0.6;
}

.onboarding-text {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 200px;
}

.onboarding-text span {
  font-size: 13px;
  color: var(--muted);
}

/* ------------------------------------------------------------------ */
/* Pannello dettaglio partita                                         */
/* ------------------------------------------------------------------ */
.match-dialog {
  width: min(1100px, calc(100vw - 24px));
  max-height: calc(100vh - 40px);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: #0b1626;
  color: var(--text);
  box-shadow: var(--shadow);
}

.match-dialog::backdrop {
  background: rgba(2, 6, 12, 0.7);
  backdrop-filter: blur(3px);
}

.match-dialog-header {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  background: #0b1626;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.match-dialog-header h2 {
  margin: 0;
  font-size: 1.15rem;
}

.match-dialog-body {
  padding: 14px 18px 20px;
}

.detail-summary {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 14px;
  color: #cfcfcf;
  margin-bottom: 12px;
}

.detail-score {
  font-size: 22px;
  font-weight: 800;
}

.detail-score .radiant { color: #4caf50; }
.detail-score .dire { color: #f44336; }

.detail-team {
  margin-top: 14px;
}

.detail-team-title {
  font-weight: 700;
  margin-bottom: 6px;
}

.detail-table {
  overflow-x: auto;
}

.detail-row {
  display: grid;
  grid-template-columns: minmax(170px, 1.6fr) 80px 70px 90px minmax(90px, 1fr) minmax(250px, 2fr);
  align-items: center;
  gap: 10px;
  min-width: 780px;
  padding: 6px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.detail-row-head {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #aab4c3;
}

.detail-row.is-highlighted {
  background: rgba(255, 152, 0, 0.12);
  border-radius: 8px;
}

.detail-hero {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.detail-hero img {
  width: 48px;
  height: 27px;
  border-radius: 4px;
  object-fit: cover;
}

.detail-hero > span {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.detail-sub {
  font-size: 11px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-damage {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.detail-damage-bar {
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.detail-damage-bar span {
  display: block;
  height: 100%;
  background: #ff9800;
}

.detail-items {
  display: flex;
  align-items: center;
  gap: 3px;
  flex-wrap: wrap;
}

.item-icon {
  width: 36px;
  height: 26px;
  border-radius: 4px;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.05);
}

.item-empty {
  display: inline-block;
}

.item-neutral {
  width: 26px;
  border-radius: 50%;
  margin-left: 4px;
}

.match-link-detail {
  background: #2f4b7c;
  border: none;
  cursor: pointer;
}

/* ------------------------------------------------------------------ */
/* Confronto Follow Players                                           */
/* ------------------------------------------------------------------ */
.follow-compare {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.compare-head,
.compare-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: center;
}

.compare-head {
  font-weight: 700;
  margin-bottom: 6px;
}

.compare-head span:last-child,
.compare-row span:last-child {
  text-align: right;
}

.compare-row {
  padding: 6px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.compare-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  text-align: center;
}

.compare-together {
  margin-top: 10px;
  font-size: 13px;
  color: #cfcfcf;
}

.stats-subtitle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin: 20px 0 12px;
}

.stats-subtitle-row .stats-subtitle {
  margin: 0;
}

/* ------------------------------------------------------------------ */
/* Lista match salvati: righe compatte                                 */
/* ------------------------------------------------------------------ */
.saved-row {
  margin-top: 8px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-left: 3px solid transparent;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.saved-row:hover {
  background: rgba(255, 255, 255, 0.05);
}

.saved-row.win { border-left-color: #4caf50; }
.saved-row.loss { border-left-color: #f44336; }

.saved-row.is-missing-mmr {
  border-color: rgba(255, 152, 0, 0.45);
  background: rgba(255, 152, 0, 0.05);
}

.saved-row.is-dirty {
  border-color: rgba(255, 152, 0, 0.8);
}

.saved-row-main {
  display: grid;
  grid-template-columns: 40px minmax(150px, 1.6fr) 90px 80px minmax(150px, auto) auto;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
}

.saved-row-hero-img {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.05);
}

.saved-row-hero {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.saved-row-hero-name {
  font-weight: 700;
  color: #fff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.saved-row-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--muted);
}

.saved-row-meta .match-badge {
  padding: 1px 7px;
  font-size: 10px;
}

.match-badge.missing-mmr {
  color: #ffb36b;
  border: 1px solid rgba(255, 152, 0, 0.5);
  background: rgba(255, 152, 0, 0.12);
}

.saved-row-kda {
  display: flex;
  flex-direction: column;
  font-variant-numeric: tabular-nums;
  color: #e6ecf7;
}

.saved-row-sub {
  font-size: 11px;
  color: var(--muted);
}

.saved-row-result {
  font-weight: 700;
}

.saved-row.win .saved-row-result { color: #4cd964; }
.saved-row.loss .saved-row-result { color: #ff6b6b; }

.saved-row-mmr {
  display: flex;
  align-items: center;
  gap: 6px;
}

.saved-row-mmr .mmr-input {
  width: 100px;
  min-height: 38px;
  padding: 8px 10px;
  border-radius: 10px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.saved-row-save {
  min-width: 38px;
  min-height: 38px;
  padding: 0;
  border-radius: 10px;
  font-size: 16px;
}

.saved-row-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

.saved-row-btn {
  min-height: 34px;
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.06);
  color: #d4dcea;
  white-space: nowrap;
}

.saved-row-picks {
  padding: 0 12px 10px;
}

.mmr-hint-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.missing-mmr-count {
  color: #ffb36b;
  font-size: 13px;
}

.link-button {
  padding: 0;
  min-height: 0;
  border: none;
  background: none;
  color: #8cc7ff;
  font-size: inherit;
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
}

.link-button:hover {
  transform: none;
  box-shadow: none;
}

.filters-actions {
  gap: 12px;
  flex-wrap: wrap;
}

@media (max-width: 860px) {
  .saved-row-main {
    grid-template-columns: 40px 1fr auto;
    grid-template-areas:
      "img hero result"
      "kda mmr mmr"
      "actions actions actions";
  }
  .saved-row-hero-img { grid-area: img; }
  .saved-row-hero { grid-area: hero; }
  .saved-row-result { grid-area: result; text-align: right; }
  .saved-row-kda { grid-area: kda; grid-column: 1 / 2; }
  .saved-row-mmr { grid-area: mmr; justify-content: flex-end; }
  .saved-row-actions { grid-area: actions; justify-content: stretch; }
  .saved-row-actions .saved-row-btn { flex: 1; }
  .saved-row-kda .saved-row-sub { display: none; }
}

.saved-row.is-dirty .match-badge.missing-mmr {
  display: none;
}

@media (max-width: 760px) {
  .bulk-mmr-bar {
    padding: 8px 10px;
    font-size: 13px;
    flex-wrap: nowrap;
  }
  .bulk-mmr-actions button {
    padding: 8px 10px;
    white-space: nowrap;
  }
  .bulk-mmr-actions #discardAllMmr {
    display: none;
  }
}

/* Pulsanti rapidi +25 / -25 */
.quick-mmr {
  display: inline-flex;
  gap: 4px;
  margin-left: 2px;
}

.quick-mmr-btn {
  min-width: 44px;
  min-height: 38px;
  padding: 0 8px;
  border-radius: 10px;
  font-weight: 800;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.quick-win {
  color: #7ee08b;
  border-color: rgba(76, 175, 80, 0.45);
  background: rgba(76, 175, 80, 0.1);
}

.quick-loss {
  color: #ff8a80;
  border-color: rgba(244, 67, 54, 0.45);
  background: rgba(244, 67, 54, 0.1);
}

.quick-mmr-btn.is-match-result {
  box-shadow: 0 0 0 2px currentColor inset;
}


@media (min-width: 861px) {
  .saved-row-main {
    grid-template-columns: 40px minmax(150px, 1.6fr) 90px 80px 260px auto;
  }
}

@media (max-width: 860px) {
  .saved-row-main > * {
    min-width: 0;
  }
  .saved-row-mmr {
    flex-wrap: wrap;
    gap: 6px;
  }
  .saved-row-mmr .mmr-input {
    width: 84px;
  }
  .quick-mmr-btn {
    min-width: 40px;
    padding: 0 6px;
  }
}

/* ------------------------------------------------------------------ */
/* Topbar: logo, navigazione principale con menu a tendina, utente     */
/* ------------------------------------------------------------------ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  gap: 20px;
  margin: -18px calc(-1 * clamp(16px, 3vw, 48px)) 0;
  padding: 10px clamp(16px, 3vw, 48px);
  background: rgba(6, 12, 22, 0.88);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(16px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  flex-shrink: 0;
}

.brand-logo {
  width: 32px;
  height: 32px;
  border-radius: 8px;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.brand-name {
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}

.brand-sub {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

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

.topnav-list {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.topnav .nav-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: #c9d6ea;
  font-size: 0.93rem;
  font-weight: 600;
  text-decoration: none;
  box-shadow: none;
  white-space: nowrap;
}

.topnav .nav-link:hover {
  transform: none;
  box-shadow: none;
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}

.topnav .nav-link.active {
  color: #fff;
  background: rgba(47, 111, 255, 0.18);
  border-color: rgba(47, 111, 255, 0.35);
}

.topnav .nav-icon {
  font-size: 0.95rem;
}

.nav-caret {
  font-size: 0.7rem;
  opacity: 0.7;
  transition: transform 0.2s ease;
}

.nav-dropdown {
  position: relative;
}

.nav-dropdown.open > .nav-dropdown-toggle .nav-caret {
  transform: rotate(180deg);
}

.nav-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 10;
  display: none;
  min-width: 260px;
  margin: 0;
  padding: 6px;
  list-style: none;
  border-radius: 14px;
  background: #0d1a2c;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}

.nav-menu-right {
  left: auto;
  right: 0;
}

.nav-dropdown.open > .nav-menu {
  display: block;
}

.topbar .nav-menu-link {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  min-height: 0;
  padding: 9px 12px;
  border-radius: 10px;
  white-space: normal;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text);
  text-decoration: none;
  box-shadow: none;
}

.topbar .nav-menu-link:hover,
.topbar .nav-menu-link:focus-visible {
  transform: none;
  box-shadow: none;
  background: rgba(255, 255, 255, 0.06);
}

.topbar .nav-menu-link.active {
  background: rgba(47, 111, 255, 0.18);
  border-color: rgba(47, 111, 255, 0.35);
}

.nav-menu-title {
  font-weight: 700;
}

.nav-menu-desc {
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
}

.nav-menu-logout {
  color: #ff8a80 !important;
  font-weight: 700;
}

body:not(.is-logged-in) .nav-private {
  display: none;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.topbar-login,
.topbar-register {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 8px 14px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.92rem;
  text-decoration: none;
  white-space: nowrap;
}

.topbar-login {
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.16);
}

.topbar-register {
  color: #fff;
  background: linear-gradient(135deg, #2f6fff, #ff7a00);
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 4px 10px 4px 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
}

.user-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2f6fff, #ff7a00);
  color: #fff;
  font-weight: 800;
}

.user-name {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 1100px) {
  .topnav .nav-icon {
    display: none;
  }
  .user-name {
    display: none;
  }
}

/* Mobile: logo e utente in alto, navigazione principale in basso */
@media (max-width: 760px) {
  .topbar {
    gap: 10px;
    padding: 8px 16px;
  }

  .brand-sub {
    display: none;
  }

  .topbar-user {
    margin-left: auto;
  }

  .topbar-register {
    display: none;
  }

  .topnav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 200;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    background: rgba(8, 15, 27, 0.97);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(16px);
  }

  .topnav-list {
    justify-content: space-around;
    gap: 0;
  }

  .topnav-list > li {
    flex: 1;
  }

  .topnav-list > li > .nav-link {
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    width: 100%;
    min-height: 54px;
    padding: 4px 2px;
    font-size: 11px;
  }

  .topnav .nav-icon {
    display: inline;
    font-size: 1.25rem;
  }

  .topnav .nav-caret {
    display: none;
  }

  .topnav .nav-dropdown {
    position: static;
  }

  .topnav .nav-menu {
    position: fixed;
    top: auto;
    left: 8px;
    right: 8px;
    bottom: calc(76px + env(safe-area-inset-bottom));
    min-width: 0;
  }

  .navbar-spacer,
  body {
    padding-bottom: 76px;
  }
}

/* ------------------------------------------------------------------ */
/* Landing page                                                       */
/* ------------------------------------------------------------------ */
.landing {
  display: flex;
  flex-direction: column;
  gap: 48px;
  padding: 24px 0 8px;
}

.landing-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  align-items: center;
  gap: 40px;
}

.landing-eyebrow {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #ffb36b;
  background: rgba(255, 152, 0, 0.12);
  border: 1px solid rgba(255, 152, 0, 0.3);
}

.landing h1 {
  margin: 16px 0 14px;
  font-size: clamp(2.2rem, 5vw, 3.6rem);
  line-height: 1.05;
  letter-spacing: -0.035em;
}

.landing-lead {
  margin: 0;
  max-width: 560px;
  font-size: 1.08rem;
  line-height: 1.65;
  color: #c3d1e6;
}

.landing-ctas {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 26px;
}

.landing-cta-primary,
.landing-cta-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 12px 22px;
  border-radius: 12px;
  font-weight: 800;
  text-decoration: none;
}

.landing-cta-primary {
  color: #fff;
  background: linear-gradient(135deg, #2f6fff, #ff7a00);
  box-shadow: 0 12px 30px rgba(47, 111, 255, 0.25);
}

.landing-cta-secondary {
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.04);
}

.landing-cta-primary:hover,
.landing-cta-secondary:hover {
  filter: brightness(1.1);
}

.landing-note {
  margin: 14px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.preview-card {
  padding: 20px;
  border-radius: 22px;
  background: linear-gradient(160deg, rgba(20, 36, 60, 0.95), rgba(10, 18, 32, 0.95));
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: var(--shadow);
  transform: rotate(-1.2deg);
}

.preview-rank {
  display: flex;
  align-items: center;
  gap: 14px;
}

.preview-rank img {
  width: 72px;
  height: 72px;
  object-fit: contain;
}

.preview-rank > div {
  flex: 1;
}

.preview-rank-name {
  font-size: 1.4rem;
  font-weight: 800;
}

.preview-rank-mmr,
.preview-rank-sub {
  font-size: 13px;
  color: var(--muted);
}

.preview-chart {
  width: 100%;
  height: 120px;
  margin: 16px 0 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
}

.preview-record {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  font-size: 14px;
}

.landing-features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}

.landing-feature {
  padding: 20px;
  border-radius: 18px;
  background: rgba(8, 14, 24, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.07);
}

.landing-feature-icon {
  font-size: 1.6rem;
}

.landing-feature h2 {
  margin: 10px 0 6px;
  font-size: 1.08rem;
}

.landing-feature p {
  margin: 0;
  color: #b5c3d9;
  line-height: 1.55;
  font-size: 0.95rem;
}

.landing-steps {
  padding: 28px;
  border-radius: 22px;
  text-align: center;
  background: linear-gradient(135deg, rgba(47, 111, 255, 0.12), rgba(255, 122, 0, 0.1));
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.landing-steps h2 {
  margin: 0 0 18px;
}

.landing-steps ol {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin: 0 0 22px;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.landing-steps li {
  counter-increment: step;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.landing-steps li::before {
  content: counter(step);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, #2f6fff, #ff7a00);
}

.landing-steps li span {
  color: #b5c3d9;
  font-size: 0.93rem;
}

@media (max-width: 860px) {
  .landing-hero {
    grid-template-columns: 1fr;
  }
  .preview-card {
    transform: none;
  }
}

/* Footer */
.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 16px;
  padding: 18px 4px 0;
  font-size: 13px;
  color: var(--muted);
}

.site-footer a {
  color: #9fb5d4;
  text-decoration: none;
}

.site-footer a:hover {
  color: #fff;
}

@media (max-width: 760px) {
  /* backdrop-filter crea un nuovo contesto per gli elementi fixed: la barra in basso
     finirebbe dentro la topbar. Su mobile si usa uno sfondo pieno. */
  .topbar {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: rgba(6, 12, 22, 0.97);
  }
}

/* Griglia fissa: 6 card = 3+3 su desktop, 2+2+2 su tablet, una per riga su mobile (mai righe spaiate). */
.landing-features {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

@media (max-width: 960px) {
  .landing-features {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  .landing-features {
    grid-template-columns: 1fr;
  }
}

/* ------------------------------------------------------------------ */
/* Selettore di date (calendario)                                     */
/* ------------------------------------------------------------------ */
.date-range {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.date-range-field {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.date-range-field input {
  width: auto;
  min-height: 38px;
  padding: 6px 10px;
  border-radius: 10px;
  font-size: 14px;
  color-scheme: dark;
}

.date-range-clear {
  min-height: 38px;
  min-width: 38px;
  padding: 0;
  border-radius: 10px;
}

.filter-label {
  display: block;
  margin: 0 0 8px;
  font-size: 0.98rem;
  color: var(--muted);
}

/* ------------------------------------------------------------------ */
/* Navbar: sottomenu all'hover su desktop (il clic resta per touch e tastiera) */
/* ------------------------------------------------------------------ */
@media (hover: hover) and (min-width: 761px) {
  .topbar .nav-dropdown:hover > .nav-menu,
  .topbar .nav-dropdown:focus-within > .nav-menu {
    display: block;
  }

  .topbar .nav-dropdown:hover > .nav-dropdown-toggle .nav-caret {
    transform: rotate(180deg);
  }

  /* ponte invisibile tra voce e menu, cosi passando col mouse il menu non si chiude */
  .topbar .nav-menu::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: -10px;
    height: 10px;
  }
}

@media (min-width: 1000px) {
  .filters-dates {
    grid-column: span 2;
  }
}

.filters-actions {
  grid-column: 1 / -1;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
}

/* ------------------------------------------------------------------ */
/* Interruttore Tutte / Ranked / Pub                                  */
/* ------------------------------------------------------------------ */
.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.section-title-row h2 {
  margin: 0;
}

.match-type-switch .chart-toggle-btn {
  min-width: 72px;
}

/* ------------------------------------------------------------------ */
/* Sezione Eroi                                                       */
/* ------------------------------------------------------------------ */
.heroes-intro {
  max-width: 900px;
  margin-bottom: 12px;
}

.heroes-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  align-items: end;
}

.heroes-controls label {
  margin: 0 0 8px;
}

.heroes-legend {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 14px 0 4px;
  font-size: 13px;
  color: var(--muted);
}

.heroes-legend .hero-badge:not(:first-child) {
  margin-left: 12px;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.hero-badge.is-ready {
  color: #0c2412;
  background: #4cd964;
}

.hero-badge.is-promising {
  color: #2b1a02;
  background: #ffb347;
}

.heroes-summary {
  margin: 14px 0 6px;
  font-size: 13px;
  color: #cfcfcf;
}

.hero-row {
  display: grid;
  grid-template-columns: minmax(180px, 2fr) repeat(4, minmax(70px, 1fr)) minmax(120px, 1.2fr);
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.hero-row:not(.hero-row-head):hover {
  background: rgba(255, 255, 255, 0.04);
}

.hero-row.is-ready {
  background: rgba(76, 217, 100, 0.06);
}

.hero-row-head {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #aab4c3;
}

.hero-row-name {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.hero-row-name img {
  width: 48px;
  height: 27px;
  border-radius: 4px;
  object-fit: cover;
}

.hero-row-name > span {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.hero-row-num {
  display: flex;
  flex-direction: column;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.hero-row-sub {
  font-size: 11px;
  font-weight: 400;
  color: var(--muted);
}

.hero-row-rating {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
}

@media (max-width: 760px) {
  .hero-row-head {
    display: none;
  }
  .hero-row {
    grid-template-columns: 1fr 1fr;
    padding: 10px;
    margin-top: 6px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
  }
  .hero-row-name {
    grid-column: 1 / -1;
  }
  .hero-row-num::before {
    content: attr(data-label);
    font-size: 11px;
    font-weight: 400;
    color: var(--muted);
  }
  .hero-row-rating {
    grid-column: 1 / -1;
    flex-direction: row;
    align-items: center;
  }
}

/* Percentuale sulla barra del rank */
.rank-progress-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}

.rank-progress-row .rank-progress {
  flex: 1;
  margin-top: 0;
}

.rank-progress-pct {
  min-width: 38px;
  text-align: right;
  font-size: 13px;
  font-weight: 800;
  color: #ffb36b;
  font-variant-numeric: tabular-nums;
}

/* Chiavi API personali */
.api-keys-card {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid #333;
  border-radius: 10px;
  background: #111;
}

.api-keys-card h3 {
  margin: 0 0 6px;
  font-size: 16px;
  color: #ff9800;
}

.api-keys-card h3 .muted-text {
  font-size: 13px;
  font-weight: 400;
}

.api-key-field {
  margin-top: 12px;
}

.api-key-field label {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 6px;
}

.api-key-field label .link-subtle {
  font-size: 12px;
}

.api-key-status {
  margin-top: 6px;
  font-size: 13px;
  color: var(--muted);
}

.api-key-status code {
  color: #fff;
}

.api-key-badge {
  display: inline-block;
  margin-right: 6px;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  color: #cfd8e6;
  background: rgba(255, 255, 255, 0.08);
}

.api-key-badge.is-own {
  color: #0c2412;
  background: #4cd964;
}

/* ------------------------------------------------------------------ */
/* Eroi meno giocati                                                  */
/* ------------------------------------------------------------------ */
.least-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.least-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
}

.least-card.is-never {
  border-color: rgba(255, 152, 0, 0.45);
  background: rgba(255, 152, 0, 0.06);
}

.least-card img {
  width: 56px;
  height: 32px;
  border-radius: 6px;
  object-fit: cover;
}

.least-card-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* ------------------------------------------------------------------ */
/* Libreria oggetti                                                   */
/* ------------------------------------------------------------------ */
.items-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
  align-items: end;
}

.items-controls label {
  margin: 0 0 8px;
}

.items-controls-check {
  display: flex;
  align-items: center;
  min-height: 46px;
}

.items-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin: 12px 0 4px;
}

.items-updated {
  font-size: 12px;
  color: var(--muted);
}

.items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  margin-top: 8px;
}

.item-tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 10px;
  min-height: 0;
  text-align: left;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
}

.item-tile:hover {
  border-color: rgba(255, 152, 0, 0.5);
}

.item-tile img,
.item-tile-noimg {
  width: 64px;
  height: 47px;
  border-radius: 6px;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.05);
}

.item-tile-name {
  font-weight: 700;
  color: #fff;
  font-size: 13px;
}

.item-tile-cost {
  font-size: 12px;
  color: #ffd166;
}

.item-tile-change {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--muted);
}

.change-badge {
  display: inline-flex;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.change-badge.is-buff { color: #0c2412; background: #4cd964; }
.change-badge.is-nerf { color: #2a0606; background: #ff6b6b; }
.change-badge.is-new { color: #06142a; background: #8cc7ff; }
.change-badge.is-change,
.change-badge.is-mixed { color: #1a1a1a; background: #c9d1dc; }

.changelog-summary {
  display: flex;
  align-items: center;
  gap: 8px 12px;
  flex-wrap: wrap;
  margin: 10px 0;
  font-size: 13px;
  color: #cfcfcf;
}

.changelog-item {
  padding: 10px 12px;
  margin-top: 8px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
}

.changelog-item-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0;
  min-height: 0;
  border: none;
  background: none;
  color: var(--text);
}

.changelog-item-head:hover {
  transform: none;
  box-shadow: none;
}

.changelog-item-head img {
  width: 44px;
  height: 32px;
  border-radius: 5px;
  object-fit: cover;
}

.change-lines {
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 4px;
}

.change-line {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 13px;
  color: #d8e0ec;
}

.change-dot {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #8a94a6;
  transform: translateY(-1px);
}

.change-line.is-buff .change-dot { background: #4cd964; }
.change-line.is-nerf .change-dot { background: #ff6b6b; }
.change-line.is-new .change-dot { background: #8cc7ff; }

.item-dialog {
  width: min(720px, calc(100vw - 24px));
}

.item-detail-head {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.item-detail-img {
  width: 88px;
  height: 64px;
  border-radius: 8px;
  object-fit: cover;
}

.item-detail-meta {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 14px;
  color: #cfcfcf;
}

.item-attrib {
  margin: 8px 0 0;
  padding-left: 18px;
  font-size: 13px;
  color: #d8e0ec;
}

.item-ability {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
}

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

.item-ability-type {
  margin-right: 6px;
  padding: 1px 7px;
  border-radius: 6px;
  font-size: 10px;
  text-transform: uppercase;
  color: #ffd166;
  background: rgba(255, 209, 102, 0.12);
}

.item-ability p {
  margin: 6px 0 0;
  font-size: 13px;
  color: #c9d3e2;
  line-height: 1.5;
}

.item-components {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 12px;
  font-size: 13px;
}

.item-component {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 4px 8px;
  font-size: 12px;
}

.item-component img {
  width: 28px;
  height: 20px;
  border-radius: 3px;
  object-fit: cover;
}

.item-lore {
  margin-top: 12px;
  font-style: italic;
  color: var(--muted);
  font-size: 13px;
}

.item-history-title {
  margin: 18px 0 4px;
}

.item-history {
  margin-top: 10px;
}

.item-history-version {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}

/* ------------------------------------------------------------------ */
/* Coach                                                              */
/* ------------------------------------------------------------------ */
.coach-controls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.coach-controls input {
  flex: 1;
  min-width: 220px;
}

.coach-recent {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.coach-recent-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 4px 10px 4px 4px;
  font-size: 12px;
  border-left: 3px solid transparent;
}

.coach-recent-btn.win { border-left-color: #4caf50; }
.coach-recent-btn.loss { border-left-color: #f44336; }

.coach-recent-btn img {
  width: 40px;
  height: 24px;
  border-radius: 4px;
  object-fit: cover;
}

.coach-pick-player {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.coach-head {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 16px;
  padding: 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-left: 4px solid transparent;
}

.coach-head.win { border-left-color: #4caf50; }
.coach-head.loss { border-left-color: #f44336; }

.coach-head img {
  width: 96px;
  height: 54px;
  border-radius: 8px;
  object-fit: cover;
}

.coach-head > div:nth-child(2) {
  flex: 1;
  min-width: 220px;
}

.coach-hero {
  font-size: 1.2rem;
  font-weight: 800;
}

.coach-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.coach-link {
  display: inline-flex;
  align-items: center;
  color: var(--text);
  text-decoration: none;
}

.coach-note {
  margin: 10px 0 0;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
  color: #ffd08a;
  background: rgba(255, 152, 0, 0.08);
  border: 1px solid rgba(255, 152, 0, 0.3);
}

.coach-subtitle {
  margin: 18px 0 8px;
}

.coach-benches {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 8px 20px;
}

.coach-bench {
  display: grid;
  grid-template-columns: 110px 1fr 44px;
  align-items: center;
  gap: 10px;
}

.coach-bench-label {
  display: flex;
  flex-direction: column;
  font-size: 13px;
  font-weight: 700;
}

.coach-bench-bar {
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.coach-bench-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #ffb347;
}

.coach-bench.is-good .coach-bench-bar span { background: #4cd964; }
.coach-bench.is-bad .coach-bench-bar span { background: #ff6b6b; }

.coach-bench-pct {
  text-align: right;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.coach-columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.coach-col {
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.coach-col.is-good { border-top: 3px solid #4cd964; }
.coach-col.is-bad { border-top: 3px solid #ff6b6b; }

.coach-col h3 {
  margin: 0 0 8px;
}

.coach-col ul {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 6px;
  font-size: 14px;
  line-height: 1.5;
  color: #dbe3ee;
}

.coach-items {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.coach-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px 6px 6px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  font-size: 13px;
}

.coach-item img {
  width: 36px;
  height: 26px;
  border-radius: 4px;
  object-fit: cover;
}

.coach-disclaimer {
  margin-top: 16px;
  font-size: 12px;
  color: var(--muted);
}

/* Changelog eroi */
.hero-change > summary {
  cursor: pointer;
  list-style: none;
}

.hero-change > summary::-webkit-details-marker {
  display: none;
}

.hero-change > summary img {
  width: 56px;
  height: 32px;
}

.hero-change-section {
  margin-top: 10px;
}

.hero-change-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #ffd166;
}

.hero-row-patch {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 3px;
  font-size: 11px;
  color: var(--muted);
  text-decoration: none;
}

.hero-row-patch:hover {
  color: #fff;
}

/* Prestazioni ranked per eroe */
.ranked-summary {
  margin-top: 14px;
}

.ranked-highlights {
  display: grid;
  gap: 8px;
  margin: 14px 0 6px;
}

.ranked-highlights > div {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.hero-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 3px 10px 3px 3px;
  font-size: 13px;
}

.hero-chip img {
  width: 40px;
  height: 23px;
  border-radius: 4px;
  object-fit: cover;
}

.hero-badge.is-bad { color: #2a0606; background: #ff6b6b; }
.hero-badge.is-neutral { color: #1a1a1a; background: #c9d1dc; }
.hero-badge.is-few { color: #c9d1dc; background: rgba(255, 255, 255, 0.08); }

.ranked-row {
  grid-template-columns: minmax(170px, 1.8fr) 70px minmax(80px, 0.9fr) minmax(90px, 1fr) minmax(90px, 1fr) minmax(120px, 1.2fr) 80px minmax(120px, 1.1fr);
}

.ranked-row.is-strong { background: rgba(76, 217, 100, 0.06); }
.ranked-row.is-avoid { background: rgba(255, 91, 91, 0.06); }

.wr-bar {
  display: block;
  width: 70px;
  height: 4px;
  margin-top: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.wr-bar span {
  display: block;
  height: 100%;
  background: #ffb347;
}

.form-dots {
  display: inline-flex;
  gap: 3px;
  flex-wrap: wrap;
}

.form-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #6b7280;
}

.form-dot.is-win { background: #4cd964; }
.form-dot.is-loss { background: #ff6b6b; }

@media (max-width: 760px) {
  .ranked-row {
    grid-template-columns: 1fr 1fr;
  }
}

/* MMR stimato dai pivot */
.history-row-mmr.is-estimated {
  color: #aab4c3;
  font-style: italic;
}

.heroes-type-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

/* ------------------------------------------------------------------ */
/* Libreria eroi                                                      */
/* ------------------------------------------------------------------ */
.herolib-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  margin-top: 8px;
}

.herolib-tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 8px;
  min-height: 0;
  text-align: left;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-top: 3px solid transparent;
}

.herolib-tile.attr-str { border-top-color: #e74c3c; }
.herolib-tile.attr-agi { border-top-color: #2ecc71; }
.herolib-tile.attr-int { border-top-color: #3498db; }
.herolib-tile.attr-all { border-top-color: #c79cff; }

.herolib-tile img {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  object-fit: cover;
}

.herolib-name {
  font-weight: 700;
  color: #fff;
}

.herolib-sub {
  font-size: 11px;
  color: var(--muted);
}

.hero-detail-head {
  display: flex;
  gap: 16px;
  align-items: center;
}

.hero-detail-img {
  width: 160px;
  border-radius: 10px;
}

.attr-pill {
  padding: 2px 10px;
  border-radius: 999px;
  font-weight: 700;
  color: #fff;
}

.attr-pill.attr-str { background: #c0392b; }
.attr-pill.attr-agi { background: #27ae60; }
.attr-pill.attr-int { background: #2980b9; }
.attr-pill.attr-all { background: #8e5cd9; }

.hero-roles {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.hero-role {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  background: rgba(255, 255, 255, 0.08);
}

.hero-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 6px 16px;
  margin-top: 14px;
}

.hero-stat {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 13px;
}

.hero-stat span:first-child {
  color: var(--muted);
}

.hero-ability-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.hero-ability-head img {
  width: 44px;
  height: 44px;
  border-radius: 6px;
}

.hero-ability-head > div:nth-child(2) {
  flex: 1;
}

.hero-ability-tags {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.hero-ability-costs {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  font-size: 12px;
  color: #cfd8e6;
  white-space: nowrap;
}

.hero-ability-attrib {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 4px 12px;
  margin-top: 8px;
  font-size: 12px;
}

.hero-talents {
  display: grid;
  gap: 6px;
}

.hero-talent-row {
  display: grid;
  grid-template-columns: 1fr 44px 1fr;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  font-size: 13px;
}

.hero-talent-row strong {
  text-align: center;
  color: #ffd166;
}

.hero-talent-row span:last-child {
  text-align: right;
}

/* ------------------------------------------------------------------ */
/* Quiz                                                               */
/* ------------------------------------------------------------------ */
.quiz-best {
  font-weight: 700;
  color: #ffd166;
}

.quiz-options {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin: 12px 0 16px;
}

.quiz-start {
  min-height: 48px;
  padding: 12px 24px;
  font-size: 1rem;
  font-weight: 800;
  color: #fff;
  border: none;
  background: linear-gradient(135deg, #2f6fff, #ff7a00);
}

.quiz-game {
  max-width: 720px;
  margin: 0 auto;
}

.quiz-status {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-weight: 700;
}

.quiz-streak {
  color: #ffb347;
}

.quiz-timer {
  height: 6px;
  margin: 10px 0 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.quiz-timer span {
  display: block;
  height: 100%;
  width: 100%;
  background: #4cd964;
  transition: width 0.1s linear;
}

.quiz-timer span.is-low {
  background: #ff6b6b;
}

.quiz-card {
  padding: 18px;
  border-radius: 18px;
  text-align: center;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.quiz-question-media img {
  max-width: 180px;
  max-height: 110px;
  border-radius: 10px;
  object-fit: contain;
}

.quiz-category {
  margin-top: 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #9fb5d4;
}

.quiz-question {
  margin: 6px 0 0;
  font-size: 1.25rem;
}

.quiz-answers {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 14px;
}

.quiz-answer {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: 10px 14px;
  font-size: 1rem;
  text-align: left;
}

.quiz-key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  font-size: 12px;
  background: rgba(255, 255, 255, 0.1);
}

.quiz-answer.is-correct {
  border-color: #4cd964;
  background: rgba(76, 217, 100, 0.18);
  opacity: 1;
}

.quiz-answer.is-wrong {
  border-color: #ff6b6b;
  background: rgba(255, 91, 91, 0.18);
  opacity: 1;
}

.quiz-feedback {
  min-height: 24px;
  margin: 12px 0;
  font-weight: 600;
}

.quiz-feedback.is-correct { color: #4cd964; }
.quiz-feedback.is-wrong { color: #ff8a80; }

.quiz-final {
  text-align: center;
  padding: 18px;
}

.quiz-final-score {
  font-size: 3rem;
  font-weight: 900;
}

.quiz-final-stats {
  margin: 8px 0 16px;
  color: var(--muted);
}

.quiz-review {
  display: grid;
  gap: 8px;
}

.quiz-review-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
}

.quiz-review-item img {
  width: 48px;
  height: 36px;
  border-radius: 6px;
  object-fit: cover;
}

.quiz-review-item > div {
  display: flex;
  flex-direction: column;
}

@media (max-width: 560px) {
  .quiz-answers {
    grid-template-columns: 1fr;
  }
  .hero-detail-head {
    flex-direction: column;
    align-items: flex-start;
  }
}

#itemsSection .chart-toggle-group {
  flex-wrap: wrap;
  max-width: 100%;
}

.user-rank-badge {
  width: 36px;
  height: 36px;
  margin: -4px 0;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.45));
}

/* ------------------------------------------------------------------ */
/* Follow Players                                                     */
/* ------------------------------------------------------------------ */
.follow-add {
  margin-top: 12px;
}

.follow-add-row {
  display: flex;
  gap: 10px;
}

.follow-add-row input {
  flex: 1;
  min-width: 0;
}

.follow-add-row button {
  flex-shrink: 0;
}

.follow-list-title {
  margin-top: 20px;
}

.follow-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 10px;
}

.follow-empty {
  grid-column: 1 / -1;
}

.follow-card {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: border-color 0.2s ease, background 0.2s ease;
}

.follow-card:hover {
  border-color: rgba(255, 255, 255, 0.18);
}

.follow-card.selected {
  border-color: rgba(255, 152, 0, 0.7);
  background: linear-gradient(135deg, rgba(47, 111, 255, 0.12), rgba(255, 122, 0, 0.1));
}

.follow-card-main {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  min-height: 0;
  padding: 4px;
  text-align: left;
  background: transparent;
  border: none;
  box-shadow: none;
}

.follow-card-main:hover {
  transform: none;
  box-shadow: none;
  background: transparent;
}

.follow-card-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.06);
}

.follow-card-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.follow-card-title {
  font-weight: 700;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.follow-card-subtitle {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
  font-weight: 400;
}

.follow-card-remove {
  flex-shrink: 0;
  opacity: 0.6;
}

.follow-card:hover .follow-card-remove,
.follow-card-remove:focus-visible {
  opacity: 1;
}

.follow-detail {
  margin-top: 20px;
}

.follow-detail-head {
  display: flex;
  align-items: center;
  gap: 14px;
}

.follow-detail-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.06);
}

.follow-detail-name {
  flex: 1;
  min-width: 0;
}

#followPlayerName {
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.follow-detail-sub {
  font-size: 13px;
  color: var(--muted);
  margin-top: 2px;
}

.follow-grid {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.follow-grid .dash-title,
.follow-matches .dash-title {
  flex-wrap: wrap;
}

.follow-compare {
  margin-top: 0;
}

.follow-heroes {
  display: grid;
  gap: 6px;
}

.follow-hero-row {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 6px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.follow-hero-row img,
.follow-hero-row .history-row-noimg {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  object-fit: cover;
}

.follow-hero-wr {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.follow-matches {
  margin-top: 14px;
}

.follow-filter {
  display: flex;
  align-items: center;
  gap: 8px;
  text-transform: none;
  letter-spacing: 0;
}

.follow-filter select {
  width: auto;
  min-width: 140px;
  padding: 8px 12px;
}

.follow-match-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.follow-match-row .dash-match {
  margin-top: 0;
  flex: 1;
  min-width: 0;
}

.dash-match.follow-match {
  grid-template-columns: 36px 1fr auto 84px;
}

.follow-match-ext {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 10px;
  color: var(--muted);
  text-decoration: none;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.follow-match-ext:hover {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.2);
}

.follow-pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 12px;
}

.follow-pagination:empty {
  display: none;
}

@media (max-width: 520px) {
  .dash-match.follow-match {
    grid-template-columns: 36px 1fr auto;
  }
  .follow-grid {
    grid-template-columns: 1fr;
  }
  .follow-filter select {
    min-width: 0;
  }
}

/* Le sezioni stanno in una griglia: senza min-width i contenuti larghi la allargano oltre lo schermo. */
.section {
  min-width: 0;
}

/* ------------------------------------------------------------------ */
/* Meta eroi (OpenDota per rank, STRATZ per posizione)                */
/* ------------------------------------------------------------------ */
.meta-updated {
  font-size: 12px;
  color: #9fb5d4;
  margin-top: 8px;
}

.meta-row {
  grid-template-columns: 34px minmax(170px, 1.8fr) minmax(90px, 1fr) minmax(90px, 1fr) minmax(80px, 0.8fr) 80px minmax(70px, 0.7fr) minmax(110px, 1fr);
}

.stratz-row {
  grid-template-columns: 34px minmax(170px, 1.8fr) minmax(110px, 1fr) minmax(90px, 1fr) minmax(90px, 1fr) minmax(110px, 1fr);
}

.meta-row.is-strong,
.stratz-row.is-strong { background: rgba(76, 217, 100, 0.06); }
.meta-row.is-weak,
.stratz-row.is-weak { background: rgba(255, 91, 91, 0.05); }

.meta-row-rank {
  font-weight: 800;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.pr-bar span {
  background: #5b8cff;
}

.position-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  font-size: 12px;
  background: rgba(91, 140, 255, 0.2);
  color: #cfe0ff;
}

.stratz-best {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

@media (max-width: 760px) {
  .meta-row,
  .stratz-row {
    grid-template-columns: 1fr 1fr;
  }
  .meta-row-rank {
    display: none;
  }
  .meta-row .hero-row-num[data-label=""] {
    display: none;
  }
}

.top-hero-noimg {
  background: rgba(255, 255, 255, 0.06);
}

/* KPI: prestazioni per eroe (vista Pub) */
.kpi-performance {
  margin-top: 16px;
}

.kpi-title {
  margin: 0 0 8px;
}

.kpi-row {
  grid-template-columns: minmax(170px, 1.8fr) 70px minmax(80px, 0.9fr) minmax(90px, 1fr) minmax(80px, 0.8fr) minmax(120px, 1.2fr) minmax(120px, 1.1fr);
}

.kpi-row.is-strong { background: rgba(76, 217, 100, 0.06); }
.kpi-row.is-avoid { background: rgba(255, 91, 91, 0.06); }

@media (max-width: 760px) {
  .kpi-row {
    grid-template-columns: 1fr 1fr;
  }
}

.mmr-value {
  font-weight: 700;
}

.history-import-status {
  display: grid;
  gap: 4px;
  font-size: 13px;
  color: #cfd8e6;
}

.history-toolbar .chart-toggle-group {
  flex-wrap: wrap;
  max-width: 100%;
}

/* Pub: nessun MMR, la colonna resta vuota */
#recordReport.is-pub .record-mmr {
  visibility: hidden;
}

/* Partite: top eroi come filtri compatti */
#topHeroesList {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.hero-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 0;
  padding: 6px 12px 6px 6px;
  border-radius: 12px;
  text-align: left;
  font: inherit;
  color: var(--text);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: none;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.hero-filter-chip:hover {
  transform: none;
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.06);
}

.hero-filter-chip.is-selected {
  border-color: rgba(255, 152, 0, 0.8);
  background: linear-gradient(135deg, rgba(47, 111, 255, 0.16), rgba(255, 122, 0, 0.14));
}

.hero-filter-chip img,
.hero-filter-chip .history-row-noimg {
  width: 48px;
  height: 27px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
}

.hero-filter-all {
  padding: 6px 14px;
  font-weight: 700;
}

.hero-filter-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.hero-filter-name {
  font-weight: 700;
  font-size: 13px;
  white-space: nowrap;
}

.hero-filter-wr {
  font-weight: 800;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

/* KPI: filtro eroe e lista partite con MMR */
.hero-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.hero-filter-row:empty {
  display: none;
}

#historyList {
  display: grid;
  gap: 8px;
}

.dash-match.kpi-match {
  grid-template-columns: 36px minmax(0, 1fr) 90px 84px 110px 90px;
  margin-top: 0;
}

.kpi-match-kda,
.kpi-match-mmr,
.kpi-match-delta {
  display: flex;
  flex-direction: column;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.kpi-match-mmr,
.kpi-match-delta {
  text-align: right;
  align-items: flex-end;
}

.kpi-match-mmr.is-estimated .mmr-value {
  opacity: 0.75;
  font-style: italic;
}

@media (max-width: 640px) {
  .dash-match.kpi-match {
    grid-template-columns: 36px minmax(0, 1fr) auto auto;
  }
  .kpi-match .kpi-match-kda,
  .kpi-match .dash-match-result {
    display: none;
  }
}

/* Segnaposto del rank mentre il profilo si carica */
.user-skeleton-badge {
  display: inline-block;
  width: 32px;
  height: 32px;
  margin: 0;
  border-radius: 50%;
}

body.is-profile-loading #navUserName:empty::before {
  content: '';
  display: inline-block;
  width: 70px;
  height: 12px;
  border-radius: 6px;
  vertical-align: middle;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.04) 25%, rgba(255, 255, 255, 0.09) 50%, rgba(255, 255, 255, 0.04) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}

.rank-placeholder {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
}

.rank-placeholder .skeleton {
  margin: 0;
}

.rank-placeholder-badge {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  flex-shrink: 0;
}

.rank-placeholder-lines {
  display: grid;
  gap: 10px;
  flex: 1;
}

.rank-placeholder-line {
  height: 12px;
  width: 45%;
  border-radius: 6px;
}

.rank-placeholder-line.is-wide {
  height: 20px;
  width: 30%;
}

/* Partite: riga temporanea per la prossima ranked */
.next-match-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  border: 1px dashed rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.02);
}

.next-match-row.is-waiting {
  border-color: rgba(255, 179, 71, 0.55);
}

.next-match-icon {
  width: 40px;
  height: 40px;
  margin: 0;
  border-radius: 10px;
  flex-shrink: 0;
}

.next-match-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 220px;
}

.next-match-input {
  display: flex;
  align-items: center;
  gap: 8px;
}

.next-match-input input {
  width: 110px;
}

.next-match-value {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-weight: 800;
  font-size: 1.1rem;
}

.next-match-actions {
  display: flex;
  gap: 8px;
}

/* Accesso: link "Password dimenticata?" accanto al pulsante */
.auth-row {
  align-items: center;
}

.auth-forgot-link {
  font-size: 13px;
}

/* ------------------------------------------------------------------ */
/* Accesso, registrazione e recupero password                         */
/* ------------------------------------------------------------------ */
.section.auth-section {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 24px 0 8px;
}

.auth-card {
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
  padding: 28px;
  border-radius: 22px;
  background: rgba(10, 14, 24, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}

.auth-brand h2 {
  margin: 0;
  font-size: 1.45rem;
}

.auth-subtitle {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: 100%;
  margin-bottom: 18px;
}

.auth-tabs .chart-toggle-btn {
  justify-content: center;
  text-align: center;
}

.auth-form {
  display: grid;
  gap: 14px;
}

.auth-field {
  display: grid;
  gap: 6px;
}

.auth-field label {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: #cfd8e6;
}

.auth-label-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.auth-forgot-link {
  font-size: 12px;
}

.auth-help {
  font-size: 12px;
  color: var(--muted);
}

.auth-password {
  position: relative;
}

.auth-password input {
  width: 100%;
  padding-right: 46px;
}

.auth-eye {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  min-height: 0;
  padding: 0;
  border: none;
  background: transparent;
  box-shadow: none;
  opacity: 0.55;
  font-size: 15px;
}

.auth-eye:hover,
.auth-eye.is-on {
  opacity: 1;
  transform: translateY(-50%);
  background: transparent;
}

.auth-submit {
  width: 100%;
  min-height: 46px;
  margin-top: 4px;
  font-size: 1rem;
  font-weight: 800;
  color: #fff;
  border: none;
  background: linear-gradient(135deg, #2f6fff, #ff7a00);
  box-shadow: 0 12px 30px rgba(47, 111, 255, 0.25);
}

.auth-submit:hover {
  filter: brightness(1.08);
}

.auth-switch {
  margin: 2px 0 0;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}

.auth-card .message:not(:empty) {
  margin-top: 14px;
}

@media (max-width: 520px) {
  .auth-card {
    padding: 22px 18px;
    border-radius: 18px;
  }
}

/* Accesso con Steam */
.auth-steam {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 46px;
  border-radius: 12px;
  font-weight: 800;
  color: #fff;
  text-decoration: none;
  background: linear-gradient(135deg, #171a21, #2a475e);
  border: 1px solid rgba(102, 192, 244, 0.35);
  transition: filter 0.15s ease, border-color 0.15s ease;
}

.auth-steam:hover {
  filter: brightness(1.15);
  border-color: rgba(102, 192, 244, 0.7);
}

.auth-steam svg {
  color: #66c0f4;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px 0 14px;
  font-size: 12px;
  color: var(--muted);
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
}

/* Profilo: collega Steam */
.steam-link-box {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.steam-link-btn {
  padding: 0 18px;
  min-height: 40px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.steam-link-ok {
  font-size: 13px;
  color: #66c0f4;
  font-weight: 600;
}
