:root {
  --bg: #07080c;
  --bg-2: #0e1018;
  --panel: #141722;
  --panel-2: #1b1f2d;
  --line: #262b3d;
  --text: #eef0f6;
  --muted: #8a90a6;
  --accent: #ff3b30;
  --accent-2: #ff8a00;
  --r-elite: #2ee6a6;
  --r-great: #5fd35f;
  --r-good: #e6d22e;
  --r-ok: #ff9f1a;
  --r-low: #ff4d4d;
  --display: "Oswald", "Bebas Neue", "Arial Narrow", "Roboto Condensed", Impact, sans-serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(1200px 500px at 85% -10%, rgba(255, 59, 48, 0.18), transparent 60%),
    radial-gradient(900px 400px at -10% 10%, rgba(255, 138, 0, 0.1), transparent 60%),
    var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--body);
}

a { color: var(--accent-2); }
h1, h2, h3, .brand, .btn, legend, .eyebrow, .ovr, dt {
  font-family: var(--display);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
h1 { font-size: clamp(2rem, 5vw, 3.25rem); line-height: 1.05; margin: 0 0 0.5rem; }
h2 { font-size: 1.4rem; margin: 0; }
h3 { font-size: 1rem; margin: 0 0 0.6rem; color: var(--muted); display: flex; justify-content: space-between; }
.muted { color: var(--muted); }
.center { text-align: center; }
.hint { color: var(--muted); font-size: 0.9rem; margin: 0.25rem 0 1rem; }
small.hint { display: block; margin: 0.35rem 0 0; font-size: 0.8rem; }
.eyebrow { color: var(--accent); font-size: 0.85rem; letter-spacing: 0.2em; margin: 0 0 0.25rem; }

/* ---- Layout ---- */

.topbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem clamp(1rem, 4vw, 2.5rem);
  border-bottom: 1px solid var(--line);
  background: rgba(7, 8, 12, 0.85);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { display: flex; align-items: center; gap: 0.6rem; color: var(--text); text-decoration: none; font-size: 1.25rem; }
.brand img { object-fit: contain; }
.brand strong { color: var(--accent); }
.topbar nav { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; }
.topbar nav a:not(.btn) { color: var(--text); text-decoration: none; font-weight: 600; }
.topbar nav a:not(.btn):hover { color: var(--accent-2); }

main { flex: 1; width: 100%; max-width: 1180px; margin: 0 auto; padding: 2rem clamp(1rem, 4vw, 2.5rem) 3rem; }
.footer { text-align: center; color: var(--muted); font-size: 0.8rem; padding: 1.5rem 1rem; border-top: 1px solid var(--line); }

.panel {
  background: linear-gradient(180deg, var(--panel), var(--bg-2));
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: clamp(1rem, 3vw, 1.75rem);
  margin: 0 0 1.5rem;
}
.panel.narrow { max-width: 440px; margin: 2rem auto; }
.page-head { display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between; align-items: end; margin-bottom: 1.5rem; }
.section-head { display: flex; flex-wrap: wrap; gap: 0.75rem; justify-content: space-between; align-items: center; margin-bottom: 0.5rem; }

/* ---- Controls ---- */

.btn, button.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.6rem 1.25rem;
  border: 0;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  font-size: 1rem;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.1s, filter 0.15s;
}
.btn:hover { filter: brightness(1.1); }
.btn:active { transform: translateY(1px); }
.btn-sm { padding: 0.35rem 0.85rem; font-size: 0.9rem; }
.btn-lg { padding: 0.85rem 1.75rem; font-size: 1.2rem; }
.btn-block { width: 100%; }
.btn.btn-ghost { background: transparent; border: 1px solid var(--line); color: var(--text); }
.btn.btn-ghost:hover { border-color: var(--accent-2); color: var(--accent-2); }
.btn.btn-danger { background: #b3261e; }
button.link { background: none; border: 0; color: var(--text); font: inherit; font-weight: 600; cursor: pointer; padding: 0; }
button.link:hover { color: var(--accent-2); }
form.inline { display: inline; margin: 0; }

label { display: block; font-weight: 600; font-size: 0.9rem; }
input:not([type="radio"]):not([type="range"]), select {
  display: block;
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.65rem 0.75rem;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font: inherit;
}
input:focus, select:focus { outline: 2px solid var(--accent-2); outline-offset: 1px; }
input:disabled, select:disabled { opacity: 0.45; }
.stack { display: grid; gap: 1rem; }

.flash { padding: 0.75rem 1rem; border-radius: 8px; margin: 0 0 1rem; border: 1px solid; }
.flash-success { border-color: #1f7a4d; background: rgba(46, 230, 166, 0.08); }
.flash-info { border-color: #2c4a7a; background: rgba(77, 166, 255, 0.08); }
.flash-error { border-color: #8a2420; background: rgba(255, 77, 77, 0.1); }

/* ---- Guest mode ---- */

.guest-banner {
  display: flex; flex-wrap: wrap; gap: 0.75rem 1.5rem; align-items: center; justify-content: space-between;
  padding: 0.85rem 1.1rem; margin: 0 0 1.5rem; border-radius: 10px;
  border: 1px solid rgba(255, 138, 0, 0.5); background: rgba(255, 138, 0, 0.08);
}
.guest-banner strong { color: var(--accent-2); margin-right: 0.35rem; }
.guest-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* ---- Sharing ---- */

.shared-banner {
  display: flex; flex-wrap: wrap; gap: 0.75rem 1.5rem; align-items: center; justify-content: space-between;
  padding: 0.85rem 1.1rem; margin: 0 0 1.5rem; border-radius: 10px;
  border: 1px solid var(--line); background: var(--panel);
}
.shared-banner strong { color: var(--accent-2); }
.share-link { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.75rem; }
.share-link input { flex: 1 1 260px; margin: 0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.9rem; }
.share-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.btn.is-copied { background: var(--r-great); color: #07080c; }
.card-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }

/* ---- Home ---- */

.hero { padding: clamp(1.5rem, 6vw, 4rem) 0 2.5rem; max-width: 760px; }
.hero h1 { font-size: clamp(2.5rem, 7vw, 4.5rem); }
.lead { font-size: 1.15rem; color: #c6cadb; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1.5rem; }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; }
.feature { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 1.5rem; border-top: 3px solid var(--accent); }
.feature-num { font-family: var(--display); color: var(--accent); font-size: 2rem; }
.feature p { color: #c6cadb; margin: 0.5rem 0 0; }

/* ---- Builder form ---- */

fieldset.panel { min-width: 0; }
legend { font-size: 1.3rem; padding: 0 0.5rem; margin-left: -0.5rem; }
.step {
  display: inline-grid; place-items: center;
  width: 1.8rem; height: 1.8rem; margin-right: 0.35rem;
  border-radius: 50%; background: var(--accent); color: #fff; font-size: 1rem;
}
.grid-5 { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1rem; }
.segmented { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.5rem; }
.segmented label {
  display: flex; align-items: center; gap: 0.4rem;
  padding: 0.5rem 1rem; border: 1px solid var(--line); border-radius: 999px; cursor: pointer;
}
.segmented label:has(input:checked) { border-color: var(--accent-2); background: rgba(255, 138, 0, 0.12); }
.segmented input { accent-color: var(--accent-2); }

/* Show the description for the selected style without JS. */
.mode-realistic, .mode-chaos { display: none; }
.mode-section:has(input[value="realistic"]:checked) .mode-realistic,
.mode-section:has(input[value="chaos"]:checked) .mode-chaos { display: block; }
.mode-section h3 { margin-top: 0.75rem; }

/* Level picker: Rookie (easiest) to Legend (full range), coloured like the badge tiers. */
.levels { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 0.6rem; }
.level {
  position: relative; display: grid; gap: 0.15rem; padding: 0.75rem 0.9rem;
  border: 1px solid var(--line); border-radius: 10px; cursor: pointer; background: var(--bg);
  border-top: 3px solid var(--level-color);
}
.level input { position: absolute; opacity: 0; pointer-events: none; }
.level-name { font-family: var(--display); text-transform: uppercase; letter-spacing: 0.03em; font-size: 1.1rem; }
.level-range { color: var(--muted); font-size: 0.85rem; }
.level:has(input:checked) { border-color: var(--level-color); background: color-mix(in srgb, var(--level-color) 14%, var(--bg)); }
.level:has(input:focus-visible) { outline: 2px solid var(--accent-2); outline-offset: 2px; }
.level-rookie { --level-color: #5fd35f; }
.level-pro { --level-color: #4da6ff; }
.level-allPro { --level-color: #f2c230; }
.level-hallOfFame { --level-color: #a46bff; }
.level-legend { --level-color: #ff4d4d; }


/* ---- Roster ---- */

.roster { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; }
.roster-card {
  display: flex; gap: 1rem; align-items: center;
  padding: 1rem 1.25rem; border-radius: 14px; text-decoration: none; color: var(--text);
  background: linear-gradient(135deg, var(--panel-2), var(--panel)); border: 1px solid var(--line);
  transition: border-color 0.15s, transform 0.15s;
  position: relative;
}
/* Keep an open delete confirmation above neighbouring cards. */
.roster-card:has(.roster-delete[open]) { z-index: 5; }
.roster-card:hover, .roster-card:focus-within { border-color: var(--accent); transform: translateY(-2px); }
/* The name link stretches over the whole card so it stays clickable as before. */
.roster-link { color: inherit; text-decoration: none; min-width: 0; overflow: hidden; }
.roster-link::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.roster-link:focus-visible { outline: none; }
.roster-card:has(.roster-link:focus-visible) { outline: 2px solid var(--accent-2); outline-offset: 2px; }

.roster-delete { position: absolute; top: 0.5rem; right: 0.5rem; z-index: 1; }
.roster-delete summary {
  list-style: none; display: grid; place-items: center; width: 2rem; height: 2rem;
  border-radius: 8px; color: var(--muted); cursor: pointer;
}
.roster-delete summary::-webkit-details-marker { display: none; }
.roster-delete summary:hover, .roster-delete[open] summary { color: #ff6b63; background: rgba(255, 77, 77, 0.12); }
.roster-delete summary:focus-visible { outline: 2px solid var(--accent-2); }
.roster-confirm {
  position: absolute; top: 2.4rem; right: 0; width: min(260px, 80vw);
  display: grid; gap: 0.6rem; padding: 0.85rem; font-size: 0.9rem;
  background: var(--panel-2); border: 1px solid #8a2420; border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}
.roster-confirm strong { overflow-wrap: anywhere; }
.roster-main { display: grid; min-width: 0; }
.roster-main strong { display: block; padding-right: 1.5rem; font-family: var(--display); font-size: 1.3rem; text-transform: uppercase; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.roster-meta { font-size: 0.85rem; color: #c6cadb; }

/* ---- Player card ---- */

.player-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas: "ovr id vitals" "ovr id actions";
  gap: 0.5rem 1.75rem;
  align-items: center;
  padding: clamp(1.25rem, 3vw, 2rem);
  margin-bottom: 1.5rem;
  border-radius: 18px;
  border: 1px solid #3a2224;
  background:
    linear-gradient(115deg, rgba(255, 59, 48, 0.28), transparent 45%),
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.025) 0 2px, transparent 2px 12px),
    var(--panel);
}
.player-card .ovr { grid-area: ovr; }
.player-id { grid-area: id; min-width: 0; }
.player-id h1 { overflow-wrap: anywhere; }
.archetype { margin: 0; font-size: 1.1rem; color: #ffd6a0; font-weight: 600; }
.vitals { grid-area: vitals; display: grid; grid-template-columns: repeat(4, auto); gap: 0.5rem 1.5rem; margin: 0; }
.vitals dt { color: var(--muted); font-size: 0.8rem; }
.vitals dd { margin: 0; font-family: var(--display); font-size: 1.6rem; }
.vitals small { font-size: 0.8rem; margin-left: 0.15rem; color: var(--muted); }
.card-actions { grid-area: actions; justify-self: end; }

@media (max-width: 760px) {
  .player-card { grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "ovr id" "vitals vitals" "actions actions"; }
  .vitals { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .card-actions { justify-self: start; }
}

.ovr {
  display: inline-grid; place-items: center; flex: none;
  border-radius: 14px; font-weight: 700; line-height: 1;
}
.ovr-lg { width: 6.5rem; height: 6.5rem; font-size: 3.4rem; align-content: center; gap: 0.15rem; }
.ovr-sm { width: 3.5rem; height: 3.5rem; font-size: 1.8rem; }
.ovr-label { font-size: 0.85rem; letter-spacing: 0.2em; }
.ovr.r-elite { background: var(--r-elite); }
.ovr.r-great { background: var(--r-great); }
.ovr.r-good { background: var(--r-good); }
.ovr.r-ok { background: var(--r-ok); }
.ovr.r-low { background: var(--r-low); }
.ovr[class*="r-"] { color: #07080c; }

.attr-grid, .badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1.25rem 2rem; }
.attr-group { min-width: 0; }
.cat-avg { font-size: 1.1rem; }

.stat { display: grid; grid-template-columns: minmax(0, 8.5rem) minmax(0, 1fr) 2rem; gap: 0.6rem; align-items: center; margin-bottom: 0.45rem; font-size: 0.9rem; }
.stat-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat-val { font-family: var(--display); font-size: 1.15rem; text-align: right; }
.bar { position: relative; height: 8px; background: var(--bg); border-radius: 4px; }
.fill { position: absolute; inset: 0 auto 0 0; border-radius: 4px; background: currentColor; }
.r-elite { color: var(--r-elite); }
.r-great { color: var(--r-great); }
.r-good { color: var(--r-good); }
.r-ok { color: var(--r-ok); }
.r-low { color: var(--r-low); }

/* ---- Badges ---- */

/* Each tier sets its colours once; the emblem, summary chip, and label all read them. */
.tier-0 { --tier-outer: var(--line); --tier-inner: var(--panel); --tier-text: var(--muted); --tier-glow: transparent; }
.tier-1 {
  --tier-outer: linear-gradient(135deg, #f6c08f, #b0602c 50%, #6e3b1f);
  --tier-inner: linear-gradient(135deg, #a8592a, #6e3b1f);
  --tier-text: #e09a63; --tier-glow: rgba(224, 154, 99, 0.35);
}
.tier-2 {
  --tier-outer: linear-gradient(135deg, #ffffff, #b4bcc8 50%, #687280);
  --tier-inner: linear-gradient(135deg, #9aa3af, #59616d);
  --tier-text: #d5dbe4; --tier-glow: rgba(213, 219, 228, 0.35);
}
.tier-3 {
  --tier-outer: linear-gradient(135deg, #fff3a8, #f2c230 50%, #9c6b00);
  --tier-inner: linear-gradient(135deg, #e0a911, #8a5e00);
  --tier-text: #f7cf45; --tier-glow: rgba(247, 207, 69, 0.45);
}
.tier-4 {
  --tier-outer: linear-gradient(135deg, #ecd9ff, #a46bff 50%, #4f2190);
  --tier-inner: linear-gradient(135deg, #8a4df0, #45197f);
  --tier-text: #c39bff; --tier-glow: rgba(164, 107, 255, 0.55);
}
.tier-5 {
  --tier-outer: conic-gradient(from 0deg, #ff4d4d, #ffcc00, #2ee6a6, #4da6ff, #b84dff, #ff4d4d);
  --tier-inner: linear-gradient(135deg, #2a1640, #10131f);
  --tier-text: #ffd36b; --tier-glow: rgba(255, 140, 90, 0.6);
}

.tier-summary { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.25rem 0 1.25rem; }
.chip {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.2rem 0.75rem 0.2rem 0.3rem; border-radius: 999px;
  font-weight: 700; font-size: 0.85rem; color: var(--tier-text);
  background: var(--panel-2); border: 1px solid var(--line);
}
.chip .emblem { width: 1.1rem; height: 1.1rem; }

/* Hexagonal emblem: metallic outer ring, darker core, and a glow for the tier. */
.emblem {
  position: relative; display: inline-block; flex: none;
  width: 1.7rem; height: 1.7rem;
  filter: drop-shadow(0 0 4px var(--tier-glow));
}
.emblem::before, .emblem::after {
  content: ""; position: absolute;
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
}
.emblem::before { inset: 0; background: var(--tier-outer); }
.emblem::after { inset: 22%; background: var(--tier-inner); }
.emblem.tier-5::before { animation: legend-shimmer 4s linear infinite; }
@keyframes legend-shimmer { to { filter: hue-rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .emblem.tier-5::before { animation: none; } }

.badge-row { display: grid; grid-template-columns: 1.7rem minmax(0, 1fr) auto; gap: 0.6rem; align-items: center; margin-bottom: 0.45rem; font-size: 0.9rem; }
.badge-row.off .badge-name { color: var(--muted); }
.badge-tier { font-size: 0.85rem; font-weight: 700; color: var(--tier-text); }

/* Build tags on the player card (style + level). */
.build-tags { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.6rem 0 0; }
.build-tags span { padding: 0.15rem 0.6rem; border-radius: 999px; font-size: 0.8rem; font-weight: 600; background: rgba(0, 0, 0, 0.35); border: 1px solid var(--line); }
.build-tags .level-tag { border-color: var(--level-color); color: var(--level-color); }

.danger-zone { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; align-items: start; }
.danger-zone summary { cursor: pointer; color: var(--muted); }
.danger-zone form { margin-top: 0.75rem; }
.danger-zone p { margin: 0 0 0.5rem; }

/* ---- Court & motion ---- */

/* Faint half-court lines behind every page. */
body::before {
  content: ""; position: fixed; z-index: -1; pointer-events: none;
  left: 50%; bottom: -6vh; width: min(1100px, 140vw); aspect-ratio: 500 / 470;
  transform: translateX(-50%);
  background: url("/images/court.svg") center bottom / contain no-repeat;
  opacity: 0.05;
}

.sfx-toggle {
  display: grid; place-items: center; width: 2.25rem; height: 2.25rem;
  border: 1px solid var(--line); border-radius: 50%; background: transparent; color: var(--text); cursor: pointer;
}
.sfx-toggle:hover { color: var(--accent-2); border-color: var(--accent-2); }
.sfx-toggle .sfx-off, .sfx-toggle.is-muted .sfx-on { display: none; }
.sfx-toggle.is-muted .sfx-off { display: block; }
.sfx-toggle.is-muted { color: var(--muted); }

/* Buttons squash a little when pressed, like a ball hitting the floor. */
.btn:active { transform: translateY(1px) scale(0.97, 0.94); }

.flash { animation: slide-down 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.3) both; }
@keyframes slide-down { from { opacity: 0; transform: translateY(-10px); } }

/* Home: a bouncing ball with a shadow that squashes on impact. */
.hero { position: relative; }
.hero-art { position: absolute; right: -14rem; top: 2.5rem; width: 120px; height: 230px; }
.hero-ball { position: absolute; top: 0; left: 0; animation: ball-bounce 1.1s cubic-bezier(0.5, 0, 0.5, 1) infinite; }
.hero-shadow {
  position: absolute; bottom: 0; left: 10px; width: 100px; height: 16px; border-radius: 50%;
  background: radial-gradient(rgba(0, 0, 0, 0.6), transparent 70%);
  animation: shadow-squash 1.1s cubic-bezier(0.5, 0, 0.5, 1) infinite;
}
@keyframes ball-bounce {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(100px) scale(1.06, 0.92) rotate(160deg); }
}
@keyframes shadow-squash {
  0%, 100% { transform: scale(0.55); opacity: 0.5; }
  50% { transform: scale(1.05); opacity: 1; }
}
@media (max-width: 1180px) { .hero-art { display: none; } }

.feature { transition: transform 0.2s, border-color 0.2s; }
.feature:hover { transform: translateY(-4px) rotate(-0.4deg); border-color: var(--accent); }

/* Create: the generate button spins a ball while the player is being rolled. */
.generate .ball-icon {
  width: 1.4rem; height: 1.4rem; background: url("/images/ball.svg") center / contain no-repeat;
}
.generate-busy { display: none; }
form.is-busy .generate { pointer-events: none; filter: saturate(1.2) brightness(1.05); }
form.is-busy .generate .ball-icon { animation: spin 0.5s linear infinite; }
form.is-busy .generate-label { display: none; }
form.is-busy .generate-busy { display: inline; }
form.is-busy .btn:not(.generate) { pointer-events: none; animation: shake 0.3s ease-in-out infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shake { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-4deg); } 75% { transform: rotate(4deg); } }

.level:has(input:checked) { animation: pop 0.3s ease-out; }
@keyframes pop { 50% { transform: scale(1.04); } }

/* Locker room: cards deal in, and a deleted card drops out of frame. */
.roster-card { animation: deal-in 0.4s ease-out both; animation-delay: calc(var(--i, 0) * 60ms); }
@keyframes deal-in { from { opacity: 0; transform: translateY(14px) scale(0.98); } }
.roster-card.is-leaving { animation: drop-out 0.5s ease-in forwards; }
@keyframes drop-out { to { opacity: 0; transform: translateY(40px) rotate(4deg) scale(0.9); } }

/* Player page: the card lands, bars fill in order, and badges pop in on a fresh roll. */
.player-card { animation: card-land 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.2) both; }
@keyframes card-land { from { opacity: 0; transform: translateY(-16px) scale(0.98); } }
.ovr-lg { animation: ovr-pop 0.6s 0.15s cubic-bezier(0.3, 1.6, 0.5, 1) both; }
@keyframes ovr-pop { from { transform: scale(0.4) rotate(-12deg); opacity: 0; } }
.fill { transform-origin: left; animation: fill-in 0.6s ease-out both; animation-delay: calc(0.2s + var(--i, 0) * 18ms); }
@keyframes fill-in { from { transform: scaleX(0); } }
.is-revealing .badge-row:not(.off) .emblem { animation: badge-pop 0.45s cubic-bezier(0.3, 1.8, 0.5, 1) both; animation-delay: calc(0.6s + var(--i, 0) * 45ms); }
@keyframes badge-pop { from { transform: scale(0) rotate(-90deg); } }
[data-fx-exit].is-leaving main { animation: drop-out 0.5s ease-in forwards; }

.fx-confetti { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 50; }

.airball { display: block; margin: 0 auto 0.5rem; animation: airball 1.4s ease-in-out infinite; }
@keyframes airball { 0%, 100% { transform: translate(-12px, 0) rotate(0); } 50% { transform: translate(12px, -14px) rotate(180deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    animation-delay: 0s !important;
    transition-duration: 0.01ms !important;
  }
}
