:root {
  --bg0: #0b0b0b;
  --bg1: #121212;
  --card: #151515;
  --border: #2a2a2a;
  --text: #f8f8f8;
  --muted: #9ca3af;
  --pink: #ff006e;
  --pink-dim: #c60055;
  --yellow: #f8d210;
  --cyan: #22d3ee;
  --purple: #a855f7;
  --green-dot: #22c55e;
  --danger: #fb7185;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: radial-gradient(1200px 600px at 20% -10%, #1a1020 0%, transparent 55%),
    linear-gradient(165deg, var(--bg0), var(--bg1) 40%, #0a0a0a);
}

.top-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(10, 10, 10, 0.92);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
}

.nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: space-between;
}

.logo {
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--pink);
  font-size: 0.85rem;
}

.nav-links {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: center;
}

.nav-links a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  font-weight: 600;
}

.nav-links a:hover {
  color: var(--text);
}

.nav-cta {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #0b0b0b;
  background: linear-gradient(120deg, var(--pink), #ff4d9d);
  padding: 8px 14px;
  border-radius: 999px;
}

.app {
  width: min(1100px, 94%);
  margin: 24px auto 48px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 22px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}

.search-card .page-title {
  margin: 6px 0 4px;
  font-size: 1.75rem;
  letter-spacing: -0.02em;
}

.eyebrow {
  margin: 0;
  font-size: 0.68rem;
  letter-spacing: 0.2em;
  font-weight: 700;
  color: var(--pink);
}

.eyebrow.dim {
  color: var(--muted);
}

.subtitle {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 0.95rem;
}

.input-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

input,
select {
  flex: 1 1 200px;
  min-height: 46px;
  border-radius: 12px;
  border: 1px solid #333;
  background: #0f0f0f;
  color: var(--text);
  padding: 0 14px;
  font-size: 1rem;
}

button#generateBtn {
  min-height: 46px;
  border: none;
  border-radius: 12px;
  padding: 0 20px;
  font-weight: 800;
  letter-spacing: 0.04em;
  cursor: pointer;
  color: #0b0b0b;
  background: linear-gradient(120deg, var(--yellow), #ffe066);
}

button#generateBtn:disabled {
  opacity: 0.65;
  cursor: wait;
}

.status {
  min-height: 22px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.status.error {
  color: var(--danger);
}

.hidden {
  display: none !important;
}

.dashboard {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.profile-hero {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  align-items: flex-start;
  border-color: #2f2f2f;
  background: linear-gradient(135deg, #181818, #111 60%);
}

.player-name {
  margin: 4px 0 6px;
  font-size: clamp(1.75rem, 4vw, 2.4rem);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 900;
}

.player-meta {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.95rem;
}

.badge-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.badge-season {
  background: rgba(34, 211, 238, 0.15);
  color: var(--cyan);
  border: 1px solid rgba(34, 211, 238, 0.35);
}

.badge-member {
  background: rgba(248, 210, 16, 0.15);
  color: var(--yellow);
  border: 1px solid rgba(248, 210, 16, 0.45);
}

.btn-edit {
  border: none;
  border-radius: 999px;
  padding: 10px 18px;
  font-weight: 700;
  font-size: 0.8rem;
  color: #fff;
  background: linear-gradient(120deg, var(--pink), var(--pink-dim));
  cursor: not-allowed;
  opacity: 0.55;
}

.hero-avatar {
  position: relative;
  margin-right: 8px;
}

.avatar-ring {
  width: 104px;
  height: 104px;
  border-radius: 50%;
  border: 3px solid var(--pink);
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 30% 20%, #2a2a2a, #0f0f0f);
  box-shadow: 0 0 30px rgba(255, 0, 110, 0.25);
}

.monogram {
  font-size: 2.4rem;
  font-weight: 900;
  color: #fff;
}

.avatar-dot {
  position: absolute;
  right: 6px;
  bottom: 8px;
  width: 14px;
  height: 14px;
  background: var(--green-dot);
  border: 2px solid #111;
  border-radius: 4px;
}

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

.kpi {
  position: relative;
  background: #1a1a1a;
  border: 1px solid #2f2f2f;
  border-radius: 16px;
  padding: 16px;
  min-height: 110px;
}

.kpi-label {
  margin: 0;
  font-size: 0.65rem;
  letter-spacing: 0.16em;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
}

.kpi-value {
  margin: 10px 0 0;
  font-size: 1.9rem;
  font-weight: 900;
  letter-spacing: -0.02em;
}

.kpi-sub {
  margin: 6px 0 0;
  font-size: 0.75rem;
  color: var(--muted);
  max-width: 18rem;
}

.kpi-trend {
  position: absolute;
  right: 12px;
  bottom: 10px;
  font-size: 1.2rem;
  color: var(--pink);
  opacity: 0.55;
}

.top3-banner {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 16px 20px;
  padding: 20px 22px;
  border-radius: 18px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  background: linear-gradient(120deg, #ff006e, #d10059 55%, #7c0a52);
  box-shadow: 0 20px 50px rgba(255, 0, 110, 0.25);
}

.top3-icon {
  grid-row: span 2;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.25);
  display: grid;
  place-items: center;
  font-size: 1.6rem;
  align-self: center;
}

.top3-title {
  margin: 0;
  font-size: 1.05rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.top3-sub,
.top3-fallback {
  margin: 8px 0 0;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.85);
  max-width: 52rem;
}

.top3-fallback {
  font-weight: 600;
}

.top3-cols {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.top3-card {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 14px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.top3-rank {
  font-size: 2rem;
  font-weight: 900;
  margin: 0 0 6px;
  color: #fff;
}

.top3-event {
  margin: 0;
  font-weight: 700;
  font-size: 0.95rem;
}

.top3-meta {
  margin: 8px 0 0;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.85);
}

.panel-title {
  margin: 0 0 12px;
  letter-spacing: 0.12em;
  font-size: 0.8rem;
  text-transform: uppercase;
  color: var(--muted);
}

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.tab {
  border: 1px solid #333;
  background: #111;
  color: var(--muted);
  padding: 8px 14px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.78rem;
  cursor: pointer;
}

.tab.active {
  color: #0b0b0b;
  background: var(--yellow);
  border-color: transparent;
}

.tab:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.table-wrap {
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid #2a2a2a;
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
}

.history-table th,
.history-table td {
  padding: 12px 10px;
  border-bottom: 1px solid #242424;
  text-align: left;
  font-size: 0.9rem;
}

.history-table th {
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  background: #111;
}

.history-table tbody tr:hover {
  background: rgba(255, 0, 110, 0.04);
}

.history-table td.partner-cell a {
  color: var(--yellow);
  font-weight: 700;
  text-decoration: none;
}

.history-table td.partner-cell a:hover {
  text-decoration: underline;
}

.chart-hint {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.85rem;
}

.chart-layout {
  display: grid;
  grid-template-columns: 1fr minmax(160px, 220px);
  gap: 16px;
  align-items: start;
}

.chart-svg-wrap {
  position: relative;
}

#seasonChart {
  width: 100%;
  height: auto;
  background: #0f0f0f;
  border-radius: 14px;
  border: 1px solid #2a2a2a;
}

.chart-tooltip {
  position: absolute;
  pointer-events: none;
  background: rgba(20, 20, 20, 0.95);
  border: 1px solid #333;
  color: var(--text);
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 0.78rem;
  z-index: 5;
  white-space: nowrap;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.chart-legend {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chart-legend li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.82rem;
  color: var(--muted);
}

.swatch {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  flex-shrink: 0;
}

.chart-legend .current-tag {
  margin-left: auto;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--yellow);
}

.nav-links a.nav-active {
  color: var(--yellow);
}

.inline-code {
  font-size: 0.85em;
  color: var(--cyan);
  background: rgba(34, 211, 238, 0.08);
  padding: 2px 6px;
  border-radius: 6px;
}

button#wrappedBtn {
  min-height: 46px;
  border: none;
  border-radius: 12px;
  padding: 0 22px;
  font-weight: 800;
  letter-spacing: 0.04em;
  cursor: pointer;
  color: #0b0b0b;
  background: linear-gradient(120deg, var(--pink), #ff4d9d);
}

button#wrappedBtn:disabled {
  opacity: 0.65;
  cursor: wait;
}

.wrapped-hero {
  border-color: rgba(248, 210, 16, 0.25);
}

.avatar-ring-yellow {
  border-color: var(--yellow);
  box-shadow: 0 0 30px rgba(248, 210, 16, 0.2);
}

.wrapped-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}

.wrapped-card {
  border-radius: 18px;
  padding: 22px;
  border: 1px solid #2f2f2f;
  min-height: 220px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.wrapped-card-rank {
  background: linear-gradient(145deg, #1a1520, #121212);
  border-color: rgba(168, 85, 247, 0.35);
}

.wrapped-card-locations {
  background: linear-gradient(145deg, #101a1f, #121212);
  border-color: rgba(34, 211, 238, 0.35);
}

.wrapped-card-partners {
  background: linear-gradient(145deg, #1a1218, #121212);
  border-color: rgba(255, 0, 110, 0.35);
}

.wrapped-label {
  margin: 0;
  font-size: 0.65rem;
  letter-spacing: 0.18em;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
}

.wrapped-big {
  margin: 8px 0 0;
  font-size: clamp(2.2rem, 6vw, 3rem);
  font-weight: 900;
  letter-spacing: -0.03em;
  line-height: 1;
}

.wrapped-mid {
  margin: 6px 0 0;
  font-size: 0.95rem;
  color: var(--yellow);
  font-weight: 700;
}

.wrapped-quip {
  margin: 12px 0 0;
  font-size: 0.92rem;
  line-height: 1.45;
  color: rgba(248, 248, 248, 0.88);
  flex: 1;
}

.wrapped-mini-list {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  border-top: 1px solid #2a2a2a;
  padding-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.wrapped-mini-list li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.82rem;
  color: var(--muted);
}

.wrapped-mini-list a {
  color: var(--cyan);
  text-decoration: none;
  font-weight: 600;
}

.wrapped-mini-list a:hover {
  text-decoration: underline;
}

.wrapped-mini-count {
  color: var(--muted);
  white-space: nowrap;
}

.wrapped-footnote {
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.4;
  text-align: center;
  max-width: 52rem;
  align-self: center;
}

@media (max-width: 840px) {
  .chart-layout {
    grid-template-columns: 1fr;
  }

  .top3-banner {
    grid-template-columns: 1fr;
  }

  .top3-icon {
    grid-row: auto;
  }
}
