:root {
  --focus-red: #ff3d4d;
  --focus-yellow: #ffd82f;
  --focus-blue: #1397ff;
  --focus-ink: #071323;
}

.focus-stage {
  isolation: isolate;
  height: min(38vh, 410px);
  min-height: 330px;
  border-top: 6px solid var(--focus-red);
  border-bottom: 6px solid #fff;
  background:
    linear-gradient(90deg, rgba(5, 14, 29, .82), rgba(5, 14, 29, .08) 28%, rgba(5, 14, 29, .05) 72%, rgba(5, 14, 29, .8)),
    url("assets/arcade-kart-circuit.png") center 62% / cover no-repeat;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .34);
}

.focus-stage::before {
  z-index: -1;
  background:
    linear-gradient(90deg, var(--focus-red) 0 25%, var(--focus-yellow) 25% 50%, var(--focus-blue) 50% 75%, #3dd36e 75%) top / 100% 6px no-repeat,
    linear-gradient(180deg, rgba(3, 11, 24, .18), transparent 45%, rgba(3, 11, 24, .4));
}

.focus-header {
  z-index: 35;
  width: 21%;
  height: 100%;
  align-items: flex-start;
  padding: 5.2vh 2.5vw;
  background: linear-gradient(90deg, rgba(4, 13, 28, .74), transparent);
  pointer-events: none;
}

.focus-header .eyebrow { font-size: clamp(11px, .85vw, 17px); }
.focus-header h1 { font-size: clamp(42px, 3.5vw, 70px); }

.focus-stage .sign-dock {
  z-index: 25;
  left: 51%;
  top: 4%;
  gap: 8px;
  transition: opacity .28s, filter .28s, transform .38s;
}

.focus-stage .sign-dock::before { top: auto; bottom: -26px; font-size: 10px; }
.focus-stage .sign-card { width: clamp(145px, 12vw, 230px); border-width: 3px; border-radius: 12px; }
.focus-stage.event-active .sign-dock { opacity: .12; filter: blur(3px); transform: translateX(-50%) translateY(-18px) scale(.94); }

.drift-spotlight {
  position: absolute;
  z-index: 42;
  left: 48%;
  top: 50%;
  width: min(310px, 82vh);
  aspect-ratio: 1;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(.8) rotate(-3deg);
  transition: opacity .25s, transform .48s cubic-bezier(.18, .86, .2, 1.15);
}

.focus-stage.event-active .drift-spotlight {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1) rotate(0);
}

.drift-square {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border: 6px solid #fff;
  border-radius: 26px;
  background:
    radial-gradient(circle at 72% 26%, rgba(255, 255, 255, .24), transparent 25%),
    linear-gradient(#21a8fb 0 46%, #70cf4f 46% 55%, #262d37 55%);
  box-shadow: 0 0 0 6px var(--driver-color, var(--focus-yellow)), 0 16px 0 rgba(4, 12, 24, .55), 0 25px 48px rgba(0, 0, 0, .4);
}

.drift-square::before {
  content: "DRIFT CAM";
  position: absolute;
  z-index: 12;
  left: 12px;
  top: 10px;
  padding: 4px 8px;
  border-radius: 4px;
  color: #fff;
  background: var(--focus-red);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .13em;
}

.drift-square::after {
  content: "";
  position: absolute;
  z-index: 3;
  left: -10%;
  right: -10%;
  bottom: 21%;
  height: 5px;
  opacity: .55;
  background: repeating-linear-gradient(90deg, #fff 0 25px, transparent 25px 48px);
  transform: rotate(-4deg);
}

.drift-speed-lines {
  position: absolute;
  z-index: 2;
  inset: 0;
  opacity: 0;
  background: repeating-linear-gradient(168deg, transparent 0 24px, rgba(255, 255, 255, .31) 25px 28px, transparent 29px 56px);
}

.event-active .drift-speed-lines { animation: drift-lines .32s linear infinite; opacity: .52; }

.drift-kart {
  position: absolute;
  z-index: 8;
  left: 50%;
  top: 51%;
  width: 72%;
  height: 72%;
  transform: translate(-50%, -50%);
  transform-origin: 50% 82%;
}

.drift-kart img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 16px 7px rgba(0, 0, 0, .5)) drop-shadow(0 0 5px #fff);
}

.drift-kart::before {
  content: "";
  position: absolute;
  z-index: -1;
  left: -19%;
  top: 50%;
  width: 42%;
  aspect-ratio: 2 / 1;
  opacity: .58;
  background: url("assets/kart-vfx-gpt-image-2.png") 0 0 / 400% 200% no-repeat;
  transform: translateY(-50%) scaleX(-1);
  animation: drift-turbo-loop .68s ease-in-out infinite alternate;
}

.drift-kart::after {
  content: "";
  position: absolute;
  z-index: -1;
  left: 18%;
  right: 9%;
  bottom: 6%;
  height: 13%;
  border-radius: 50%;
  background: rgba(0, 0, 0, .45);
  filter: blur(6px);
}

.event-active .drift-kart { animation: banana-drift 2.35s cubic-bezier(.18, .72, .2, 1) both; }

@keyframes drift-turbo-loop {
  from { opacity: .35; transform: translate(18px, -50%) scale(.72) scaleX(-1); }
  to { opacity: .9; transform: translate(-8px, -50%) scale(1.08) scaleX(-1); }
}

.drift-track-mark {
  position: absolute;
  z-index: 4;
  left: 13%;
  bottom: 22%;
  width: 67%;
  height: 5px;
  opacity: 0;
  border-radius: 50%;
  background: #111821;
  transform: rotate(-13deg);
  filter: blur(1px);
}

.mark-two { left: 19%; bottom: 16%; transform: rotate(-8deg); }
.event-active .drift-track-mark { animation: skid-mark 2.2s .45s ease-out both; }
.event-active .mark-two { animation-delay: .6s; }

.drift-smoke { position: absolute; z-index: 7; left: 18%; bottom: 18%; }
.drift-smoke i {
  position: absolute;
  width: 34px;
  height: 34px;
  opacity: 0;
  border-radius: 50%;
  background: rgba(240, 247, 255, .9);
  filter: blur(2px);
}

.event-active .drift-smoke i { animation: smoke-pop 1.15s .5s ease-out both; }
.event-active .drift-smoke i:nth-child(2) { animation-delay: .62s; --smoke-x: -42px; --smoke-y: -28px; }
.event-active .drift-smoke i:nth-child(3) { animation-delay: .74s; --smoke-x: 22px; --smoke-y: -50px; }
.event-active .drift-smoke i:nth-child(4) { animation-delay: .86s; --smoke-x: -60px; --smoke-y: -62px; }
.event-active .drift-smoke i:nth-child(5) { animation-delay: .98s; --smoke-x: 45px; --smoke-y: -78px; }

.yes-burst {
  position: absolute;
  z-index: 20;
  right: 5%;
  top: 15%;
  display: grid;
  opacity: 0;
  color: #fff;
  text-align: right;
  transform: scale(.2) rotate(-15deg);
}

.yes-burst small { color: var(--focus-yellow); font-size: 9px; font-weight: 900; letter-spacing: .12em; text-shadow: 0 2px 2px #000; }
.yes-burst strong { font: italic clamp(43px, 4.1vw, 76px)/.85 "Jua", sans-serif; text-shadow: 4px 4px 0 var(--focus-red), 7px 7px 0 #111c30, 0 0 17px #fff; }
.event-active .yes-burst { animation: yes-pop 2.15s .88s cubic-bezier(.17, 1.1, .25, 1) both; }

.drift-driver-card {
  position: absolute;
  z-index: 15;
  right: 10px;
  bottom: 9px;
  left: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 10px;
  color: #fff;
  background: linear-gradient(90deg, rgba(5, 14, 29, .95), rgba(14, 35, 63, .83));
  border-left: 5px solid var(--driver-color, var(--focus-yellow));
  font-weight: 900;
  transform: skewX(-5deg);
}

.drift-driver-card b { overflow: hidden; font: 18px/1 "Jua", sans-serif; text-overflow: ellipsis; white-space: nowrap; }
.drift-driver-card span { color: var(--focus-yellow); font-size: 11px; white-space: nowrap; }

.focus-standings {
  position: absolute;
  z-index: 36;
  top: 5%;
  right: 1.5%;
  bottom: 5%;
  width: min(315px, 17vw);
  overflow: hidden;
  border: 3px solid rgba(255, 255, 255, .58);
  border-radius: 15px;
  color: #fff;
  background: linear-gradient(155deg, rgba(6, 15, 29, .95), rgba(15, 31, 53, .9));
  box-shadow: 0 12px 30px rgba(0, 0, 0, .4);
  backdrop-filter: blur(8px);
}

.focus-standings header {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 11px;
  border-bottom: 1px solid rgba(255, 255, 255, .15);
}

.focus-standings header > span { padding: 4px 6px; border-radius: 4px; background: var(--focus-red); font-size: 9px; font-weight: 900; }
.focus-standings header div { display: grid; }
.focus-standings header small { color: #93a6bf; font-size: 8px; font-weight: 800; letter-spacing: .12em; }
.focus-standings header strong { font: 22px/1 "Jua", sans-serif; }
.focus-standings ol { display: grid; gap: 5px; margin: 0; padding: 8px; list-style: none; }
.focus-rank-row { display: grid; grid-template-columns: 28px 38px minmax(0, 1fr) auto; align-items: center; gap: 7px; min-height: 57px; padding: 6px 7px; border: 1px solid rgba(255, 255, 255, .12); border-radius: 9px; background: rgba(255, 255, 255, .06); }
.focus-rank-row:first-child { border-color: rgba(255, 216, 47, .55); background: linear-gradient(90deg, rgba(255, 216, 47, .17), rgba(255,255,255,.05)); }
.focus-rank-row.just-moved { animation: rank-flash .8s ease-out; }
.focus-rank-number { font: 22px/1 "Jua", sans-serif; text-align: center; }
.focus-rank-row img { width: 38px; height: 38px; object-fit: contain; border-radius: 8px; background: linear-gradient(#52c9ff 0 57%, #63c858 58%); }
.focus-rank-copy { min-width: 0; display: grid; }
.focus-rank-copy b { overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.focus-rank-copy small { color: #91a5bf; font-size: 8px; }
.focus-rank-progress { color: var(--rank-color, var(--focus-yellow)); font-size: 11px; font-weight: 900; }

.focus-event-copy {
  position: absolute;
  z-index: 38;
  left: 64%;
  top: 50%;
  display: grid;
  width: min(330px, 19vw);
  opacity: 0;
  color: #fff;
  text-shadow: 0 3px 6px rgba(0, 0, 0, .7);
  transform: translateY(-50%) translateX(30px);
}

.focus-event-copy small { color: var(--focus-yellow); font-size: 10px; font-weight: 900; letter-spacing: .18em; }
.focus-event-copy strong { font: italic clamp(27px, 2.2vw, 43px)/1 "Jua", sans-serif; }
.focus-event-copy span { margin-top: 5px; color: #e0e9f5; font-size: 12px; font-weight: 700; }
.focus-stage.event-active .focus-event-copy { animation: event-copy-in 5.7s .2s ease both; }
.focus-stage.combo-active .drift-square { box-shadow: 0 0 0 6px #b873ff, 0 0 32px #b873ff, 0 16px 0 rgba(4, 12, 24, .55), 0 25px 48px rgba(0, 0, 0, .4); }

.focus-stage .move-toast { display: none; }

/* `/drift` is an OBS widget: keep the 1920x1080 canvas transparent and only
   draw the action camera beside the standings panel. */
.drift-page .drift-stage {
  width: 100vw;
  height: 100vh;
  min-height: 0;
  overflow: visible;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.drift-page .drift-stage::before,
.drift-page .focus-header,
.drift-page .focus-event-copy {
  display: none;
}

.drift-page .sign-dock {
  left: auto;
  right: 24px;
  top: 24px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  width: 686px;
  gap: 8px;
  transform: none;
}

.drift-page .sign-dock::before {
  content: "ROUND " attr(data-round);
  left: -8px;
  top: -12px;
  bottom: auto;
  display: block;
  z-index: 40;
  padding: 3px 8px;
  border: 2px solid #fff;
  font-size: 9px;
  transform: none;
}

.drift-page .sign-card {
  width: 100%;
  height: 96px;
  border-width: 3px;
  border-radius: 11px;
  animation: none;
}

.drift-page .sign-card-info {
  gap: 5px;
  padding: 17px 7px 6px;
}

.drift-page .sign-card-info b { font-size: 17px; }
.drift-page .sign-card-info span { font-size: 10px; }

.drift-page .sign-card.round-claimed {
  border-color: #7f8da0;
  filter: grayscale(.72) brightness(.58);
}

.drift-page .sign-card.round-claimed .get-stamp {
  opacity: 1;
  background: rgba(7, 15, 28, .82);
  transform: scale(1) rotate(-3deg);
}

.drift-page .sign-card.round-claimed .get-stamp b { font-size: 29px; }
.drift-page .sign-card.round-claimed .get-stamp span { font-size: 14px; }

.drift-page .drift-stage.event-active .sign-dock {
  opacity: 1;
  filter: none;
  transform: none;
}

.drift-page .sign-dock::after {
  content: "ROUND CLEAR!";
  position: absolute;
  z-index: 30;
  inset: -6px;
  display: grid;
  place-items: center;
  opacity: 0;
  pointer-events: none;
  border: 4px solid #fff;
  border-radius: 15px;
  color: #fff;
  background: linear-gradient(115deg, rgba(255, 61, 77, .96), rgba(255, 139, 32, .96));
  box-shadow: 0 0 0 5px var(--focus-yellow), 0 12px 28px rgba(0, 0, 0, .45);
  font: italic 38px/1 "Jua", sans-serif;
  text-shadow: 3px 3px 0 #7d1c28;
  transform: scale(.7) rotate(-2deg);
  transition: opacity .25s, transform .4s cubic-bezier(.18, .86, .2, 1.15);
}

.drift-page .drift-stage.round-complete:not(.event-active) .sign-dock::after {
  opacity: 1;
  transform: scale(1) rotate(0);
  animation: round-clear-pulse 1.1s ease-in-out infinite alternate;
}

.drift-page .drift-spotlight {
  left: auto;
  right: 370px;
  top: 142px;
  width: 340px;
  opacity: 0;
  transform: translateX(28px) scale(.9) rotate(-2deg);
}

.drift-page .drift-stage.event-active .drift-spotlight {
  opacity: 1;
  transform: translateX(0) scale(1) rotate(0);
}

.drift-claim-queue {
  display: none;
}

.drift-page .drift-claim-queue {
  position: absolute;
  z-index: 44;
  top: 494px;
  right: 370px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: 340px;
  gap: 7px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px);
  transition: opacity .2s, transform .28s;
}

.drift-page .drift-claim-queue.show {
  opacity: 1;
  transform: translateY(0);
}

.drift-queue-card {
  position: relative;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  min-width: 0;
  height: 58px;
  padding: 6px 8px;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, .72);
  border-radius: 10px;
  color: #fff;
  background: linear-gradient(145deg, rgba(8, 19, 36, .97), rgba(24, 47, 76, .94));
  box-shadow: 0 7px 16px rgba(0, 0, 0, .35);
  animation: queue-card-in .32s calc(var(--queue-index) * .08s) cubic-bezier(.18, .86, .2, 1.15) both;
}

.drift-queue-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--focus-red);
}

.drift-queue-card img {
  width: 38px;
  height: 38px;
  object-fit: contain;
  border-radius: 7px;
  background: linear-gradient(#52c9ff 0 57%, #63c858 58%);
}

.drift-queue-card span { min-width: 0; display: grid; }
.drift-queue-card small { color: var(--focus-yellow); font-size: 7px; font-weight: 900; letter-spacing: .08em; }
.drift-queue-card b { overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.drift-queue-card strong { grid-column: 1 / -1; position: absolute; right: 7px; bottom: 4px; color: #a9c8e8; font-size: 8px; }

.drift-queue-extra {
  position: absolute;
  right: -10px;
  top: -10px;
  display: grid;
  place-items: center;
  min-width: 30px;
  height: 30px;
  padding: 0 6px;
  border: 2px solid #fff;
  border-radius: 999px;
  color: #fff;
  background: var(--focus-red);
  box-shadow: 0 4px 10px rgba(0, 0, 0, .35);
  font-size: 11px;
  font-weight: 900;
}

.drift-page .focus-standings {
  top: 142px;
  right: 24px;
  bottom: auto;
  width: 322px;
  min-height: 0;
  transition: transform .42s cubic-bezier(.18, .86, .2, 1.15);
}

.drift-page .focus-standings header {
  padding: 13px 14px;
}

.drift-page .focus-standings ol {
  gap: 7px;
  padding: 10px;
}

.drift-page .focus-rank-row {
  min-height: 68px;
  grid-template-columns: 31px 44px minmax(0, 1fr) auto;
  gap: 8px;
  padding: 8px;
}

.drift-page .focus-rank-row img {
  width: 44px;
  height: 44px;
}

.drift-page .focus-rank-copy b { font-size: 14px; }
.drift-page .focus-rank-progress { font-size: 12px; }

@media (max-width: 800px) {
  .drift-page .sign-dock {
    right: 16px;
    width: 528px;
    gap: 5px;
  }

  .drift-page .sign-card { height: 78px; }

  .drift-page .drift-spotlight {
    right: 284px;
    top: 122px;
    width: 260px;
  }

  .drift-page .drift-claim-queue {
    top: 392px;
    right: 284px;
    width: 260px;
  }

  .drift-page .focus-standings {
    top: 122px;
    right: 16px;
    width: 250px;
  }
}

@keyframes round-clear-pulse {
  to { filter: brightness(1.12); transform: scale(1.015) rotate(.5deg); }
}

@keyframes queue-card-in {
  from { opacity: 0; transform: translateY(-10px) scale(.92); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes banana-drift {
  0% { transform: translate(90%, -42%) rotate(18deg) scale(.72); }
  25% { transform: translate(-35%, -55%) rotate(-17deg) scale(1.07); }
  48% { transform: translate(-57%, -52%) rotate(-12deg) scale(1.12); }
  69% { transform: translate(-43%, -50%) rotate(9deg) scale(1.08); }
  84% { transform: translate(-51%, -50%) rotate(-4deg) scale(1.03); }
  100% { transform: translate(-50%, -50%) rotate(0) scale(1); }
}
@keyframes drift-lines { to { transform: translateX(-56px); } }
@keyframes skid-mark { 0% { width: 0; opacity: 0; } 22% { opacity: .8; } 100% { width: 67%; opacity: 0; } }
@keyframes smoke-pop { 0% { opacity: 0; transform: translate(0, 0) scale(.2); } 25% { opacity: .9; } 100% { opacity: 0; transform: translate(var(--smoke-x, -24px), var(--smoke-y, -45px)) scale(1.8); } }
@keyframes yes-pop { 0% { opacity: 0; transform: scale(.2) rotate(-15deg); } 16%, 72% { opacity: 1; transform: scale(1) rotate(-5deg); } 100% { opacity: 0; transform: scale(1.25) rotate(2deg); } }
@keyframes rank-flash { 40% { background: rgba(26, 155, 255, .32); transform: translateX(-6px); } }
@keyframes event-copy-in { 0%, 100% { opacity: 0; transform: translateY(-50%) translateX(30px); } 16%, 76% { opacity: 1; transform: translateY(-50%) translateX(0); } }

@media (max-width: 1200px) {
  .focus-standings { width: 250px; }
  .focus-event-copy { display: none; }
  .drift-spotlight { left: 55%; }
}
