@font-face {
  font-family: Cairo;
  src: url("../assets/fonts/Cairo-Variable.ttf") format("truetype");
  font-weight: 200 1000;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: Syne;
  src: url("../assets/fonts/Syne-Variable.ttf") format("truetype");
  font-weight: 400 800;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #0c0a09;
  --bg-elev: #161210;
  --bg-hover: #1e1914;
  --cream: #f4ede4;
  --muted: #a89b8c;
  --gold: #e4b86a;
  --gold-2: #f3d399;
  --ember: #ff5c39;
  --mint: #9be7c0;
  --line: rgba(244, 237, 228, 0.12);
  --line-strong: rgba(244, 237, 228, 0.22);
  --danger: #ff8a7a;
  --ok: #9be7c0;
  --shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
  --radius: 22px;
  --font: Cairo, "Segoe UI", Tahoma, sans-serif;
  --display: Syne, Cairo, sans-serif;
  --max: 1120px;
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(228, 184, 106, 0.14), transparent 55%),
    radial-gradient(900px 500px at 0% 20%, rgba(255, 92, 57, 0.1), transparent 50%),
    var(--bg);
  color: var(--cream);
  line-height: 1.65;
  font-size: 16.5px;
}

[hidden], .hidden { display: none !important; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

a { color: var(--gold); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--gold-2); }

img { max-width: 100%; }

button, input, select { font: inherit; color: inherit; }

.skip {
  position: absolute;
  inset-inline-start: 16px;
  top: -40px;
  background: var(--gold);
  color: #1a1208;
  padding: 8px 12px;
  border-radius: 8px;
  z-index: 20;
}
.skip:focus { top: 12px; }

.wrap {
  width: min(var(--max), calc(100% - 32px));
  margin-inline: auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(16px);
  background: rgba(12, 10, 9, 0.72);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
}
.logo {
  display: flex;
  align-items: baseline;
  gap: 10px;
  color: inherit;
  text-decoration: none;
  font-weight: 800;
  font-size: 1.55rem;
  letter-spacing: -0.03em;
}
.logo span { color: var(--muted); font-weight: 500; font-size: 0.85rem; letter-spacing: 0; }
.nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
}
.nav a {
  color: var(--cream);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  opacity: 0.82;
}
.nav a:hover { opacity: 1; color: var(--gold); }
.lang-toggle, .scale-toggle {
  display: inline-flex;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 3px;
  background: rgba(255,255,255,0.03);
}
.lang-toggle button, .scale-toggle button {
  border: 0;
  background: transparent;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.85rem;
}
.lang-toggle button.is-active,
.scale-toggle button.is-active {
  background: var(--cream);
  color: #1a1208;
}

.hero {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 48px;
  align-items: center;
  padding: 64px 0 48px;
}
.kicker {
  display: inline-block;
  color: var(--gold);
  font-weight: 700;
  letter-spacing: 0.02em;
  margin-bottom: 12px;
}
.hero h1 {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(2.3rem, 5vw, 4.1rem);
  line-height: 1.12;
  letter-spacing: -0.04em;
  margin: 0 0 16px;
}
[lang="ar"] .hero h1 { font-family: var(--font); letter-spacing: 0; }
.lead { font-size: 1.15rem; color: var(--muted); margin: 0 0 28px; max-width: 40ch; }
[dir="rtl"] .lead { max-width: 46ch; }
.cta-row { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 14px; }
.privacy-note { color: var(--muted); font-size: 0.92rem; margin: 0; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  cursor: pointer;
  text-decoration: none;
  padding: 12px 20px;
  border-radius: 999px;
  font-weight: 700;
  background: var(--cream);
  color: #1a1208;
}
.btn:hover { filter: brightness(1.05); }
.btn:disabled, .btn.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}
.btn-ghost {
  background: transparent;
  color: var(--cream);
  border: 1px solid var(--line-strong);
}
.btn-ember { background: var(--ember); color: #fff8f5; }
.btn-gold { background: var(--gold); color: #1a1208; }

.hero-card {
  background: linear-gradient(160deg, #2a1810, #120c0a 60%);
  border: 1px solid var(--line-strong);
  border-radius: 28px;
  min-height: 340px;
  padding: 28px 32px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.hero-card::after {
  content: "";
  position: absolute;
  inset: auto -20% -40% 20%;
  height: 70%;
  background: radial-gradient(circle, rgba(228,184,106,0.28), transparent 65%);
}
.hero-card .hc-brand { color: var(--gold); font-weight: 800; margin: 0 0 24px; }
.hero-card .hc-gpa {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(3.4rem, 8.5vw, 4.7rem);
  line-height: 0.95;
  margin: 0;
  letter-spacing: -0.05em;
}
.hero-card .hc-meta { color: var(--gold-2); font-weight: 700; margin: 8px 0 18px; }
.hero-card .hc-line { color: var(--cream); font-size: 1.15rem; font-weight: 700; margin: 0; position: relative; z-index: 1; }
.hero-card .hc-sub { color: var(--muted); margin: 8px 0 0; position: relative; z-index: 1; }

.panel {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
  margin: 0 0 28px;
}
.panel h2 { margin: 0 0 8px; font-size: 1.6rem; letter-spacing: -0.02em; }
.hint { color: var(--muted); margin: 0 0 20px; }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.course-head, .course-row {
  display: grid;
  grid-template-columns: 1fr 110px 150px 44px;
  gap: 10px;
  align-items: center;
}
.course-head {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0 0 8px;
}
.course-list { display: flex; flex-direction: column; gap: 10px; }
.course-row {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 8px;
}
.field { display: flex; flex-direction: column; gap: 6px; }
.field input, .field select {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  padding: 10px 12px;
  outline: none;
}
.course-row .field input,
.course-row .field select { background: transparent; border-color: transparent; }
.field input:focus, .field select:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(228, 184, 106, 0.2);
}
.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 1.4rem;
  line-height: 1;
}
.icon-btn:hover { background: var(--bg-hover); color: var(--danger); }

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.results {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 16px;
  align-items: stretch;
}
.result-hero {
  background: linear-gradient(165deg, #24160f, #120c0a);
  border-radius: 20px;
  padding: 24px;
  border: 1px solid var(--line);
}

/* Syne's "." is a wide bar; replace it with a real circular decimal point. */
.gpa-figure {
  display: inline-block;
  direction: ltr;
  unicode-bidi: isolate;
}
.gpa-dot {
  display: inline-block;
  position: relative;
  width: 0.22em;
  height: 1em;
  letter-spacing: 0;
  overflow: hidden;
  vertical-align: baseline;
  text-indent: 1.2em;
}
.gpa-dot::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0.06em;
  width: 0.13em;
  height: 0.13em;
  border-radius: 50%;
  transform: translateX(-50%);
  background: currentColor;
}

.gpa-num {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(3.4rem, 8vw, 5.6rem);
  line-height: 0.95;
  letter-spacing: -0.05em;
  margin: 4px 0;
}
.gpa-scale { color: var(--gold); font-weight: 700; margin: 0; }
.gpa-band { font-size: 1.15rem; font-weight: 700; margin: 12px 0 0; }
.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.stat {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
}
.stat dt { color: var(--muted); font-size: 0.82rem; font-weight: 700; margin: 0 0 6px; }
.stat dd { margin: 0; font-size: 1.4rem; font-weight: 800; }
.tier-line { margin: 16px 0 0; color: var(--gold-2); font-weight: 600; }
.countdown-live {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--gold);
  margin: 8px 0 0;
}

.card-stage {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.card-preview {
  width: min(320px, 100%);
  aspect-ratio: 1080 / 1920;
  background: #120c0a;
  border-radius: 24px;
  border: 1px solid var(--line-strong);
  overflow: hidden;
  box-shadow: var(--shadow);
  margin-inline: auto;
}
#share-card-canvas { width: 100%; height: 100%; display: block; }
.theme-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.theme-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--cream);
  border-radius: 999px;
  padding: 8px 12px;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.88rem;
}
.theme-pill.is-active { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(228,184,106,0.25); }
.theme-pill.is-locked { opacity: 0.55; cursor: not-allowed; }
.theme-swatch {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--sw), var(--sw2));
}
.card-note { color: var(--muted); min-height: 1.4em; margin: 0; }

.pro-box {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
.price { font-size: 1.8rem; font-weight: 800; margin: 8px 0; color: var(--gold); }
.license-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; }
.license-form .field { flex: 1 1 220px; }
.status { margin: 10px 0 0; font-weight: 600; }
.status.is-ok { color: var(--ok); }
.status.is-error { color: var(--danger); }

.whatif-row {
  display: grid;
  grid-template-columns: 1.2fr 140px 1fr;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.whatif-name { font-weight: 700; }
.whatif-need, .whatif-gpa { color: var(--muted); font-size: 0.92rem; }
.whatif-row .whatif-need { grid-column: 1 / -1; }

.footer {
  border-top: 1px solid var(--line);
  padding: 36px 0 64px;
  color: var(--muted);
  font-size: 0.92rem;
}
.footer nav { display: flex; flex-wrap: wrap; gap: 14px; margin: 12px 0; }
.footer a { color: var(--cream); text-decoration: none; }
.footer a:hover { color: var(--gold); }

.seo-article { padding: 48px 0 24px; }
.seo-article h1 { font-size: clamp(2rem, 4vw, 3rem); margin: 0 0 12px; }
.seo-article h2 { margin: 28px 0 8px; }
.seo-article p, .seo-article li { color: var(--muted); }
.seo-article strong { color: var(--cream); }
.grade-table { width: 100%; border-collapse: collapse; margin: 16px 0 28px; }
.grade-table th, .grade-table td {
  text-align: start;
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
}
.grade-table th { color: var(--muted); font-size: 0.85rem; }

@media (max-width: 860px) {
  .hero, .results, .pro-box, .grid-2 { grid-template-columns: 1fr; }
  .hero { padding-top: 36px; }
  .course-head { display: none; }
  .course-row, .whatif-row { grid-template-columns: 1fr 1fr auto; }
  .field-name { grid-column: 1 / -1; }
  .nav .hide-sm { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
