/* =====================================================================
   Rookies Selection — conto alla rovescia alla chiusura (v2)
   Tensione crescente con data-stage: calm > warm (< 6 h) > hot (< 1 h) > panic (< 10 min) > final (< 1 min)
   ===================================================================== */

.rkc {
  --rkc-red: #e2003b;
  --rkc-red-deep: #c8003a;
  --rkc-gold: #ffc906;
  position: relative;
  overflow: hidden;
  padding: 2.25rem 0 2.5rem;
  text-align: center;
  color: #fff;
  background:
    radial-gradient(60% 120% at 50% 0%, rgba(226, 0, 59, 0.35), rgba(226, 0, 59, 0) 70%),
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.025) 0 2px, transparent 2px 14px),
    #070d24;
  border-top: 3px solid var(--rkc-red);
  border-bottom: 3px solid var(--rkc-red);
}

.rkc-glow {
  position: absolute;
  inset: -40%;
  background: radial-gradient(circle at 50% 50%, rgba(226, 0, 59, 0.28), transparent 55%);
  animation: rkc-breathe 2.4s ease-in-out infinite;
  pointer-events: none;
}

@keyframes rkc-breathe {
  50% {
    opacity: 0.35;
    transform: scale(1.08);
  }
}

.rkc-inner {
  position: relative;
}

.rkc-kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 0.5rem;
  padding: 0.3rem 0.85rem;
  border-radius: 999px;
  background: var(--rkc-red-deep);
  font-family: "Titillium Web", var(--font-display, sans-serif);
  font-weight: 900;
  font-size: 0.8125rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.rkc-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #fff;
  animation: rkc-blink 1s steps(2, start) infinite;
}

@keyframes rkc-blink {
  to {
    visibility: hidden;
  }
}

.rkc-title {
  margin: 0 0 1rem;
  font-family: "Titillium Web", var(--font-display, sans-serif);
  font-weight: 900;
  font-style: italic;
  font-size: clamp(1.35rem, 5.5vw, 2.1rem);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

/* orologio */
.rkc-clock {
  display: inline-flex;
  align-items: flex-start;
  justify-content: center;
  gap: clamp(0.15rem, 1.2vw, 0.6rem);
  max-width: 100%;
}

.rkc-unit {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
}

.rkc-unit b {
  display: block;
  min-width: 1.35em;
  padding: 0.12em 0.14em 0.08em;
  border-radius: 0.18em;
  background: linear-gradient(180deg, #1a2f6b 0%, #0b1638 52%, #081030 52%, #0b1638 100%);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.12),
    0 10px 24px rgba(0, 0, 0, 0.45),
    0 0 0 2px rgba(226, 0, 59, 0.35);
  font-family: "Saira Condensed", "Titillium Web", sans-serif;
  font-weight: 900;
  font-size: clamp(2.6rem, 13vw, 6.25rem);
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  color: #fff;
  text-shadow: 0 0 18px rgba(255, 255, 255, 0.25);
}

.rkc-unit--cs b {
  color: var(--rkc-gold);
  text-shadow: 0 0 18px rgba(255, 201, 6, 0.45);
}

.rkc-unit span {
  font-family: "Titillium Web", sans-serif;
  font-size: clamp(0.625rem, 2.4vw, 0.8125rem);
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.75);
}

.rkc-sep {
  font-style: normal;
  font-family: "Saira Condensed", sans-serif;
  font-weight: 900;
  font-size: clamp(2rem, 9vw, 4.5rem);
  line-height: 1.15;
  color: var(--rkc-red);
  animation: rkc-blink 1s steps(2, start) infinite;
}

.rkc-unit b.tick {
  animation: rkc-tick 0.28s ease-out;
}

@keyframes rkc-tick {
  0% {
    transform: translateY(-6%) scale(1.06);
    color: var(--rkc-gold);
  }
  100% {
    transform: none;
  }
}

/* barra di avanzamento (ultime 48 ore) */
.rkc-track {
  height: 8px;
  max-width: 34rem;
  margin: 1.25rem auto 0.75rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.rkc-fill {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--rkc-gold), var(--rkc-red));
  transform-origin: left center;
}

.rkc-when {
  margin: 0;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.82);
}

.rkc-go {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  margin-top: 1rem;
  padding: 0 1.5rem;
  border-radius: 999px;
  background: var(--rkc-red-deep);
  color: #fff;
  font-family: "Titillium Web", sans-serif;
  font-weight: 900;
  font-style: italic;
  text-transform: uppercase;
  text-decoration: none;
  box-shadow: 0 10px 30px rgba(226, 0, 59, 0.45);
}

/* ---------- tensione crescente ---------- */
.rkc[data-stage="hot"] .rkc-glow {
  animation-duration: 1.3s;
}

.rkc[data-stage="hot"] .rkc-unit b,
.rkc[data-stage="panic"] .rkc-unit b,
.rkc[data-stage="final"] .rkc-unit b {
  background: linear-gradient(180deg, #8a0026 0%, #5c0019 52%, #4a0014 52%, #5c0019 100%);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.15),
    0 10px 24px rgba(0, 0, 0, 0.45),
    0 0 26px rgba(226, 0, 59, 0.7);
}

.rkc[data-stage="panic"] {
  animation: rkc-alarm 0.9s ease-in-out infinite;
}

.rkc[data-stage="panic"] .rkc-glow {
  animation-duration: 0.7s;
}

@keyframes rkc-alarm {
  50% {
    background-color: #3a0012;
    border-color: var(--rkc-gold);
  }
}

.rkc[data-stage="final"] {
  animation: rkc-alarm 0.45s ease-in-out infinite;
}

.rkc[data-stage="final"] .rkc-clock {
  animation: rkc-shake 0.35s linear infinite;
}

@keyframes rkc-shake {
  25% {
    transform: translate(-2px, 1px) rotate(-0.4deg);
  }
  75% {
    transform: translate(2px, -1px) rotate(0.4deg);
  }
}

.rkc[data-stage="over"] .rkc-unit b {
  color: rgba(255, 255, 255, 0.4);
}

/* ---------- barra fissa (compare scorrendo la pagina) ----------
   Larghezza fissa e una casella fissa per ogni coppia di cifre: non cambia misura a ogni centesimo, quindi non traballa. */
.rkc-bar {
  position: fixed;
  left: 50%;
  top: calc(var(--nav-height, 3.5rem) + 0.5rem);
  z-index: 45;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  width: min(calc(100% - 1.5rem), 25rem);
  padding: 0.55rem 1.1rem;
  border-radius: 999px;
  background: #c8003a;
  color: #fff;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45), 0 0 0 2px rgba(255, 201, 6, 0.6);
  font-family: "Titillium Web", sans-serif;
  transform: translate(-50%, -160%);
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
  pointer-events: none;
}

.rkc-bar.is-on {
  transform: translate(-50%, 0);
  opacity: 1;
}

.rkc-bar-dot {
  flex: none;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #fff;
  animation: rkc-blink 1s steps(2, start) infinite;
}

.rkc-bar-label {
  flex: none;
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
}

.rkc-bar-time {
  display: flex;
  align-items: baseline;
  flex: none;
  font-family: "Saira Condensed", sans-serif;
  font-weight: 900;
  font-size: 1.5rem;
  line-height: 1;
}

.rkc-bar-time span {
  display: inline-block;
  width: 1.12em;
  text-align: center;
}

.rkc-bar-time i {
  font-style: normal;
  width: 0.32em;
  text-align: center;
  opacity: 0.85;
}

.rkc-bar-time .cs {
  color: #ffc906;
}

.rkc-bar[data-stage="panic"],
.rkc-bar[data-stage="final"] {
  animation: rkc-bar-pulse 0.6s ease-in-out infinite;
}

@keyframes rkc-bar-pulse {
  50% {
    background: #ffc906;
    color: #0b1638;
  }
}

.rkc-bar[data-stage="panic"] .cs,
.rkc-bar[data-stage="final"] .cs {
  color: inherit;
}

/* ---------- tempo scaduto ---------- */
.rkc-over {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(5, 9, 25, 0.85);
  backdrop-filter: blur(6px);
}

.rkc-over[hidden] {
  display: none;
}

.rkc-over-box {
  max-width: 26rem;
  padding: 2rem 1.5rem;
  border-radius: 1.25rem;
  text-align: center;
  color: #fff;
  background: #0b1638;
  border: 3px solid #e2003b;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
  animation: rkc-pop 0.5s cubic-bezier(0.2, 1.6, 0.4, 1);
}

.rkc-over-flag {
  height: 22px;
  margin: 0 0 1rem;
  background: repeating-conic-gradient(#fff 0 25%, #111 0 50%) 0 0 / 22px 22px;
  border-radius: 4px;
}

.rkc-over-box h2 {
  margin: 0 0 0.5rem;
  font-family: "Saira Condensed", sans-serif;
  font-weight: 900;
  font-style: italic;
  font-size: 2.5rem;
  text-transform: uppercase;
}

@keyframes rkc-pop {
  from {
    transform: scale(0.6);
    opacity: 0;
  }
}

@media (max-width: 899px) {
  .rkc-bar {
    top: calc(var(--nav-height, 3.5rem) + 0.4rem);
  }
}

@media (max-width: 360px) {
  .rkc-bar {
    gap: 0.5rem;
    padding: 0.5rem 0.8rem;
  }

  .rkc-bar-label {
    font-size: 0.6875rem;
  }

  .rkc-bar-time {
    font-size: 1.3rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .rkc-glow,
  .rkc[data-stage],
  .rkc-clock,
  .rkc-sep,
  .rkc-dot,
  .rkc-bar,
  .rkc-bar-dot {
    animation: none !important;
  }
}
