:root {
  color-scheme: dark;
  --ink: #12140f;
  --ink-2: #1a1d17;
  --ink-3: #252921;
  --paper: #f3eddc;
  --muted: #a9ac9c;
  --line: rgba(243, 237, 220, 0.15);
  --acid: #d8ff4f;
  --orange: #ff6a3d;
  --blue: #64d7ff;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
  --mono: "Arial Narrow", "Roboto Condensed", ui-monospace, monospace;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--ink);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--paper);
  background:
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    var(--ink);
  background-size: 32px 32px;
}

button,
input,
select {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 3px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.38;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 0.75rem;
  left: 0.75rem;
  padding: 0.75rem 1rem;
  color: var(--ink);
  background: var(--acid);
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: translateY(0);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.game-shell {
  width: min(1180px, calc(100% - 2rem));
  min-height: 100vh;
  margin: 0 auto;
  padding: 1.25rem 0 2rem;
}

.game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 62px;
  margin-bottom: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-mark {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  color: var(--ink);
  background: var(--acid);
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 950;
  letter-spacing: -0.05em;
  transform: skew(-5deg);
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: clamp(1rem, 2vw, 1.35rem);
  font-weight: 950;
  letter-spacing: 0.08em;
}

.brand small {
  margin-top: 0.15rem;
  color: var(--muted);
  font-size: 0.72rem;
}

.header-actions,
.race-actions,
.end-actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.quiet-button,
.text-button,
.secondary-button,
.primary-button,
.close-button {
  min-height: 44px;
  border: 0;
  border-radius: 5px;
  cursor: pointer;
  font-weight: 850;
}

.quiet-button {
  padding: 0.65rem 0.85rem;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
}

.quiet-button:hover {
  color: var(--paper);
  border-color: rgba(243, 237, 220, 0.35);
}

.status-bar {
  display: grid;
  grid-template-columns: 0.8fr 1.5fr 0.8fr;
  margin-bottom: 1.25rem;
  overflow: hidden;
  background: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.status-bar > div {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: end;
  gap: 0.15rem 0.75rem;
  min-height: 74px;
  padding: 0.85rem 1rem;
  border-right: 1px solid var(--line);
}

.status-bar > div:last-child {
  border-right: 0;
}

.status-bar span,
.status-bar em {
  color: var(--muted);
  font-size: 0.68rem;
  font-style: normal;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.status-bar strong {
  grid-row: 1 / 3;
  font-size: 1.8rem;
  line-height: 1;
  justify-self: end;
}

.status-bar strong small {
  margin-left: 0.2rem;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
}

.status-score {
  position: relative;
}

.progress {
  display: block;
  width: 100%;
  height: 5px;
  overflow: hidden;
  background: rgba(243, 237, 220, 0.09);
  border-radius: 999px;
}

.status-score .progress {
  grid-column: 1 / -1;
}

.progress i {
  display: block;
  width: 0;
  height: 100%;
  background: var(--acid);
  border-radius: inherit;
  transition: width 360ms ease;
}

.view-enter {
  animation: enter 260ms ease both;
}

@keyframes enter {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.plan-heading,
.race-heading,
.reward-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1.5rem;
  margin: 1.6rem 0 1.25rem;
}

.eyebrow {
  margin: 0 0 0.35rem;
  color: var(--acid);
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(2rem, 5vw, 4.2rem);
  font-weight: 950;
  letter-spacing: -0.055em;
  line-height: 0.95;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.1rem, 2vw, 1.45rem);
  font-weight: 900;
  letter-spacing: -0.02em;
}

.three-steps {
  display: flex;
  gap: 0.6rem;
  padding: 0;
  margin: 0;
  list-style: none;
}

.three-steps li {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 750;
  white-space: nowrap;
}

.three-steps b {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  color: var(--ink);
  background: var(--paper);
  border-radius: 50%;
  font-size: 0.7rem;
}

.plan-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 1rem;
  align-items: start;
}

.course-card,
.team-card,
.result-summary,
.result-details,
.reward-stage,
.end-card {
  background: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
}

.course-card,
.team-card {
  padding: 1.1rem;
}

.section-title {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.section-title span,
.section-title p {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.section-title span {
  display: block;
  margin-bottom: 0.2rem;
}

.section-title p {
  margin: 0;
  letter-spacing: 0;
  text-transform: none;
}

.leg-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.7rem;
}

.leg-card {
  position: relative;
  min-width: 0;
  min-height: 230px;
  padding: 0.8rem;
  text-align: left;
  background: var(--ink-3);
  border: 2px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 150ms ease, border-color 150ms ease, background 150ms ease;
}

.leg-card:hover {
  transform: translateY(-2px);
  border-color: rgba(243, 237, 220, 0.3);
}

.leg-card.active {
  background: #292e21;
  border-color: var(--acid);
}

.leg-card.active::after {
  position: absolute;
  top: -9px;
  right: 0.6rem;
  padding: 0.2rem 0.45rem;
  content: "変更中";
  color: var(--ink);
  background: var(--acid);
  border-radius: 3px;
  font-size: 0.62rem;
  font-weight: 900;
}

.leg-number {
  display: block;
  margin-bottom: 0.65rem;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 850;
}

.terrain-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.3rem;
}

.terrain-tile {
  display: grid;
  min-width: 0;
  min-height: 50px;
  place-items: center;
  align-content: center;
  gap: 0.1rem;
  color: var(--ink);
  border-radius: 4px;
}

.terrain-tile b {
  font-size: 0.8rem;
  line-height: 1;
}

.terrain-tile small {
  font-size: 0.6rem;
  font-weight: 900;
}

.terrain-turf {
  background: var(--acid);
}

.terrain-mud {
  background: var(--orange);
}

.terrain-hill {
  background: var(--blue);
}

.assigned-animal {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
  margin: 0.8rem 0 0.55rem;
}

.assigned-animal strong,
.assigned-animal small {
  display: block;
}

.assigned-animal strong {
  font-size: 1rem;
}

.assigned-animal small {
  margin-top: 0.12rem;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.64rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.animal-icon {
  display: grid;
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
  place-items: center;
  background: rgba(243, 237, 220, 0.08);
  border-radius: 50%;
  font-size: 1.75rem;
}

.fit-label {
  display: block;
  padding: 0.45rem 0.55rem;
  color: var(--muted);
  background: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
  font-size: 0.68rem;
  font-weight: 800;
  text-align: center;
}

.fit-label.good {
  color: var(--acid);
  background: rgba(216, 255, 79, 0.09);
}

.forecast-card {
  display: grid;
  grid-template-columns: 0.8fr 1.5fr;
  gap: 0.9rem 1rem;
  align-items: center;
  margin-top: 0.8rem;
  padding: 1rem;
  background: #0e100c;
  border-radius: 8px;
}

.forecast-total span,
.forecast-total strong {
  display: block;
}

.forecast-total span {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
}

.forecast-total strong {
  margin-top: 0.2rem;
  color: var(--acid);
  font-size: 2.7rem;
  line-height: 1;
}

.forecast-total small {
  margin-left: 0.2rem;
  color: var(--paper);
  font-size: 0.75rem;
}

.simple-formula {
  display: flex;
  align-items: stretch;
  justify-content: flex-end;
  gap: 0.35rem;
}

.simple-formula span {
  display: grid;
  min-width: 0;
  flex: 1;
  place-items: center;
  padding: 0.55rem 0.35rem;
  color: var(--muted);
  background: var(--ink-2);
  border-radius: 4px;
  font-size: 0.62rem;
  text-align: center;
}

.simple-formula b {
  display: block;
  margin-top: 0.15rem;
  color: var(--paper);
  font-size: 1rem;
}

.simple-formula i {
  align-self: center;
  color: var(--muted);
  font-size: 0.65rem;
  font-style: normal;
}

.forecast-message {
  align-self: center;
  margin: 0;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 750;
}

.forecast-message.will-clear {
  color: var(--acid);
}

.primary-button,
.secondary-button,
.text-button {
  padding: 0.8rem 1rem;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  color: var(--ink);
  background: var(--acid);
  font-weight: 950;
  box-shadow: 0 8px 20px rgba(216, 255, 79, 0.12);
}

.primary-button:hover:not(:disabled) {
  background: #e3ff7a;
  transform: translateY(-1px);
}

.secondary-button {
  background: transparent;
  border: 1px solid var(--line);
}

.secondary-button:hover:not(:disabled) {
  border-color: var(--paper);
}

.text-button {
  color: var(--muted);
  background: transparent;
}

.text-button:hover {
  color: var(--paper);
}

.selection-hint {
  padding: 0.65rem 0.75rem;
  margin-bottom: 0.65rem;
  color: var(--muted);
  background: rgba(216, 255, 79, 0.07);
  border-left: 3px solid var(--acid);
  font-size: 0.75rem;
}

.selection-hint strong {
  color: var(--acid);
}

.animal-list {
  display: grid;
  gap: 0.5rem;
}

.animal-choice {
  position: relative;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 36px;
  gap: 0.6rem;
  align-items: center;
  min-height: 70px;
  padding: 0.55rem 0.6rem;
  text-align: left;
  background: var(--ink-3);
  border: 1px solid transparent;
  border-radius: 7px;
  cursor: pointer;
}

.animal-choice:hover,
.animal-choice.active {
  border-color: var(--acid);
}

.animal-choice.active {
  background: #292e21;
}

.choice-icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  background: rgba(243, 237, 220, 0.08);
  border-radius: 50%;
  font-size: 1.5rem;
}

.choice-copy strong,
.choice-copy small,
.choice-stat b,
.choice-stat small {
  display: block;
}

.choice-copy strong {
  font-size: 0.85rem;
}

.choice-copy small {
  margin-top: 0.15rem;
  color: var(--muted);
  font-size: 0.65rem;
}

.choice-stat {
  text-align: center;
}

.choice-stat b {
  font-size: 1.2rem;
}

.choice-stat small {
  color: var(--muted);
  font-size: 0.55rem;
}

.choice-affinity {
  position: absolute;
  right: 0.45rem;
  bottom: 0.3rem;
  padding: 0.12rem 0.3rem;
  color: var(--ink);
  border-radius: 2px;
  font-size: 0.52rem;
  font-weight: 900;
}

.choice-affinity.all-round {
  color: var(--paper);
  background: rgba(243, 237, 220, 0.16);
}

.animal-choice em {
  position: absolute;
  top: 0.3rem;
  right: 0.35rem;
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  color: var(--ink);
  background: var(--acid);
  border-radius: 50%;
  font-size: 0.55rem;
  font-style: normal;
  font-weight: 950;
}

.build-box,
.current-build,
.end-build {
  padding-top: 0.8rem;
  margin-top: 0.8rem;
  border-top: 1px solid var(--line);
}

.build-box > span,
.current-build > span,
.end-build > small {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--muted);
  font-size: 0.65rem;
  font-weight: 800;
}

.build-box > div,
.current-build > div,
.end-build > div {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.upgrade-pill,
.empty-build {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  min-height: 28px;
  padding: 0.25rem 0.45rem;
  color: var(--paper);
  background: rgba(243, 237, 220, 0.08);
  border-radius: 3px;
  font-size: 0.62rem;
  font-weight: 750;
}

.upgrade-pill b {
  color: var(--acid);
}

.empty-build {
  color: var(--muted);
}

.race-stage {
  min-height: 620px;
  padding: clamp(1rem, 4vw, 3rem);
  background: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
}

.race-heading {
  margin-top: 0;
}

.race-heading p:last-child,
.reward-heading p:last-child {
  max-width: 30rem;
  margin: 0;
  color: var(--muted);
}

.race-score {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.55rem;
  margin: 2rem 0;
}

.race-score span,
.race-score small {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 750;
}

.race-score strong {
  color: var(--acid);
  font-size: clamp(3rem, 8vw, 6rem);
  line-height: 0.8;
}

.race-track {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}

.race-leg {
  position: relative;
  min-height: 190px;
  padding: 0.8rem;
  overflow: hidden;
  background: var(--ink-3);
  border: 2px solid transparent;
  border-radius: 8px;
  opacity: 0.5;
  transition: opacity 180ms ease, border-color 180ms ease, transform 180ms ease;
}

.race-leg.current {
  border-color: var(--acid);
  opacity: 1;
  transform: translateY(-5px);
}

.race-leg.done {
  opacity: 1;
}

.race-leg-number {
  display: grid;
  width: 26px;
  height: 26px;
  margin-bottom: 0.65rem;
  place-items: center;
  color: var(--ink);
  background: var(--paper);
  border-radius: 50%;
  font-size: 0.68rem;
  font-weight: 950;
}

.terrain-row.compact .terrain-tile {
  min-height: 36px;
}

.runner {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-top: 1rem;
}

.runner-icon,
.result-icon {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  background: rgba(243, 237, 220, 0.08);
  border-radius: 50%;
  font-size: 2rem;
}

.race-leg.current .runner-icon {
  animation: dash 350ms ease-in-out infinite alternate;
}

@keyframes dash {
  to { transform: translateX(10px) rotate(4deg); }
}

.leg-gain {
  position: absolute;
  right: 0.8rem;
  bottom: 0.8rem;
  color: var(--acid);
  font-size: 1.1rem;
}

.race-call {
  min-height: 48px;
  padding: 1rem;
  margin-top: 0.9rem;
  color: var(--paper);
  background: #0d0f0b;
  border-radius: 6px;
  font-weight: 850;
  text-align: center;
}

.race-progress {
  height: 6px;
  margin: 0.75rem 0 1rem;
  overflow: hidden;
  background: rgba(243, 237, 220, 0.09);
  border-radius: 999px;
}

.race-progress i {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--orange), var(--acid));
  transition: width 400ms ease;
}

.race-actions {
  justify-content: flex-end;
}

.recap-stage {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  gap: 1rem;
}

.result-summary,
.result-details {
  padding: clamp(1rem, 3vw, 2rem);
}

.result-summary {
  display: flex;
  flex-direction: column;
  min-height: 480px;
}

.result-summary.cleared {
  border-color: rgba(216, 255, 79, 0.55);
}

.result-score {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  margin: 2rem 0;
}

.result-score span,
.result-score small {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 750;
}

.result-score strong {
  color: var(--acid);
  font-size: clamp(3.5rem, 8vw, 6rem);
  line-height: 0.8;
}

.result-progress {
  padding: 0.9rem;
  margin-bottom: auto;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 6px;
}

.result-progress > div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.6rem;
  font-size: 0.8rem;
}

.result-summary > .primary-button {
  margin-top: 1.25rem;
}

.leg-results {
  display: grid;
  gap: 0.6rem;
}

.leg-results article {
  display: grid;
  grid-template-columns: 28px 50px minmax(0, 1fr) auto;
  gap: 0.7rem;
  align-items: center;
  min-height: 82px;
  padding: 0.7rem;
  background: var(--ink-3);
  border-radius: 6px;
}

.result-leg-number {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  color: var(--ink);
  background: var(--paper);
  border-radius: 50%;
  font-size: 0.65rem;
  font-weight: 950;
}

.leg-results .result-icon {
  width: 46px;
  height: 46px;
  font-size: 1.55rem;
}

.leg-results strong,
.leg-results small {
  display: block;
}

.leg-results small {
  margin-top: 0.2rem;
  color: var(--muted);
  font-size: 0.68rem;
}

.leg-results article > b {
  color: var(--acid);
  font-size: 1.2rem;
}

.baton-icon {
  color: var(--acid);
  font-size: 1.2rem !important;
}

.reward-stage {
  padding: clamp(1rem, 4vw, 3rem);
}

.reward-heading {
  align-items: start;
  margin-top: 0;
}

.reward-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.8rem;
}

.reward-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 280px;
  padding: 1.25rem;
  text-align: left;
  background: var(--ink-3);
  border: 2px solid transparent;
  border-radius: 8px;
  cursor: pointer;
}

.reward-card:hover {
  border-color: var(--acid);
  transform: translateY(-3px);
}

.reward-icon {
  display: grid;
  width: 58px;
  height: 58px;
  margin-bottom: 1rem;
  place-items: center;
  color: var(--ink);
  background: var(--acid);
  border-radius: 50%;
  font-size: 1.25rem;
  font-weight: 950;
}

.reward-number {
  position: absolute;
  top: 1rem;
  right: 1rem;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 900;
}

.reward-card > strong {
  font-size: 1.3rem;
}

.reward-card p {
  margin: 0.65rem 0 auto;
  color: var(--muted);
  line-height: 1.6;
}

.take-reward {
  padding-top: 1rem;
  color: var(--acid);
  font-size: 0.75rem;
  font-weight: 900;
}

.current-build {
  margin-top: 1.5rem;
}

.end-stage {
  display: grid;
  grid-template-columns: 1fr 0.9fr;
  gap: 1rem;
  min-height: 620px;
  align-items: center;
}

.end-copy {
  padding: clamp(1rem, 5vw, 4rem);
}

.end-copy h1 {
  color: var(--acid);
  font-size: clamp(4rem, 11vw, 8.5rem);
}

.end-copy p:last-child {
  max-width: 28rem;
  margin-top: 1.25rem;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.7;
}

.defeat .end-copy h1 {
  color: var(--orange);
}

.end-card {
  padding: clamp(1.25rem, 4vw, 2.5rem);
}

.end-card > span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.end-card > strong {
  display: block;
  margin: 0.4rem 0 1.5rem;
  color: var(--acid);
  font-size: clamp(3.5rem, 8vw, 6rem);
  line-height: 1;
}

.end-actions {
  flex-direction: column;
  align-items: stretch;
  margin-top: 1.5rem;
}

.rules-dialog {
  width: min(580px, calc(100% - 2rem));
  padding: 1.25rem;
  color: var(--paper);
  background: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
}

.rules-dialog::backdrop {
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
}

.dialog-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 1rem;
}

.close-button {
  display: grid;
  width: 44px;
  place-items: center;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  font-size: 1.4rem;
}

.rule-list {
  display: grid;
  gap: 0.65rem;
  padding: 0;
  margin: 1.25rem 0;
  list-style: none;
}

.rule-list li {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 0.75rem;
  align-items: start;
  padding: 0.75rem;
  background: var(--ink-3);
  border-radius: 6px;
}

.rule-list li > b {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  color: var(--ink);
  background: var(--acid);
  border-radius: 50%;
}

.rule-list strong {
  display: block;
  margin-bottom: 0.2rem;
}

.rule-list p {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.5;
}

.rules-formula {
  padding: 0.85rem;
  margin-bottom: 1rem;
  background: rgba(216, 255, 79, 0.08);
  border-left: 3px solid var(--acid);
}

.rules-formula span,
.rules-formula strong {
  display: block;
}

.rules-formula span {
  margin-bottom: 0.25rem;
  color: var(--muted);
  font-size: 0.65rem;
}

.rules-dialog > .primary-button {
  width: 100%;
  justify-content: center;
}

.game-footer {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 0 0;
  color: rgba(243, 237, 220, 0.38);
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

@media (max-width: 980px) {
  .plan-grid,
  .recap-stage {
    grid-template-columns: 1fr;
  }

  .team-card {
    order: -1;
  }

  .animal-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .forecast-card {
    grid-template-columns: 0.75fr 1.5fr;
  }

  .forecast-card .primary-button {
    grid-column: 2;
  }

  .end-stage {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .end-copy {
    padding-bottom: 0;
  }
}

@media (max-width: 720px) {
  .game-shell {
    width: min(100% - 1rem, 1180px);
    padding-top: 0.5rem;
  }

  .brand small {
    display: none;
  }

  .quiet-button {
    padding-inline: 0.65rem;
    font-size: 0.72rem;
  }

  .status-bar {
    grid-template-columns: repeat(3, 1fr);
  }

  .status-bar > div {
    display: block;
    min-height: 68px;
    padding: 0.7rem;
    text-align: center;
  }

  .status-bar strong {
    display: block;
    margin: 0.25rem 0;
    font-size: 1.35rem;
  }

  .status-score .progress {
    margin-top: 0.3rem;
  }

  .plan-heading,
  .race-heading,
  .reward-heading {
    display: block;
  }

  .three-steps {
    margin-top: 1rem;
    overflow-x: auto;
  }

  .leg-grid,
  .race-track,
  .reward-grid {
    grid-template-columns: 1fr;
  }

  .leg-card {
    display: grid;
    grid-template-columns: 0.8fr 1fr;
    gap: 0.6rem 0.8rem;
    min-height: 0;
  }

  .leg-number,
  .fit-label {
    grid-column: 1 / -1;
  }

  .assigned-animal {
    margin: 0;
  }

  .forecast-card {
    grid-template-columns: 1fr;
  }

  .forecast-card .primary-button {
    grid-column: auto;
  }

  .simple-formula {
    overflow-x: auto;
  }

  .simple-formula span {
    min-width: 75px;
  }

  .race-stage {
    min-height: 0;
  }

  .race-leg {
    min-height: 150px;
  }

  .race-actions {
    align-items: stretch;
  }

  .reward-card {
    min-height: 210px;
  }
}

@media (max-width: 480px) {
  .game-header {
    align-items: start;
  }

  .brand-mark {
    width: 42px;
    height: 42px;
  }

  .brand strong {
    font-size: 0.9rem;
  }

  .header-actions {
    gap: 0.3rem;
  }

  .quiet-button {
    min-height: 42px;
    padding: 0.55rem;
  }

  .status-bar em {
    display: none;
  }

  .status-bar > div {
    min-width: 0;
  }

  .status-bar strong {
    font-size: 1.12rem;
  }

  .status-bar strong small {
    display: block;
    margin: 0.2rem 0 0;
  }

  h1 {
    font-size: 2.35rem;
  }

  .three-steps {
    gap: 0.8rem;
  }

  .three-steps li {
    font-size: 0.66rem;
  }

  .animal-list {
    grid-template-columns: 1fr;
  }

  .section-title p {
    display: none;
  }

  .course-card,
  .team-card,
  .result-summary,
  .result-details,
  .reward-stage {
    padding: 0.8rem;
  }

  .leg-card {
    padding: 0.7rem;
  }

  .forecast-total {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
  }

  .forecast-total strong {
    font-size: 2.1rem;
  }

  .race-score {
    margin: 1.5rem 0;
  }

  .race-actions {
    flex-direction: column-reverse;
  }

  .race-actions button,
  .end-actions button {
    width: 100%;
  }

  .leg-results article {
    grid-template-columns: 26px 42px 1fr auto;
    gap: 0.45rem;
    padding: 0.55rem;
  }

  .leg-results .result-icon {
    width: 40px;
    height: 40px;
    font-size: 1.3rem;
  }

  .leg-results small {
    font-size: 0.6rem;
  }

  .end-copy {
    padding-inline: 0.5rem;
  }

  .end-copy h1 {
    font-size: 4rem;
  }
}

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

/* Point-race edition */
.point-race-shell {
  --lane-1: #f4f0df;
  --lane-2: #232622;
  --lane-3: #e94e3d;
  --lane-4: #3979cf;
  --lane-5: #e6c64f;
}

.no-cash-label {
  padding: 0.45rem 0.65rem;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 800;
}

.point-status {
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr;
  margin-bottom: 1.25rem;
  overflow: hidden;
  background: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.point-status > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  min-height: 76px;
  padding: 0.9rem 1rem;
  border-right: 1px solid var(--line);
}

.point-status > div:last-child {
  border-right: 0;
}

.point-status span {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
}

.point-status strong {
  color: var(--acid);
  font-size: 2rem;
}

.point-status small {
  margin-left: 0.2rem;
  color: var(--muted);
  font-size: 0.65rem;
}

.bet-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin: 1.5rem 0 1.25rem;
}

.course-badge {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-width: 180px;
  padding: 0.8rem 1rem;
  color: var(--ink);
  border-radius: 7px;
}

.course-badge > b {
  font-size: 1.4rem;
}

.course-badge span,
.course-badge small {
  display: block;
  font-weight: 900;
}

.course-badge small {
  margin-top: 0.15rem;
  font-size: 0.65rem;
}

.bet-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 1rem;
  align-items: start;
}

.field-card,
.ticket-card {
  padding: 1rem;
  background: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
}

.bet-guide {
  padding: 0.75rem 0.9rem;
  margin-bottom: 0.7rem;
  color: var(--muted);
  background: rgba(216, 255, 79, 0.07);
  border-left: 3px solid var(--acid);
  font-size: 0.75rem;
}

.bet-guide strong {
  color: var(--acid);
}

.entrant-list {
  display: grid;
  gap: 0.45rem;
}

.entrant-row {
  position: relative;
  display: grid;
  grid-template-columns: 34px 52px minmax(150px, 1fr) 74px 145px 48px;
  gap: 0.6rem;
  align-items: center;
  min-height: 82px;
  padding: 0.55rem 0.6rem;
  background: var(--ink-3);
  border: 1px solid transparent;
  border-radius: 7px;
}

.entrant-row.favorite {
  border-color: rgba(216, 255, 79, 0.4);
}

.entrant-row.favorite::after {
  position: absolute;
  top: -6px;
  left: 0.5rem;
  padding: 0.12rem 0.35rem;
  content: "本命";
  color: var(--ink);
  background: var(--acid);
  border-radius: 2px;
  font-size: 0.52rem;
  font-weight: 950;
}

.lane-number {
  display: grid;
  width: 30px;
  height: 42px;
  place-items: center;
  color: var(--ink);
  background: var(--paper);
  border-radius: 3px;
  font-size: 0.9rem;
  font-weight: 950;
}

.lane-2 {
  color: var(--paper);
  background: var(--lane-2);
  border: 1px solid var(--line);
}

.lane-3 { background: var(--lane-3); }
.lane-4 { color: var(--paper); background: var(--lane-4); }
.lane-5 { background: var(--lane-5); }

.entrant-icon {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  background: rgba(243, 237, 220, 0.08);
  border-radius: 50%;
  font-size: 1.65rem;
}

.entrant-name strong,
.entrant-name small,
.popularity strong,
.popularity small {
  display: block;
}

.entrant-name strong {
  font-size: 0.88rem;
}

.entrant-name small,
.popularity small {
  margin-top: 0.18rem;
  color: var(--muted);
  font-size: 0.62rem;
}

.popularity {
  text-align: right;
}

.popularity strong {
  margin-top: 0.12rem;
  color: var(--acid);
  font-size: 1.1rem;
}

.bet-controls {
  display: grid;
  grid-template-columns: 40px 1fr 40px;
  align-items: center;
  overflow: hidden;
  background: #0d0f0b;
  border: 1px solid var(--line);
  border-radius: 5px;
}

.bet-controls button,
.max-button {
  min-height: 44px;
  border: 0;
  cursor: pointer;
  font-weight: 950;
}

.bet-controls button {
  padding: 0;
  color: var(--acid);
  background: rgba(243, 237, 220, 0.06);
  font-size: 1.2rem;
}

.bet-controls button:hover,
.max-button:hover {
  background: rgba(216, 255, 79, 0.14);
}

.bet-controls b {
  text-align: center;
}

.bet-controls small {
  margin-left: 0.1rem;
  color: var(--muted);
  font-size: 0.55rem;
}

.max-button {
  min-width: 46px;
  padding: 0.4rem;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 0.6rem;
}

.ticket-card {
  position: sticky;
  top: 1rem;
}

.ticket-card > span {
  color: var(--acid);
  font-size: 0.65rem;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.ticket-card h2 {
  margin-top: 0.25rem;
}

.ticket-number {
  padding: 1.25rem 0;
  margin: 1rem 0;
  text-align: center;
  background: #0d0f0b;
  border-block: 1px dashed rgba(243, 237, 220, 0.22);
}

.ticket-number strong,
.ticket-number small {
  display: block;
}

.ticket-number strong {
  color: var(--acid);
  font-size: 3.5rem;
  line-height: 1;
}

.ticket-number small {
  margin-top: 0.25rem;
  color: var(--muted);
  font-size: 0.65rem;
}

.ticket-card dl {
  margin: 0 0 1rem;
}

.ticket-card dl > div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.7rem;
}

.ticket-card dt {
  color: var(--muted);
}

.ticket-card dd {
  margin: 0;
  font-weight: 900;
}

.ticket-card .primary-button {
  width: 100%;
}

.ticket-card > p {
  margin: 0.75rem 0 0;
  color: var(--muted);
  font-size: 0.64rem;
  line-height: 1.5;
  text-align: center;
}

@media (max-width: 940px) {
  .bet-layout {
    grid-template-columns: 1fr;
  }

  .ticket-card {
    position: static;
  }
}

@media (max-width: 720px) {
  .no-cash-label {
    display: none;
  }

  .point-status > div {
    display: block;
    min-height: 68px;
    text-align: center;
  }

  .point-status strong {
    display: block;
    margin-top: 0.2rem;
    font-size: 1.5rem;
  }

  .bet-heading {
    align-items: center;
  }

  .entrant-row {
    grid-template-columns: 30px 44px minmax(110px, 1fr) 62px;
    gap: 0.45rem;
    padding-bottom: 3.45rem;
  }

  .entrant-icon {
    width: 42px;
    height: 42px;
    font-size: 1.4rem;
  }

  .bet-controls {
    position: absolute;
    right: 3.8rem;
    bottom: 0.45rem;
    left: 0.55rem;
  }

  .max-button {
    position: absolute;
    right: 0.55rem;
    bottom: 0.45rem;
  }
}

@media (max-width: 480px) {
  .bet-heading {
    display: block;
  }

  .course-badge {
    min-width: 0;
    margin-top: 1rem;
  }

  .field-card,
  .ticket-card {
    padding: 0.7rem;
  }

  .entrant-name strong {
    font-size: 0.78rem;
  }

  .entrant-name small {
    font-size: 0.56rem;
  }

  .popularity strong {
    font-size: 0.95rem;
  }
}

.status-wallet {
  position: relative;
}

.target-progress {
  position: absolute;
  right: 1rem;
  bottom: 0.55rem;
  left: 1rem;
  height: 4px;
  overflow: hidden;
  background: rgba(243, 237, 220, 0.1);
  border-radius: 99px;
}

.target-progress i {
  display: block;
  height: 100%;
  background: var(--acid);
}

.entrant-row.has-bet {
  background: #2a3021;
  border-color: var(--acid);
}

.payout-preview {
  position: absolute;
  right: 4rem;
  bottom: 0.2rem;
  color: var(--acid);
  font-size: 0.54rem;
  font-weight: 850;
}

.active-perks {
  padding: 0.7rem 0;
  margin-bottom: 0.7rem;
  border-bottom: 1px solid var(--line);
}

.active-perks > span,
.current-perks > span {
  display: block;
  margin-bottom: 0.4rem;
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 800;
}

.active-perks > div,
.current-perks > div {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.perk-pill,
.empty-perks {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  min-height: 27px;
  padding: 0.22rem 0.42rem;
  color: var(--paper);
  background: rgba(243, 237, 220, 0.08);
  border-radius: 3px;
  font-size: 0.6rem;
  font-weight: 800;
}

.perk-pill b {
  color: var(--acid);
}

.perk-pill i {
  padding: 0.1rem 0.25rem;
  color: var(--ink);
  background: var(--acid);
  border-radius: 2px;
  font-size: 0.48rem;
  font-style: normal;
}

.empty-perks {
  color: var(--muted);
}

.clear-ticket {
  width: 100%;
  min-height: 38px;
  padding: 0.4rem;
}

.point-race-stage,
.payout-summary,
.ranking-card,
.perk-stage,
.point-end-card {
  background: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
}

.point-race-stage {
  min-height: 620px;
  padding: clamp(1rem, 3vw, 2.25rem);
}

.live-race-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 2rem;
}

.live-points {
  text-align: right;
}

.live-points span,
.live-points strong,
.live-points small {
  display: block;
}

.live-points span {
  color: var(--muted);
  font-size: 0.65rem;
  font-weight: 800;
}

.live-points strong {
  color: var(--acid);
  font-size: 2.4rem;
  line-height: 1;
}

.live-points small {
  display: inline;
  margin-left: 0.2rem;
  color: var(--muted);
  font-size: 0.65rem;
}

.animal-lanes {
  display: grid;
  gap: 0.45rem;
}

.animal-lane {
  display: grid;
  grid-template-columns: 34px 105px minmax(160px, 1fr) 44px;
  gap: 0.7rem;
  align-items: center;
  min-height: 76px;
  padding: 0.55rem 0.7rem;
  background: var(--ink-3);
  border: 1px solid transparent;
  border-radius: 7px;
  transition: background 180ms ease, border-color 180ms ease;
}

.animal-lane.winner {
  background: #2a3021;
  border-color: var(--acid);
}

.lane-name strong,
.lane-name small {
  display: block;
}

.lane-name strong {
  font-size: 0.78rem;
}

.lane-name small {
  margin-top: 0.15rem;
  color: var(--muted);
  font-size: 0.58rem;
}

.lane-track {
  position: relative;
  height: 34px;
  background:
    repeating-linear-gradient(90deg, transparent, transparent calc(20% - 1px), rgba(243, 237, 220, 0.08) calc(20% - 1px), rgba(243, 237, 220, 0.08) 20%),
    #10120e;
  border-radius: 4px;
}

.lane-fill {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 0;
  background: rgba(216, 255, 79, 0.1);
  border-right: 2px solid var(--acid);
  transition: width 720ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.race-animal {
  position: absolute;
  z-index: 2;
  top: 50%;
  left: 1%;
  font-size: 1.55rem;
  transform: translate(-50%, -50%);
  transition: left 720ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.finish-line {
  position: absolute;
  top: 0;
  right: 1.5%;
  bottom: 0;
  width: 5px;
  background: repeating-linear-gradient(0deg, var(--paper), var(--paper) 4px, var(--ink) 4px, var(--ink) 8px);
}

.lane-position {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 900;
  text-align: center;
}

.animal-lane.winner .lane-position {
  color: var(--acid);
}

.race-comment {
  min-height: 52px;
  padding: 1rem;
  margin: 1rem 0 0.75rem;
  color: var(--paper);
  background: #0d0f0b;
  border-radius: 6px;
  font-weight: 850;
  text-align: center;
}

.payout-stage {
  display: grid;
  grid-template-columns: 0.82fr 1.18fr;
  gap: 1rem;
}

.payout-summary,
.ranking-card {
  padding: clamp(1rem, 3vw, 2rem);
}

.payout-summary {
  display: flex;
  flex-direction: column;
  min-height: 570px;
}

.payout-summary.hit {
  border-color: rgba(216, 255, 79, 0.55);
}

.winner-icon {
  display: grid;
  width: 78px;
  height: 78px;
  margin: 1.25rem 0 0.7rem;
  place-items: center;
  background: rgba(243, 237, 220, 0.08);
  border-radius: 50%;
  font-size: 2.8rem;
}

.payout-summary h1 {
  font-size: clamp(2.1rem, 5vw, 4rem);
}

.payout-summary h1 small {
  display: inline-block;
  margin-left: 0.5rem;
  color: var(--acid);
  font-size: 0.75rem;
  letter-spacing: 0;
}

.payout-result {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 0;
  margin-top: 1rem;
  border-block: 1px solid var(--line);
}

.payout-result > span {
  color: var(--acid);
  font-size: 0.8rem;
  font-weight: 900;
}

.payout-result strong {
  font-size: 2.8rem;
  line-height: 1;
}

.payout-result small {
  margin-left: 0.25rem;
  color: var(--muted);
  font-size: 0.62rem;
}

.payout-math {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin: 0.8rem 0;
}

.payout-math > div {
  padding: 0.65rem;
  background: var(--ink-3);
  border-radius: 5px;
  text-align: center;
}

.payout-math dt {
  color: var(--muted);
  font-size: 0.6rem;
}

.payout-math dd {
  margin: 0.25rem 0 0;
  font-size: 1.15rem;
  font-weight: 900;
}

.positive { color: var(--acid); }
.negative { color: var(--orange); }

.perk-notes {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.8rem;
}

.perk-notes span {
  padding: 0.3rem 0.45rem;
  color: var(--acid);
  background: rgba(216, 255, 79, 0.08);
  border-radius: 3px;
  font-size: 0.6rem;
  font-weight: 800;
}

.wallet-after {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem;
  margin-bottom: auto;
  background: #0d0f0b;
  border-radius: 6px;
}

.wallet-after span {
  color: var(--muted);
  font-size: 0.68rem;
}

.wallet-after strong {
  color: var(--acid);
  font-size: 1.8rem;
}

.wallet-after small {
  margin-left: 0.2rem;
  color: var(--muted);
  font-size: 0.6rem;
}

.payout-summary > .primary-button {
  margin-top: 1rem;
}

.ranking-list {
  display: grid;
  gap: 0.45rem;
  padding: 0;
  margin: 0;
  list-style: none;
}

.ranking-list li {
  position: relative;
  display: grid;
  grid-template-columns: 32px 48px minmax(0, 1fr) 54px;
  gap: 0.65rem;
  align-items: center;
  min-height: 78px;
  padding: 0.55rem 0.7rem;
  background: var(--ink-3);
  border: 1px solid transparent;
  border-radius: 6px;
}

.ranking-list li.covered {
  border-color: rgba(216, 255, 79, 0.45);
}

.ranking-list li > b {
  position: absolute;
  top: 0.25rem;
  right: 0.35rem;
  color: var(--acid);
  font-size: 0.55rem;
}

.rank-number {
  font-size: 1.2rem;
  font-weight: 950;
  text-align: center;
}

.rank-icon {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  background: rgba(243, 237, 220, 0.07);
  border-radius: 50%;
  font-size: 1.5rem;
}

.rank-name strong,
.rank-name small {
  display: block;
}

.rank-name small {
  margin-top: 0.2rem;
  color: var(--muted);
  font-size: 0.62rem;
}

.rank-bet {
  text-align: right;
  font-weight: 900;
}

.rank-bet small {
  margin-left: 0.1rem;
  color: var(--muted);
  font-size: 0.55rem;
}

.perk-stage {
  min-height: 590px;
  padding: clamp(1rem, 4vw, 3rem);
}

.perk-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.perk-heading p:last-child {
  max-width: 28rem;
  margin: 0;
  color: var(--muted);
}

.perk-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}

.perk-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 270px;
  padding: 1.2rem;
  text-align: left;
  background: var(--ink-3);
  border: 2px solid transparent;
  border-radius: 8px;
  cursor: pointer;
}

.perk-card:hover {
  border-color: var(--acid);
  transform: translateY(-3px);
}

.perk-card.upgrade {
  border-color: rgba(216, 255, 79, 0.45);
}

.perk-level-badge {
  align-self: flex-start;
  padding: 0.22rem 0.38rem;
  margin: 0.65rem 0 0.4rem;
  color: var(--ink);
  background: var(--acid);
  border-radius: 2px;
  font-size: 0.55rem;
  font-weight: 950;
  letter-spacing: 0.08em;
}

.perk-icon {
  display: grid;
  width: 58px;
  height: 58px;
  margin-bottom: 1rem;
  place-items: center;
  color: var(--ink);
  background: var(--acid);
  border-radius: 50%;
  font-size: 1.2rem;
  font-weight: 950;
}

.perk-index {
  position: absolute;
  top: 1rem;
  right: 1rem;
  color: var(--muted);
  font-size: 0.65rem;
  font-weight: 900;
}

.perk-card > strong {
  font-size: 1.25rem;
}

.perk-card p {
  margin: 0.65rem 0 auto;
  color: var(--muted);
  line-height: 1.6;
}

.take-perk {
  padding-top: 1rem;
  color: var(--acid);
  font-size: 0.72rem;
  font-weight: 900;
}

.current-perks {
  padding-top: 0.9rem;
  margin-top: 1rem;
  border-top: 1px solid var(--line);
}

.point-end {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 1rem;
  min-height: 650px;
  align-items: center;
}

.point-end .end-copy h1 {
  white-space: pre-line;
}

.point-end-card > strong small {
  margin-left: 0.3rem;
  color: var(--muted);
  font-size: 0.7rem;
}

.end-meter {
  position: relative;
  height: 8px;
  margin: 0.5rem 0 1.5rem;
  background: rgba(243, 237, 220, 0.1);
  border-radius: 99px;
}

.end-meter i {
  display: block;
  height: 100%;
  background: var(--acid);
  border-radius: inherit;
}

.end-meter b {
  position: absolute;
  right: 0;
  bottom: 0.65rem;
  color: var(--muted);
  font-size: 0.55rem;
}

@media (max-width: 860px) {
  .payout-stage,
  .point-end {
    grid-template-columns: 1fr;
  }

  .payout-summary {
    min-height: 0;
  }

  .perk-heading {
    display: block;
  }

  .perk-heading p:last-child {
    margin-top: 1rem;
  }
}

@media (max-width: 720px) {
  .point-race-stage {
    min-height: 0;
    padding: 0.8rem;
  }

  .live-race-head {
    align-items: center;
  }

  .animal-lane {
    grid-template-columns: 30px 74px minmax(110px, 1fr) 36px;
    gap: 0.4rem;
    padding: 0.45rem;
  }

  .lane-name small {
    font-size: 0.52rem;
  }

  .race-animal {
    font-size: 1.3rem;
  }

  .payout-stage {
    grid-template-columns: 1fr;
  }

  .perk-grid {
    grid-template-columns: 1fr;
  }

  .perk-card {
    min-height: 210px;
  }
}

@media (max-width: 480px) {
  .live-race-head {
    display: block;
  }

  .live-points {
    margin-top: 1rem;
    text-align: left;
  }

  .animal-lane {
    grid-template-columns: 28px 55px minmax(90px, 1fr) 32px;
    min-height: 66px;
  }

  .lane-name small {
    white-space: nowrap;
  }

  .race-actions {
    flex-direction: column-reverse;
    align-items: stretch;
  }

  .payout-summary,
  .ranking-card,
  .perk-stage {
    padding: 0.8rem;
  }

  .payout-result strong {
    font-size: 2.2rem;
  }

  .ranking-list li {
    grid-template-columns: 28px 42px minmax(0, 1fr) 44px;
    gap: 0.45rem;
    padding: 0.5rem;
  }

  .rank-icon {
    width: 38px;
    height: 38px;
    font-size: 1.25rem;
  }
}
/* Relay v3 — compact decisions: order, one race tactic, and a focused build draft. */
.relay-v3 { max-width: 1120px; }
.relay-brief {
  display: grid; grid-template-columns: 1fr auto; gap: 28px; align-items: end;
  margin: 26px 0 18px; padding: 26px; border: 1px solid var(--line); background: var(--ink-2);
}
.relay-brief h2 { margin: 4px 0 8px; font-size: clamp(1.6rem, 4vw, 2.8rem); }
.relay-brief p { margin: 0; }
.quota-card { min-width: 138px; padding-left: 24px; border-left: 1px solid var(--line); }
.quota-card span, .quota-card small { display: block; }
.quota-card strong { display: block; font-size: 3rem; line-height: 1; color: var(--orange); }
.relay-order { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.relay-leg {
  position: relative; display: flex; min-height: 310px; padding: 18px; border: 1px solid var(--line);
  background: var(--ink-2); color: var(--paper); text-align: left; flex-direction: column; align-items: flex-start;
  transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}
.relay-leg:hover { transform: translateY(-3px); border-color: var(--acid); }
.relay-leg.is-selected { border-color: var(--acid); box-shadow: inset 0 0 0 2px var(--acid); }
.leg-number { font: 700 .76rem/1 var(--mono); letter-spacing: .12em; }
.leg-terrain { display: inline-flex; gap: 8px; align-items: center; margin: 18px 0 4px; font-weight: 800; }
.terrain-mark { font-size: .8em; }
.terrain-turf { color: var(--acid); } .terrain-mud { color: var(--orange); } .terrain-hill { color: var(--blue); }
.animal-icon { margin: auto 0 8px; font-size: 4.2rem; line-height: 1; }
.relay-leg strong { font-size: 1.25rem; }
.animal-stats { margin-top: 5px; font: 700 .72rem/1.4 var(--mono); opacity: .68; }
.animal-ability { margin-top: 10px; min-height: 38px; color: var(--muted); font: 700 .68rem/1.45 var(--mono); }
.animal-ability b { display: block; color: var(--acid); }
.opponent-power { margin-top: 12px; font: 700 .7rem/1.4 var(--mono); color: var(--orange); }
.relay-actions { display: flex; justify-content: flex-end; margin-top: 18px; padding: 18px 0; border-top: 1px solid var(--line); }
.tactic-panel { display: grid; grid-template-columns: minmax(190px, .75fr) 1.6fr; gap: 18px; align-items: center; margin-top: 18px; padding: 18px; border: 1px solid var(--line); background: var(--ink-2); }
.tactic-panel h3, .tactic-panel p { margin: 0; }
.tactic-panel h3 { margin: 4px 0 6px; }
.tactic-panel > div:first-child > p:last-child { color: var(--muted); font-size: .78rem; }
.tactic-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tactic-options button { display: flex; gap: 9px; min-height: 72px; padding: 10px; border: 1px solid var(--line); background: var(--ink-3); color: var(--paper); text-align: left; align-items: center; cursor: pointer; }
.tactic-options button:hover, .tactic-options button.is-selected { border-color: var(--acid); }
.tactic-options button.is-selected { box-shadow: inset 0 -3px var(--acid); }
.tactic-options i { display: grid; width: 34px; height: 34px; flex: 0 0 auto; place-items: center; border: 1px solid var(--line); color: var(--acid); font: 900 .78rem/1 var(--mono); font-style: normal; }
.tactic-options strong, .tactic-options small { display: block; font-family: var(--mono); }
.tactic-options strong { font-size: .72rem; }
.tactic-options small { margin-top: 5px; color: var(--muted); font-size: .58rem; line-height: 1.35; }
.retry-note { grid-column: 1 / -1; padding-top: 10px; border-top: 1px solid var(--line); color: var(--orange) !important; font: 800 .7rem/1.3 var(--mono); }
@media (max-width: 720px) {
  .relay-brief { grid-template-columns: 1fr; }
  .quota-card { padding: 16px 0 0; border-left: 0; border-top: 1px solid var(--line); }
  .relay-order { grid-template-columns: 1fr; }
  .relay-leg { min-height: 180px; }
  .animal-icon { margin-top: 24px; }
  .relay-actions { align-items: stretch; flex-direction: column; }
  .tactic-panel { grid-template-columns: 1fr; }
  .tactic-options { grid-template-columns: 1fr; }
}

.relay-status {
  display: flex; align-items: center; gap: 24px; padding: 12px 0; border-bottom: 1px solid var(--line);
  font: 700 .74rem/1 var(--mono); letter-spacing: .08em;
}
.relay-status strong { margin-left: 4px; color: var(--acid); font-size: 1rem; }
.relay-status .run-seed { margin-left: auto; color: var(--muted); }
.status-perks { position: relative; z-index: 20; }
.status-perks summary { display: flex; align-items: center; cursor: pointer; list-style: none; user-select: none; }
.status-perks summary::-webkit-details-marker { display: none; }
.status-perks summary i { margin-left: 5px; color: var(--muted); font-style: normal; transition: transform 140ms ease; }
.status-perks[open] summary i { transform: rotate(180deg); }
.status-perk-panel { position: absolute; top: calc(100% + 14px); left: 50%; width: min(420px, calc(100vw - 32px)); max-height: 62vh; padding: 16px; overflow-y: auto; transform: translateX(-50%); background: var(--ink-2); border: 1px solid var(--acid); box-shadow: var(--shadow); letter-spacing: 0; }
.status-perk-panel::before { position: absolute; top: -6px; left: calc(50% - 5px); width: 10px; height: 10px; content: ""; background: var(--ink-2); border-top: 1px solid var(--acid); border-left: 1px solid var(--acid); transform: rotate(45deg); }
.status-perk-panel .section-label { margin: 0 0 10px; }
.status-perk-panel article { display: grid; grid-template-columns: 34px 1fr; gap: 10px; align-items: start; padding: 10px 0; border-top: 1px solid var(--line); }
.status-perk-panel article > b { display: grid; width: 30px; height: 30px; place-items: center; margin: 0; color: var(--acid); background: var(--ink-3); border: 1px solid var(--line); font: 900 .7rem/1 var(--mono); }
.status-perk-panel article.is-core > b { color: var(--orange); border-color: var(--orange); }
.relay-status .status-perk-panel article span { display: block; font-size: .75rem; line-height: 1.35; }
.status-perk-panel article strong { display: block; margin: 0 0 4px; color: var(--paper); font-size: .82rem; }
.status-perk-panel article small { display: block; color: var(--muted); font: 700 .65rem/1.45 var(--mono); }
.title-screen { position: relative; overflow: hidden; margin-top: 34px; padding: clamp(28px, 6vw, 64px); border: 1px solid var(--line); background: linear-gradient(135deg, var(--ink-2), #20261c 68%, #30391f); }
.title-screen::after { position: absolute; right: -45px; bottom: -88px; width: 280px; height: 280px; content: "↗"; color: rgba(215, 255, 75, .08); font: 950 16rem/1 var(--mono); transform: rotate(-8deg); pointer-events: none; }
.title-screen .section-label { margin-bottom: 14px; }
.title-screen h2 { max-width: 760px; margin: 0; font-size: clamp(2.5rem, 7vw, 6.2rem); line-height: .94; letter-spacing: -.055em; }
.title-screen > p:not(.section-label) { max-width: 580px; margin: 22px 0 0; color: var(--muted); font-size: clamp(.95rem, 2vw, 1.15rem); font-weight: 700; }
.title-facts { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 30px; }
.title-facts span { min-width: 118px; padding: 10px 14px; border: 1px solid var(--line); background: rgba(0, 0, 0, .16); font: 800 .68rem/1 var(--mono); color: var(--muted); }
.title-facts b { margin-right: 6px; color: var(--acid); font-size: 1.2rem; }
.title-start { position: relative; z-index: 1; margin-top: 34px; min-width: 220px; }
.modifier-select { margin-top: 34px; }
.modifier-head { max-width: 680px; margin-bottom: 22px; }
.modifier-head h2 { margin: 5px 0 8px; font-size: clamp(2.4rem, 6vw, 4.8rem); }
.modifier-head p { color: var(--muted); }
.modifier-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.modifier-grid > button { display: flex; min-height: 250px; padding: 20px; border: 1px solid var(--line); background: var(--ink-2); color: var(--paper); text-align: left; flex-direction: column; cursor: pointer; transition: transform 140ms ease, border-color 140ms ease; }
.modifier-grid > button:hover { transform: translateY(-3px); border-color: var(--acid); }
.modifier-grid i { display: grid; width: 52px; height: 52px; margin-bottom: 18px; place-items: center; border: 1px solid var(--acid); color: var(--acid); font: 900 1.3rem/1 var(--mono); font-style: normal; }
.modifier-grid h3, .modifier-grid p { margin: 0; }
.modifier-grid h3 { margin-top: 7px; font-size: 1.35rem; }
.modifier-grid p { margin: 9px 0 18px; color: var(--muted); line-height: 1.55; }
.modifier-grid > button > strong { margin-top: auto; color: var(--orange); font: 800 .68rem/1 var(--mono); }
.modifier-type { color: var(--muted); font: 800 .65rem/1 var(--mono); letter-spacing: .14em; }
.modifier-strip { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; padding: 10px 12px; border: 1px solid rgba(255, 139, 74, .5); background: rgba(255, 139, 74, .06); }
.modifier-strip > b { display: grid; width: 36px; height: 36px; flex: 0 0 auto; place-items: center; border: 1px solid var(--orange); color: var(--orange); font: 900 .9rem/1 var(--mono); }
.modifier-strip > span { color: var(--muted); font-size: .72rem; line-height: 1.4; }
.modifier-strip small, .modifier-strip strong { display: block; font-family: var(--mono); }
.modifier-strip small { color: var(--orange); font-size: .58rem; }
.modifier-strip strong { color: var(--paper); font-size: .78rem; }
.pack-strip { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; padding: 10px 12px; border: 1px solid var(--line); background: var(--ink-3); }
.pack-strip > b { display: grid; width: 36px; height: 36px; flex: 0 0 auto; place-items: center; border: 1px solid var(--line); color: var(--muted); font: 900 .9rem/1 var(--mono); }
.pack-strip > span { color: var(--muted); font-size: .72rem; line-height: 1.4; }
.pack-strip small, .pack-strip strong { display: block; font-family: var(--mono); }
.pack-strip small { color: var(--muted); font-size: .58rem; }
.pack-strip strong { color: var(--paper); font-size: .78rem; }
.pack-strip.is-active { border-color: rgba(216, 255, 79, .55); background: rgba(216, 255, 79, .06); }
.pack-strip.is-active > b { border-color: var(--acid); color: var(--acid); }
.pack-strip.is-active small { color: var(--acid); }
.build-panel { margin-top: 18px; padding: 18px; border: 1px solid var(--line); background: var(--ink-2); }
.build-panel .section-label { margin: 0 0 10px; }
.empty-build { margin: 0; color: var(--muted); }
.perk-strip { display: flex; flex-wrap: wrap; gap: 8px; }
.perk-strip > span { display: inline-flex; gap: 7px; align-items: center; padding: 8px 10px; border: 1px solid var(--line); background: var(--ink-3); font-size: .8rem; }
.perk-strip > span.is-core { border-color: var(--orange); background: rgba(255, 139, 74, .08); }
.perk-strip small { padding-left: 7px; border-left: 1px solid var(--line); color: var(--muted); font: 800 .55rem/1 var(--mono); }
.perk-strip b { color: var(--acid); }
.tag-summary { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.tag-summary span { color: var(--muted); font: 800 .62rem/1 var(--mono); }
.tag-summary b { margin-right: 4px; color: var(--orange); }
.clear-text { color: var(--acid); } .danger-text { color: var(--orange); }
.rival-preview { display: grid; grid-template-columns: 1.25fr repeat(2, 1fr); gap: 12px; align-items: stretch; margin-top: 18px; }
.rival-preview > div, .rival-preview article { padding: 16px; border: 1px solid var(--line); background: var(--ink-2); }
.rival-preview p, .rival-preview h3 { margin: 0; }
.rival-preview h3 { margin: 5px 0; }
.rival-preview > div > p:last-child { color: var(--muted); font-size: .8rem; }
.rival-preview article { display: flex; gap: 12px; align-items: center; }
.rival-preview article > b, .leader-badge { display: grid; width: 38px; height: 38px; flex: 0 0 auto; place-items: center; border: 1px solid var(--line); color: var(--acid); font: 900 1rem/1 var(--mono); }
.rival-preview article span { display: flex; min-width: 0; flex-direction: column; }
.rival-preview article strong { font: 800 .78rem/1.2 var(--mono); }
.rival-preview article small { margin-top: 6px; letter-spacing: .18em; }

.race-live { margin-top: 26px; padding: 28px; border: 1px solid var(--line); background: var(--ink-2); }
.race-live-head { display: flex; justify-content: space-between; gap: 20px; align-items: end; }
.race-live-head h2 { margin: 3px 0 0; font-size: clamp(2rem, 5vw, 4rem); }
.live-score { text-align: right; font-family: var(--mono); }
.live-score span, .live-score small { display: block; }
.live-score strong { color: var(--acid); font-size: 4rem; line-height: .9; }
.live-leaderboard { display: grid; gap: 6px; margin-top: 24px; }
.leader-row { display: grid; grid-template-columns: auto 1fr auto auto; gap: 12px; align-items: center; padding: 8px 12px; border: 1px solid var(--line); background: var(--ink-3); }
.leader-row.is-player { border-color: rgba(216, 255, 79, .55); }
.leader-row.is-player .leader-badge { background: var(--acid); color: var(--ink); }
.leader-row > strong { font: 800 .8rem/1 var(--mono); }
.leader-runner { font-size: 1.5rem; }
.leader-row > b { min-width: 2ch; color: var(--paper); font: 900 1.4rem/1 var(--mono); text-align: right; }
.relay-track { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 28px; border: 1px solid var(--line); }
.track-leg { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; min-height: 180px; padding: 18px; border-right: 1px solid var(--line); opacity: .4; }
.track-leg:last-child { border-right: 0; }
.track-leg.is-running, .track-leg.is-done { opacity: 1; }
.track-leg.is-running { background: rgba(216, 255, 79, .07); box-shadow: inset 0 -4px var(--acid); }
.track-terrain { display: flex; gap: 7px; font-size: .78rem; }
.track-animal { grid-column: 1 / -1; font-size: 4rem; transform: translateX(0); }
.track-leg.is-running .track-animal { animation: relay-dash 550ms ease-in-out infinite alternate; }
.track-leg > b { color: var(--acid); font: 900 .85rem/1.4 var(--mono); text-align: right; }
.race-skip { display: block; margin: 20px auto 0; }
.baton-call { display: grid; grid-template-columns: minmax(190px, .75fr) 1.4fr; gap: 18px; align-items: center; margin-top: 18px; padding: 20px; border: 1px solid var(--acid); background: rgba(216, 255, 79, .06); box-shadow: inset 0 -3px var(--acid); }
.baton-call h3, .baton-call p { margin: 0; }
.baton-call h3 { margin: 5px 0 7px; }
.baton-call > div:first-child > p:last-child { color: var(--muted); font-size: .78rem; }
.baton-call-options { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.baton-call-options button { display: flex; gap: 11px; min-height: 86px; padding: 13px; border: 1px solid var(--line); background: var(--ink-3); color: var(--paper); text-align: left; align-items: center; cursor: pointer; transition: border-color 140ms ease, transform 140ms ease; }
.baton-call-options button:hover { border-color: var(--acid); transform: translateY(-2px); }
.baton-call-options button:last-child:hover { border-color: var(--orange); }
.baton-call-options i { display: grid; width: 40px; height: 40px; flex: 0 0 auto; place-items: center; border: 1px solid var(--line); color: var(--acid); font: 900 1rem/1 var(--mono); font-style: normal; }
.baton-call-options button:last-child i { color: var(--orange); }
.baton-call-options strong, .baton-call-options small { display: block; font-family: var(--mono); }
.baton-call-options strong { font-size: .78rem; }
.baton-call-options small { margin-top: 6px; color: var(--muted); font-size: .62rem; line-height: 1.45; }
@keyframes relay-dash { to { transform: translateX(18px); } }

.recap-card, .end-card { max-width: 780px; margin: 46px auto 0; padding: clamp(28px, 6vw, 64px); border: 1px solid var(--line); background: var(--ink-2); text-align: center; }
.recap-card.is-clear { box-shadow: inset 0 5px var(--acid); }
.recap-card.is-fail { box-shadow: inset 0 5px var(--orange); }
.result-kicker { margin: 20px 0 2px; color: var(--acid); font: 900 .9rem/1 var(--mono); letter-spacing: .16em; }
.is-fail .result-kicker { color: var(--orange); }
.baton-call-result { display: inline-flex; gap: 7px; align-items: center; margin: 10px 0 0; padding: 7px 10px; border: 1px solid var(--line); color: var(--muted); font: 800 .66rem/1 var(--mono); }
.baton-call-result b { color: var(--acid); }
.recap-card h2 { margin: 0; font: 900 clamp(5rem, 16vw, 9rem)/.95 var(--mono); }
.recap-card h2 small { font-size: .24em; color: var(--muted); }
.result-parts, .end-stats { display: flex; justify-content: center; gap: 24px; margin: 28px 0; }
.result-parts span, .end-stats span { font: 700 .72rem/1.5 var(--mono); color: var(--muted); }
.result-parts b, .end-stats b { display: block; color: var(--paper); font-size: 1.35rem; }
.result-parts small { display: block; color: var(--acid); font-size: .64rem; }
.score-formula { display: flex; justify-content: center; align-items: center; gap: 18px; margin: 28px 0; }
.score-formula span { min-width: 110px; color: var(--muted); font: 700 .72rem/1.5 var(--mono); }
.score-formula b { display: block; color: var(--paper); font-size: 1.8rem; }
.score-formula small { display: block; color: var(--acid); font-size: .62rem; }
.score-formula i { color: var(--orange); font: 900 1.5rem/1 var(--mono); font-style: normal; }
.calculation-chain { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 22px auto; max-width: 720px; }
.calculation-chain > span { min-height: 70px; padding: 12px; border: 1px solid var(--line); background: var(--ink-3); opacity: .28; transform: translateY(4px); transition: opacity 180ms ease, transform 180ms ease, border-color 180ms ease; }
.calculation-chain > span.is-revealed, .calculation-chain > span.is-active { opacity: 1; transform: translateY(0); }
.calculation-chain > span.is-active { border-color: var(--acid); box-shadow: inset 0 -3px var(--acid); }
.calculation-chain small, .calculation-chain b { display: block; font-family: var(--mono); }
.calculation-chain small { color: var(--muted); font-size: .65rem; }
.calculation-chain b { margin-top: 8px; color: var(--paper); font-size: .86rem; }
.calculation-chain > span.is-active b { color: var(--acid); }
.calculation-chain em { display: block; margin-top: 5px; color: var(--orange); font: 700 .6rem/1.35 var(--mono); font-style: normal; }
.calculation-wait { color: var(--muted); font-family: var(--mono); }
.credit-earned strong { color: var(--acid); }
.podium-list { display: grid; gap: 6px; max-width: 460px; margin: 22px auto; }
.podium-list > span { display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); text-align: left; font: 800 .76rem/1 var(--mono); }
.podium-list > span.is-player { border-color: var(--acid); background: rgba(216, 255, 79, .06); }
.podium-list > span > b { color: var(--acid); font-size: 1.1rem; }
.podium-list > span > strong { font-size: 1.2rem; }
.recap-card > .primary-button, .end-card > .primary-button { margin-top: 18px; }
.recap-actions { display: flex; gap: 12px; justify-content: center; align-items: center; margin-top: 18px; }
.recap-actions .primary-button { margin: 0; }

.shop-head { display: flex; justify-content: space-between; gap: 24px; align-items: end; margin: 28px 0 18px; }
.shop-head h2 { margin: 4px 0; font-size: clamp(2rem, 5vw, 3.5rem); }
.shop-head p { margin: 0; }
.wallet { min-width: 140px; padding: 16px 20px; border: 1px solid var(--acid); background: rgba(216, 255, 79, .06); }
.wallet span { display: block; font: 700 .7rem/1 var(--mono); }
.wallet strong { color: var(--acid); font: 900 2.8rem/1 var(--mono); }
.shop-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.shop-grid-two { grid-template-columns: 1.45fr 1fr; }
.shop-card { display: flex; min-height: 390px; padding: 20px; border: 1px solid var(--line); background: var(--ink-2); flex-direction: column; }
.shop-card.is-bought { border-color: rgba(216, 255, 79, .45); }
.shop-type { font: 800 .68rem/1 var(--mono); letter-spacing: .12em; color: var(--muted); }
.shop-card > i { display: grid; width: 62px; height: 62px; margin: 26px 0 12px; place-items: center; border: 1px solid var(--line); color: var(--acid); font: 900 2rem/1 var(--mono); font-style: normal; }
.shop-card h3 { margin: 0; font-size: 1.4rem; }
.shop-card p { color: var(--muted); line-height: 1.6; }
.shop-card > .secondary-button, .target-row { margin-top: auto; }
.perk-choice-card { min-height: 390px; }
.perk-draft-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 18px; }
.perk-draft-title h3 { margin: 0; }
.reroll-button { padding: 9px 11px; border: 1px solid var(--orange); background: transparent; color: var(--orange); font: 800 .67rem/1 var(--mono); cursor: pointer; white-space: nowrap; }
.reroll-button:hover:not(:disabled) { background: var(--orange); color: var(--ink); }
.reroll-button:disabled { opacity: .4; cursor: default; }
.perk-options { display: grid; gap: 10px; margin-top: 18px; }
.perk-options > section { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 14px; border: 1px solid var(--line); background: var(--ink-3); }
.perk-options > section.is-core { border-color: var(--orange); background: rgba(255, 139, 74, .08); }
.perk-options i { display: grid; width: 44px; height: 44px; place-items: center; border: 1px solid var(--line); color: var(--acid); font: 900 .9rem/1 var(--mono); font-style: normal; }
.perk-options h4, .perk-options p { margin: 0; }
.perk-options h4 { font-size: 1rem; }
.perk-options p { margin-top: 4px; font-size: .78rem; line-height: 1.4; }
.perk-tag { color: var(--orange); font: 800 .58rem/1 var(--mono); letter-spacing: .08em; }
.perk-option-actions { display: grid; gap: 5px; min-width: 108px; }
.perk-options .secondary-button { min-width: 94px; padding: 10px 12px; }
.reserve-button { padding: 8px 9px; border: 1px solid var(--orange); background: transparent; color: var(--orange); font: 800 .6rem/1 var(--mono); cursor: pointer; }
.reserve-button:hover { background: var(--orange); color: var(--ink); }
.reservation-note { margin: 12px 0 0 !important; color: var(--orange) !important; font: 700 .65rem/1.4 var(--mono); }
.scout-card { min-width: 0; }
.scout-options { display: grid; gap: 10px; margin-top: 18px; }
.scout-options > section { display: grid; gap: 12px; padding: 14px; border: 1px solid var(--line); background: var(--ink-3); }
.scout-options > section > p { margin: 0; font-size: .75rem; line-height: 1.45; }
.scout-options > section > p b { color: var(--paper); }
.scout-animal { display: flex; gap: 12px; align-items: center; }
.scout-animal > i { display: grid; width: 48px; height: 48px; flex: 0 0 auto; place-items: center; border: 1px solid var(--line); color: var(--acid); font: 900 1.7rem/1 var(--mono); font-style: normal; }
.scout-animal h3 { margin: 3px 0 4px; font-size: 1rem; }
.scout-animal small { color: var(--muted); font: 700 .61rem/1 var(--mono); }
.scout-pack-tag { display: inline-block; padding: 3px 5px; border: 1px solid var(--line); color: var(--muted); font: 800 .54rem/1 var(--mono); }
.scout-pack-tag.is-pack { border-color: var(--acid); color: var(--acid); }
.target-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.target-row button { display: flex; min-height: 66px; padding: 7px 4px; border: 1px solid var(--line); background: var(--ink-3); flex-direction: column; align-items: center; justify-content: center; cursor: pointer; }
.target-row button:hover:not(:disabled) { border-color: var(--acid); }
.target-row button:disabled { opacity: .38; cursor: default; }
.target-row small { margin-top: 4px; font: 700 .62rem/1 var(--mono); }
.shop-price { display: block; margin-top: 10px; color: var(--acid); font: 800 .72rem/1 var(--mono); text-align: right; }
.shop-build { display: grid; grid-template-columns: 1fr 1.4fr; gap: 18px; margin-top: 18px; padding: 18px; border: 1px solid var(--line); }
.shop-build p { margin: 0; }
.shop-build .section-label { margin-bottom: 10px; }
.shop-actions { display: flex; align-items: center; justify-content: flex-end; gap: 20px; padding: 18px 0; }
.shop-actions.has-message { justify-content: space-between; }
.shop-actions p { margin: 0; color: var(--muted); }

.end-mark { margin: 16px auto; color: var(--acid); font: 900 5rem/1 var(--mono); }
.end-card h2 { margin: 0 0 12px; font-size: clamp(2rem, 5vw, 3.5rem); }

.leaderboard-card { max-width: 780px; margin: 26px auto 0; padding: 22px; border: 1px solid var(--line); background: var(--ink-2); text-align: left; }
.end-card .leaderboard-card { margin-top: 30px; background: var(--ink-3); }
.leaderboard-head { display: flex; justify-content: space-between; gap: 18px; align-items: end; }
.leaderboard-head h3, .leaderboard-head p { margin: 0; }
.leaderboard-head h3 { margin-top: 4px; font-size: 1.45rem; }
.leaderboard-list { padding: 0; margin: 18px 0 0; list-style: none; counter-reset: none; }
.leaderboard-list li { padding: 10px 12px; border-top: 1px solid var(--line); font-family: var(--mono); }
.leaderboard-list li:last-child { border-bottom: 1px solid var(--line); }
.leaderboard-rank-row { display: grid; grid-template-columns: 36px 1fr auto; gap: 12px; align-items: center; }
.leaderboard-rank-row > b { color: var(--acid); }
.leaderboard-rank-row > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.leaderboard-rank-row > strong { color: var(--paper); font-size: 1.15rem; }
.leaderboard-build { margin: 9px 0 0 48px; }
.leaderboard-build summary { display: grid; grid-template-columns: 26px auto auto 16px; gap: 9px; width: fit-content; align-items: center; color: var(--muted); cursor: pointer; list-style: none; }
.leaderboard-build summary::-webkit-details-marker { display: none; }
.leaderboard-build summary > b { display: grid; width: 24px; height: 24px; place-items: center; border: 1px solid var(--line); color: var(--orange); }
.leaderboard-build summary > small { font-size: .58rem; }
.leaderboard-build summary > i { color: var(--acid); font-style: normal; transition: transform 140ms ease; }
.leaderboard-build[open] summary > i { transform: rotate(180deg); }
.leaderboard-runners { display: flex; gap: 5px; }
.leaderboard-runners > span { display: flex; gap: 1px; align-items: end; color: var(--paper); font-size: 1rem; }
.leaderboard-runners small { color: var(--muted); font-size: .5rem; }
.leaderboard-build > div { display: grid; gap: 7px; margin-top: 10px; padding: 11px; border: 1px solid var(--line); background: var(--ink); }
.leaderboard-build > div p { display: grid; grid-template-columns: 58px 1fr; gap: 8px; margin: 0; font-size: .62rem; line-height: 1.5; }
.leaderboard-build > div p > strong { color: var(--acid); }
.leaderboard-build > div p > span, .leaderboard-build > div p > small { color: var(--muted); }
.leaderboard-empty { margin: 18px 0 0; padding: 18px; border: 1px dashed var(--line); color: var(--muted); text-align: center; }
.leaderboard-notice { margin: 14px 0 0; color: var(--orange); font: 700 .72rem/1.5 var(--mono); }
.leaderboard-notice.is-success, .leaderboard-registered { color: var(--acid); }
.leaderboard-card > .text-button { margin-top: 8px; }
.leaderboard-build-note { margin: 18px 0 -4px; color: var(--muted); font: 700 .65rem/1.5 var(--mono); }
.leaderboard-form { display: flex; gap: 10px; align-items: end; margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.leaderboard-form label { display: grid; flex: 1; gap: 7px; color: var(--muted); font: 700 .68rem/1 var(--mono); }
.leaderboard-form input { min-width: 0; padding: 12px 13px; border: 1px solid var(--line); background: var(--ink); color: var(--paper); font: 700 .9rem/1 var(--mono); }
.leaderboard-form input:focus { outline: 2px solid var(--acid); outline-offset: 2px; }
.leaderboard-registered { margin: 18px 0 0; font: 800 .76rem/1.4 var(--mono); }

@media (prefers-reduced-motion: reduce) { .track-leg.is-running .track-animal { animation: none; } .calculation-chain > span { transition: none; } }
@media (max-width: 760px) {
  .relay-status { gap: 12px; flex-wrap: wrap; }
  .relay-status .run-seed { display: none; }
  .relay-track, .shop-grid { grid-template-columns: 1fr; }
  .rival-preview { grid-template-columns: 1fr 1fr; }
  .rival-preview > div { grid-column: 1 / -1; }
  .track-leg { min-height: 120px; border-right: 0; border-bottom: 1px solid var(--line); }
  .shop-card { min-height: 330px; }
  .shop-head, .race-live-head { align-items: stretch; flex-direction: column; }
  .baton-call { grid-template-columns: 1fr; }
  .live-score { text-align: left; }
  .shop-build { grid-template-columns: 1fr; }
  .result-parts, .end-stats { gap: 12px; }
  .modifier-grid { grid-template-columns: repeat(2, 1fr); }
  .leaderboard-head { align-items: flex-start; flex-direction: column; }
}
@media (max-width: 520px) {
  .relay-status { justify-content: space-between; }
  .relay-status span { font-size: .64rem; }
  .result-parts, .end-stats { flex-direction: column; }
  .score-formula { flex-wrap: wrap; gap: 10px; }
  .score-formula span { min-width: 92px; }
  .calculation-chain { grid-template-columns: repeat(2, 1fr); }
  .perk-draft-title { align-items: stretch; flex-direction: column; }
  .shop-actions { align-items: stretch; flex-direction: column; }
  .rival-preview { grid-template-columns: 1fr; }
  .rival-preview > div { grid-column: auto; }
  .perk-options > section { grid-template-columns: auto 1fr; }
  .perk-option-actions { grid-column: 1 / -1; }
  .recap-actions { align-items: stretch; flex-direction: column; }
  .modifier-grid { grid-template-columns: 1fr; }
  .leaderboard-form { align-items: stretch; flex-direction: column; }
  .leaderboard-build { margin-left: 0; }
  .leaderboard-build summary { width: 100%; grid-template-columns: 26px 1fr auto 16px; }
  .leaderboard-build > div p { grid-template-columns: 1fr; gap: 3px; }
  .baton-call-options { grid-template-columns: 1fr; }
}
