/* ==============================================
   JACKPOT MODAL
   ============================================== */

:root {
  --accent: #0d6efd;
  --accent-deep: #084298;
  --accent-soft: #e8f1ff;
  --gold: #f2b705;
  --ink: #172033;
  --muted: #667085;
  --panel: #ffffff;
  --line: #d9e2f1;
}

body {
  min-height: 100vh;
  background:
    radial-gradient(circle at 15% 20%, rgba(242, 183, 5, 0.18), transparent 28rem),
    radial-gradient(circle at 85% 12%, rgba(13, 110, 253, 0.2), transparent 26rem),
    linear-gradient(135deg, #edf4ff 0%, #ffffff 42%, #f7fafc 100%);
}

.modal-backdrop.show {
  opacity: 0.62;
}

#jackpot-modal {
  --bs-modal-width: min(680px, 95vw);
}

.jackpot-dialog {
  width: var(--bs-modal-width);
  max-width: 95vw;
  min-height: calc(100vh - 1.5rem);
  min-height: calc(100dvh - 1.5rem);
  margin: 0.75rem auto;
  align-items: center;
}

.jackpot-modal-card {
  display: flex;
  max-height: calc(100vh - 1.5rem);
  max-height: calc(100dvh - 1.5rem);
  overflow: hidden;
  color: var(--ink);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: 0 28px 70px rgba(15, 23, 42, 0.28);
}

.jackpot-modal-header {
  flex: 0 0 auto;
  padding: clamp(1rem, 2.5vw, 1.5rem);
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(135deg, rgba(13, 110, 253, 0.12), rgba(242, 183, 5, 0.12)),
    #ffffff;
}

.jackpot-icon {
  display: inline-flex;
  width: 72px;
  height: 72px;
  flex: 0 0 72px;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  background: transparent;
  font-size: 1.35rem;
}

.jackpot-icon img {
  width: 72px;
  height: 72px;
  object-fit: contain;
  display: block;
}

.modal-kicker {
  display: block;
  color: var(--accent-deep);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1.1;
  text-transform: uppercase;
}

.modal-title {
  margin: 0.15rem 0 0;
  color: var(--ink);
  font-size: clamp(1.2rem, 4.6vw, 1.65rem);
  font-weight: 800;
}

.btn-close {
  flex: 0 0 auto;
  opacity: 0.7;
}

.btn-close:hover {
  opacity: 1;
}

.jackpot-modal-body {
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  min-height: 0;
  padding: clamp(1rem, 3.2vw, 1.75rem);
  background:
    linear-gradient(180deg, rgba(248, 251, 255, 0.9), #ffffff 42%),
    #ffffff;
}

.entry-brief {
  border: 1px solid rgba(13, 110, 253, 0.2);
  border-left: 5px solid var(--gold);
  border-radius: 10px;
  padding: 0.95rem 1rem;
  color: #24364f;
  background: linear-gradient(135deg, #fff9e7, var(--accent-soft));
  font-size: 0.95rem;
}

.entry-brief i {
  color: var(--gold);
  font-size: 1.35rem;
}

.jackpot-form {
  display: grid;
  gap: 0.95rem;
}

.jackpot-form .mb-3,
.jackpot-form .mb-4 {
  margin-bottom: 0 !important;
}

.form-label {
  margin-bottom: 0.45rem;
  color: #263244;
  font-size: 0.95rem;
}

.form-control,
.form-control-lg {
  min-height: 50px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 0.72rem 0.95rem;
  color: var(--ink);
  background: #fbfdff;
  font-size: 1rem;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.form-control:focus,
.form-control-lg:focus {
  border-color: var(--accent);
  background: #ffffff;
  box-shadow: 0 0 0 0.22rem rgba(13, 110, 253, 0.15);
}

.form-control.error,
.number-input.error {
  border-color: #dc3545;
  background-color: #fff5f5;
}

.number-grid,
.grid-cols-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(0.38rem, 1.8vw, 0.75rem);
}

.number-input {
  width: 100%;
  min-width: 0;
  height: clamp(48px, 13vw, 64px);
  padding: 0.35rem !important;
  font-size: clamp(1.05rem, 5vw, 1.45rem) !important;
  font-weight: 800 !important;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.number-input::-webkit-inner-spin-button,
.number-input::-webkit-outer-spin-button {
  margin: 0;
  appearance: none;
}

.number-input {
  appearance: textfield;
}

.jackpot-media {
  overflow: hidden;
  border: 1px solid rgba(13, 110, 253, 0.18);
  border-radius: 12px;
  background:
    linear-gradient(135deg, rgba(255, 249, 231, 0.9), rgba(232, 241, 255, 0.9)),
    #ffffff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.65);
}

.jackpot-media img {
  display: block;
  width: 100%;
  aspect-ratio: 12 / 5;
  object-fit: cover;
}

.error-message {
  display: block;
  margin-top: 0.35rem;
  font-weight: 600;
}

.error-message:empty {
  display: none;
}

.submit-entry-btn,
.btn-primary {
  min-height: 52px;
  border: 0;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), #0aa2ff);
  box-shadow: 0 14px 28px rgba(13, 110, 253, 0.26);
  font-weight: 800;
  letter-spacing: 0;
  transition: transform 160ms ease, box-shadow 160ms ease, filter 160ms ease;
}

.submit-entry-btn:hover,
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 34px rgba(13, 110, 253, 0.32);
  filter: brightness(1.02);
}

.submit-entry-btn:disabled,
.btn-primary:disabled {
  transform: none;
  box-shadow: none;
}

.form-section,
.suspense-section,
.results-section {
  animation: fadeIn 220ms ease-out;
}

.suspense-section {
  min-height: 320px;
  display: grid;
  align-content: center;
  justify-items: center;
  padding: clamp(2.5rem, 10vw, 4rem) 1rem;
}

.spinner-border {
  width: 3.25rem;
  height: 3.25rem;
  border-width: 0.32rem;
}

.loading-frame-image,
.result-display-image {
  display: block;
  width: min(100%, 320px);
  height: auto;
  max-height: 170px;
  object-fit: contain;
}

.loading-frame-image {
  margin: 0.2rem auto 1.2rem;
}

.suspense-title {
  margin-bottom: 0.35rem;
  color: var(--ink);
  font-size: clamp(1.25rem, 5vw, 1.65rem);
}

#confetti-canvas {
  position: fixed;
  inset: 0;
  z-index: 1065;
  pointer-events: none;
}

.winner-message,
.loser-message {
  text-align: center;
  padding: clamp(1.5rem, 6vw, 2.4rem) 0 0.5rem;
}

.winner-title {
  color: var(--accent-deep);
  font-size: clamp(1.35rem, 5.5vw, 1.9rem);
  font-weight: 900;
}

.winner-subtitle,
.winner-congratulations {
  color: var(--accent-deep);
  font-weight: 800;
}

.winner-text,
.winner-footer,
.loser-text,
.loser-subtitle {
  color: var(--muted);
}

.winner-text {
  max-width: 34rem;
  margin-inline: auto;
  font-size: clamp(1.05rem, 3.4vw, 1.22rem);
  line-height: 1.65;
}

.winner-numbers {
  display: flex;
  justify-content: center;
  margin: 1.35rem 0;
  color: var(--accent);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: clamp(1.35rem, 8vw, 2.35rem);
  font-weight: 900;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.loser-title {
  color: #435066;
  font-size: clamp(1.35rem, 6vw, 1.85rem);
  font-weight: 900;
}

.result-display-image {
  margin: 1rem auto 0;
}

.action-buttons {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.75rem;
  margin-top: 1.4rem;
}

.action-btn {
  min-height: 48px;
  border: 0;
  border-radius: 10px;
  padding: 0.75rem 1rem;
  font-weight: 800;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.action-btn:hover {
  transform: translateY(-1px);
}

.primary-btn {
  color: #ffffff;
  background: linear-gradient(135deg, #16a34a, #22c55e);
  box-shadow: 0 12px 24px rgba(22, 163, 74, 0.24);
}

.secondary-btn {
  color: #ffffff;
  background: linear-gradient(135deg, var(--accent), #0aa2ff);
  box-shadow: 0 12px 24px rgba(13, 110, 253, 0.24);
}

.tertiary-btn {
  color: #263244;
  background: #eef4fb;
  border: 1px solid var(--line);
}

.tertiary-btn:hover {
  background: #e4edf8;
}

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

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

@keyframes winner-flash {
  0%,
  100% {
    box-shadow: 0 28px 70px rgba(15, 23, 42, 0.28);
  }
  50% {
    box-shadow: 0 0 0 5px rgba(242, 183, 5, 0.35), 0 30px 90px rgba(242, 183, 5, 0.42);
  }
}

@media (max-width: 576px) {
  #jackpot-modal {
    --bs-modal-width: calc(100vw - 16px);
  }

  .jackpot-dialog {
    width: 95vw;
    max-width: 95vw;
    min-height: calc(100vh - 1rem);
    min-height: calc(100dvh - 1rem);
    margin: 0.5rem auto;
  }

  .jackpot-modal-card {
    height: calc(100vh - 1rem);
    height: calc(100dvh - 1rem);
    max-height: calc(100vh - 1rem);
    max-height: calc(100dvh - 1rem);
    border-radius: 14px;
  }

  .jackpot-icon {
    width: 56px;
    height: 56px;
    flex-basis: 56px;
    font-size: 1.15rem;
  }

  .jackpot-icon img {
    width: 56px;
    height: 56px;
  }

  .jackpot-modal-header {
    padding-block: 0.65rem;
  }

  .entry-brief {
    padding: 0.8rem;
    font-size: 0.88rem;
  }

  .action-buttons {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 340px) {
  .jackpot-modal-header {
    padding: 0.55rem 0.8rem;
  }

  .jackpot-modal-body {
    padding: 0.8rem;
  }

  .number-grid,
  .grid-cols-4 {
    gap: 0.28rem;
  }
}
