:root {
  --ink: 236 243 250;
  --bg: #0b1322;
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .04 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E");
  --wallpaper:
    var(--grain),
    radial-gradient(70% 60% at 8% 10%, rgba(255, 70, 85, .26), rgba(255, 70, 85, .12) 26%, rgba(255, 70, 85, .04) 52%, transparent 80%),
    radial-gradient(60% 55% at 94% 4%, rgba(140, 90, 255, .2), rgba(140, 90, 255, .09) 28%, rgba(140, 90, 255, .03) 55%, transparent 85%),
    radial-gradient(85% 70% at 75% 100%, rgba(50, 110, 230, .24), rgba(50, 110, 230, .11) 28%, rgba(50, 110, 230, .04) 55%, transparent 88%),
    linear-gradient(170deg, #0b1322 0%, #0e1729 50%, #0a1220 100%);
  --glass: rgba(255, 255, 255, .065);
  --glass-strong: rgba(22, 32, 52, .88);
  --glass-border: rgba(255, 255, 255, .12);
  --glass-highlight: rgba(255, 255, 255, .09);
  --glass-shadow: 0 10px 36px rgba(0, 0, 0, .35);
  --field: rgba(255, 255, 255, .06);
  --line: rgb(var(--ink) / .08);
  --line-2: rgb(var(--ink) / .14);
  --text: rgb(var(--ink) / .86);
  --text-strong: rgb(var(--ink) / .97);
  --muted: rgb(var(--ink) / .6);
  --faint: rgb(var(--ink) / .42);
  --accent: #ff4655;
  --accent-top: #ff6a76;
  --accent-soft: rgba(255, 70, 85, .15);
  --win: #3fe0b5;
  --win-soft: rgba(63, 224, 181, .14);
  --loss: #ff7a86;
  --loss-soft: rgba(255, 122, 134, .13);
  --gold: #f5c56b;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI Variable Display", "Segoe UI", system-ui, sans-serif;
  --radius: 22px;
  --radius-sm: 14px;
  --page: 1160px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
/* Fond en calque fixe : background-attachment: fixed ne marche pas sur iOS. */
body::before { content: ""; position: fixed; inset: 0; z-index: -1; background: var(--wallpaper); pointer-events: none; }
img { display: block; max-width: 100%; }
a { color: inherit; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent-top); outline-offset: 3px; border-radius: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* --- Verre */
.glass {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--glass-shadow), inset 0 1px 0 var(--glass-highlight);
  -webkit-backdrop-filter: blur(24px) saturate(1.6);
  backdrop-filter: blur(24px) saturate(1.6);
}

/* --- Boutons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 46px; padding: 0 20px; border-radius: 999px;
  border: 1px solid transparent; cursor: pointer; text-decoration: none;
  font-weight: 600; letter-spacing: -.01em;
  transition: transform .15s ease, background-color .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.btn:active { transform: scale(.97); }
.btn-primary {
  background: linear-gradient(180deg, var(--accent-top), var(--accent));
  color: #fff;
  box-shadow: 0 8px 24px rgba(255, 70, 85, .35), inset 0 1px 0 rgba(255, 255, 255, .25);
}
.btn-primary:hover { box-shadow: 0 10px 30px rgba(255, 70, 85, .45), inset 0 1px 0 rgba(255, 255, 255, .3); }
.btn-discord { background: linear-gradient(180deg, #6d79f6, #5865f2); color: #fff; box-shadow: 0 8px 24px rgba(88, 101, 242, .35), inset 0 1px 0 rgba(255, 255, 255, .25); }
.btn-ghost {
  background: var(--glass); border-color: var(--line-2); color: var(--text-strong);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}
.btn-ghost:hover { border-color: rgb(var(--ink) / .24); }
.btn-sm { min-height: 36px; padding: 0 14px; font-size: 13px; }

/* --- Structure */
.page { width: min(var(--page), 100% - 32px); margin: 0 auto; padding-bottom: 64px; }
.nav {
  position: sticky; top: 12px; z-index: 10;
  display: flex; align-items: center; gap: 14px;
  margin: 12px 0 28px; padding: 10px 12px 10px 18px;
  border-radius: 999px;
}
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 700; letter-spacing: -.02em; color: var(--text-strong); text-decoration: none; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center;
  background: linear-gradient(145deg, var(--accent-top), #c81e33); color: #fff; font-size: 13px; font-weight: 800;
  box-shadow: 0 4px 14px rgba(255, 70, 85, .4), inset 0 1px 0 rgba(255, 255, 255, .3);
}
.nav-spacer { flex: 1; }
.seg { display: inline-flex; padding: 3px; border-radius: 999px; background: rgba(0, 0, 0, .22); border: 1px solid var(--line); }
.seg button {
  border: 0; background: transparent; cursor: pointer; padding: 6px 14px; border-radius: 999px;
  font-size: 13px; font-weight: 600; color: var(--muted); transition: background-color .15s ease, color .15s ease;
}
.seg button[aria-pressed="true"] { background: rgb(var(--ink) / .12); color: var(--text-strong); box-shadow: inset 0 1px 0 var(--glass-highlight); }
.avatar { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; border: 1px solid var(--line-2); background: var(--field); }
.user-chip { display: flex; align-items: center; gap: 8px; }
.btn-icon svg { flex: none; }

/* --- Titres */
h1, h2, h3 { font-family: var(--font-display); color: var(--text-strong); letter-spacing: -.025em; margin: 0; }
.section-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin: 40px 4px 14px; }
.section-title h2 { font-size: 22px; }
.section-title p { margin: 0; color: var(--muted); font-size: 14px; }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }

/* --- Landing */
.hero { text-align: center; padding: 72px 20px 40px; }
.hero h1 { font-size: clamp(38px, 6.5vw, 68px); line-height: 1.02; letter-spacing: -.045em; }
.hero h1 em { font-style: normal; background: linear-gradient(120deg, #ff8a94, var(--accent) 45%, #b06bff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { max-width: 560px; margin: 20px auto 30px; color: var(--muted); font-size: 17px; }
.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 30px; }
.feature { padding: 24px; }
.feature .ico { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-size: 20px; background: var(--accent-soft); margin-bottom: 14px; }
.feature h3 { font-size: 17px; margin-bottom: 6px; }
.feature p { margin: 0; color: var(--muted); font-size: 14px; }
.notice { max-width: 560px; margin: 40px auto; padding: 32px; text-align: center; }
.notice h2 { font-size: 26px; margin-bottom: 10px; }
.notice p { color: var(--muted); margin: 0 0 22px; }
.error-banner { max-width: 560px; margin: 0 auto 16px; padding: 12px 16px; border-radius: var(--radius-sm); background: var(--loss-soft); border: 1px solid rgba(255, 122, 134, .3); color: #ffd3d8; text-align: center; font-size: 14px; }

/* --- Profil */
.profile { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 24px; padding: 26px 28px; }
.rank-icon { width: 96px; height: 96px; filter: drop-shadow(0 8px 20px rgba(0, 0, 0, .4)); }
.profile h1 { font-size: 30px; line-height: 1.1; }
.profile .riot { color: var(--muted); margin-top: 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.chip { padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: rgb(var(--ink) / .08); border: 1px solid var(--line); color: var(--text); }
.chip-accent { background: var(--accent-soft); border-color: rgba(255, 70, 85, .3); color: #ffc2c8; }
.rr { min-width: 200px; }
.rr-top { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.rr-top strong { color: var(--text-strong); font-size: 20px; font-family: var(--font-display); }
.bar { height: 8px; border-radius: 99px; background: rgb(var(--ink) / .08); overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), var(--accent-top)); box-shadow: 0 0 12px rgba(255, 70, 85, .6); }

/* --- KPI */
.kpis { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; margin-top: 16px; }
.kpi { padding: 18px 18px 16px; }
.kpi .label { font-size: 12px; color: var(--muted); font-weight: 600; }
.kpi .value { font-family: var(--font-display); font-size: 28px; font-weight: 700; color: var(--text-strong); letter-spacing: -.03em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .sub { font-size: 12px; color: var(--faint); }
.kpi.good .value { color: var(--win); }
.kpi.bad .value { color: var(--loss); }

/* --- Grilles de cartes */
.grid-2 { display: grid; grid-template-columns: 1.6fr 1fr; gap: 16px; }
.grid-2-even { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.card { padding: 22px; min-width: 0; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.card-head h3 { font-size: 16px; }
.card-head span { font-size: 12px; color: var(--faint); }
.chart-box { position: relative; height: 240px; }
.chart-box.sm { height: 200px; }

/* --- Mates */
.mates { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.mate { padding: 18px; display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; transition: transform .2s ease, border-color .2s ease; }
.mate:hover { transform: translateY(-2px); border-color: rgb(var(--ink) / .2); }
.mate .avatar { width: 48px; height: 48px; }
.mate-name { font-weight: 650; color: var(--text-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mate-sub { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); margin-top: 2px; }
.mate-sub img { width: 16px; height: 16px; }
.mate-foot { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; padding-top: 12px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.badge-fym { padding: 3px 8px; border-radius: 999px; background: var(--accent-soft); color: #ffc2c8; font-weight: 600; font-size: 11px; }
.ring { --p: 0; --c: var(--win); width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--c) calc(var(--p) * 1%), rgb(var(--ink) / .09) 0); position: relative; }
.ring::before { content: ""; position: absolute; inset: 5px; border-radius: 50%; background: #121b2d; }
.ring b { position: relative; font-size: 13px; color: var(--text-strong); font-variant-numeric: tabular-nums; }
.delta-up { color: var(--win); font-weight: 600; }
.delta-down { color: var(--loss); font-weight: 600; }

/* --- Listes (agents, cartes, parties, duos) */
.rows { display: flex; flex-direction: column; gap: 4px; }
.row { display: grid; align-items: center; gap: 12px; padding: 10px 10px; border-radius: 12px; transition: background-color .15s ease; }
.row:hover { background: rgb(var(--ink) / .04); }
.row-agent { grid-template-columns: 36px 1fr auto auto; }
.row-agent img { width: 36px; height: 36px; border-radius: 10px; background: var(--field); }
.row .name { font-weight: 600; color: var(--text-strong); }
.row .meta { font-size: 12px; color: var(--muted); }
.num { font-variant-numeric: tabular-nums; text-align: right; }
.mini-bar { width: 72px; height: 6px; border-radius: 99px; background: rgb(var(--ink) / .08); overflow: hidden; }
.mini-bar span { display: block; height: 100%; border-radius: inherit; }

.match { grid-template-columns: 4px 56px 1fr auto auto; padding: 8px 10px 8px 0; }
.match .res { width: 4px; align-self: stretch; border-radius: 4px; }
.match.win .res { background: var(--win); box-shadow: 0 0 10px rgba(63, 224, 181, .5); }
.match.loss .res { background: var(--loss); box-shadow: 0 0 10px rgba(255, 122, 134, .45); }
.match.draw .res { background: var(--faint); }
.match .thumb { width: 56px; height: 40px; border-radius: 9px; object-fit: cover; background: var(--field); }
.match .score { font-family: var(--font-display); font-weight: 700; font-size: 16px; }
.match.win .score { color: var(--win); }
.match.loss .score { color: var(--loss); }
.stack { display: flex; }
.stack img { width: 24px; height: 24px; border-radius: 50%; border: 2px solid #121b2d; margin-left: -6px; }
.stack img:first-child { margin-left: 0; }

.duo { grid-template-columns: 28px auto 1fr auto; }
.duo .pos { font-family: var(--font-display); font-weight: 700; color: var(--faint); text-align: center; }
.duo .pos.top { color: var(--gold); }

.empty { padding: 34px 20px; text-align: center; color: var(--muted); font-size: 14px; }
.empty b { display: block; color: var(--text-strong); font-size: 16px; margin-bottom: 4px; }

/* --- Chargement */
.skeleton { border-radius: var(--radius); background: linear-gradient(100deg, rgb(var(--ink) / .05) 30%, rgb(var(--ink) / .1) 50%, rgb(var(--ink) / .05) 70%); background-size: 300% 100%; animation: shimmer 1.4s ease infinite; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }
.fade-in { animation: fadeIn .45s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

footer { text-align: center; color: var(--faint); font-size: 12px; margin-top: 48px; }

/* --- Responsive */
@media (max-width: 1000px) {
  .kpis { grid-template-columns: repeat(3, 1fr); }
  .grid-2, .grid-2-even { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .features { grid-template-columns: 1fr; }
  .profile { grid-template-columns: auto 1fr; padding: 20px; gap: 16px; }
  .profile .rr { grid-column: 1 / -1; min-width: 0; }
  .rank-icon { width: 68px; height: 68px; }
  .profile h1 { font-size: 23px; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .kpi .value { font-size: 24px; }
  .nav { padding-left: 14px; gap: 8px; }
  .btn-icon { width: 36px; padding: 0; }
  .btn-icon .lbl { display: none; }
  .seg button { padding: 6px 10px; }
  .brand span:last-child { display: none; }
  .match { grid-template-columns: 4px 44px 1fr auto; }
  .match .stack { display: none; }
  .match .thumb { width: 44px; height: 34px; }
  .hero { padding-top: 40px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
