
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800;900&display=swap');

:root {
  --lrav-red: #bd0000;
  --lrav-red-bright: #ed383e;
  --ink: #121212;
  --cream: #fff3d8;
}

* {
  box-sizing: border-box;
}

.dbr-plugin { width: 100%; padding: clamp(8px, 1.5vw, 24px); background: radial-gradient(ellipse at top, #29201d 0%, #111 60%); color: #fff; font-family: "Outfit", Arial, sans-serif; }

button {
  font: inherit;
}

.dbr-layout { width: min(1260px, 100%); margin-left: auto; margin-right: auto; display: flex; align-items: flex-start; justify-content: center; gap: 24px; }
.game-shell { width: min(1000px, calc(100% - 260px)); max-width: 1000px; flex: 0 1 1000px; min-width: 0; margin: 0; }
.dbr-leaderboard { flex: 0 0 236px; min-height: 345px; padding: 22px 18px; border: 1px solid rgba(237, 56, 62, .6); border-radius: 16px; background: #1f0301; box-shadow: none; color: #fff; }
.dbr-side-eyebrow { margin: 0 0 8px; color: #bd0000; font-size: 10px; font-weight: 800; letter-spacing: .19em; }
.dbr-leaderboard h2 { margin: 0 0 8px; font-size: 25px; line-height: 1.1; font-weight: 800; }
.dbr-side-description { margin: 0 0 24px; color: #c8b9cf; font-size: 12px; line-height: 1.5; }
.dbr-leaderboard-head, .dbr-score-row { display: grid; grid-template-columns: 36px minmax(0,1fr) auto; gap: 7px; align-items: center; }
.dbr-leaderboard-head { padding: 0 6px 10px; color: #ad91b3; font-size: 9px; font-weight: 800; letter-spacing: .12em; }
.dbr-leaderboard-list { list-style: none; padding: 0; margin: 0 0 14px; }
.dbr-score-row { padding: 12px 6px; border-top: 1px solid rgba(255,255,255,.1); font-size: 12px; font-weight: 700; }
.dbr-score-row span:first-child { color: #bd0000; } .dbr-score-row span:last-child { text-align: right; }
.dbr-empty-score { padding: 12px 6px; border-top: 1px solid rgba(255,255,255,.1); color: #c8b9cf; font-size: 12px; }
.dbr-top10-label { display: inline-block; padding: 6px 9px; border-radius: 4px; background: #ed383e; color: white; font-size: 10px; font-weight: 900; letter-spacing: .06em; }
.rotate-device-message { display: none; margin: 10px 0 0; color: #fff; font-weight: 900; font-size: 13px; letter-spacing: .08em; }
.name-entry-card { width: min(420px, 90%); padding: clamp(22px, 4vw, 38px); border: 1px solid #ed383e; border-radius: 16px; background: rgba(20,12,20,.97); box-shadow: 0 0 35px rgba(189,0,0,.28); text-align: center; }
.name-entry-card h2 { margin: 4px 0 10px; font-size: clamp(24px, 4vw, 38px); font-weight: 900; }
.name-entry-card p:not(.eyebrow) { color: #ddd; font-size: 14px; }
.name-entry-card label { display:block; margin: 20px 0 7px; text-align:left; font-size:11px; font-weight:800; letter-spacing:.12em; }
.name-entry-card input { width:100%; min-height:46px; padding:12px 14px; border:1px solid #8e657f; border-radius:6px; background:#100d18; color:#fff; font:inherit; outline-color:#ed383e; }
.name-entry-card .primary-button { margin-top:16px; }

.game-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  min-height: 360px;
  overflow: hidden;
  isolation: isolate;
  background: #201512;
  border: 1px solid rgba(237, 56, 62, .6);
  border-radius: clamp(8px, 1.3vw, 18px);
  box-shadow: none;
  user-select: none;
  -webkit-user-select: none;
}

.stage-scene {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.scene-background {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  pointer-events: none;
}

.stage-vignette {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  background: linear-gradient(
    180deg,
    rgba(0, 0, 0, .26) 0%,
    transparent 22%,
    transparent 68%,
    rgba(0, 0, 0, .24) 100%
  );
}

/* =========================================================
   BULL AND RIDER
   ========================================================= */

.bull-wrap {
  position: absolute;
  z-index: 3;
  width: 27.5%;
  left: 50%;
  bottom: 1.2%;
  transform: translateX(-50%);
  transform-origin: 50% 76%;
  will-change: transform;
}

.bull-sprite {
  display: block;
  width: 100%;
  height: auto;
  pointer-events: none;

  /* Prevent transparent fade when switching sprite images. */
  opacity: 1 !important;
  transition: none !important;
  animation: none;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.bull-sprite-secondary {
  display: none !important;
}

.bull-sprite-primary {
  position: relative;
  z-index: 1;
}

.rider-wrap {
  position: absolute;
  z-index: 4;
  width: 22%;
  left: 45%;
  bottom: 22%;
  transform: translateX(-5%) rotate(5deg);
  transform-origin: 54% 84%;
  will-change: transform, left, bottom;
}


.rider-sprite {
  display: block;
  width: 100%;
  height: auto;
  pointer-events: none;

  /* Default / center position */
  clip-path: polygon(
    0 0,
    100% 0,
    80% 50%,
    55% 70%,
    50% 100%,
    0 100%
  );

  /* Avoid clipping animation or transitions causing visual flicker */
  transition: none;
}


.falling-sprite {
  position: absolute;
  z-index: 5;
  width: 22%;
  left: 45%;
  bottom: 22%;
  transform: translateX(-10%) rotate(0deg);
  transform-origin: 54% 84%;
  will-change: transform, left, bottom;
}

/* =========================================================
   BUCKING CHALLENGE EFFECTS
   ========================================================= */

.game-stage.bucking-warning {
  animation: bucking-stage-flash .55s ease-in-out infinite alternate;
}

.game-stage.bucking-warning .stage-vignette {
  background: linear-gradient(
    180deg,
    rgba(189, 0, 0, .25),
    transparent 30%,
    transparent 65%,
    rgba(189, 0, 0, .32)
  );
  animation: bucking-vignette-flash .55s ease-in-out infinite alternate;
}

.bucking-banner {
  position: absolute;
  z-index: 14;
  top: 28%;
  left: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  width: max-content;
  max-width: 88%;
  padding: 10px 22px 12px;
  border: 2px solid #fff3d8;
  border-radius: 9px;
  background: rgba(115, 0, 0, .94);
  box-shadow:
    0 0 18px rgba(237, 56, 62, .8),
    0 6px 22px rgba(0, 0, 0, .55);
  color: #fff;
  text-align: center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translate(-50%, -8px) scale(.92);
}

.bucking-banner.bucking-banner-visible {
  visibility: visible;
  animation:
    bucking-banner-enter .25s ease-out forwards,
    bucking-banner-pulse .55s ease-in-out .25s infinite alternate;
}

.bucking-banner-small {
  color: #ffd7a3;
  font-size: clamp(9px, 1.1vw, 14px);
  font-weight: 900;
  letter-spacing: .3em;
}

.bucking-banner-main {
  color: #fff;
  font-size: clamp(25px, 4.5vw, 58px);
  font-weight: 900;
  font-style: italic;
  line-height: .98;
  letter-spacing: -.035em;
  text-shadow: 0 3px 0 #710000, 0 0 12px rgba(255, 255, 255, .3);
}

.bucking-banner-sub {
  color: #fff3d8;
  font-size: clamp(9px, 1.4vw, 17px);
  font-weight: 800;
  letter-spacing: .17em;
}

@keyframes bucking-stage-flash {
  from {
    box-shadow:
      0 24px 80px rgba(0, 0, 0, .55),
      inset 0 0 0 0 rgba(189, 0, 0, 0);
  }

  to {
    box-shadow:
      0 24px 80px rgba(0, 0, 0, .55),
      inset 0 0 0 4px rgba(237, 56, 62, .7),
      0 0 28px rgba(189, 0, 0, .45);
  }
}

@keyframes bucking-vignette-flash {
  from { opacity: .65; }
  to { opacity: 1; }
}

@keyframes bucking-banner-enter {
  from {
    opacity: 0;
    transform: translate(-50%, -8px) scale(.92);
  }

  to {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
  }
}

@keyframes bucking-banner-pulse {
  from { filter: brightness(1); }
  to { filter: brightness(1.18); }
}

/* =========================================================
   HEADS-UP DISPLAY
   ========================================================= */

.hud {
  position: absolute;
  inset: 2.8% 3% auto;
  z-index: 10;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 2%;
  pointer-events: none;
}

.timer-hud {
  position: relative;
  width: 21%;
  min-width: 120px;
  max-width: 290px;
}

.timer-hud > img {
  display: block;
  width: 100%;
  height: auto;
}

.timer-value {
  position: absolute;
  inset: 0 5% 0 22%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8%;
  color: var(--cream);
  text-shadow: 0 2px 3px #000;
}

.timer-value span {
  font-size: clamp(13px, 1.55vw, 23px);
  line-height: 1;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.timer-value small {
  font-size: clamp(7px, .7vw, 10px);
  font-weight: 800;
  letter-spacing: .13em;
}

.balance-hud {
  position: absolute;
  left: 50%;
  top: 0;
  transform: translateX(-50%);
  width: 35%;
  max-width: 500px;
  min-width: 180px;
}

.balance-hud > img {
  position: relative;
  z-index: 2;
  display: block;
  width: 100%;
  height: auto;
  pointer-events: none;
}

.balance-track {
  position: absolute;
  z-index: 3;
  left: 11.5%;
  right: 11.5%;
  top: 31%;
  height: 37%;
  overflow: hidden;
  border-radius: 30px;
  background: rgba(8, 8, 8, .95);
}

.balance-fill {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 0;
  border-radius: 30px;
  transition: none;
}

.balance-center {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 3px;
  transform: translateX(-50%);
  background: #fff3d8;
  box-shadow: 0 0 8px #fff;
}

.balance-label {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 2px);
  text-align: center;
  color: #fff;
  font-size: clamp(7px, .72vw, 10px);
  letter-spacing: .2em;
  font-weight: 800;
  text-shadow: 0 2px 4px #000;
}

.icon-button {
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  pointer-events: auto;
  width: clamp(36px, 5.5vw, 70px);
  flex: 0 0 auto;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, .45));
}

.icon-button img {
  display: block;
  width: 100%;
  height: auto;
}

.icon-button:hover {
  transform: scale(1.06);
}

.icon-button:focus-visible,
button:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 4px;
}

.status-pill {
  position: absolute;
  z-index: 8;
  top: 17%;
  left: 50%;
  transform: translateX(-50%);
  padding: .5em 1.1em;
  border: 1px solid rgba(255, 255, 255, .28);
  border-radius: 999px;
  background: rgba(15, 12, 11, .62);
  color: #fff2d5;
  font-size: clamp(8px, 1vw, 13px);
  font-weight: 800;
  letter-spacing: .18em;
  white-space: nowrap;
  text-shadow: 0 2px 5px #000;
}

/* =========================================================
   TOUCH CONTROLS
   ========================================================= */

.touch-controls {
  position: absolute;
  z-index: 12;
  left: 4%;
  right: 4%;
  bottom: 3%;
  display: none;
  justify-content: space-between;
  gap: 12px;
}

.control-button {
  min-height: 46px;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 1px solid rgba(255, 255, 255, .3);
  border-radius: 9px;
  background: rgba(14, 12, 12, .78);
  color: white;
  font-size: 17px;
  font-weight: 800;
  touch-action: none;
}

.control-button span {
  font-size: 10px;
  letter-spacing: .1em;
}

/* =========================================================
   OVERLAYS
   ========================================================= */

.screen-overlay {
  position: absolute;
  z-index: 20;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3%;
  background: rgba(8, 6, 6, .56);
  backdrop-filter: blur(3px);
}

.hidden {
  display: none !important;
}

.intro-card,
.message-card {
  width: min(580px, 90%);
  padding: clamp(20px, 4vw, 46px);
  text-align: center;
  border: 1px solid rgba(237, 56, 62, .7);
  border-radius: 16px;
  background: linear-gradient(
    145deg,
    rgba(29, 23, 20, .96),
    rgba(10, 10, 10, .97)
  );
  box-shadow:
    0 18px 60px rgba(0, 0, 0, .5),
    inset 0 0 35px rgba(189, 0, 0, .08);
}

.eyebrow {
  margin: 0 0 8px;
  color: #ff6b6b;
  font-size: clamp(9px, 1vw, 12px);
  font-weight: 800;
  letter-spacing: .26em;
}

h1,
h2 {
  margin: 0;
  color: #fff4dd;
  font-weight: 900;
  line-height: .98;
  letter-spacing: -.035em;
}

h1 {
  font-size: clamp(30px, 5.4vw, 72px);
}

h1 span {
  display: block;
  color: var(--lrav-red-bright);
}

h2 {
  font-size: clamp(26px, 4vw, 52px);
}

.intro-copy,
.message-card > p:not(.eyebrow) {
  margin: 15px auto 18px;
  max-width: 400px;
  color: #e6d9c9;
  font-size: clamp(12px, 1.4vw, 17px);
  line-height: 1.5;
}

.counterbalance-instruction {
  max-width: 430px;
  margin: 0 auto 18px;
  padding: 12px 15px;
  border: 1px solid rgba(237, 56, 62, .35);
  border-left: 3px solid var(--lrav-red-bright);
  border-radius: 7px;
  background: rgba(189, 0, 0, .10);
  color: #fff3d8;
  font-size: clamp(11px, 1.15vw, 14px);
  font-weight: 600;
  line-height: 1.5;
  text-align: left;
}

.instruction-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin: 18px 0 22px;
}

.keycap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 5px;
  border: 1px solid #77645a;
  background: #211c19;
  color: #fff;
  font-weight: 800;
}

.instruction-text {
  margin-left: 6px;
  max-width: 230px;
  color: #c8b8a8;
  text-align: left;
  font-size: clamp(10px, 1.05vw, 13px);
  line-height: 1.35;
}

.primary-button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  min-height: 48px;
  padding: 0 25px;
  border: 1px solid #ff6565;
  border-radius: 7px;
  background: linear-gradient(180deg, #e5252b, #a90000);
  color: #fff;
  font-weight: 900;
  letter-spacing: .1em;
  font-size: 13px;
  cursor: pointer;
  box-shadow: 0 5px 0 #650000, 0 10px 24px rgba(189, 0, 0, .25);
  transition: transform .12s ease, filter .12s ease;
}

.primary-button:hover {
  filter: brightness(1.13);
  transform: translateY(-2px);
}

.primary-button:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #650000;
}

#startOverlay .best-line {
  display: none !important;
}

.best-line {
  margin: 22px 0 0;
  color: #9e9185;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .18em;
}

.best-line strong {
  margin-left: 8px;
  color: #fff1d4;
}

/* =========================================================
   GAME OVER
   ========================================================= */

.gameover-card {
  width: min(570px, 88%);
  text-align: center;
}

.gameover-card > img {
  display: block;
  width: 100%;
  max-height: 36vh;
  object-fit: contain;
  cursor: pointer;
  filter: drop-shadow(0 10px 20px rgba(0, 0, 0, .45));
}

.gameover-stats {
  display: flex;
  justify-content: center;
  gap: clamp(16px, 4vw, 45px);
  margin: 8px 0 16px;
}

.gameover-stats p {
  margin: 0;
  color: #d7c6b2;
  font-size: clamp(9px, 1vw, 12px);
  letter-spacing: .12em;
}

.gameover-stats strong {
  display: block;
  margin-top: 4px;
  color: white;
  font-size: clamp(18px, 2.2vw, 28px);
  letter-spacing: 0;
}

.replay-button {
  min-height: 42px;
}

/* =========================================================
   COUNTDOWN
   ========================================================= */

.countdown {
  position: absolute;
  z-index: 16;
  inset: 0;
  display: grid;
  place-items: center;
  color: white;
  font-size: clamp(70px, 15vw, 190px);
  font-weight: 900;
  font-style: italic;
  text-shadow: 0 5px 30px #bd0000;
  pointer-events: none;
}

.game-footnote {
  margin: 13px 4px 0;
  color: #81766d;
  text-align: right;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .15em;
}

.game-footnote span {
  color: var(--lrav-red-bright);
  margin: 0 6px;
}

.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;
}

/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 760px) {
  .dbr-plugin {
    padding: 8px;
  }

  .game-stage {
    min-height: 0;
    border-radius: 8px;
  }

  .hud {
    inset: 2.5% 2.5% auto;
  }

  .timer-hud {
    width: 29%;
    min-width: 0;
  }

  .timer-value {
    inset-inline: 21% 4%;
    gap: 4%;
  }

  .timer-value span {
    font-size: clamp(10px, 2.2vw, 16px);
  }

  .timer-value small {
    font-size: clamp(5px, 1.25vw, 8px);
  }

  .balance-hud {
    width: 40%;
    min-width: 0;
  }

  .balance-label {
    font-size: 5px;
    letter-spacing: .12em;
  }

  .icon-button {
    width: clamp(27px, 7vw, 42px);
  }

  .status-pill {
    top: 16%;
    font-size: clamp(6px, 1.5vw, 9px);
    letter-spacing: .12em;
  }

  .bull-wrap {
    width: 39%;
    bottom: 0;
  }

  .rider-wrap {
    width: 29%;
    bottom: 25%;
  }

  .falling-sprite {
    width: 29%;
  }

  .bucking-banner {
    top: 30%;
    padding: 7px 13px 9px;
    border-width: 1px;
  }

  .bucking-banner-small {
    font-size: clamp(7px, 1.7vw, 10px);
  }

  .bucking-banner-main {
    font-size: clamp(23px, 7vw, 38px);
  }

  .bucking-banner-sub {
    font-size: clamp(7px, 1.8vw, 11px);
    letter-spacing: .12em;
  }

  .touch-controls {
    display: flex;
    bottom: 2%;
  }

  .control-button {
    min-height: clamp(30px, 7vw, 42px);
    font-size: clamp(12px, 3vw, 16px);
  }

  .control-button span {
    font-size: clamp(7px, 1.6vw, 9px);
  }

  .intro-card,
  .message-card {
    width: 94%;
    padding: clamp(12px, 3vw, 22px);
    border-radius: 10px;
  }

  .eyebrow {
    margin-bottom: 5px;
    font-size: clamp(7px, 1.5vw, 10px);
  }

  h1 {
    font-size: clamp(23px, 6.5vw, 42px);
  }

  h2 {
    font-size: clamp(22px, 5.5vw, 36px);
  }

  .intro-copy,
  .message-card > p:not(.eyebrow) {
    margin: 8px auto;
    font-size: clamp(9px, 2vw, 12px);
  }

  .counterbalance-instruction {
    margin: 8px auto 10px;
    padding: 8px 10px;
    font-size: clamp(9px, 2vw, 12px);
    line-height: 1.4;
  }

  .instruction-row {
    margin: 8px 0 12px;
  }

  .keycap {
    width: 22px;
    height: 22px;
    font-size: 12px;
  }

  .instruction-text {
    font-size: clamp(8px, 1.7vw, 10px);
  }

  .primary-button {
    min-height: 34px;
    padding: 0 15px;
    gap: 10px;
    font-size: clamp(9px, 2vw, 11px);
  }

  .best-line {
    margin-top: 12px;
    font-size: 7px;
  }

  .gameover-card {
    width: 94%;
  }

  .gameover-card > img {
    max-height: 27vh;
  }

  .gameover-stats {
    margin: 2px 0 8px;
  }

  .gameover-stats p {
    font-size: 7px;
  }

  .gameover-stats strong {
    font-size: 16px;
  }

  .replay-button {
    min-height: 30px;
  }

  .game-footnote {
    margin-top: 8px;
    font-size: 7px;
  }
}

@media (max-width: 420px) {
  .instruction-row {
    gap: 4px;
  }

  .instruction-text {
    max-width: 155px;
  }

  .touch-controls {
    left: 2%;
    right: 2%;
    gap: 6px;
  }

  .control-button {
    gap: 4px;
  }
}

/* =========================================================
   REDUCED MOTION
   ========================================================= */

@media (prefers-reduced-motion: reduce) {
  .game-stage.bucking-warning,
  .game-stage.bucking-warning .stage-vignette,
  .bucking-banner.bucking-banner-visible {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }

  .primary-button,
  .icon-button {
    transition-duration: .01ms !important;
  }
}

@media (max-width: 1023px) { .dbr-layout { width: min(1000px, 100%); flex-direction: column; align-items: center; gap: 20px; } .game-shell { width: 100%; max-width: 1000px; flex: 0 0 auto; align-self: center; } .dbr-leaderboard { width: 100%; max-width: 1000px; flex: 0 0 auto; min-height: 0; } }
@media (max-width: 766px) { .rotate-device-message { display: block; } .dbr-plugin { padding: 8px; } .dbr-layout { gap: 20px; } }
