:root {
  --blue-hero: #2050FA;
  --blue-glow: #3872FF;
  --yellow: #FFE600;
  --yellow-hover: #FFF04D;
  --green: #00D084;
  --pink: #FF3B9A;
  --ink: #0B0D17;
  --white: #FFFFFF;
  --cream: #FFFDF4;
  --muted: #4A526D;
  --font-display: 'Anton', Impact, 'Arial Narrow', sans-serif;
  --font-sans: 'Space Grotesk', 'Cairo', system-ui, sans-serif;
  --font-ar: 'Cairo', 'Space Grotesk', sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  background-color: var(--blue-hero);
  background-image: radial-gradient(circle at 32% 48%, #2859FF 0%, var(--blue-hero) 55%, #1A42E0 100%);
  color: var(--ink);
  overflow-x: hidden;
  position: relative;
}

.bg-halftone {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image: radial-gradient(rgba(11, 13, 23, 0.14) 1.5px, transparent 1.5px);
  background-size: 16px 16px;
}

.bg-speedlines {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    linear-gradient(125deg, transparent 0 10%, rgba(255, 255, 255, 0.11) 10% 10.35%, transparent 10.35%),
    linear-gradient(54deg, transparent 0 86%, rgba(255, 255, 255, 0.11) 86% 86.35%, transparent 86.35%);
}

.bolt {
  position: fixed;
  pointer-events: none;
  z-index: 1;
  filter: drop-shadow(4px 4px 0 var(--ink));
  animation: boltFloat 4.5s ease-in-out infinite;
}

.bolt-tl { top: 82px; left: 2%; width: 64px; transform: rotate(-18deg); }
.bolt-tr { top: 90px; right: 2%; width: 64px; transform: rotate(18deg); animation-delay: -1.8s; }
.bolt-bl { bottom: 96px; left: 2.5%; width: 54px; transform: rotate(14deg); animation-delay: -0.9s; }

@keyframes boltFloat {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -7px; }
}

.page-shell {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Compact Top Bar */
.topbar {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 14px 24px 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-stamp-badge {
  background: var(--cream);
  border: 3px solid var(--ink);
  border-radius: 14px;
  padding: 4px 10px;
  box-shadow: 4px 4px 0 var(--ink);
  transform: rotate(-3deg);
}

.brand-stamp-img {
  height: 40px;
  width: auto;
  display: block;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
}

.brand-title {
  font-family: var(--font-display);
  font-size: 1.45rem;
  letter-spacing: 0.04em;
  color: var(--white);
  text-shadow: 2px 2px 0 var(--ink);
}

.brand-sub {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--yellow);
}

.header-counter {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.counter-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--yellow);
  color: var(--ink);
  border: 3px solid var(--ink);
  border-radius: 14px;
  padding: 6px 14px;
  box-shadow: 4px 4px 0 var(--ink);
  font-weight: 700;
}

.counter-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--green);
  border: 2px solid var(--ink);
  animation: pulseDot 1.6s ease-in-out infinite;
}

@keyframes pulseDot {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.3); }
}

.counter-number {
  font-family: var(--font-display);
  font-size: 1.4rem;
  line-height: 1;
}

.counter-label {
  font-size: 0.85rem;
}

/* Single Stage Main Content */
.single-stage {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 4px 24px 10px;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.hero-banner {
  text-align: center;
  margin-bottom: 16px;
}

.hero-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 4.4vw, 3.8rem);
  line-height: 1;
  letter-spacing: 0.02em;
  color: var(--white);
  text-transform: uppercase;
  -webkit-text-stroke: 2px var(--ink);
  text-shadow: 0 4px 0 var(--ink), 4px 5px 0 var(--ink);
}

.hero-title span {
  color: var(--yellow);
}

.hero-darija-lead {
  margin: 8px auto 0;
  max-width: 780px;
  font-size: 0.96rem;
  font-weight: 700;
  color: var(--white);
  text-shadow: 2px 2px 0 rgba(11, 13, 23, 0.85);
}

.main-grid {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 24px;
  align-items: center;
}

/* Left Column: Illustration + Badges + Arabic Darija Strip */
.visual-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.illustration-wrap {
  position: relative;
  width: 108%;
  max-width: 680px;
  margin: -10px -4% -16px;
  background: transparent;
}

.hero-illustration {
  width: 100%;
  height: auto;
  display: block;
  -webkit-mask-image:
    linear-gradient(to right, transparent 0%, #000 13%, #000 87%, transparent 100%),
    linear-gradient(to bottom, transparent 0%, #000 14%, #000 86%, transparent 100%);
  -webkit-mask-composite: source-in;
  mask-image:
    linear-gradient(to right, transparent 0%, #000 13%, #000 87%, transparent 100%),
    linear-gradient(to bottom, transparent 0%, #000 14%, #000 86%, transparent 100%);
  mask-composite: intersect;
}

/* Right Column: Compact Form Card */
.capsule-form-card {
  background: var(--white);
  border: 4px solid var(--ink);
  border-radius: 24px;
  padding: 20px 22px;
  box-shadow: 9px 9px 0 var(--ink);
}

.form-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.form-step-badge {
  display: inline-block;
  background: var(--blue-hero);
  color: var(--white);
  border: 2px solid var(--ink);
  border-radius: 7px;
  padding: 2px 9px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  margin-bottom: 4px;
}

.form-top-bar h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.7rem;
  letter-spacing: 0.02em;
  line-height: 1.05;
}

.form-darija-ask {
  margin: 0 0 14px;
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 700;
}

.track-fieldset {
  border: none;
  margin: 0 0 14px;
  padding: 0;
}

.track-fieldset legend {
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 8px;
}

.req {
  color: #E11D48;
}

.track-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.track-card {
  cursor: pointer;
  position: relative;
}

.track-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.track-card-inner {
  height: 100%;
  display: flex;
  align-items: flex-start;
  gap: 9px;
  background: #F6F8FF;
  border: 2.5px solid var(--ink);
  border-radius: 14px;
  padding: 10px 11px;
  box-shadow: 3px 3px 0 var(--ink);
  transition: transform 0.14s ease, background-color 0.14s ease, box-shadow 0.14s ease;
}

.track-card:hover .track-card-inner {
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0 var(--ink);
}

.track-card input:checked + .track-card-inner {
  background: var(--yellow);
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0 var(--ink);
}

.track-icon {
  font-size: 1.3rem;
  line-height: 1;
}

.track-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.track-copy strong {
  font-size: 0.86rem;
  line-height: 1.2;
}

.track-copy small {
  font-size: 0.72rem;
  color: #2E344A;
  line-height: 1.25;
}

.track-check {
  width: 21px;
  height: 21px;
  border-radius: 50%;
  border: 2px solid var(--ink);
  background: var(--white);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.75rem;
  opacity: 0.35;
  flex-shrink: 0;
}

.track-card input:checked + .track-card-inner .track-check {
  background: var(--green);
  opacity: 1;
}

.input-row {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 10px;
  margin-bottom: 12px;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 12px;
}

.input-row .field-group {
  margin-bottom: 0;
}

.field-group label {
  font-weight: 700;
  font-size: 0.84rem;
}

.field-group input,
.field-group textarea {
  font-family: var(--font-sans);
  font-size: 0.92rem;
  padding: 10px 12px;
  border: 2.5px solid var(--ink);
  border-radius: 12px;
  background: #FAFBFF;
  color: var(--ink);
}

.field-group input:focus,
.field-group textarea:focus {
  outline: none;
  background: var(--white);
  border-color: var(--blue-hero);
  box-shadow: 3px 3px 0 var(--blue-hero);
}

.field-group textarea {
  resize: vertical;
  min-height: 98px;
  line-height: 1.45;
}

.textarea-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.74rem;
  color: var(--muted);
  font-weight: 700;
}

.form-error {
  margin-bottom: 10px;
  padding: 9px 12px;
  background: #FFE4E8;
  color: #9F1239;
  border: 2px solid var(--ink);
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 700;
}

.submit-btn {
  width: 100%;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--yellow);
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 1.28rem;
  letter-spacing: 0.04em;
  padding: 12px 20px;
  border: 3px solid var(--ink);
  border-radius: 14px;
  box-shadow: 5px 5px 0 var(--ink);
  transition: transform 0.14s ease, box-shadow 0.14s ease, background-color 0.14s ease;
}

.submit-btn:hover:not(:disabled) {
  background: var(--green);
  transform: translate(-2px, -2px);
  box-shadow: 7px 7px 0 var(--ink);
}

.submit-btn:active:not(:disabled) {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 var(--ink);
}

.submit-btn:disabled {
  opacity: 0.65;
  cursor: wait;
}

/* Bottom Wave & Compact Footer */
.bottom-waves {
  line-height: 0;
  margin-top: 6px;
}

.bottom-waves svg {
  width: 100%;
  height: 76px;
  display: block;
}

.mini-footer {
  background: var(--white);
  text-align: center;
  padding: 4px 16px 12px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ink);
}

/* Confirmation Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(11, 13, 23, 0.72);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal-backdrop[hidden] {
  display: none;
}

.modal-card {
  position: relative;
  width: 100%;
  max-width: 470px;
  background: var(--cream);
  border: 4px solid var(--ink);
  border-radius: 24px;
  padding: 26px;
  box-shadow: 10px 10px 0 var(--ink);
  text-align: center;
  animation: stampPop 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes stampPop {
  from { transform: scale(0.88); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2.5px solid var(--ink);
  background: var(--white);
  font-weight: 700;
  cursor: pointer;
}

.receipt-stamp {
  height: 76px;
  width: auto;
  transform: rotate(-6deg);
  margin-bottom: 8px;
}

.receipt-kicker {
  display: inline-block;
  background: var(--green);
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 3px 12px;
  font-size: 0.74rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.modal-card h2 {
  margin: 4px 0 8px;
  font-family: var(--font-display);
  font-size: 1.85rem;
}

.receipt-darija {
  margin: 0 0 16px;
  font-size: 0.9rem;
  line-height: 1.5;
}

.receipt-details {
  background: var(--white);
  border: 3px solid var(--ink);
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 16px;
  display: grid;
  gap: 7px;
  text-align: left;
}

.receipt-details div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.85rem;
}

.receipt-details span {
  color: var(--muted);
}

/* Mini-Game Modal */
.game-card {
  max-width: 440px;
}

.game-kicker {
  background: var(--yellow);
}

.game-darija {
  margin: 0 0 12px;
  font-size: 0.9rem;
  line-height: 1.45;
  color: #1F2538;
}

.game-hud {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.game-stat {
  flex: 1;
  background: var(--white);
  border: 2.5px solid var(--ink);
  border-radius: 12px;
  padding: 7px 10px;
  font-size: 0.88rem;
  font-weight: 700;
  box-shadow: 3px 3px 0 var(--ink);
}

.game-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}

.game-cell {
  height: 74px;
  border: 3px solid var(--ink);
  border-radius: 14px;
  background: #EEF3FF;
  box-shadow: 4px 4px 0 var(--ink);
  font-size: 2rem;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: transform 0.08s ease, background-color 0.1s ease;
  user-select: none;
}

.game-cell:active {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 var(--ink);
}

.game-cell.is-target {
  background: var(--yellow);
}

.game-cell.is-hit {
  background: var(--green);
}

.game-status {
  margin: 0 0 12px;
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--ink);
  min-height: 20px;
}

/* Responsive */
@media (max-width: 980px) {
  .main-grid {
    grid-template-columns: 1fr;
  }

  .bolt {
    display: none;
  }
}

@media (max-width: 640px) {
  .topbar {
    padding: 12px 16px 6px;
  }

  .single-stage {
    padding: 4px 16px 10px;
  }

  .track-options,
  .input-row {
    grid-template-columns: 1fr;
  }

  .floating-stamp {
    height: 46px;
  }

  .bottom-waves svg {
    height: 48px;
  }
}
