/* Puma Musume 2 — race.css
 * Broadcast race screen (#screen-race), owned by racescreen.js.
 * Mobile-first (fits 390px). The track is a canvas with an internal camera, so
 * the page itself never scrolls sideways.
 */

.rs2-root {
  --rs2-ink: #3a2b3f;
  --rs2-pink: #ff6a88;
  --rs2-gold: #ffcf3a;
  --rs2-panel: rgba(20, 12, 26, 0.86);
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
  padding: 8px;
  box-sizing: border-box;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--rs2-ink);
}

/* ---- HUD ---------------------------------------------------------------- */
.rs2-hud {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
}
.rs2-phase {
  font-weight: 800;
  font-size: 13px;
  padding: 6px 11px;
  border-radius: 999px;
  color: #fff;
  white-space: nowrap;
  background: linear-gradient(135deg, #ff9a9e, #fad0c4);
  box-shadow: 0 2px 6px rgba(255, 106, 136, 0.4);
  transition: background 0.3s ease;
}
.rs2-phase[data-p="Last Spurt"] { background: linear-gradient(135deg, #ff3d6a, #ff8a5b); animation: rs2-pulse 0.55s infinite alternate; }
.rs2-phase[data-p="Final"] { background: linear-gradient(135deg, #f5b301, #ffcf5c); }
@keyframes rs2-pulse { from { transform: scale(1); } to { transform: scale(1.07); } }

.rs2-barwrap { position: relative; display: flex; align-items: center; gap: 8px; }
.rs2-bar {
  position: relative;
  flex: 1;
  height: 12px;
  border-radius: 999px;
  background: #e7dce6;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.18);
  overflow: visible;
}
.rs2-barfill {
  position: absolute; left: 0; top: 0; bottom: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #ff9a9e, var(--rs2-pink));
  width: 0;
}
.rs2-bardot {
  position: absolute; top: 50%; width: 12px; height: 12px;
  margin-left: -6px; transform: translateY(-50%);
  border-radius: 50%; background: var(--rs2-gold);
  border: 2px solid #7a5300; box-shadow: 0 0 5px rgba(255,207,58,0.9);
}
.rs2-tick { position: absolute; top: -3px; bottom: -3px; width: 0; border-left: 2px dotted rgba(90,60,80,0.5); }
.rs2-tick span {
  position: absolute; top: -13px; left: 50%; transform: translateX(-50%);
  font-size: 8px; font-weight: 700; color: #a06; white-space: nowrap;
}
.rs2-dist { font-size: 11px; font-weight: 800; color: #a06; white-space: nowrap; min-width: 62px; text-align: right; }

.rs2-ctrl { display: flex; gap: 4px; }
.rs2-ctrl button {
  font: inherit; font-size: 12px; font-weight: 700; border: none; border-radius: 8px;
  padding: 6px 8px; min-width: 32px; background: #fff; color: var(--rs2-ink);
  box-shadow: 0 1px 3px rgba(0,0,0,0.15); cursor: pointer;
}
.rs2-ctrl button.rs2-on { background: var(--rs2-pink); color: #fff; }
.rs2-ctrl button.rs2-skip { background: #efe6ef; }
.rs2-ctrl button:active { transform: translateY(1px); }

/* ---- stage ------------------------------------------------------------- */
.rs2-stage {
  position: relative;
  width: 100%;
  border-radius: 14px;
  overflow: hidden;
  background: #2a3b24;
  box-shadow: inset 0 2px 10px rgba(0,0,0,0.35);
}
.rs2-canvas { display: block; width: 100%; height: 100%; }

/* minimap */
.rs2-mini {
  position: absolute; top: 8px; right: 8px;
  width: 132px; height: 96px;
  background: rgba(16, 26, 14, 0.66);
  border: 1px solid rgba(255,255,255,0.28);
  border-radius: 8px;
}

/* order ticker */
.rs2-ticker {
  position: absolute; top: 8px; left: 8px;
  min-width: 116px; max-width: 45%;
  background: var(--rs2-panel);
  border-radius: 10px; padding: 4px;
  backdrop-filter: blur(2px);
}
.rs2-row {
  display: flex; align-items: center; gap: 5px;
  padding: 2px 4px; border-radius: 6px;
  color: #f4eaf2; font-size: 11px; font-weight: 600;
  transition: background 0.25s ease;
}
.rs2-row.rs2-me { background: rgba(255, 207, 58, 0.24); color: #fff; }
.rs2-pl { font-weight: 800; width: 14px; text-align: center; color: var(--rs2-gold); }
.rs2-row.rs2-me .rs2-pl { color: #fff; }
.rs2-ic { width: 18px; height: 18px; display: inline-flex; }
.rs2-ic svg { width: 18px; height: 18px; }
.rs2-nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* skill chips */
.rs2-chips { position: absolute; inset: 0; pointer-events: none; }
.rs2-chip {
  position: absolute; transform: translate(-50%, -100%);
  border: 2px solid #e0a92e; border-radius: 999px;
  padding: 2px 8px; font-size: 11px; font-weight: 800;
  box-shadow: 0 3px 8px rgba(0,0,0,0.3); white-space: nowrap;
  animation: rs2-chip 1.5s ease-out forwards;
}
@keyframes rs2-chip {
  0% { opacity: 0; transform: translate(-50%, -80%) scale(0.7); }
  16% { opacity: 1; transform: translate(-50%, -110%) scale(1.06); }
  70% { opacity: 1; transform: translate(-50%, -150%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -190%) scale(0.95); }
}

/* phase banner flash */
.rs2-banner {
  position: absolute; top: 42%; left: 0; right: 0; text-align: center;
  font-size: 30px; font-weight: 900; letter-spacing: 0.04em;
  color: #fff; text-shadow: 0 2px 12px rgba(0,0,0,0.6), 0 0 20px rgba(255,106,136,0.6);
  opacity: 0; pointer-events: none;
}
.rs2-banner.rs2-go { animation: rs2-banner 1.3s ease-out; }
@keyframes rs2-banner {
  0% { opacity: 0; transform: scale(1.4); }
  18% { opacity: 1; transform: scale(1); }
  75% { opacity: 1; }
  100% { opacity: 0; transform: scale(0.96); }
}

/* spurt flash */
.rs2-spurtfx {
  position: absolute; top: 12%; left: 0; right: 0; text-align: center;
  font-size: 26px; font-weight: 900; font-style: italic; letter-spacing: 0.05em;
  color: var(--rs2-gold); text-shadow: 0 2px 10px rgba(0,0,0,0.7);
  opacity: 0; pointer-events: none;
}
.rs2-spurtfx.rs2-go { animation: rs2-spurt 1.1s ease-out; }
@keyframes rs2-spurt {
  0% { opacity: 0; transform: translateY(10px) scale(0.8); }
  20% { opacity: 1; transform: translateY(0) scale(1.1); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: scale(1); }
}

/* unique-skill cut-in: motif canvas behind a tilted portrait card */
.rs2-cutin {
  position: absolute; inset: 0; overflow: hidden;
  pointer-events: none; opacity: 0; z-index: 20;
  transition: opacity 0.18s ease;
  --cc: #ff6a88;
}
.rs2-cutin.rs2-go { opacity: 1; }
.rs2-cut-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.rs2-cut-card {
  position: absolute; left: 0; right: 0; top: 50%;
  transform: translateY(-50%);
  display: flex; align-items: center; gap: 14px;
  padding: 0 20px; box-sizing: border-box;
}
.rs2-cut-card.rs2-cardgo { animation: rs2-cardin 0.42s cubic-bezier(0.2, 0.9, 0.25, 1); }
@keyframes rs2-cardin {
  0% { transform: translateY(-50%) translateX(-44px); opacity: 0; }
  100% { transform: translateY(-50%) translateX(0); opacity: 1; }
}
.rs2-cut-port {
  width: 108px; height: 108px; flex: 0 0 auto;
  transform: rotate(-8deg);
  background: rgba(255,255,255,0.94); border-radius: 16px;
  border: 3px solid var(--cc);
  box-shadow: 0 8px 30px rgba(0,0,0,0.55), 0 0 26px var(--cc);
  display: flex; align-items: center; justify-content: center;
}
.rs2-cut-port svg { width: 92px; height: 92px; }
.rs2-cut-txt { min-width: 0; }
.rs2-cut-lbl { font-size: 11px; font-weight: 800; letter-spacing: 0.18em; color: #fff; text-shadow: 0 1px 4px rgba(0,0,0,0.7); }
.rs2-cut-nm { font-size: 27px; font-weight: 900; line-height: 1.04; color: #fff; text-shadow: 0 2px 10px rgba(0,0,0,0.85), 0 0 18px var(--cc); }
.rs2-cut-cry { font-size: 13px; font-style: italic; color: #fff; opacity: 0.96; margin-top: 3px; text-shadow: 0 1px 4px rgba(0,0,0,0.85); }
.rs2-cut-who { font-size: 12px; font-weight: 800; color: var(--cc); filter: brightness(1.5); margin-top: 4px; text-shadow: 0 1px 3px rgba(0,0,0,0.7); }

/* photo finish */
.rs2-photo { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(10,6,14,0.7); opacity: 0; pointer-events: none; }
.rs2-photo.rs2-go { opacity: 1; transition: opacity 0.2s; }
.rs2-photo-in { font-size: 24px; font-weight: 900; color: #fff; letter-spacing: 0.05em; animation: rs2-pulse 0.5s infinite alternate; }

/* ---- results board ----------------------------------------------------- */
.rs2-results {
  background: #fff; border-radius: 16px; padding: 14px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.18);
}
.rs2-place-banner {
  text-align: center; padding: 12px; border-radius: 12px; margin-bottom: 12px;
  background: linear-gradient(135deg, #efe1ee, #f9eef4);
}
.rs2-place-banner.rs2-win { background: linear-gradient(135deg, #fff0b8, #ffd76a); }
.rs2-pb-num { font-size: 46px; font-weight: 900; line-height: 1; color: #c0396b; }
.rs2-place-banner.rs2-win .rs2-pb-num { color: #a76b00; }
.rs2-pb-sub { font-size: 14px; font-weight: 800; letter-spacing: 0.08em; color: #7a5a68; margin-top: 2px; }
.rs2-place-banner.rs2-win .rs2-pb-sub { color: #7a5300; }

.rs2-board { display: flex; flex-direction: column; gap: 2px; }
.rs2-brow {
  display: grid; grid-template-columns: 26px 24px 1fr auto auto; align-items: center; gap: 8px;
  padding: 5px 6px; border-radius: 8px; font-size: 13px; border-bottom: 1px solid #f3e3e8;
}
.rs2-brow.rs2-me { background: #fff5da; font-weight: 800; }
.rs2-bpl { font-weight: 900; text-align: center; color: #c0396b; }
.rs2-bic { width: 22px; height: 22px; display: inline-flex; }
.rs2-bic svg { width: 22px; height: 22px; }
.rs2-bnm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rs2-bmg { font-size: 11px; color: #9a7; font-style: italic; white-space: nowrap; }
.rs2-bt { font-size: 12px; color: #86707c; font-variant-numeric: tabular-nums; }

.rs2-rewards { text-align: center; font-size: 13px; color: #6a5560; margin-top: 10px; }
.rs2-rewards b { color: #c0396b; }

.rs2-continue {
  display: block; width: 100%; margin-top: 12px; font: inherit; font-weight: 800; font-size: 15px;
  color: #fff; border: none; border-radius: 12px; padding: 12px;
  background: linear-gradient(135deg, #ff9a9e, #ff6a88); box-shadow: 0 3px 8px rgba(255,106,136,0.5); cursor: pointer;
}
.rs2-continue:active { transform: translateY(1px); }

@media (max-width: 400px) {
  .rs2-phase { font-size: 11px; padding: 5px 8px; }
  .rs2-ctrl button { padding: 5px 6px; min-width: 28px; font-size: 11px; }
  .rs2-mini { width: 104px; height: 76px; }
  .rs2-ticker { min-width: 96px; font-size: 10px; }
  .rs2-banner { font-size: 22px; }
  .rs2-pb-num { font-size: 38px; }
  .rs2-tick span { display: none; }   /* labels don't fit the narrow mobile bar */
  .rs2-cut-port { width: 84px; height: 84px; }
  .rs2-cut-port svg { width: 70px; height: 70px; }
  .rs2-cut-nm { font-size: 21px; }
  .rs2-cut-cry { font-size: 12px; }
}
