/* ================= Colours ================= */
:root {
  --bg: #1673ff;           /* page background */
  --primary: #1f78ff;      /* buttons, sidebar */
  --primary-dark: #1160e0;
  --primary-soft: #e6f0ff;
  --accent: #f4cb1f;       /* yellow card / side block */
  --accent-dark: #d9a90a;
  --accent-ink: #5c4500;
  --panel: #9cc8f5;        /* light panel under champion card */
  --sky1: #2f8cff; --sky2: #8fd3ff; --sky3: #1f6bff;
}
:root {
  --pixel: "Pixelify Sans", "Nunito", sans-serif;   /* headings, names, buttons */
  --arcade: "Press Start 2P", monospace;            /* big numbers, ranks, badges */
  --gold: #f5b301; --silver: #9fb0c6; --bronze: #d9894a;
  --green: #22c55e; --red: #ff4d5e; --pink: #ff5fa2; --purple: #8b5cf6; --orange: #ff8a3d; --teal: #14c3b0;
  --ink: #3a3f4b; --ink-strong: #2a2f3a; --muted: #8a93a6;
  --card: #fff; --page: #f1f4f9; --line: #e8ecf3;
  --radius: 18px;
  --shadow: 0 6px 18px rgba(20, 50, 120, 0.08);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Nunito", system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
  padding: 48px 24px;
  transition: background .3s;
}
h1, h2, h3, .name, .champions-title, .side-panel h4 { font-family: var(--pixel); }
h3 { margin: 0 0 14px; font-size: 1.1rem; display: flex; align-items: center; gap: 10px; color: var(--ink-strong); font-weight: 700; }
.muted { color: var(--muted); font-size: .82rem; font-weight: 600; }
button { font-family: inherit; }

/* ================= Frame ================= */
.frame {
  max-width: 1240px; margin: 0 auto;
  display: grid; grid-template-columns: 110px 1fr;
  background: var(--page);
  border-radius: 30px; overflow: hidden;
  box-shadow: 0 40px 80px rgba(0, 20, 80, 0.28);
}

/* ================= Sidebar ================= */
.sidebar { background: var(--primary); display: flex; flex-direction: column; color: #fff; }
.logo {
  width: 58px; height: 58px; margin: 34px auto 28px; background: #fff; border-radius: 14px;
  display: grid; place-items: center; padding: 6px; box-shadow: 0 4px 0 rgba(0,0,0,.12);
}
.sidebar nav { display: flex; flex-direction: column; }
.nav-btn {
  border: 0; background: transparent; color: #fff; cursor: pointer;
  font: 800 .82rem "Nunito"; padding: 18px 4px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  border-top: 1px solid rgba(255,255,255,.18);
  text-shadow: 0 1px 0 rgba(0,0,0,.1);
}
.nav-btn:hover { background: rgba(255,255,255,.08); }
.nav-btn.active { background: rgba(0,0,0,.08); }
.ring {
  width: 44px; height: 44px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.9);
  display: inline-grid; place-items: center; position: relative; flex: none; padding: 9px;
}
.nav-btn .ring { background: #fff; border-color: rgba(255,255,255,.55); box-shadow: 0 3px 0 rgba(0,0,0,.12); }
.nav-btn.active .ring { box-shadow: 0 0 0 4px rgba(255,255,255,.35); }
.nav-btn.active .ring { background: #fff; }
.ring.sm { width: 40px; height: 40px; border-color: var(--primary); font-size: 16px; }
.badge {
  position: absolute; top: -6px; right: -8px; min-width: 20px; height: 20px; padding: 0 5px;
  background: var(--red); color: #fff; border-radius: 99px; border: 2px solid #fff;
  font: 800 .65rem/16px "Nunito"; font-style: normal; text-align: center;
}
.side-white { background: #fff; display: flex; flex-direction: column; align-items: center; gap: 20px; padding: 26px 0; }
.side-yellow {
  margin-top: auto; border: 0; cursor: pointer; background: var(--accent); color: var(--ink-strong);
  font: 900 .78rem "Nunito"; letter-spacing: .3px; padding: 22px 4px 26px;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.side-yellow .star {
  width: 52px; height: 52px; border-radius: 50%; background: #fff;
  display: grid; place-items: center; padding: 12px; box-shadow: inset 0 -4px 0 rgba(0,0,0,.15);
}
.side-yellow:hover { filter: brightness(1.05); }

/* ================= Main ================= */
main { min-width: 0; padding-bottom: 28px; }
.view { display: none; padding: 0 28px; }
.view.active { display: block; }
.pad-top { padding-top: 28px; }

/* ================= Hero ================= */
.hero {
  height: 330px; position: relative; overflow: hidden;
  background:
    radial-gradient(ellipse at 70% 20%, rgba(255,255,255,.45), transparent 50%),
    linear-gradient(170deg, var(--sky1) 0%, var(--sky2) 55%, var(--sky3) 100%);
  transition: background .3s;
}
.sky { position: absolute; inset: 0; pointer-events: none; }
.cloud { position: absolute; background: #fff; border-radius: 999px; opacity: .55; filter: blur(6px); }
.cloud.c1 { width: 260px; height: 70px; left: 32%; top: 190px; }
.cloud.c2 { width: 340px; height: 90px; right: -60px; top: 210px; opacity: .45; }
.cloud.c3 { width: 180px; height: 50px; left: 55%; top: 40px; opacity: .35; }
.pcard {
  position: absolute; width: 96px; height: 136px; background: #fff; border-radius: 12px;
  box-shadow: 0 14px 30px rgba(0,0,0,.25); color: #222; padding: 8px 10px;
  display: flex; flex-direction: column; justify-content: space-between;
  font-family: var(--pixel); border: 3px solid #fff; outline: 2px solid rgba(0,0,0,.05);
}
.pcard b { font-size: 1.6rem; line-height: 1; }
.pcard span { font-size: 3rem; line-height: 1; align-self: center; margin-bottom: 14px; }
.pcard.red { color: #e8314a; }
.pc1 { left: 44%; top: 30px; transform: rotate(-16deg); }
.pc2 { left: calc(44% + 70px); top: 18px; transform: rotate(4deg); z-index: 1; }
.pc3 { left: calc(44% + 150px); top: 40px; transform: rotate(22deg); }
.pc4 { right: 60px; top: 120px; transform: rotate(-10deg) scale(.8); opacity: .9; }
.big-star { position: absolute; right: 150px; top: 6px; width: 130px; height: 130px; transform: rotate(12deg); filter: drop-shadow(0 10px 18px rgba(0,0,0,.2)); }
.spark { position: absolute; color: #fff; font-style: normal; opacity: .9; text-shadow: 0 0 10px #fff; }

.tabs {
  position: absolute; left: 40px; top: 30px; z-index: 2;
  display: flex; gap: 4px; flex-wrap: nowrap; overflow-x: auto; max-width: min(560px, calc(100% - 80px)); scrollbar-width: none;
  background: rgba(255,255,255,.18); border: 2px solid rgba(255,255,255,.55);
  backdrop-filter: blur(6px); padding: 5px; border-radius: 18px;
}
.tab {
  display: inline-flex; align-items: center; gap: 6px;
  flex: none; border: 0; background: transparent; cursor: pointer; color: #fff;
  padding: 6px 12px; border-radius: 12px; font: 800 .8rem "Nunito";
  text-shadow: 0 1px 2px rgba(0,0,0,.15);
}
.tab.active { background: #fff; color: var(--primary); text-shadow: none; }

.hero-bar {
  position: absolute; left: 0; right: 0; bottom: 0; height: 84px; z-index: 2;
  background: var(--primary); display: flex; align-items: center; gap: 30px;
  padding: 0 40px 0 380px; color: #fff;
}
.chip { display: flex; align-items: center; gap: 12px; min-width: 0; }
.chip b { display: block; font-family: var(--pixel); font-size: 1.05rem; line-height: 1.1; white-space: nowrap; }
.chip small { opacity: .8; font-weight: 700; font-size: .72rem; }
.ring.w { width: 40px; height: 40px; border-color: rgba(255,255,255,.6); font-size: 16px; }

/* ================= Profile layout ================= */
.profile-layout { display: grid; grid-template-columns: 300px 1fr; gap: 32px; padding-left: 12px; }
.left-col { margin-top: -240px; position: relative; z-index: 3; }
.right-col { padding-top: 32px; min-width: 0; }

.champ-card {
  background: #fff; border-radius: 22px 22px 0 0; padding: 0 22px 24px; text-align: center;
  box-shadow: 0 10px 0 rgba(0,0,0,.06), var(--shadow); margin-top: 80px; position: relative;
}
.champ-card .big-av {
  width: 170px; height: 170px; border-radius: 50%; margin: -80px auto 10px;
  display: grid; place-items: center; overflow: hidden;
  border: 8px solid #fff; box-shadow: 0 6px 18px rgba(0,0,0,.15); position: relative; cursor: pointer;
}
.champ-card .big-av svg { width: 100%; height: 100%; display: block; }
.champ-card .big-av.empty { background: var(--primary-soft); padding: 36px; cursor: default; }
.champ-card .big-av.empty::after { display: none; }
.champ-card .big-av::after {
  content: ""; position: absolute; right: 12px; bottom: 12px; width: 22px; height: 22px;
  background: var(--green); border: 4px solid #fff; border-radius: 50%;
}
.champ-card .crown-tag {
  position: absolute; top: -92px; left: 50%; transform: translateX(-50%) rotate(-8deg);
  width: 60px; height: 60px; filter: drop-shadow(0 4px 6px rgba(0,0,0,.2)); z-index: 1;
}
.champ-card .name { font-size: 2rem; font-weight: 700; color: #4b4f58; margin: 0; line-height: 1.1; }
.champ-card .sub { color: var(--muted); font-size: .88rem; font-weight: 600; margin: 6px 0 16px; }
.champ-stats { display: grid; grid-template-columns: 1fr 1fr; margin-bottom: 20px; }
.champ-stats div + div { border-left: 1px solid var(--line); }
.champ-stats b { display: block; font: 700 1.5rem var(--pixel); color: var(--primary); line-height: 1.2; }
.champ-stats span { color: var(--muted); font-size: .85rem; font-weight: 600; }
.champ-card .btn-row { justify-content: center; }

.side-panel {
  background: var(--panel); padding: 22px 22px 18px; border-radius: 0 0 22px 22px;
  box-shadow: var(--shadow);
}
.side-panel h4 { color: #fff; text-align: center; font-size: 1.05rem; margin: 4px 0 12px; text-shadow: 0 1px 2px rgba(0,0,0,.15); }
.side-item {
  background: #fff; border-radius: 12px; padding: 10px 12px; display: flex; align-items: center; gap: 12px;
  margin-bottom: 12px; box-shadow: 0 4px 0 rgba(0,0,0,.08); cursor: pointer; position: relative;
}
.side-item:hover { transform: translateY(-1px); }
.side-item .t { font: 700 .95rem var(--pixel); color: #4b4f58; line-height: 1.1; }
.side-item .s { font-size: .75rem; color: var(--muted); font-weight: 600; }
.side-item .medal { margin-left: auto; display: grid; place-items: center; }
.load-more {
  display: block; width: 100%; border: 0; background: transparent; color: #fff; cursor: pointer;
  font: 700 1.05rem var(--pixel); padding: 8px 0 0; text-shadow: 0 1px 2px rgba(0,0,0,.15);
}

/* ================= Cards ================= */
.card {
  background: var(--card); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow);
  margin-bottom: 24px; min-width: 0;
}
.card h3 { border-bottom: 1px solid var(--line); padding-bottom: 14px; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; flex-wrap: wrap; }
.card-head h3 { flex: 1; }
.dot {
  width: 30px; height: 30px; border-radius: 50%; background: #fff; display: inline-grid; place-items: center;
  font-size: 14px; flex: none; box-shadow: 0 2px 6px rgba(0,0,0,.08);
}
.dot.blue { background: var(--primary-soft); } .dot.pink { background: #ffe3f0; } .dot.green { background: #dcfce7; }
.row-2 { display: grid; grid-template-columns: 260px 1fr; gap: 24px; }
.row-2.even { grid-template-columns: 1fr 1fr; }

.yellow-card {
  background: var(--accent); border-radius: var(--radius); padding: 22px; margin-bottom: 24px;
  position: relative; box-shadow: var(--shadow); color: var(--accent-ink);
}
.yellow-card h3 { border-bottom: 1px solid rgba(0,0,0,.1); padding-bottom: 14px; color: var(--ink-strong); }
.yellow-card p { font-size: .88rem; line-height: 1.6; font-weight: 600; margin: 0; padding-right: 46px; }
.yellow-card b { color: var(--ink-strong); }
.mascot {
  position: absolute; right: 10px; bottom: 10px; width: 56px; height: 56px; transform: rotate(14deg);
  filter: drop-shadow(0 8px 10px rgba(0,0,0,.25));
}

.players-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px 10px; }
.pg { display: flex; align-items: center; gap: 10px; cursor: pointer; min-width: 0; }
.pg .n { font: 700 .92rem var(--pixel); color: var(--primary); line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pg .s { white-space: nowrap; font-size: .72rem; color: var(--muted); font-weight: 600; }
.pg > div { min-width: 0; }

.skills { display: flex; flex-wrap: wrap; gap: 14px 36px; align-items: center; }
.skill { display: flex; align-items: center; gap: 8px; font: 700 .9rem var(--pixel); color: #5a5f6a; }
.stars { letter-spacing: 2px; font-size: 1rem; }
.stars .on { color: var(--gold); text-shadow: 0 1px 0 #c98f00; }
.stars .off { color: #d5dae3; }

/* ================= Tiles ================= */
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin-bottom: 24px; }
.tile {
  border-radius: var(--radius); padding: 16px; color: #fff; position: relative; overflow: hidden;
  box-shadow: var(--shadow); cursor: pointer; min-width: 0; display: flex; flex-direction: column; gap: 10px;
}
.tile::after { content: ""; position: absolute; right: -30px; top: -30px; width: 100px; height: 100px; border-radius: 50%; background: rgba(255,255,255,.18); }
.tile.t1 { background: linear-gradient(135deg, #ffb703, #ff8a00); }
.tile.t2 { background: linear-gradient(135deg, #22c55e, #10b3a3); }
.tile.t3 { background: linear-gradient(135deg, #ff5fa2, #ff4d6d); }
.tile.t4 { background: linear-gradient(135deg, #8b5cf6, #3b82f6); }
.tile .label { font-size: .78rem; font-weight: 800; display: flex; align-items: center; gap: 8px; }
.tile-ic { width: 30px; height: 30px; border-radius: 10px; background: rgba(255,255,255,.9); display: grid; place-items: center; padding: 5px; }
.tile .row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.tile .who { font: 700 1rem var(--pixel); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
.tile .big { font: 800 2rem/1 var(--pixel); }

/* ================= Game champs ================= */
.game-champs { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.gc { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; cursor: pointer; background: var(--gcb); }
.gc:hover { filter: brightness(.98); transform: translateY(-1px); }
.gc.c0 { --gcb: #fff4cc; } .gc.c1 { --gcb: #e6f0ff; } .gc.c2 { --gcb: #ffe3f0; }
.gc.c3 { --gcb: #dcfce7; } .gc.c4 { --gcb: #f0e6ff; } .gc.c5 { --gcb: #ffe8d9; }
.gc .info { flex: 1; min-width: 0; }
.gc .gname { font: 700 1rem var(--pixel); color: var(--ink-strong); }
.gc .champ { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: .88rem; text-align: right; }

/* ================= Match list ================= */
.match-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.match { display: flex; align-items: center; gap: 12px; padding: 10px 12px; background: #f7f9fd; border-radius: 14px; }
.match .info { flex: 1; min-width: 0; }
.match .title { font-weight: 800; color: var(--ink-strong); }
.match .sub { font-size: .78rem; color: var(--muted); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.empty { color: var(--muted); text-align: center; padding: 18px; font-weight: 600; }

/* ================= Podium (Ranking view) ================= */
.champions-title {
  text-align: center; font-size: 5rem; font-weight: 800; color: #dde4ef; line-height: 1;
  margin: 26px 0 -30px; user-select: none;
}
.podium { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; align-items: end; margin-bottom: 26px; position: relative; }
.podium-card {
  background: #fff; border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow);
  position: relative; overflow: hidden; cursor: pointer; transition: transform .15s; border: 3px solid transparent;
}
.podium-card:hover { transform: translateY(-3px); }
.podium-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 84px; background: var(--glow); }
.podium-card.r1 { --glow: linear-gradient(120deg, #fff1a8, #ffd166, #a8e6ff); border-color: var(--gold); padding-top: 34px; }
.podium-card.r2 { --glow: linear-gradient(120deg, #d6e8ff, #c9b8ff, #ffc8ec); }
.podium-card.r3 { --glow: linear-gradient(120deg, #ffd9b8, #ffb38a, #b8f5d0); }
.podium-card > * { position: relative; }
.place { position: absolute; top: 6px; right: 14px; font: 800 2.6rem var(--pixel); color: rgba(255,255,255,.95); text-shadow: 0 2px 6px rgba(0,0,0,.12); }
.place sup { font-size: .9rem; }
.podium .top { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.podium .name { font-size: 1.2rem; font-weight: 700; line-height: 1.1; color: var(--ink-strong); }
.crown { font-size: .8rem; font-weight: 800; color: var(--primary); display: flex; align-items: center; gap: 4px; }
.podium .stats { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 16px; }
.podium .stats b { display: block; font: 800 1.2rem var(--pixel); color: var(--ink-strong); }
.podium .stats span { font-size: .72rem; color: var(--muted); font-weight: 700; }
.podium-empty { background: #fff; border: 2px dashed var(--line); border-radius: var(--radius); padding: 30px; text-align: center; color: var(--muted); }

/* ================= Leaderboard ================= */
.table-wrap { overflow-x: auto; }
.leaderboard { width: 100%; border-collapse: separate; border-spacing: 0 8px; font-size: .9rem; }
.leaderboard th { text-align: left; font-size: .75rem; color: var(--muted); font-weight: 800; padding: 0 10px; white-space: nowrap; }
.leaderboard td { padding: 10px; background: #f7f9fd; white-space: nowrap; font-weight: 700; }
.leaderboard td:first-child { border-radius: 12px 0 0 12px; font: 800 1.3rem var(--pixel); color: var(--muted); width: 44px; text-align: center; }
.leaderboard td:last-child { border-radius: 0 12px 12px 0; }
.leaderboard tbody tr { cursor: pointer; }
.leaderboard tbody tr:hover td { background: var(--primary-soft); }
.leaderboard tr.g td { background: #fff7d6; } .leaderboard tr.g td:first-child { color: var(--gold); }
.leaderboard tr.s td { background: #eef3fb; } .leaderboard tr.s td:first-child { color: var(--silver); }
.leaderboard tr.b td { background: #fff0e4; } .leaderboard tr.b td:first-child { color: var(--bronze); }
.player-cell { display: flex; align-items: center; gap: 10px; font-weight: 800; color: var(--ink-strong); }
.rate { display: flex; align-items: center; gap: 8px; }
.bar { width: 70px; height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; display: inline-block; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--green), var(--teal)); border-radius: 99px; }
.pill { display: inline-flex; align-items: center; gap: 5px; background: var(--primary-soft); color: var(--primary); padding: 3px 10px 3px 4px; border-radius: 99px; font-weight: 800; font-size: .78rem; }
.form { display: inline-flex; gap: 3px; }
.form i { width: 20px; height: 20px; border-radius: 6px; font: 900 .65rem/20px "Nunito"; text-align: center; font-style: normal; color: #fff; }
.form .w { background: var(--green); } .form .l { background: #d4dae5; }

/* ================= Buttons ================= */
.btn {
  border: 2px solid transparent; border-radius: 999px; cursor: pointer;
  font: 700 .95rem var(--pixel); padding: 8px 22px; display: inline-flex; align-items: center; gap: 6px;
  transition: transform .1s, filter .15s; white-space: nowrap; line-height: 1.4;
}
.btn:active { transform: scale(.97); }
.btn:hover { filter: brightness(1.06); }
.btn-blue { background: var(--primary); color: #fff; box-shadow: 0 4px 0 var(--primary-dark); }
.btn-ghost { background: #fff; color: #5a5f6a; border-color: #cfd5df; }
.btn-danger { background: #ffe8ea; color: var(--red); }
.btn-small { padding: 3px 12px; font-size: .85rem; background: #fff; color: var(--ink-strong); }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-row.end { justify-content: flex-end; margin-top: 16px; }
.icon-btn { border: 0; background: none; cursor: pointer; color: var(--muted); font-size: 1rem; padding: 4px 8px; border-radius: 8px; }
.icon-btn:hover { background: #ffe8ea; color: var(--red); }

/* ================= Manage ================= */
.demo-note { background: var(--accent); color: var(--accent-ink); border-radius: 14px; padding: 12px 16px; margin-bottom: 20px; font-weight: 700; }
.demo-note[hidden] { display: none; }
.inline-form { display: flex; gap: 8px; margin-bottom: 14px; }
.inline-form input, .inline-form select, dialog select, dialog input {
  font: 700 .95rem "Nunito"; padding: 10px 12px; border: 2px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink);
}
.inline-form input { flex: 1; min-width: 0; }
.inline-form select { width: 66px; font-size: 1.1rem; }
.chip-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.chip-list li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; background: #f7f9fd; border-radius: 12px; font-weight: 800; }
.chip-list li .grow { flex: 1; }

/* ================= Dialogs ================= */
dialog {
  border: 0; border-radius: 22px; padding: 24px; width: min(520px, calc(100vw - 32px));
  box-shadow: 0 30px 80px rgba(0,0,0,.3); color: var(--ink);
}
dialog::backdrop { background: rgba(10, 30, 80, .45); }
dialog h2 { margin: 0 0 14px; font-size: 1.5rem; color: var(--ink-strong); }
dialog label { display: flex; flex-direction: column; gap: 6px; font-weight: 800; font-size: .85rem; margin-bottom: 12px; }
.field-label { font-weight: 800; font-size: .85rem; margin: 10px 0 8px; }
.pick-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.pick {
  border: 2px solid var(--line); background: #fff; border-radius: 999px; cursor: pointer;
  padding: 4px 12px 4px 4px; display: flex; align-items: center; gap: 8px; font: 800 .85rem "Nunito"; color: var(--ink);
}
.pick.on { border-color: var(--primary); background: var(--primary-soft); }
.pick.win.on { border-color: var(--gold); background: #fff4cc; }
.error { color: var(--red); font-weight: 800; font-size: .85rem; min-height: 1em; margin: 4px 0 0; }
.profile-head { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; }
.profile-head h2 { margin: 0; }
.profile-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 18px; }
.profile-stats div { background: #f7f9fd; border-radius: 12px; padding: 10px; text-align: center; }
.profile-stats b { display: block; font: 800 1.3rem var(--pixel); color: var(--primary); }
.profile-stats span { font-size: .7rem; color: var(--muted); font-weight: 700; }
.pg-row > span:first-child { display: flex; align-items: center; gap: 6px; }
.pg-row { display: grid; grid-template-columns: 1fr 2fr auto; gap: 10px; align-items: center; margin-bottom: 8px; font-size: .9rem; font-weight: 800; }
.pg-row .bar { width: 100%; height: 10px; }

/* ================= Responsive ================= */
@media (max-width: 1100px) {
  .row-2 { grid-template-columns: 1fr; gap: 0; }
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .hero-bar { padding-left: 360px; gap: 18px; }
  .hero-bar .chip:nth-child(3) { display: none; }
}
@media (max-width: 860px) {
  body { padding: 0; }
  .frame { grid-template-columns: 1fr; border-radius: 0; padding-bottom: 76px; }
  .sidebar {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; height: 72px;
    flex-direction: row; box-shadow: 0 -6px 20px rgba(0,0,0,.15);
  }
  .logo, .side-white { display: none; }
  .sidebar nav { flex-direction: row; flex: 4; }
  .nav-btn { flex: 1; border: 0; padding: 8px 2px; gap: 3px; font-size: .7rem; }
  .ring { width: 34px; height: 34px; padding: 6px; }
  .side-yellow { margin: 0; flex: 1.1; padding: 6px 2px; gap: 3px; font-size: .66rem; }
  .side-yellow .star { width: 34px; height: 34px; padding: 7px; }

  .view { padding: 0 16px; }
  .pad-top { padding-top: 20px; }
  .hero { height: 300px; }
  .tabs { left: 16px; right: 16px; top: 16px; max-width: none; flex-wrap: wrap; }
  .pcard { width: 70px; height: 100px; padding: 5px 7px; }
  .pcard b { font-size: 1.2rem; } .pcard span { font-size: 2rem; margin-bottom: 8px; }
  .pc1 { left: 18%; top: 110px; } .pc2 { left: calc(18% + 52px); top: 100px; } .pc3 { left: calc(18% + 110px); top: 116px; }
  .pc4 { display: none; }
  .big-star { right: 6px; top: 96px; width: 84px; height: 84px; }
  .hero-bar { display: none; }

  .profile-layout { grid-template-columns: 1fr; gap: 0; padding: 0; }
  .left-col { margin-top: -110px; }
  .right-col { padding-top: 24px; }
  .champ-card .big-av { width: 140px; height: 140px; margin-top: -70px; }
  .champ-card { margin-top: 70px; }
  .players-grid { grid-template-columns: repeat(2, 1fr); }
  .game-champs { grid-template-columns: 1fr; }
  .tiles { gap: 12px; }
  .tile .big { font-size: 1.6rem; }
  .skills { gap: 12px 24px; }
  .champions-title { font-size: 3rem; margin-bottom: -16px; }
  .podium { grid-template-columns: 1fr; gap: 14px; }
  .podium-card.r1 { order: -1; }
  .row-2.even { grid-template-columns: 1fr; gap: 0; }
  .profile-stats { grid-template-columns: repeat(2, 1fr); }
  .mascot { right: -8px; }
}
@media (max-width: 400px) {
  .side-yellow .lbl { font-size: 0; }
  .side-yellow .lbl::after { content: "ADD"; font-size: .66rem; }
}

/* keep Save/Cancel visible on small screens */
dialog { max-height: calc(100dvh - 32px); overflow-y: auto; }
.btn-row.sticky { position: sticky; bottom: -24px; background: #fff; padding: 12px 0 4px; margin-bottom: -4px; }

/* ================= Icons ================= */
.ic { display: inline-grid; place-items: center; width: 100%; height: 100%; flex: none; font-style: normal; }
.ic svg { width: 100%; height: 100%; display: block; }
.ic.xs { width: 16px; height: 16px; } .ic.sm { width: 22px; height: 22px; } .ic.md { width: 34px; height: 34px; }
.ic.lg { width: 44px; height: 44px; } .ic.xl { width: 96px; height: 96px; }
.tab .ic { width: 18px; height: 18px; }
.dot .ic { width: 18px; height: 18px; }
.ring.w .ic, .ring.sm .ic { width: 22px; height: 22px; }
.ring.w { background: #fff; padding: 0; }
.big-star .ic { transform: rotate(12deg); }
.filters label span .ic { width: 16px; height: 16px; }

/* ================= Avatars: coloured heads ================= */
.avatar {
  flex: none; width: 48px; height: 48px; border-radius: 50%; overflow: hidden; display: inline-block;
  border: 3px solid #fff; box-shadow: 0 2px 8px rgba(0,0,0,.14); background: #fff;
}
.avatar svg { width: 100%; height: 100%; display: block; }
.avatar.xs { width: 26px; height: 26px; border-width: 2px; }
.avatar.sm { width: 38px; height: 38px; border-width: 2px; }
.avatar.lg { width: 72px; height: 72px; }
.avatar.xl { width: 120px; height: 120px; border-width: 6px; }

.place-badge { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font: 800 .9rem var(--pixel); color: #fff; }
.place-badge.p2 { background: linear-gradient(135deg, #c7d2e2, #8e9bb0); }
.place-badge.p3 { background: linear-gradient(135deg, #f3b07a, #c9773d); }
.place-badge.p4 { background: linear-gradient(135deg, #b9a4ff, #7c5cff); }
.empty.light { color: #fff; }
.btn-sm { padding: 4px 14px; font-size: .85rem; }

/* ================= Match rows ================= */
.stack { display: flex; }
.stack > span { margin-left: -8px; position: relative; }
.stack > span:first-child { margin-left: 0; }
.stack .winner .avatar { box-shadow: 0 0 0 2px var(--gold); }
.stack .more { width: 26px; height: 26px; border-radius: 50%; background: var(--line); font: 800 .65rem/26px "Nunito"; text-align: center; color: var(--muted); }
.icon-btn { display: grid; place-items: center; padding: 6px; }
.icon-btn:hover { background: var(--primary-soft); }
.icon-btn.del:hover { background: #ffe8ea; }

/* ================= History ================= */
.filters { display: grid; grid-template-columns: repeat(4, 1fr) auto; gap: 12px; align-items: end; }
.filters label { min-width: 0; display: flex; flex-direction: column; gap: 6px; font-weight: 800; font-size: .8rem; color: var(--muted); }
.filters label span { display: flex; align-items: center; gap: 6px; }
.filters select, .filters input {
  font: 700 .92rem "Nunito"; padding: 9px 10px; border: 2px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink); width: 100%;
}
.h-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 18px; }
.hs { display: flex; align-items: center; gap: 12px; background: #f7f9fd; border-radius: 14px; padding: 12px 14px; min-width: 0; }
.hs b { display: block; font: 800 1.15rem var(--pixel); color: var(--ink-strong); line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hs span { font-size: .75rem; color: var(--muted); font-weight: 700; }
.hs > div { min-width: 0; }
.day { background: #fff; border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); margin-bottom: 16px; }
.day-head { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.day-badge {
  width: 54px; height: 58px; border-radius: 14px; background: var(--primary); color: #fff; flex: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center; font: 700 .72rem "Nunito"; text-transform: uppercase;
  box-shadow: 0 4px 0 var(--primary-dark);
}
.day-badge b { font: 800 1.5rem/1 var(--pixel); }
.day-title { font: 700 1.05rem var(--pixel); color: var(--ink-strong); }

/* ================= Editors & pickers ================= */
.editor-preview { display: grid; place-items: center; margin: 4px 0 16px; }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 8px; }
.swatch { width: 36px; height: 36px; border-radius: 50%; border: 3px solid #fff; background: var(--c); cursor: pointer; box-shadow: 0 0 0 2px var(--line); padding: 0; margin: 0; }
.swatch.on { box-shadow: 0 0 0 3px var(--ink-strong); }
.swatch.custom { position: relative; background: conic-gradient(#ff5c8a, #ffb800, #22c55e, #1f9bff, #a259ff, #ff5c8a); display: block; }
.swatch.custom input { opacity: 0; position: absolute; inset: 0; width: 100%; height: 100%; cursor: pointer; padding: 0; border: 0; }
.faces { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.face-opt, .gpick {
  border: 2px solid var(--line); background: #fff; border-radius: 14px; padding: 6px 10px; cursor: pointer;
  display: flex; align-items: center; gap: 8px; font: 800 .85rem "Nunito"; color: var(--ink);
}
.face-opt.on, .gpick.on { border-color: var(--primary); background: var(--primary-soft); }
.game-pick { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.gpick { padding: 5px 12px 5px 6px; }
.gpick.add { border-style: dashed; }
.newgame { background: #f7f9fd; border-radius: 14px; padding: 12px; margin-bottom: 12px; }
.newgame input { width: 100%; margin-bottom: 10px; }
.icon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); gap: 6px; max-height: 170px; overflow-y: auto; padding: 2px; }
.icon-opt { border: 2px solid transparent; background: #fff; border-radius: 12px; padding: 6px; cursor: pointer; aspect-ratio: 1; }
.icon-opt:hover { background: var(--primary-soft); }
.icon-opt.on { border-color: var(--primary); background: var(--primary-soft); }
#e-body label { display: flex; flex-direction: column; gap: 6px; font-weight: 800; font-size: .85rem; margin-bottom: 12px; }
#e-body input#e-name, .newgame input { font: 700 .95rem "Nunito"; padding: 10px 12px; border: 2px solid var(--line); border-radius: 12px; }
.date-label { margin-top: 4px; }
.pick .ic { width: 16px; height: 16px; }
.profile-head .btn { margin-left: auto; }
.credits { text-align: center; color: var(--muted); font-size: .75rem; font-weight: 600; }
.credits a { color: var(--primary); }

@media (max-width: 860px) {
  .filters { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .filters input, .filters select { min-width: 0; font-size: .85rem; }
  .filters .btn { grid-column: 1 / -1; justify-content: center; }
  .h-summary { grid-template-columns: 1fr; }
  .day { padding: 14px; }
  .match .stack { display: none; }
  .faces { grid-template-columns: repeat(2, 1fr); }
  .profile-head { flex-wrap: wrap; }
}

.show-more { display: flex; justify-content: center; margin: 4px 0 20px; }

/* ================= Cloud sync ================= */
.sync-pill {
  margin-left: auto; border: 2px solid rgba(255,255,255,.5); background: rgba(255,255,255,.15); color: #fff; cursor: pointer;
  border-radius: 999px; padding: 6px 14px; font: 800 .78rem "Nunito"; display: flex; align-items: center; gap: 8px; white-space: nowrap;
}
.sync-pill i, .cloud-status i { width: 10px; height: 10px; border-radius: 50%; background: #c9d2e0; flex: none; }
.sync-pill.live i, .cloud-status.live i { background: var(--green); box-shadow: 0 0 0 3px rgba(34,197,94,.3); }
.sync-pill.syncing i, .cloud-status.syncing i { background: var(--yellow, #ffc928); animation: pulse 1s infinite; }
.sync-pill.error i, .cloud-status.error i { background: var(--red); }
@keyframes pulse { 50% { opacity: .3; } }
.cloud-status { display: flex; align-items: center; gap: 12px; background: #f7f9fd; border-radius: 14px; padding: 12px 14px; margin-bottom: 14px; }
.cloud-status i { width: 14px; height: 14px; }
.cloud-form { display: grid; grid-template-columns: 1fr 1fr auto; gap: 10px; align-items: end; margin-top: 12px; }
.cloud-form label { display: flex; flex-direction: column; gap: 6px; font-weight: 800; font-size: .8rem; color: var(--muted); min-width: 0; }
.cloud-form input { font: 700 .9rem "Nunito"; padding: 10px 12px; border: 2px solid var(--line); border-radius: 12px; min-width: 0; }
#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 140%); z-index: 50; max-width: calc(100vw - 32px);
  background: var(--ink-strong); color: #fff; padding: 12px 18px; border-radius: 14px; font-weight: 700; font-size: .9rem;
  box-shadow: 0 10px 30px rgba(0,0,0,.25); transition: transform .25s;
}
#toast.show { transform: translate(-50%, 0); }
@media (max-width: 860px) {
  .cloud-form { grid-template-columns: 1fr; }
  #toast { bottom: 90px; }
}

/* ================= Welcome / lock screen ================= */
body.locked { overflow: hidden; }
.lock { position: fixed; inset: 0; z-index: 100; display: grid; grid-template-columns: 1.1fr 1fr; background: #dbe7fb; }
.lock[hidden] { display: none; }
.lock-art { position: relative; overflow: hidden; background: #2a6fd8; }
#welcome-art, #welcome-photo { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; }
#welcome-photo { object-fit: cover; object-position: center 60%; }
.lock-wave { position: absolute; top: 0; right: -1px; height: 100%; width: 72px; }
.lock-wave path { fill: #dbe7fb; shape-rendering: crispEdges; }
.lock-panel { display: flex; flex-direction: column; justify-content: center; padding: 40px clamp(20px, 5vw, 72px); overflow-y: auto; }
.lock-logo { position: absolute; top: 28px; right: clamp(20px, 5vw, 72px); display: flex; align-items: center; gap: 8px; font: 600 .95rem var(--pixel); color: #2a3d66; }
.lock-logo .ic { width: 28px; height: 28px; }
.lock-inner { width: 100%; max-width: 520px; margin: 0 auto; }
.lock-hello { text-align: center; margin-bottom: 30px; }
.lock-hello h2 { font: 600 clamp(1.4rem, 2.4vw, 1.9rem)/1.25 var(--pixel); color: #2a3d66; margin: 0 0 6px; }
.lock-hello p { font: 500 1.15rem var(--pixel); color: #3d5383; margin: 0; display: inline-flex; align-items: center; gap: 6px; }
.lock-field { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; min-width: 0; }
.lock-field label { font-weight: 700; font-size: .9rem; color: #2a3d66; padding-left: 18px; }
.pill-input {
  width: 100%; min-width: 0; height: 58px; border: 2px solid transparent; border-radius: 999px; background: #f6f2ec;
  padding: 0 24px; font: 700 1rem "Nunito"; color: var(--ink-strong); outline: none; transition: border-color .15s, box-shadow .15s;
}
.pill-input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(31,120,255,.18); }
.pill-row { display: flex; gap: 10px; }
.pill-row .pill-btn { flex: none; }
.pill-btn {
  height: 58px; padding: 0 34px; border: 0; border-radius: 999px; background: #f6f2ec; color: #2a3d66; cursor: pointer;
  font: 600 1.05rem var(--pixel); display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  box-shadow: 0 4px 0 rgba(42,61,102,.15); transition: transform .1s, filter .15s;
}
.pill-btn:hover { filter: brightness(1.04); } .pill-btn:active { transform: translateY(2px); box-shadow: 0 2px 0 rgba(42,61,102,.15); }
.pill-btn.primary { background: var(--primary); color: #fff; box-shadow: 0 4px 0 var(--primary-dark); }
#lock-go { width: min(260px, 100%); margin-top: 8px; }
.lock-note { color: #5d6f96; font-size: .85rem; font-weight: 600; margin: -6px 0 18px 18px; }
.lock-check { display: flex; align-items: center; gap: 14px; font-weight: 600; color: #2a3d66; margin: 6px 0 24px; cursor: pointer; }
.lock-check input { position: absolute; opacity: 0; }
.lock-check span { width: 40px; height: 40px; border-radius: 12px; background: #f6f2ec; flex: none; display: grid; place-items: center; }
.lock-check input:checked + span::after { content: ""; width: 14px; height: 14px; background: var(--primary); box-shadow: 0 0 0 3px #f6f2ec, 0 0 0 5px var(--primary); }
.lock-check input:focus-visible + span { outline: 3px solid var(--primary); }
.lock-or { display: flex; align-items: center; gap: 14px; color: #5d6f96; font-size: .85rem; font-weight: 700; margin: 10px 0 22px; }
.lock-or::before, .lock-or::after { content: ""; flex: 1; height: 2px; background: #2a3d66; opacity: .35; }
.lock-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
@media (max-width: 860px) {
  .lock { grid-template-columns: 1fr; grid-template-rows: 34vh 1fr; overflow-y: auto; }
  .lock-wave { display: none; }
  .lock-art { clip-path: polygon(0 0, 100% 0, 100% 86%, 92% 86%, 92% 90%, 84% 90%, 84% 94%, 72% 94%, 72% 97%, 58% 97%, 58% 94%, 46% 94%, 46% 90%, 36% 90%, 36% 94%, 24% 94%, 24% 97%, 12% 97%, 12% 93%, 4% 93%, 4% 89%, 0 89%); }
  .lock-panel { justify-content: flex-start; padding: 26px 20px 40px; }
  .lock-logo { position: static; justify-content: center; margin-bottom: 16px; }
  .lock-grid { grid-template-columns: 1fr; }
  .pill-input, .pill-btn { height: 52px; }
}

/* ================= Sharing & change log ================= */
.invite-row { display: flex; gap: 8px; margin-bottom: 8px; }
.invite-row input { flex: 1; min-width: 0; font: 700 .85rem "Nunito"; padding: 9px 12px; border: 2px solid var(--line); border-radius: 12px; color: var(--muted); background: #f7f9fd; }
.name-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--primary-soft); color: var(--primary); font-weight: 800; padding: 4px 12px 4px 6px; border-radius: 999px; }
.owner-head { margin-bottom: 12px; align-items: center; }
.log { list-style: none; margin: 0; padding: 0; max-height: 420px; overflow-y: auto; }
.log li { display: flex; gap: 12px; padding: 10px 4px; border-bottom: 1px solid var(--line); font-size: .9rem; }
.log li:last-child { border-bottom: 0; }
.log-dot { width: 12px; height: 12px; border-radius: 50%; margin-top: 4px; flex: none; background: var(--primary); }
.log-insert .log-dot { background: var(--green); }
.log-delete .log-dot { background: var(--red); }
.log-update .log-dot { background: #ffb800; }

/* ================= 8-bit accents ================= */
.champions-title { font-family: var(--arcade); font-size: 3.4rem; letter-spacing: 2px; }
.place, .leaderboard td:first-child, .day-badge b, .place-badge, .tile .big,
.champ-stats b, .podium .stats b, .profile-stats b, .hs b, .badge { font-family: var(--arcade); font-weight: 400; }
.tile .big { font-size: 1.35rem; }
.champ-stats b { font-size: 1.15rem; line-height: 1.6; }
.podium .stats b, .profile-stats b { font-size: .95rem; line-height: 1.7; }
.leaderboard td:first-child { font-size: .95rem; }
.place { font-size: 1.8rem; }
.place sup { font-size: .6rem; }
.day-badge b { font-size: 1.05rem; line-height: 1.4; }
.place-badge { font-size: .65rem; }
.hs b { font-size: .8rem; line-height: 1.6; }
.badge { font-size: .5rem; line-height: 16px; }
.form i { font-family: var(--arcade); font-size: .45rem; line-height: 20px; }
h1, h2, h3, .name, .side-panel h4, .btn, .tab, .chip b, .gname, .day-title, .pg .n, .side-item .t, .tile .who { font-family: var(--pixel); }
.nav-btn, .side-yellow .lbl { font-family: var(--pixel); font-weight: 600; letter-spacing: .3px; }
.side-yellow .lbl { font-family: var(--arcade); font-size: .5rem; line-height: 1.5; }
@media (max-width: 860px) {
  .champions-title { font-size: 1.9rem; }
  .side-yellow .lbl { font-size: .45rem; }
}
@media (max-width: 400px) {
  .side-yellow .lbl { font-size: 0 !important; }
  .side-yellow .lbl::after { font-family: var(--arcade); font-size: .5rem; }
}
/* keep the game tabs readable over any header art */
.tabs { background: rgba(16, 36, 110, .45); border-color: rgba(255,255,255,.45); }

/* ================= 8-bit header scene ================= */
.hero { background: #2a74e0; }
#hero-art {
  position: absolute; left: 0; top: 0; width: 100%; height: calc(100% - 84px);
  image-rendering: pixelated; image-rendering: crisp-edges; display: block;
}
@media (max-width: 860px) {
  .hero { height: 340px; }
  #hero-art { top: 94px; height: 132px; }
}
@media (max-width: 860px) {
  .champ-card .crown-tag { top: -66px; width: 44px; height: 44px; }
}

/* ================= canvas-ui overlays ================= */
.cui-out { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.cui-fixed { position: fixed; z-index: 15; }
/* header effects sit exactly over the 8-bit canvas */
.hero .cui-art-out { top: 0; height: calc(100% - 84px); image-rendering: pixelated; z-index: 1; }
.hero .cui-glitch, .hero .cui-decrypt { opacity: 0; transition: opacity .25s; z-index: 2; }
.hero .cui-glitch.on, .hero .cui-decrypt.on { opacity: 1; }
@media (max-width: 860px) { .hero .cui-art-out { top: 94px; height: 132px; } }
.hero .tabs, .hero .hero-bar { z-index: 3; }
.cui-flame { position: relative; margin-top: 80px; }
.cui-flame > .champ-card { margin-top: 0; }
.cui-flame-out { z-index: 2; border-radius: 22px 22px 0 0; }
@media (max-width: 860px) { .cui-flame { margin-top: 70px; } }

/* keep the champion column in view while the right side scrolls (laptop) */
@media (min-width: 861px) {
  .left-col { position: sticky; top: var(--stick-top, 16px); align-self: start; }
}

/* ================= Full-screen layout ================= */
body { padding: 0; }
.frame { max-width: none; min-height: 100vh; border-radius: 0; box-shadow: none; overflow: clip; }
@media (min-width: 861px) {
  .sidebar { position: sticky; top: 0; height: 100vh; }
  main { padding-bottom: 40px; }
}

/* =====================================================================
   Home redesign: header → toolbar → podium → highlights → two columns
   ===================================================================== */
.hero { height: 230px; }
#hero-art { top: 0 !important; height: 100% !important; }
.hero .cui-art-out { top: 0 !important; height: 100% !important; }

.toolbar {
  position: sticky; top: 0; z-index: 12; display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 12px 28px; background: rgba(255,255,255,.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.toolbar .tabs {
  position: static; max-width: none; background: #eef3fb; border: 0; padding: 4px; border-radius: 999px;
  display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; backdrop-filter: none;
}
.toolbar .tab { color: #4a5677; text-shadow: none; border-radius: 999px; padding: 7px 14px; }
.toolbar .tab:hover { background: #fff; }
.toolbar .tab.active { background: var(--primary); color: #fff; box-shadow: 0 3px 0 var(--primary-dark); }
.toolbar-right { display: flex; align-items: center; gap: 10px; flex: none; }
.date-chip { display: inline-flex; align-items: center; gap: 8px; font: 600 .9rem var(--pixel); color: #2a3d66; background: #fff6d6; padding: 6px 14px 6px 8px; border-radius: 999px; }
.date-chip .ic { width: 22px; height: 22px; }
.toolbar .sync-pill { margin: 0; color: #2a3d66; border-color: #d6e0f0; background: #fff; }

#view-dashboard { padding-top: 26px; }
.section-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 16px; }
.section-head h2 { display: flex; align-items: center; gap: 10px; font: 700 1.5rem var(--pixel); color: var(--ink-strong); margin: 0; }
.section-head h2 .ic { width: 30px; height: 30px; }
.scope { font-weight: 800; font-size: .85rem; color: var(--primary); background: var(--primary-soft); padding: 4px 12px; border-radius: 999px; }

/* ---------- Podium ---------- */
.podium { display: grid; grid-template-columns: 1fr 1.15fr 1fr; gap: 18px; align-items: end; margin-bottom: 22px; }
.podium-card {
  position: relative; border: 0; cursor: pointer; text-align: center; color: var(--ink-strong); font: inherit;
  border-radius: 26px; padding: 22px 16px 18px; display: flex; flex-direction: column; align-items: center; gap: 6px;
  background-image: radial-gradient(rgba(255,255,255,.55) 1.5px, transparent 1.6px), var(--podium-bg);
  background-size: 18px 18px, 100% 100%; box-shadow: 0 8px 0 var(--podium-edge), 0 14px 30px rgba(30,50,120,.12);
  transition: transform .15s;
}
.podium-card:hover { transform: translateY(-4px); }
.podium-card.r1 { --podium-bg: linear-gradient(160deg, #fff1a6, #ffc94a 55%, #ffad33); --podium-edge: #e09a1f; padding-top: 30px; min-height: 300px; }
.podium-card.r2 { --podium-bg: linear-gradient(160deg, #eee8ff, #c9bcff 60%, #a99cff); --podium-edge: #8c7ce8; min-height: 255px; }
.podium-card.r3 { --podium-bg: linear-gradient(160deg, #ffe6d6, #ffbf99 60%, #ff9f73); --podium-edge: #e57c4f; min-height: 235px; }
.podium-card .place {
  position: absolute; top: 14px; left: 14px; font: 400 .7rem var(--arcade); background: rgba(255,255,255,.85);
  color: var(--ink-strong); padding: 6px 9px; border-radius: 10px;
}
.podium-card.r1 .place { background: #2a3d66; color: #ffe066; }
.podium-card .avatar { border-width: 4px; box-shadow: 0 6px 14px rgba(0,0,0,.15); }
.podium-card .pname { font: 700 1.35rem var(--pixel); margin-top: 6px; }
.podium-card.r1 .pname { font-size: 1.6rem; }
.podium-card .ptag { font-size: .78rem; font-weight: 800; background: rgba(255,255,255,.7); padding: 3px 10px; border-radius: 999px; }
.podium-card .pstats { display: flex; gap: 6px; margin-top: 10px; width: 100%; justify-content: center; }
.podium-card .pstats span { background: rgba(255,255,255,.75); border-radius: 12px; padding: 7px 10px; font-size: .7rem; font-weight: 700; color: #4a5677; min-width: 64px; }
.podium-card .pstats b { display: block; font: 400 .8rem/1.6 var(--arcade); color: var(--ink-strong); }
.podium-card.ghost { cursor: default; opacity: .55; justify-content: center; color: #4a5677; font-weight: 700; }
.podium-empty { grid-column: 1 / -1; display: flex; align-items: center; gap: 18px; background: #fff; border: 3px dashed #cfdaee; border-radius: 26px; padding: 26px; }
.podium-empty p { margin: 4px 0 0; color: var(--muted); font-weight: 600; }
.podium-empty .btn { margin-left: auto; }

/* ---------- Highlights ---------- */
#tiles.tiles { grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
#tiles .tile { flex-direction: row; align-items: center; gap: 14px; padding: 18px; cursor: default; }
#tiles .tile[data-player] { cursor: pointer; }
#tiles .tile-ic { width: 48px; height: 48px; border-radius: 14px; padding: 9px; flex: none; }
#tiles .tile-body { display: flex; flex-direction: column; min-width: 0; position: relative; z-index: 1; }
#tiles .label { font-size: .78rem; font-weight: 800; opacity: .95; }
#tiles .big { font: 400 1.05rem/1.7 var(--arcade); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#tiles .tile-sub { font-size: .8rem; font-weight: 700; opacity: .92; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Two columns ---------- */
.dash-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.side-stack > .card:last-child { margin-bottom: 0; }
.leaderboard th.num, .leaderboard td.num { text-align: center; }
.leaderboard td:first-child { width: 48px; }
.leaderboard tr.g td, .leaderboard tr.s td, .leaderboard tr.b td { background: #f7f9fd; }
.rank { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 10px; font: 400 .7rem var(--arcade); background: #e8edf6; color: #4a5677; }
.rank.r1 { background: #ffd34d; color: #5c3d00; } .rank.r2 { background: #cfc4ff; color: #3b2d8f; } .rank.r3 { background: #ffc4a3; color: #7a3410; }
.game-champs { grid-template-columns: 1fr !important; gap: 10px; }
.gc { border: 0; width: 100%; text-align: left; font: inherit; color: inherit; padding: 10px 12px; }
.gc .info { display: flex; flex-direction: column; }
.gc .champ { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: .88rem; }
#recent .match .stack { display: none; }

@media (max-width: 1100px) {
  #tiles.tiles { grid-template-columns: repeat(2, 1fr); }
  .dash-grid { grid-template-columns: 1fr; gap: 0; }
}
@media (max-width: 860px) {
  .hero { height: 150px !important; }
  .toolbar { padding: 10px 12px; top: 0; }
  .toolbar-right { display: none; }
  #view-dashboard { padding-top: 18px; }
  .section-head h2 { font-size: 1.2rem; }
  .podium { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .podium-card { padding: 34px 6px 12px; border-radius: 18px; min-height: 0 !important; }
  .podium-card.r1 { padding-top: 40px; }
  .podium-card .avatar.xl { width: 78px; height: 78px; }
  .podium-card .avatar.lg { width: 58px; height: 58px; }
  .podium-card .pname, .podium-card.r1 .pname { font-size: 1rem; }
  .podium-card .ptag { font-size: .62rem; padding: 2px 6px; }
  .podium-card .pstats { flex-direction: column; gap: 4px; }
  .podium-card .pstats span { min-width: 0; padding: 4px 6px; font-size: .62rem; }
  .podium-card .pstats span:last-child { display: none; }
  .podium-card .place { top: 8px; left: 50%; transform: translateX(-50%); font-size: .55rem; }
  .podium-empty { flex-direction: column; text-align: center; }
  .podium-empty .btn { margin: 0; }
  #tiles.tiles { gap: 10px; }
  #tiles .tile { padding: 12px; gap: 10px; flex-direction: column; align-items: flex-start; }
  #tiles .tile-ic { width: 38px; height: 38px; padding: 7px; }
  #tiles .big { font-size: .85rem; }
  .hide-sm { display: none; }
}
/* podium clean-up: drop old decorative band, keep 2nd-1st-3rd order everywhere */
.podium-card::before { display: none !important; }
.podium-card .place { right: auto; color: var(--ink-strong); text-shadow: none; }
.podium-card.r1 { order: 0 !important; }
@media (max-width: 860px) {
  .podium-card .place { right: auto; }
  .leaderboard .rate .bar { display: none; }
  .leaderboard td, .leaderboard th { padding-left: 6px; padding-right: 6px; }
}
@media (max-width: 860px) { .toolbar .tabs { flex-wrap: nowrap; left: auto; right: auto; top: auto; } .toolbar .tab { flex: none; } }

/* =====================================================================
   Navigation: top bar on laptop, floating tab bar + "+" button on phone
   ===================================================================== */
.frame { grid-template-columns: 1fr !important; padding-bottom: 0 !important; }
.topnav {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 18px;
  padding: 10px 28px; background: #fff; border-bottom: 1px solid var(--line); box-shadow: 0 6px 18px rgba(20, 50, 120, .06);
}
.brand { display: flex; align-items: center; gap: 10px; font: 700 1.15rem var(--pixel); color: #2a3d66; white-space: nowrap; }
.brand .ic { width: 34px; height: 34px; }
.nav-links { display: flex; gap: 4px; background: #f1f5fc; padding: 5px; border-radius: 999px; }
.topnav .nav-btn {
  flex: none; flex-direction: row; gap: 8px; padding: 8px 18px; border: 0; border-radius: 999px; background: transparent;
  color: #4a5677; font: 600 .98rem var(--pixel); letter-spacing: 0; text-shadow: none; cursor: pointer; transition: background .15s, color .15s;
}
.topnav .nav-btn .ic { width: 22px; height: 22px; }
.topnav .nav-btn:hover { background: #fff; color: var(--ink-strong); }
.topnav .nav-btn.active { background: var(--primary); color: #fff; box-shadow: 0 3px 0 var(--primary-dark); }
.topnav .nav-btn.active .ic { background: #fff; border-radius: 50%; padding: 2px; }
.nav-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.topnav .sync-pill { margin: 0; color: #2a3d66; border-color: #d6e0f0; background: #fff; }
.add-btn {
  display: inline-flex; align-items: center; gap: 8px; border: 0; cursor: pointer; border-radius: 999px; padding: 10px 20px 10px 12px;
  background: #ffc928; color: #3d2a00; font: 700 1rem var(--pixel); box-shadow: 0 4px 0 #d9a400; transition: transform .1s, filter .15s;
}
.add-btn .ic { width: 26px; height: 26px; background: #fff; border-radius: 50%; padding: 2px; }
.add-btn:hover { filter: brightness(1.05); } .add-btn:active { transform: translateY(2px); box-shadow: 0 2px 0 #d9a400; }
.game-filter { margin: 0 0 18px; display: flex; gap: 4px; flex-wrap: wrap; background: #fff; padding: 5px; border-radius: 999px; width: fit-content; max-width: 100%; box-shadow: var(--shadow); border: 0; position: static; backdrop-filter: none; }
.game-filter .tab { color: #4a5677; text-shadow: none; border-radius: 999px; padding: 7px 14px; }
.game-filter .tab:hover { background: #f1f5fc; }
.game-filter .tab.active { background: var(--primary); color: #fff; box-shadow: 0 3px 0 var(--primary-dark); }
@media (max-width: 1100px) { .date-chip { display: none; } }
@media (max-width: 860px) {
  .topnav { position: static; padding: 0; height: 0; border: 0; box-shadow: none; }
  .brand, .topnav .sync-pill { display: none; }
  .nav-links {
    position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 30;
    justify-content: space-around; background: #fff; border-radius: 24px; padding: 8px; box-shadow: 0 10px 30px rgba(20, 50, 120, .22);
  }
  .topnav .nav-btn { flex: 1; flex-direction: column; gap: 3px; padding: 7px 4px; font-size: .74rem; border-radius: 16px; }
  .topnav .nav-btn .ic { width: 26px; height: 26px; }
  .topnav .nav-btn.active { box-shadow: none; }
  .add-btn {
    position: fixed; right: 18px; bottom: calc(96px + env(safe-area-inset-bottom)); z-index: 31; width: 60px; height: 60px;
    padding: 0; justify-content: center; border-radius: 50%; box-shadow: 0 5px 0 #d9a400, 0 10px 24px rgba(0,0,0,.18);
  }
  .add-btn span { display: none; }
  .add-btn .ic { width: 32px; height: 32px; }
  main { padding-bottom: 110px; }
  .game-filter { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; border-radius: 18px; }
  .game-filter .tab { flex: none; }
  #toast { bottom: 100px; }
}
.add-btn .plus { width: 26px; height: 26px; border-radius: 50%; background: #fff; color: #e09a00; display: grid; place-items: center; font: 900 1.3rem/1 "Nunito"; }
@media (max-width: 860px) {
  .add-btn .plus { width: auto; height: auto; background: none; color: #3d2a00; font-size: 2.2rem; }
  #view-history .card-head .btn-blue { display: none; }
}
.name-line { display: inline-flex; align-items: center; gap: 8px; font-size: .85rem; font-weight: 600; color: var(--muted); }
.name-line b { color: var(--ink-strong); }
/* active nav item: soft tinted pill, icon shown as-is (no white circle) */
.topnav .nav-btn.active { background: #dce9ff; color: var(--primary); box-shadow: inset 0 0 0 2px #b9d3ff; }
.topnav .nav-btn.active .ic { background: none; border-radius: 0; padding: 0; }

/* ================= Player photos & inline "new player" ================= */
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-actions { display: flex; gap: 8px; justify-content: center; margin-top: 12px; flex-wrap: wrap; }
.editor-preview { flex-direction: column; }
.pick.add-player { padding: 3px 4px 3px 12px; border-style: dashed; cursor: default; gap: 6px; }
.pick.add-player .plus { font: 900 1.1rem/1 "Nunito"; color: var(--primary); }
.pick.add-player input { border: 0; outline: 0; background: transparent; font: 700 .85rem "Nunito"; width: 110px; padding: 6px 0; }
.pick.add-player:focus-within { border-color: var(--primary); }
.pick.add-player .btn { padding: 4px 12px; }

/* game filter: always one row, scroll sideways when there are many games */
.game-filter {
  flex-wrap: nowrap !important; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; max-width: 100%;
  border-radius: 18px; align-items: center; scroll-padding: 8px;
  -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent);
          mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent);
}
.game-filter::-webkit-scrollbar { display: none; }
.game-filter .tab { flex: none; white-space: nowrap; line-height: 1.2; }
.game-filter.at-end { -webkit-mask-image: none; mask-image: none; }

/* =====================================================================
   Header palette, used everywhere
   navy #1d2f63 / #2c4a92 · sky #3584ea / #74bcfc · grass #46b83a / #2e8c2a
   gold #ffc928 · orange #ff7a1a · dirt #6b4226 · cloud #eaf5ff
   ===================================================================== */
:root { --primary: #3584ea; --primary-dark: #1d5fc0; --primary-soft: #e2efff; --page: #eaf5ff; --navy: #1d2f63; --navy-2: #2c4a92; --ink-strong: #1d2f63; }
body { background: #eaf5ff; }
.frame, main { background: #eaf5ff radial-gradient(#d3e8ff 2px, transparent 2.1px) 0 0 / 24px 24px; }
h3, .section-head h2, .day-title, dialog h2 { color: var(--navy); }

/* menu */
.topnav { background: var(--navy); border-bottom: 4px solid #46b83a; box-shadow: none; }
.brand { color: #fff; }
.nav-links { background: var(--navy-2); }
.topnav .nav-btn { color: #d8e6ff; }
.topnav .nav-btn:hover { background: #3a5bab; color: #fff; }
.topnav .nav-btn.active { background: #ffc928; color: #3d2a00; box-shadow: 0 3px 0 #d9a400; }
.topnav .sync-pill, .date-chip { background: var(--navy-2); color: #fff; border-color: #3a5bab; }
.add-btn { border: 3px solid var(--navy); box-shadow: 4px 4px 0 var(--navy); }
.add-btn:active { box-shadow: 2px 2px 0 var(--navy); }
@media (max-width: 860px) {
  .topnav { background: none; border: 0; }
  .nav-links { background: var(--navy); border: 3px solid var(--navy); box-shadow: 0 8px 0 rgba(29,47,99,.25); }
  .add-btn { box-shadow: 4px 4px 0 var(--navy); }
}

/* sticker cards: navy outline + hard shadow */
.card, .tile, .podium-card, .game-filter, .day, dialog {
  border: 3px solid var(--navy) !important; box-shadow: 5px 5px 0 var(--navy) !important;
}
.card, .day { border-radius: 16px; }
.game-filter .tab.active, .btn-blue, .pill-btn.primary { background: var(--primary); box-shadow: 0 3px 0 var(--primary-dark); }
.btn-ghost { border-color: var(--navy); color: var(--navy); }

/* colours from the header */
.tile.t4 { background: linear-gradient(135deg, #4596f2, #2a74e0); }
.tile.t2 { background: linear-gradient(135deg, #5cc75a, #2e8c2a); }
.tile.t3 { background: linear-gradient(135deg, #ffb52e, #ff7a1a); }
.tile.t1 { background: linear-gradient(135deg, #ffd23f, #e9a800); }
.podium-card.r1 { --podium-bg: linear-gradient(160deg, #fff1a6, #ffc94a 55%, #ffad33); }
.podium-card.r2 { --podium-bg: linear-gradient(160deg, #e6f3ff, #a9d4ff 60%, #74bcfc); }
.podium-card.r3 { --podium-bg: linear-gradient(160deg, #eaffdf, #b5ec9b 60%, #7fd66a); }
.rank.r1 { background: #ffd34d; color: #5c3d00; } .rank.r2 { background: #a9d4ff; color: #163f7a; } .rank.r3 { background: #b5ec9b; color: #1d5a1f; }
.gc.c0 { --gcb: #fff4c2; } .gc.c1 { --gcb: #e2efff; } .gc.c2 { --gcb: #e6f8dc; } .gc.c3 { --gcb: #ffe6cc; } .gc.c4 { --gcb: #e2efff; } .gc.c5 { --gcb: #fff4c2; }
.bar i, .form .w { background: #46b83a; }
.day-badge { background: var(--navy); box-shadow: 0 4px 0 #46b83a; }
.dot.blue { background: #e2efff; } .dot.green { background: #e6f8dc; } .dot.pink { background: #fff4c2; }

/* ---------- pixel podium: cards stand on grass-and-dirt blocks ---------- */
.podium { gap: 18px; align-items: end; }
.slot { display: flex; flex-direction: column; min-width: 0; }
.slot .podium-card { min-height: 0 !important; position: relative; z-index: 1; }
.podium-card { box-shadow: 5px 0 0 var(--navy) !important; border-bottom-width: 0 !important; border-radius: 26px 26px 0 0 !important; }
.step {
  position: relative; border: 3px solid var(--navy); border-top: 0; box-shadow: 5px 5px 0 var(--navy);
  background:
    linear-gradient(#46b83a 0 10px, #2e8c2a 10px 13px, transparent 13px),
    repeating-linear-gradient(90deg, transparent 0 7px, rgba(0,0,0,.12) 7px 9px),
    linear-gradient(#7a4a2a, #6b4226);
  display: grid; place-items: center; image-rendering: pixelated;
}
.step::before { /* grass blades */
  content: ""; position: absolute; left: 0; right: 0; top: -5px; height: 5px;
  background: repeating-linear-gradient(90deg, #46b83a 0 3px, transparent 3px 7px, #5cc75a 7px 9px, transparent 9px 12px);
}
.step b { font: 400 1.4rem var(--arcade); color: #ffe066; text-shadow: 3px 3px 0 #3a2312; margin-top: 10px; }
.step.step-1 { height: 74px; } .step.step-2 { height: 52px; } .step.step-3 { height: 36px; }
.step.step-3 b { font-size: 1rem; }
.podium-card .place { display: none; }

/* ---------- pixel ground footer ---------- */
.pixel-ground {
  margin-top: 36px; height: 92px; position: relative; display: grid; place-items: end center; padding-bottom: 16px;
  background:
    linear-gradient(#46b83a 0 14px, #2e8c2a 14px 18px, transparent 18px),
    radial-gradient(#5a3519 1.5px, transparent 1.6px) 0 22px / 14px 12px,
    radial-gradient(#83532f 1.5px, transparent 1.6px) 7px 28px / 14px 12px,
    #6b4226;
}
.pixel-ground::before {
  content: ""; position: absolute; left: 0; right: 0; top: -6px; height: 6px;
  background: repeating-linear-gradient(90deg, #46b83a 0 3px, transparent 3px 8px, #5cc75a 8px 10px, transparent 10px 14px);
}
.pixel-ground span { font: 600 .85rem var(--pixel); color: #f3dcc4; }
main { padding-bottom: 0 !important; }
.credits { margin-bottom: 0; }

@media (max-width: 860px) {
  .podium { gap: 8px; }
  .podium-card { border-radius: 18px 18px 0 0 !important; }
  .step.step-1 { height: 54px; } .step.step-2 { height: 38px; } .step.step-3 { height: 26px; }
  .step b { font-size: 1rem; margin-top: 8px; } .step.step-3 b { font-size: .75rem; }
  .pixel-ground { margin-bottom: 0; height: 120px; padding-bottom: 100px; place-items: start center; padding-top: 30px; }
  main { padding-bottom: 0 !important; }
}
