/* =================================================================
   SPG · World Cup Prediction — design system
   Palette grounded in the real SPG brand (spc.whisper.sa):
   blue #1E5BBF / navy #0F2447 / green #0F8A56 — clean & light.
   ================================================================= */
:root {
  --bg: #F6F9FE;
  --bg-2: #EFF4FC;
  --surface: #FFFFFF;
  --surface-2: #FBFCFE;
  --line: #E1E8F2;
  --line-2: #C8D6EC;

  --blue: #1E5BBF;        /* SPG primary blue */
  --blue-deep: #15428A;
  --navy: #0F2447;        /* ink / headings */
  --green: #0F8A56;       /* SPG green */
  --green-2: #3C9132;
  --green-bright: #52B848;

  --ksa: #006C35;         /* Saudi national green */
  --ksa-tint: #E8F5EC;
  --spain: #C53030;       /* Spain red (also an SPG accent) */
  --spain-tint: #FDECEC;

  --ink: #0F2447;
  --ink-dim: #3A547A;
  --ink-faint: #7B8DA8;

  --radius: 18px;
  --radius-sm: 12px;
  --maxw: 1080px;
  --shadow: 0 18px 50px -24px rgba(15, 36, 71, 0.22);
  --shadow-sm: 0 6px 18px -10px rgba(15, 36, 71, 0.18);
  --font-ar: 'IBM Plex Sans Arabic', system-ui, sans-serif;
  --font-en: 'IBM Plex Sans', system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-ar);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  min-height: 100vh;
  overflow-x: hidden;
  background-image:
    radial-gradient(1100px 520px at 50% -8%, rgba(30, 91, 191, 0.07), transparent 60%),
    radial-gradient(760px 460px at 0% 100%, rgba(15, 138, 86, 0.08), transparent 55%),
    radial-gradient(760px 460px at 100% 100%, rgba(197, 48, 48, 0.05), transparent 55%);
  background-attachment: fixed;
}
html[lang='en'] body { font-family: var(--font-en); }

.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: 20px; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 14px 20px;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand img { height: 52px; width: auto; display: block; }
.brand .fallback {
  font-weight: 700; letter-spacing: 0.02em; color: var(--navy);
  font-size: 18px; display: flex; align-items: center; gap: 8px;
}
.brand .fallback b { color: var(--green); }

.lang-toggle {
  border: 1px solid var(--line-2); background: var(--surface); color: var(--blue-deep);
  font: inherit; font-weight: 600; font-size: 13px; cursor: pointer;
  padding: 8px 16px; border-radius: 999px; transition: 0.2s; box-shadow: var(--shadow-sm);
  display: inline-flex; align-items: center; gap: 6px;
}
.lang-toggle:hover { border-color: var(--blue); color: var(--blue); }

/* ---------- hero ---------- */
.hero { position: relative; padding: 50px 0 26px; text-align: center; }
.hero .kicker {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--blue); background: rgba(30, 91, 191, 0.07);
  border: 1px solid var(--line-2);
  padding: 6px 14px; border-radius: 999px; margin-bottom: 22px;
}
.hero h1 {
  font-size: clamp(30px, 6.4vw, 58px); line-height: 1.14; font-weight: 700;
  letter-spacing: -0.01em; margin-bottom: 14px; color: var(--navy);
}
.hero h1 .accent { color: var(--green); }
.hero .sub {
  color: var(--ink-dim); font-size: clamp(15px, 2.4vw, 19px);
  max-width: 640px; margin: 0 auto 8px;
}
.hero .sub-en { color: var(--ink-faint); font-size: 14px; font-family: var(--font-en); direction: ltr; }
html[lang='en'] .hero .sub-en { display: none; }

/* VS strip */
.vs {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  gap: 10px; margin: 30px auto 8px; max-width: 560px;
}
.vs .team { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.vs .flag {
  width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center;
  font-size: 30px; background: var(--surface); box-shadow: var(--shadow-sm);
  border: 1px solid var(--line);
}
.vs .team.ksa .flag { box-shadow: 0 0 0 2px var(--ksa), var(--shadow-sm); }
.vs .team.spain .flag { box-shadow: 0 0 0 2px var(--spain), var(--shadow-sm); }
.vs .team b { font-size: 16px; color: var(--navy); }
.vs .versus {
  font-family: var(--font-en); font-weight: 800; font-size: 20px; color: #fff;
  width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center;
  background: linear-gradient(160deg, var(--blue), var(--blue-deep)); box-shadow: var(--shadow-sm);
}
.match-meta { color: var(--ink-faint); font-size: 13px; margin-top: 4px; }

/* countdown */
.countdown { display: flex; justify-content: center; gap: 10px; margin: 26px 0 6px; }
.countdown .unit {
  min-width: 66px; padding: 12px 6px; border-radius: var(--radius-sm);
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm);
}
.countdown .num { font-family: var(--font-en); font-size: 26px; font-weight: 700; color: var(--blue-deep); line-height: 1; }
.countdown .lbl { font-size: 11px; color: var(--ink-faint); margin-top: 6px; letter-spacing: 0.04em; }
.deadline-note { color: var(--spain); font-size: 13px; margin-top: 12px; font-weight: 500; }

/* ---------- prediction card ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden; margin: 18px 0;
}
.card-head {
  padding: 18px 22px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--surface-2);
}
.card-head h2 { font-size: 18px; color: var(--navy); }
.card-head .step { color: var(--ink-faint); font-size: 13px; font-family: var(--font-en); }
.card-body { padding: 22px; }

/* score picker */
.score {
  display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: stretch;
}
.side {
  border-radius: var(--radius-sm); padding: 18px 12px; text-align: center;
  border: 1px solid var(--line); position: relative; overflow: hidden;
}
.side.ksa { background: var(--ksa-tint); border-color: rgba(0, 108, 53, 0.18); }
.side.spain { background: var(--spain-tint); border-color: rgba(197, 48, 48, 0.18); }
.side .team-name { font-weight: 700; font-size: 17px; margin-bottom: 2px; color: var(--navy); }
.side.ksa .team-name { color: var(--ksa); }
.side.spain .team-name { color: var(--spain); }
.side .team-sub { font-family: var(--font-en); font-size: 11px; color: var(--ink-faint); direction: ltr; margin-bottom: 12px; }
.side .value { font-family: var(--font-en); font-size: 56px; font-weight: 700; line-height: 1; color: var(--navy); }
.stepper { display: flex; justify-content: center; gap: 12px; margin-top: 14px; }
.stepper button {
  width: 52px; height: 52px; border-radius: 50%; font-size: 26px; line-height: 1;
  border: 1px solid var(--line-2); background: var(--surface);
  color: var(--ink-dim); cursor: pointer; transition: 0.15s; display: grid; place-items: center;
  -webkit-tap-highlight-color: transparent; box-shadow: var(--shadow-sm);
}
.side.ksa .stepper button:hover { border-color: var(--ksa); color: var(--ksa); }
.side.spain .stepper button:hover { border-color: var(--spain); color: var(--spain); }
.stepper button:active { transform: scale(0.92); }
.score .dash { display: grid; place-items: center; font-size: 40px; color: var(--line-2); font-family: var(--font-en); }

/* quick chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 18px; }
.chips .lbl { width: 100%; text-align: center; color: var(--ink-faint); font-size: 12px; margin-bottom: 2px; }
.chip {
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-dim);
  font: inherit; font-family: var(--font-en); font-size: 14px; cursor: pointer;
  padding: 7px 14px; border-radius: 999px; transition: 0.15s;
}
.chip:hover, .chip.active { border-color: var(--blue); color: var(--blue); background: rgba(30, 91, 191, 0.07); }

/* form */
.fields { display: grid; gap: 16px; margin-top: 6px; }
.field label { display: block; font-size: 14px; color: var(--ink-dim); margin-bottom: 7px; }
.field label .req { color: var(--spain); }
.field input, .field select {
  width: 100%; font: inherit; font-size: 16px; color: var(--ink);
  background: var(--surface-2); border: 1px solid var(--line-2);
  border-radius: var(--radius-sm); padding: 14px 16px; transition: 0.15s;
}
.field input::placeholder { color: var(--ink-faint); }
.field input:focus, .field select:focus { outline: none; border-color: var(--blue); background: var(--surface); box-shadow: 0 0 0 3px rgba(30, 91, 191, 0.1); }
.field select { appearance: none; cursor: pointer; }
.field .hint { font-size: 12px; color: var(--ink-faint); margin-top: 6px; }
.field.err input, .field.err select { border-color: var(--spain); }
.field .err-msg { color: var(--spain); font-size: 12px; margin-top: 6px; display: none; }
.field.err .err-msg { display: block; }

/* submit */
.submit {
  width: 100%; margin-top: 22px; font: inherit; font-weight: 700; font-size: 18px;
  color: #fff; cursor: pointer; padding: 17px; border-radius: var(--radius-sm); border: none;
  background: linear-gradient(165deg, var(--green-bright), var(--green));
  box-shadow: 0 14px 30px -12px rgba(15, 138, 86, 0.5); transition: 0.18s;
}
.submit:hover { filter: brightness(1.04); transform: translateY(-1px); }
.submit:active { transform: translateY(0); }
.submit:disabled { opacity: 0.6; cursor: not-allowed; transform: none; filter: grayscale(0.2); }
.form-note { text-align: center; color: var(--ink-faint); font-size: 12px; margin-top: 12px; }

/* hero banner (players + Mishwar prize) */
.hero-banner {
  margin: 30px auto 10px; max-width: 760px; border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow); border: 1px solid var(--line); background: var(--surface);
}
.hero-banner img { width: 100%; height: auto; display: block; }

/* card-head flags graphic */
.head-flags { height: 42px; width: auto; display: block; }

/* prize banner */
.prize {
  display: flex; align-items: stretch; gap: 0; margin: 18px 0; overflow: hidden;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.prize-img { flex: 0 0 132px; overflow: hidden; }
.prize-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.prize-body { padding: 18px 22px; display: flex; flex-direction: column; justify-content: center; gap: 3px; }
.prize-tag {
  align-self: flex-start; font-size: 12px; font-weight: 600; color: var(--green);
  background: var(--ksa-tint); border-radius: 999px; padding: 3px 12px; margin-bottom: 4px;
}
.prize .t { font-weight: 700; color: var(--navy); font-size: 19px; }
.prize .d { color: var(--ink-dim); font-size: 14px; }
.prize .d-en { color: var(--ink-faint); font-size: 12px; font-family: var(--font-en); direction: ltr; }
html[lang='en'] .prize .d-en { display: none; }

/* blessing wordmark on confirmation */
.blessing-art { margin-top: 26px; }
.blessing-art img { width: clamp(220px, 60vw, 340px); height: auto; opacity: 0.95; }

@media (max-width: 480px) {
  .prize { flex-direction: column; }
  .prize-img { flex-basis: 130px; }
}

/* confirmation */
.confirm { display: none; text-align: center; padding: 40px 22px; }
.confirm.show { display: block; animation: pop 0.5s ease; }
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(0.98); } to { opacity: 1; transform: none; } }
.confirm .tick {
  width: 84px; height: 84px; border-radius: 50%; margin: 0 auto 18px; display: grid; place-items: center;
  font-size: 40px; background: var(--ksa-tint); border: 1px solid var(--ksa); color: var(--ksa);
}
.confirm h2 { font-size: 26px; margin-bottom: 8px; color: var(--navy); }
.confirm p { color: var(--ink-dim); margin-bottom: 18px; }
.confirm .myscore {
  display: inline-flex; align-items: center; gap: 14px; padding: 14px 24px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--surface-2); font-family: var(--font-en); font-size: 30px; font-weight: 700;
  margin-bottom: 22px; color: var(--navy);
}
.confirm .myscore small { font-family: var(--font-ar); font-size: 13px; color: var(--ink-faint); font-weight: 400; }
.confirm .share {
  border: 1px solid var(--blue); color: var(--blue); background: rgba(30, 91, 191, 0.06);
  font: inherit; font-weight: 600; cursor: pointer; padding: 12px 22px; border-radius: 999px;
}
.confirm .share:hover { background: rgba(30, 91, 191, 0.12); }

/* closed state */
.closed-banner {
  display: none; text-align: center; padding: 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--spain); background: var(--spain-tint); color: var(--spain); margin-top: 18px; font-weight: 500;
}
.closed-banner.show { display: block; }

/* footer */
.foot { text-align: center; color: var(--ink-faint); font-size: 13px; padding: 30px 0 50px; }
.foot a { color: var(--blue); text-decoration: none; }

/* toast */
.toast {
  position: fixed; inset-block-end: 24px; inset-inline: 0; margin-inline: auto; width: max-content; max-width: 90vw;
  background: var(--navy); color: #fff; padding: 12px 20px; border-radius: 999px; font-size: 14px;
  box-shadow: var(--shadow); opacity: 0; transform: translateY(20px); transition: 0.3s; z-index: 200; pointer-events: none;
}
.toast.show { opacity: 1; transform: none; }

/* en font for latin runs */
.en { font-family: var(--font-en); direction: ltr; unicode-bidi: isolate; }

@media (max-width: 560px) {
  .vs { gap: 4px; }
  .vs .flag { width: 54px; height: 54px; font-size: 26px; }
  .side .value { font-size: 46px; }
  .stepper button { width: 48px; height: 48px; }
}
