.rpi-prediction {
  position: relative;
  padding: 34px 0 12px;
}

.rpi-prediction__shell {
  position: relative;
  overflow: hidden;
  padding: clamp(24px, 4vw, 46px);
  border: 1px solid rgba(200, 149, 50, 0.34);
  border-radius: var(--rpi-radius-lg);
  background:
    radial-gradient(circle at 95% 0, rgba(237, 138, 44, 0.14), transparent 25rem),
    linear-gradient(145deg, rgba(255, 255, 255, 0.98), rgba(248, 240, 223, 0.9));
  box-shadow: var(--rpi-shadow-md);
}

.rpi-prediction__shell::before {
  content: "";
  position: absolute;
  top: -115px;
  right: -80px;
  width: 300px;
  height: 300px;
  border: 1px solid rgba(12, 101, 90, 0.12);
  border-radius: 50% 50% 8px 8px;
  box-shadow: 0 0 0 34px rgba(200, 149, 50, 0.035), 0 0 0 68px rgba(139, 30, 66, 0.025);
  pointer-events: none;
}

.rpi-prediction__heading,
.rpi-prediction__history-heading {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.rpi-prediction__heading h2 {
  max-width: 760px;
  margin: 0;
  color: var(--rpi-primary-deep);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(32px, 4.5vw, 56px);
  line-height: 1.08;
  letter-spacing: -0.035em;
}

.rpi-lang-hi .rpi-prediction__heading h2 {
  font-family: var(--rpi-font-hi);
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.rpi-prediction__clock {
  display: grid;
  flex: 0 0 auto;
  gap: 4px;
  min-width: 144px;
  padding: 12px 16px;
  border: 1px solid var(--rpi-border);
  border-radius: var(--rpi-radius-sm);
  background: rgba(255, 255, 255, 0.8);
  text-align: right;
}

.rpi-prediction__clock span,
.rpi-prediction__periods span {
  color: var(--rpi-muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.rpi-lang-hi .rpi-prediction__clock span,
.rpi-lang-hi .rpi-prediction__periods span {
  letter-spacing: 0;
  text-transform: none;
}

.rpi-prediction__clock time {
  color: var(--rpi-primary-deep);
  font-size: 19px;
  font-variant-numeric: tabular-nums;
  font-weight: 850;
}

.rpi-prediction__intervals {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 28px 0;
}

.rpi-prediction__intervals a {
  min-height: 46px;
  display: grid;
  place-items: center;
  padding: 9px 12px;
  border: 1px solid var(--rpi-border);
  border-radius: 999px;
  color: var(--rpi-primary-deep);
  background: rgba(255, 255, 255, 0.74);
  font-size: 14px;
  font-weight: 820;
  text-align: center;
  text-decoration: none;
}

.rpi-prediction__intervals a[aria-current="page"] {
  color: #fff;
  border-color: var(--rpi-primary);
  background: linear-gradient(135deg, var(--rpi-primary-deep), var(--rpi-primary));
  box-shadow: 0 9px 22px rgba(7, 75, 68, 0.18);
}

.rpi-prediction__periods {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr 0.72fr;
  overflow: hidden;
  border: 1px solid var(--rpi-border);
  border-radius: var(--rpi-radius-md);
  background: rgba(255, 255, 255, 0.82);
}

.rpi-prediction__periods > div {
  display: grid;
  align-content: center;
  gap: 6px;
  min-height: 96px;
  padding: 16px 20px;
  border-right: 1px solid var(--rpi-border);
}

.rpi-prediction__periods > div:last-child {
  border-right: 0;
}

.rpi-prediction__periods strong {
  overflow-wrap: anywhere;
  color: var(--rpi-text);
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}

.rpi-prediction__periods .rpi-prediction__countdown {
  color: #fff;
  background: var(--rpi-primary-deep);
}

.rpi-prediction__countdown span,
.rpi-prediction__countdown strong {
  color: #fff;
}

.rpi-prediction__countdown strong {
  font-size: 30px;
  line-height: 1;
}

.rpi-prediction__progress {
  height: 7px;
  overflow: hidden;
  margin: 12px 0 24px;
  border-radius: 999px;
  background: rgba(12, 101, 90, 0.1);
}

.rpi-prediction__progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--rpi-accent), var(--rpi-saffron), var(--rpi-secondary));
  transition: width 300ms linear;
}

.rpi-prediction__reference {
  position: relative;
  display: grid;
  grid-template-columns: 1.35fr repeat(3, minmax(0, 0.8fr));
  gap: 12px;
}

.rpi-prediction__reference article {
  min-height: 154px;
  padding: 20px;
  border: 1px solid var(--rpi-border);
  border-radius: var(--rpi-radius-md);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--rpi-shadow-sm);
}

.rpi-prediction__reference h3,
.rpi-prediction__history h3 {
  margin: 0 0 14px;
  color: var(--rpi-primary-deep);
  font-size: 15px;
}

.rpi-prediction__reference article > p {
  margin: 8px 0 0;
  color: var(--rpi-muted);
  font-size: 11px;
  line-height: 1.45;
}

.rpi-prediction__balls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.rpi-prediction__balls span {
  display: grid;
  width: 50px;
  height: 50px;
  place-items: center;
  color: #fff;
  border: 3px solid rgba(255, 255, 255, 0.76);
  border-radius: 50%;
  background: linear-gradient(145deg, var(--rpi-secondary), #a92c53 56%, var(--rpi-saffron));
  box-shadow: 0 8px 18px rgba(139, 30, 66, 0.22);
  font-size: 21px;
  font-weight: 900;
}

.rpi-prediction__signal {
  display: inline-flex;
  min-height: 50px;
  align-items: center;
  color: var(--rpi-primary-deep);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 28px;
  line-height: 1.1;
}

.rpi-lang-hi .rpi-prediction__signal {
  font-family: var(--rpi-font-hi);
}

.rpi-prediction__colour {
  gap: 8px;
}

.rpi-prediction__colour::before {
  content: "";
  width: 12px;
  height: 12px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 4px rgba(37, 29, 24, 0.06);
}

.rpi-prediction__colour--red { color: #a62642; }
.rpi-prediction__colour--green { color: #08705e; }
.rpi-prediction__colour--violet { color: #75408f; }

.rpi-prediction__history {
  position: relative;
  margin-top: 30px;
  padding-top: 26px;
  border-top: 1px solid var(--rpi-border);
}

.rpi-prediction__history h3 {
  margin-bottom: 4px;
  font-size: 22px;
}

.rpi-prediction__history-heading p {
  max-width: 760px;
  margin: 0 0 18px;
  color: var(--rpi-muted);
  font-size: 13px;
}

.rpi-prediction__history table {
  background: rgba(255, 255, 255, 0.78);
}

.rpi-prediction__history thead th {
  color: var(--rpi-primary-deep);
  background: var(--rpi-bg-soft);
}

.rpi-prediction__history tbody th {
  color: var(--rpi-text);
  font-variant-numeric: tabular-nums;
}

.rpi-prediction__history td,
.rpi-prediction__history th {
  white-space: nowrap;
}

@media (max-width: 1024px) {
  .rpi-prediction__reference {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  .rpi-prediction__heading,
  .rpi-prediction__history-heading {
    display: grid;
  }

  .rpi-prediction__clock {
    justify-self: start;
    text-align: left;
  }

  .rpi-prediction__periods {
    grid-template-columns: 1fr 1fr;
  }

  .rpi-prediction__periods > div:nth-child(2) {
    border-right: 0;
  }

  .rpi-prediction__periods .rpi-prediction__countdown {
    grid-column: 1 / -1;
  }
}

@media (max-width: 640px) {
  .rpi-prediction {
    padding-top: 24px;
  }

  .rpi-prediction__shell {
    padding: 20px;
    border-radius: var(--rpi-radius-md);
  }

  .rpi-prediction__intervals,
  .rpi-prediction__reference,
  .rpi-prediction__periods {
    grid-template-columns: 1fr;
  }

  .rpi-prediction__periods > div,
  .rpi-prediction__periods > div:nth-child(2) {
    min-height: 82px;
    border-right: 0;
    border-bottom: 1px solid var(--rpi-border);
  }

  .rpi-prediction__periods > div:last-child {
    border-bottom: 0;
  }

  .rpi-prediction__periods .rpi-prediction__countdown {
    grid-column: auto;
  }

  .rpi-prediction__reference article {
    min-height: 0;
  }

  .rpi-prediction__cta .rpi-button {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .rpi-prediction__progress span {
    transition: none;
  }
}
