/* VRC Scout — playful theme. Each mode has its own color (--mode). */
:root {
  --bg: #f4f2fb;
  --card: #ffffff;
  --fill: #eeebf7;
  --fill-strong: #dcd7ec;
  --line: #e6e2f2;
  --text: #1d1b2e;
  --text2: #6b6788;
  --text3: #a7a3bf;
  --red: #ff4d5e;
  --red-soft: #ffe3e6;
  --blue: #3b82f6;
  --blue-soft: #e0ecff;
  --yellow: #ffc21a;
  --yellow-soft: #fff4cf;
  --green: #22c55e;
  --green-soft: #dcfce7;
  --orange: #ff8a1f;
  --mode: #7c5cff;
  --mode-soft: #ece7ff;
  --on-mode: #ffffff;
  --shadow: 0 2px 0 var(--line);
  --radius: 20px;
  --top: env(safe-area-inset-top, 0px);
  --bottom: env(safe-area-inset-bottom, 0px);
  --browser-pad: 0px;
  --modebar-h: calc(var(--top) + 74px);
  --font: ui-rounded, "SF Pro Rounded", "Nunito", "Varela Round", "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  color-scheme: light;
}
/* iPhone Safari's floating toolbar covers the bottom of the page. */
:root.ios-browser { --browser-pad: 64px; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12111c;
    --card: #1e1c2c;
    --fill: #2a2840;
    --fill-strong: #3a3754;
    --line: #2d2a42;
    --text: #f4f2ff;
    --text2: #a29fc0;
    --text3: #625f80;
    --red-soft: #4a1d26;
    --blue-soft: #1b2b4d;
    --yellow-soft: #43360f;
    --green-soft: #143723;
    --mode-soft: #2e2754;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #12111c;
  --card: #1e1c2c;
  --fill: #2a2840;
  --fill-strong: #3a3754;
  --line: #2d2a42;
  --text: #f4f2ff;
  --text2: #a29fc0;
  --text3: #625f80;
  --red-soft: #4a1d26;
  --blue-soft: #1b2b4d;
  --yellow-soft: #43360f;
  --green-soft: #143723;
  --mode-soft: #2e2754;
  color-scheme: dark;
}

/* Mode colors */
#app[data-mode="events"] { --mode: #ff7a1a; --mode-soft: #ffeadb; }
#app[data-mode="scout"] { --mode: #6d5dfc; --mode-soft: #ebe8ff; }
#app[data-mode="teams"] { --mode: #12b886; --mode-soft: #d9f7ec; }
#app[data-mode="me"] { --mode: #f0479b; --mode-soft: #ffe0f0; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) #app[data-mode="events"] { --mode-soft: #45291a; }
  :root:not([data-theme="light"]) #app[data-mode="scout"] { --mode-soft: #2c2752; --mode: #8b7dff; }
  :root:not([data-theme="light"]) #app[data-mode="teams"] { --mode-soft: #123a2f; --mode: #2dd4a0; }
  :root:not([data-theme="light"]) #app[data-mode="me"] { --mode-soft: #4a1a33; --mode: #ff5fae; }
}
:root[data-theme="dark"] #app[data-mode="events"] { --mode-soft: #45291a; }
:root[data-theme="dark"] #app[data-mode="scout"] { --mode-soft: #2c2752; --mode: #8b7dff; }
:root[data-theme="dark"] #app[data-mode="teams"] { --mode-soft: #123a2f; --mode: #2dd4a0; }
:root[data-theme="dark"] #app[data-mode="me"] { --mode-soft: #4a1a33; --mode: #ff5fae; }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 600 16px/1.35 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
}
body { position: fixed; inset: 0; overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button {
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  cursor: pointer;
  border: 0;
  background: none;
  padding: 0;
}
[hidden] { display: none !important; }
.ic { display: inline-flex; line-height: 0; }
b, strong { font-weight: 800; }

/* ───────── Frame ───────── */
#app { position: absolute; inset: 0; }

.modebar {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: var(--modebar-h);
  padding: calc(var(--top) + 8px) 10px 8px;
  display: flex;
  gap: 6px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  backdrop-filter: saturate(180%) blur(18px);
  z-index: 5;
}
.mode {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  border-radius: 18px;
  color: var(--text2);
  font-size: 12.5px;
  font-weight: 800;
  position: relative;
  transition: background 0.2s, color 0.2s, transform 0.12s;
}
.mode:active { transform: scale(0.94); }
.mode .e {
  font-size: 26px;
  line-height: 1.05;
  transition: transform 0.35s cubic-bezier(0.3, 1.8, 0.5, 1), filter 0.2s;
  filter: saturate(0.4);
  opacity: 0.8;
}
.mode.on { background: var(--mode); color: var(--on-mode); box-shadow: 0 4px 0 color-mix(in srgb, var(--mode) 70%, #000); }
.mode.on .e { transform: scale(1.15) rotate(-8deg); filter: none; opacity: 1; }
.mode-badge {
  position: absolute;
  top: 2px; right: 10%;
  min-width: 20px; height: 20px;
  padding: 0 5px;
  border-radius: 10px;
  background: var(--red);
  color: #fff;
  font-size: 11.5px;
  line-height: 20px;
  text-align: center;
  font-weight: 900;
  border: 2px solid var(--bg);
}

.stack { position: absolute; inset: var(--modebar-h) 0 0 0; overflow: hidden; }
.page {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  transition: transform 0.34s cubic-bezier(0.2, 0.9, 0.25, 1), opacity 0.34s;
  will-change: transform;
}
.page.enter { transform: translateX(100%); }
.page.behind { transform: translateX(-28%); opacity: 0.5; pointer-events: none; }
.page.leave { transform: translateX(100%); }

.topbar {
  flex: none;
  min-height: 52px;
  padding: 4px 8px;
  display: grid;
  grid-template-columns: 1fr minmax(0, 66%) 1fr;
  align-items: center;
}
.topbar-title { font-weight: 900; font-size: 18px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 2px; }
.topbar-right { justify-content: flex-end; }
.nav-btn {
  min-width: 44px; height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--mode);
  border-radius: 14px;
}
.nav-btn:active { background: var(--mode-soft); }
.nav-btn.back {
  background: var(--card);
  box-shadow: 0 3px 0 var(--line);
}
.nav-btn.back:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--line); }

.scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 6px 16px calc(32px + var(--bottom) + var(--browser-pad));
}
.page:has(.footer-bar) .scroll { padding-bottom: 24px; }

.hero { display: flex; align-items: flex-start; gap: 10px; margin: 4px 2px 14px; }
.hero-text { flex: 1; min-width: 0; }
.hero h1 { margin: 0; font-size: 34px; font-weight: 900; letter-spacing: -0.02em; line-height: 1.1; display: flex; align-items: center; gap: 8px; }
.hero-emoji { display: inline-block; animation: wiggle 2.8s ease-in-out infinite; transform-origin: 50% 80%; }
@keyframes wiggle { 0%, 80%, 100% { transform: rotate(0); } 85% { transform: rotate(-12deg); } 90% { transform: rotate(10deg); } 95% { transform: rotate(-6deg); } }
.hero-sub { margin: 4px 0 0; color: var(--text2); font-weight: 700; }
.hero-sub:empty { display: none; }
.hero-actions { display: flex; gap: 8px; padding-top: 2px; }
.round-btn {
  width: 44px; height: 44px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--card);
  color: var(--text2);
  box-shadow: 0 3px 0 var(--line);
}
.round-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--line); }

.footer-bar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px calc(10px + var(--bottom) + var(--browser-pad));
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  backdrop-filter: saturate(180%) blur(18px);
  border-top: 2px solid var(--line);
}

.install-tip {
  display: flex; align-items: center; gap: 10px;
  background: var(--yellow-soft);
  border-radius: 16px;
  padding: 10px 12px;
  margin-bottom: 12px;
  font-size: 14px;
}

/* ───────── Cards & lists ───────── */
.card {
  background: var(--card);
  border-radius: var(--radius);
  border: 2px solid var(--line);
  margin-bottom: 12px;
  overflow: hidden;
}
.card-pad { padding: 14px 16px; }
.section-title {
  font-size: 15px;
  font-weight: 900;
  color: var(--text);
  margin: 22px 4px 8px;
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.section-title .spacer { flex: 1; }
.section-title .tag { font-size: 13px; font-weight: 700; color: var(--text2); }
.list { background: var(--card); border-radius: var(--radius); border: 2px solid var(--line); overflow: hidden; margin-bottom: 12px; }
.row-item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 10px 14px;
  position: relative;
  width: 100%;
  text-align: left;
}
.row-item + .row-item { border-top: 2px solid var(--line); }
button.row-item:active { background: var(--mode-soft); }
.row-main { flex: 1; min-width: 0; }
.row-title { font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-sub { color: var(--text2); font-size: 14px; margin-top: 1px; font-weight: 600; }
.row-sub.wrap { white-space: normal; }
.row-trail { color: var(--text2); display: flex; align-items: center; gap: 4px; flex: none; }
.chev { color: var(--text3); }
.big-num { font-size: 22px; font-weight: 900; font-variant-numeric: tabular-nums; color: var(--mode); }
.rank {
  min-width: 34px; height: 34px; flex: none;
  border-radius: 12px;
  background: var(--fill);
  display: flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 15px;
}
.rank.gold { background: #ffd54a; color: #5a4100; }
.rank.silver { background: #d9dee8; color: #2b3440; }
.rank.bronze { background: #f0b78c; color: #4a260b; }
.live-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--red); flex: none; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--red) 25%, transparent); } }

.empty { text-align: center; color: var(--text2); padding: 34px 20px; }
.empty-emoji { font-size: 56px; margin-bottom: 8px; animation: bob 2.4s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-6px); } }
.empty h3 { color: var(--text); margin: 0 0 6px; font-size: 21px; font-weight: 900; }
.empty p { margin: 0 0 18px; font-weight: 600; }

/* ───────── Buttons (chunky, press down) ───────── */
.btn {
  --b: var(--fill-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  padding: 0 20px;
  border-radius: 16px;
  font-weight: 900;
  font-size: 17px;
  box-shadow: 0 4px 0 var(--b);
  transition: transform 0.06s, box-shadow 0.06s;
  margin-bottom: 4px;
}
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--b); }
.btn:disabled { opacity: 0.45; transform: none; }
.btn-primary { background: var(--mode); color: var(--on-mode); --b: color-mix(in srgb, var(--mode) 68%, #000); }
.btn-tonal { background: var(--mode-soft); color: var(--mode); --b: color-mix(in srgb, var(--mode) 30%, var(--mode-soft)); }
.btn-plain { background: var(--card); color: var(--text); --b: var(--line); border: 2px solid var(--line); }
.btn-danger { background: var(--red); color: #fff; --b: #b8202f; }
.btn-block { width: 100%; }
.btn-small { min-height: 38px; font-size: 15px; padding: 0 14px; border-radius: 12px; box-shadow: 0 3px 0 var(--b); }
.icon-btn {
  width: 44px; height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  color: var(--text3);
  flex: none;
}
.icon-btn:active { background: var(--fill); transform: scale(0.9); }
.icon-btn.on { color: var(--yellow); }
.icon-btn.on .ic { animation: star-pop 0.45s cubic-bezier(0.3, 1.8, 0.5, 1); }
@keyframes star-pop { from { transform: scale(0.3) rotate(-90deg); } }
.row { display: flex; align-items: center; }
.gap { gap: 10px; }
.grow { flex: 1; }

/* ───────── Inputs ───────── */
.field {
  width: 100%;
  min-height: 52px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 2px solid var(--line);
  background: var(--card);
  font-size: 18px;
  font-weight: 800;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}
.field::placeholder { color: var(--text3); font-weight: 700; }
.field:focus { border-color: var(--mode); box-shadow: 0 0 0 4px var(--mode-soft); }
textarea.field { resize: none; line-height: 1.4; font-weight: 700; font-size: 17px; }
.field-label { font-size: 13px; color: var(--text2); font-weight: 900; margin: 0 4px 6px; display: block; text-transform: uppercase; letter-spacing: 0.04em; }
.field-help { font-size: 13px; color: var(--mode); margin: 6px 4px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 800; }
.field-help:empty { display: none; }
.search {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: 16px;
  padding: 0 4px 0 12px;
  color: var(--text3);
}
.search:focus-within { border-color: var(--mode); }
.search input { flex: 1; border: 0; background: none; min-height: 48px; font-size: 17px; font-weight: 700; outline: none; color: var(--text); min-width: 0; }
select.field {
  background-image: linear-gradient(45deg, transparent 50%, var(--text2) 50%), linear-gradient(135deg, var(--text2) 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%;
  background-size: 6px 6px;
  background-repeat: no-repeat;
  padding-right: 36px;
}

/* Segmented control */
.seg {
  display: grid;
  grid-auto-columns: 1fr;
  grid-auto-flow: column;
  background: var(--fill);
  border-radius: 16px;
  padding: 4px;
  gap: 4px;
}
.seg button {
  min-height: 42px;
  border-radius: 12px;
  font-weight: 800;
  font-size: 15px;
  color: var(--text2);
  transition: background 0.15s, color 0.15s, transform 0.1s;
  padding: 0 6px;
  white-space: nowrap;
}
.seg button:active { transform: scale(0.96); }
.seg button.on { background: var(--card); color: var(--text); box-shadow: 0 3px 0 var(--line); }
.seg.alliance button.on.red { background: var(--red); color: #fff; box-shadow: 0 3px 0 #b8202f; }
.seg.alliance button.on.blue { background: var(--blue); color: #fff; box-shadow: 0 3px 0 #1d4fb8; }
.seg.big button { min-height: 50px; font-size: 17px; }

/* Chips */
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px 0 6px; }
.chips::-webkit-scrollbar { display: none; }
.chips:empty { display: none; }
.chip {
  flex: none;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 14px;
  background: var(--card);
  border: 2px solid var(--line);
  font-weight: 800;
  font-size: 15px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  transition: transform 0.08s;
}
.chip:active { transform: scale(0.93); }
.chip.on { background: var(--mode); border-color: var(--mode); color: var(--on-mode); }
.chip.red { background: var(--red-soft); border-color: transparent; color: var(--red); }
.chip.blue { background: var(--blue-soft); border-color: transparent; color: var(--blue); }
.chip.red.on { background: var(--red); color: #fff; }
.chip.blue.on { background: var(--blue); color: #fff; }
.chip.done { opacity: 0.5; }

/* Switch */
.switch {
  -webkit-appearance: none;
  appearance: none;
  width: 56px; height: 34px;
  border-radius: 17px;
  background: var(--fill-strong);
  position: relative;
  flex: none;
  transition: background 0.2s;
  margin: 0;
  cursor: pointer;
}
.switch::after {
  content: "";
  position: absolute;
  top: 3px; left: 3px;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
  transition: transform 0.25s cubic-bezier(0.3, 1.6, 0.6, 1);
}
.switch:checked { background: var(--green); }
.switch:checked::after { transform: translateX(22px); }
.haptic-trigger { position: fixed; left: -100px; top: 0; width: 1px; height: 1px; overflow: hidden; opacity: 0; pointer-events: none; }

/* ───────── Scout ───────── */
.xp-strip { display: flex; align-items: center; gap: 10px; padding: 10px 14px; }
.avatar { font-size: 28px; line-height: 1; }
.lvl { font-weight: 900; font-size: 15px; white-space: nowrap; }
.bar { flex: 1; height: 12px; border-radius: 6px; background: var(--fill); overflow: hidden; }
.bar > i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #ffc21a, #ff7a1a, #f0479b, #6d5dfc);
  background-size: 300% 100%;
  animation: shimmer 6s linear infinite;
  transition: width 0.8s cubic-bezier(0.2, 0.9, 0.25, 1);
}
@keyframes shimmer { to { background-position: 300% 0; } }
.bar.thick { height: 16px; border-radius: 8px; }
.bar.green > i { background: var(--green); animation: none; }
.pill {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 4px 10px;
  border-radius: 12px;
  font-weight: 900;
  font-size: 14px;
  background: var(--fill);
  white-space: nowrap;
}
.pill.fire { background: #ffe8d6; color: #e85d04; }
.pill.pop { animation: pop 0.45s cubic-bezier(0.3, 1.8, 0.5, 1); }
@keyframes pop { from { transform: scale(0.4); } }

.banner {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
  border-radius: 18px;
  margin-bottom: 12px;
  font-weight: 800;
}
.banner.edit { background: var(--yellow-soft); }
.banner.info { background: var(--mode-soft); color: var(--mode); }
.banner.error { background: var(--red-soft); color: var(--red); }
.banner .grow { min-width: 0; }

.un { padding: 10px 0 12px; }
.un + .un { border-top: 2px solid var(--line); }
.un-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 14px; }
.un-head b { font-size: 17px; }
.un-head .spacer { flex: 1; }
.un-head .chip { min-height: 32px; padding: 0 12px; font-size: 14px; }
.un-teams { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.un-teams .chip { justify-content: center; padding: 0 4px; min-height: 44px; font-size: 15px; gap: 2px; }

.team-field { position: relative; }
.suggest {
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: -60%;
  max-height: 260px;
  overflow-y: auto;
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2);
  z-index: 20;
}
.suggest button { display: block; width: 100%; text-align: left; padding: 11px 14px; border-bottom: 2px solid var(--line); }
.suggest button:active { background: var(--mode-soft); }
.suggest span { color: var(--text2); font-size: 14px; margin-left: 8px; }

.sec-head { display: flex; align-items: baseline; justify-content: space-between; margin: 24px 4px 8px; }
.sec-head h2 { margin: 0; font-size: 22px; font-weight: 900; letter-spacing: -0.01em; }
.sec-head .pts { font-weight: 900; color: var(--mode); font-variant-numeric: tabular-nums; font-size: 17px; }

.counter { display: flex; align-items: center; gap: 10px; padding: 12px 14px; position: relative; }
.counter + .counter, .counter + .toggle-row, .toggle-row + .counter, .toggle-row + .toggle-row, .seg-row + .toggle-row, .counter + .seg-row { border-top: 2px solid var(--line); }
.counter-label { flex: 1; min-width: 0; }
.counter-label b { display: block; font-weight: 900; }
.counter-label small { color: var(--text2); font-size: 13px; font-weight: 700; }
.cbtn {
  --b: var(--line);
  width: 46px; height: 46px;
  border-radius: 16px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--fill);
  color: var(--text2);
  flex: none;
  box-shadow: 0 3px 0 var(--b);
  transition: transform 0.05s, box-shadow 0.05s;
}
.cbtn.plus { --b: color-mix(in srgb, var(--mode) 65%, #000); width: 62px; height: 58px; background: var(--mode); color: #fff; box-shadow: 0 5px 0 var(--b); }
.cbtn.plus.yellow { --b: #c98f00; background: var(--yellow); color: #4a3500; }
.cbtn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--b); }
.cbtn:disabled { opacity: 0.3; transform: none; box-shadow: none; }
.cval {
  min-width: 46px; height: 46px;
  font-size: 28px; font-weight: 900;
  font-variant-numeric: tabular-nums;
  border-radius: 12px;
  text-align: center;
}
.cval:active { background: var(--fill); }
.cval.bump { animation: bump 0.25s ease-out; }
@keyframes bump { 40% { transform: scale(1.4); color: var(--mode); } }
.float-pts {
  position: absolute;
  right: 26px;
  top: 8px;
  font-weight: 900;
  font-size: 20px;
  color: var(--mode);
  pointer-events: none;
  animation: float-up 0.8s ease-out forwards;
  text-shadow: 0 2px 0 var(--card);
}
.float-pts.yellow { color: #d99a00; }
@keyframes float-up { from { opacity: 1; transform: translateY(0) scale(0.8); } 30% { transform: translateY(-14px) scale(1.2); } to { opacity: 0; transform: translateY(-40px) scale(1); } }
.toggle-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; min-height: 64px; }
.toggle-row .counter-label { cursor: pointer; }
.seg-row { padding: 12px 14px; }
.seg-row .counter-label { margin-bottom: 8px; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.tags .chip { min-height: 36px; font-size: 14px; }
.score-total { font-size: 30px; font-weight: 900; font-variant-numeric: tabular-nums; min-width: 86px; color: var(--mode); }
.score-total small { font-size: 14px; font-weight: 800; color: var(--text2); }
.score-total.bump { animation: bump 0.3s ease-out; }

/* ───────── Matches ───────── */
.match { display: grid; grid-template-columns: 54px 1fr 1fr; gap: 6px; align-items: center; padding: 8px 12px; }
.match + .match { border-top: 2px solid var(--line); }
.match-name { font-weight: 900; font-size: 15px; }
.match-time { font-size: 12px; color: var(--text2); font-weight: 700; }
.side { border-radius: 12px; padding: 6px 8px; display: flex; align-items: center; gap: 6px; min-height: 42px; font-size: 14px; font-variant-numeric: tabular-nums; font-weight: 700; }
.side.red { background: var(--red-soft); }
.side.blue { background: var(--blue-soft); }
.side .teams { flex: 1; display: flex; flex-wrap: wrap; gap: 2px 8px; min-width: 0; }
.side .score { font-weight: 800; }
.side.won .score { font-weight: 900; }
.side.won .score::after { content: " 🏆"; font-size: 12px; }
.side .fav { font-weight: 900; }

/* ───────── Stats / Me ───────── */
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; background: var(--line); }
.stat { background: var(--card); padding: 14px 6px; text-align: center; }
.stat b { display: block; font-size: 23px; font-weight: 900; font-variant-numeric: tabular-nums; }
.stat small { color: var(--text2); font-size: 12.5px; font-weight: 700; }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 12px; }
.tile { background: var(--card); border: 2px solid var(--line); border-radius: var(--radius); padding: 12px 6px; text-align: center; }
.tile .e { font-size: 28px; }
.tile b { display: block; font-size: 24px; font-weight: 900; font-variant-numeric: tabular-nums; }
.tile small { color: var(--text2); font-size: 12px; line-height: 1.2; display: block; font-weight: 700; }
.tile.warn { background: var(--yellow-soft); border-color: transparent; }

.profile {
  background: linear-gradient(135deg, #f0479b, #8b5cf6 55%, #3b82f6);
  color: #fff;
  border-radius: 24px;
  padding: 18px;
  margin-bottom: 12px;
  box-shadow: 0 5px 0 #6d2a9e;
}
.profile-top { display: flex; align-items: center; gap: 14px; }
.profile-avatar {
  width: 72px; height: 72px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.22);
  font-size: 42px;
  display: flex; align-items: center; justify-content: center;
  flex: none;
  animation: bob 2.6s ease-in-out infinite;
}
.profile-avatar:active { transform: scale(0.9); }
.profile-name { font-size: 26px; font-weight: 900; display: flex; align-items: center; gap: 6px; text-align: left; color: #fff; }
.profile-title { opacity: 0.92; font-weight: 800; }
.profile .bar { background: rgba(255, 255, 255, 0.25); margin-top: 16px; }
.profile .bar > i { background: #fff; animation: none; }
.profile-xp { display: flex; justify-content: space-between; font-size: 14px; margin-top: 6px; font-weight: 800; }
.profile .btn { background: rgba(255, 255, 255, 0.95); color: #8b2fc9; margin-top: 14px; width: 100%; --b: rgba(0, 0, 0, 0.2); }

.badges { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 12px; }
.badge {
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 6px 10px;
  text-align: center;
  min-height: 116px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  box-shadow: 0 3px 0 var(--line);
}
.badge:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--line); }
.badge .e { font-size: 38px; line-height: 1.1; }
.badge.locked .e { filter: grayscale(1); opacity: 0.25; }
.badge b { font-size: 13px; line-height: 1.2; }
.badge small { color: var(--text2); font-size: 12px; font-weight: 800; }
.badge.got { background: linear-gradient(160deg, var(--yellow-soft), var(--card) 75%); border-color: #ffd54a; box-shadow: 0 3px 0 #f2b600; }

.quest { display: flex; align-items: center; gap: 12px; padding: 12px 14px; }
.quest + .quest { border-top: 2px solid var(--line); }
.quest .e { font-size: 28px; }
.quest b.done { text-decoration: line-through; color: var(--text2); }
.quest .bar { margin-top: 8px; }

.avatar-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; padding: 4px 16px 16px; }
.avatar-grid button { font-size: 36px; height: 62px; border-radius: 16px; background: var(--fill); }
.avatar-grid button:active { transform: scale(0.9); }
.avatar-grid button.on { background: var(--mode-soft); box-shadow: 0 0 0 3px var(--mode) inset; }

/* ───────── Sheets / toasts / celebrations ───────── */
.sheet-wrap { position: fixed; inset: 0; z-index: 50; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(10, 8, 30, 0.45); opacity: 0; transition: opacity 0.28s; }
.sheet {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  max-height: 88%;
  overflow-y: auto;
  background: var(--card);
  border-radius: 28px 28px 0 0;
  padding-bottom: calc(var(--bottom) + var(--browser-pad) + 14px);
  transform: translateY(100%);
  transition: transform 0.36s cubic-bezier(0.2, 1.1, 0.3, 1);
}
.sheet-wrap.open .sheet-backdrop { opacity: 1; }
.sheet-wrap.open .sheet { transform: none; }
.sheet-grabber { width: 42px; height: 6px; border-radius: 3px; background: var(--fill-strong); margin: 10px auto 4px; }
.sheet-title { font-weight: 900; font-size: 21px; text-align: center; padding: 6px 20px 4px; }
.sheet-body { padding: 10px 16px 4px; display: flex; flex-direction: column; gap: 10px; }
.sheet-message { margin: 0 4px 4px; color: var(--text2); text-align: center; font-weight: 700; }
.sheet-buttons { display: flex; flex-direction: column; gap: 8px; }
.hint { margin: 0 4px; color: var(--text2); font-size: 14px; font-weight: 700; }

.toast {
  position: fixed;
  left: 50%;
  top: calc(var(--top) + 8px);
  transform: translate(-50%, -150%);
  max-width: calc(100% - 32px);
  background: #24203a;
  color: #fff;
  border-radius: 18px;
  padding: 12px 16px;
  display: flex; align-items: center; gap: 14px;
  font-weight: 800;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  z-index: 60;
  transition: transform 0.35s cubic-bezier(0.2, 1.2, 0.3, 1);
}
.toast.show { transform: translate(-50%, 0); }
.toast-action { color: #ffd54a; font-weight: 900; padding: 4px 2px; }

.celebration {
  position: fixed;
  left: 0; right: 0;
  top: calc(var(--top) + 8px);
  display: flex; justify-content: center;
  pointer-events: none;
  z-index: 70;
  animation: cel-fade 1.5s forwards;
}
.celebration.big { top: 0; bottom: 0; align-items: center; animation-duration: 2.6s; }
.celebration-card {
  background: var(--card);
  border: 3px solid var(--mode);
  border-radius: 22px;
  padding: 8px 20px;
  text-align: center;
  box-shadow: 0 5px 0 color-mix(in srgb, var(--mode) 60%, #000), 0 14px 40px rgba(0, 0, 0, 0.2);
  animation: cel-pop 0.55s cubic-bezier(0.3, 1.8, 0.5, 1);
  max-width: 86%;
  display: flex; align-items: center; gap: 10px;
}
.celebration.big .celebration-card {
  flex-direction: column; gap: 0;
  padding: 24px 34px;
  background: linear-gradient(135deg, #f0479b, #8b5cf6 55%, #3b82f6);
  color: #fff;
  border: 0;
  box-shadow: 0 6px 0 #6d2a9e, 0 20px 60px rgba(0, 0, 0, 0.35);
}
.celebration-emoji { font-size: 30px; }
.celebration.big .celebration-emoji { font-size: 70px; animation: wiggle 1.2s ease-in-out infinite; }
.celebration-headline { font-weight: 900; font-size: 19px; }
.celebration.big .celebration-headline { font-size: 34px; letter-spacing: -0.01em; }
.celebration-detail { font-weight: 800; opacity: 0.85; white-space: pre-line; font-size: 14px; }
@keyframes cel-pop { from { transform: scale(0.3) rotate(-6deg); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes cel-fade { 0%, 78% { opacity: 1; transform: none; } 100% { opacity: 0; transform: translateY(-16px); } }
.confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 65; }

.spinner {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 3px solid var(--fill-strong);
  border-top-color: var(--mode);
  animation: spin 0.8s linear infinite;
  display: inline-block;
}
.loading-row { display: flex; justify-content: center; padding: 30px; }
@keyframes spin { to { transform: rotate(360deg); } }
.muted { color: var(--text2); }
.small { font-size: 13px; }
.center { text-align: center; }
.mt { margin-top: 12px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
@media (min-width: 700px) {
  .scroll { padding-left: max(16px, calc(50% - 320px)); padding-right: max(16px, calc(50% - 320px)); }
  .modebar { padding-left: max(10px, calc(50% - 330px)); padding-right: max(10px, calc(50% - 330px)); }
}

/* ───────── Quality-of-life additions ───────── */
.tag { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 10px; background: var(--fill); font-size: 12px; font-weight: 800; color: var(--text2); white-space: nowrap; }
.tag.red { background: var(--red-soft); color: var(--red); }
.tag.blue { background: var(--blue-soft); color: var(--blue); }
.chips.wrap { flex-wrap: wrap; overflow: visible; }
.small-seg button { font-size: 13px; padding: 0 4px; }
.field-wrap { position: relative; }
.field-wrap .field { padding-right: 48px; }
.field-btn { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); }
.warn-line { margin-top: 8px; font-weight: 700; font-size: 14px; color: var(--orange); }
.station-select { appearance: none; border: 2px solid var(--line); background: var(--card); color: var(--text); border-radius: 12px; padding: 6px 10px; font: inherit; font-size: 13px; font-weight: 800; max-width: 55%; }
.station-select.red { border-color: var(--red); background: var(--red-soft); }
.station-select.blue { border-color: var(--blue); background: var(--blue-soft); }
.chip.station { border-width: 3px; font-weight: 900; }
.timer-start { margin-top: 10px; color: var(--text2); display: inline-flex; align-items: center; gap: 6px; }
.timer-card { display: flex; align-items: center; gap: 10px; margin-top: 10px; padding: 12px 14px; border-radius: 18px; background: var(--fill); }
.timer-card.auto { background: var(--mode-soft); color: var(--mode); }
.timer-card.driver { background: var(--green-soft); color: var(--green); }
.timer-card b { color: var(--text); }
.stars { display: flex; gap: 2px; }
.star { font-size: 28px; line-height: 1; padding: 4px 2px; color: var(--fill-strong); background: none; border: 0; cursor: pointer; }
.star.on { color: var(--yellow); }
.total-wrap { display: flex; flex-direction: column; min-width: 0; }
.breakdown { font-size: 12px; font-weight: 700; white-space: nowrap; }
.row-main.plain { background: none; border: 0; padding: 0; text-align: left; color: inherit; font: inherit; cursor: pointer; }
.row-item.selected { background: var(--mode-soft); }
.row-item.mine { box-shadow: inset 4px 0 0 var(--mode); }
.row-item.pick.taken .row-title { text-decoration: line-through; color: var(--text3); }
.sparkline svg { display: block; }
table.compare { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
table.compare th, table.compare td { padding: 9px 8px; text-align: center; border-bottom: 2px solid var(--line); }
table.compare td:first-child, table.compare th:first-child { text-align: left; }
table.compare th { font-weight: 900; font-size: 16px; }
table.compare td.best { font-weight: 900; color: var(--mode); }
details.unscouted summary { font-weight: 800; cursor: pointer; }
.banner.offline { background: var(--yellow-soft); }
.credit { margin: 24px 0 8px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.row-item.pick { gap: 6px; }
.row-item.pick .icon-btn { width: 34px; min-width: 34px; height: 40px; }
.row-item.pick .row-main { flex: 1; min-width: 0; }
