:root {
  --ink: #26231F;
  --paper: #F8F4ED;
  --white: #FFFFFF;
  --tile: #EFE7DA;
  --muted: #6F675D;
  --hair: #E0D8C8;
  --y: #EBCB7D;
  --g: #9CCDA7;
  --b: #A7BFE6;
  --r: #E5A59F;
  --p: #C5B0E2;
  /* Lamplight night palette (Assets/Resources/PaletteNight.asset in the app) */
  --night-1: #26221D;
  --night-2: #1C1916;
  --cream: #EDE6DA;
  --gold: #E0BE6C;
  --ly: #E0BE6C;
  --lg: #8CBF98;
  --lb: #8EA5D6;
  --lr: #C97F78;
  --lp: #B3A2D6;
  --display: "Fraunces", "Iowan Old Style", Georgia, "Times New Roman", serif;
  --body: "Readex Pro", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

.wrap {
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ---------- Top bar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--paper);
  border-bottom: 1px solid var(--hair);
}

.topbar .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 64px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-family: var(--display);
  font-weight: 600;
  font-size: 23px;
  line-height: 1;
  white-space: nowrap;
}

.brand img {
  width: 34px;
  height: 34px;
  border-radius: 8px;
}

.right { display: flex; align-items: center; gap: 8px; }

.nav { display: flex; gap: 4px; }

.nav a {
  white-space: nowrap;
  text-decoration: none;
  font-weight: 500;
  font-size: 15px;
  padding: 7px 13px;
  border-radius: 999px;
}

.nav a:hover { background: var(--tile); }

.nav a.studio {
  color: var(--muted);
  padding-inline-end: 12px;
  margin-inline-end: 4px;
  border-inline-end: 1px solid var(--hair);
  border-radius: 0;
}

.nav a.studio:hover { background: none; color: var(--ink); }

.nav a[aria-current="page"] {
  background: var(--ink);
  color: var(--paper);
}

.donate {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  font-weight: 500;
  font-size: 15px;
  padding: 6px 13px;
  border: 1px solid var(--hair);
  border-radius: 999px;
}

.donate:hover { background: var(--tile); }

.donate svg { width: 15px; height: 15px; fill: #C8553D; }

/* Language menu */

.lang details { position: relative; }

.lang summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
  font-size: 14px;
  padding: 6px 11px;
  border: 1px solid var(--hair);
  border-radius: 999px;
}

.lang summary::-webkit-details-marker { display: none; }
.lang summary:hover, .lang details[open] summary { background: var(--tile); }

.lang .globe { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.lang .chev { width: 10px; height: 10px; fill: none; stroke: currentColor; stroke-width: 1.6; }

.lang ul {
  position: absolute;
  inset-inline-end: 0;
  top: calc(100% + 8px);
  margin: 0;
  padding: 6px;
  list-style: none;
  min-width: 150px;
  background: var(--white);
  border: 1px solid var(--hair);
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(38, 35, 31, 0.12);
}

.lang li a {
  display: block;
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 9px;
  font-size: 15px;
}

.lang li a:hover { background: var(--tile); }
.lang li a[aria-current] { font-weight: 700; background: var(--tile); }

/* ---------- Hero ---------- */

.hero {
  position: relative;
  overflow: hidden;
  color: var(--cream);
  background:
    radial-gradient(900px 420px at 80% 10%, rgba(224, 190, 108, 0.10), transparent 70%),
    linear-gradient(160deg, var(--night-1), var(--night-2));
}

.hero .wrap {
  position: relative;
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  align-items: center;
  gap: 40px;
  padding-top: 52px;
  padding-bottom: 56px;
}

.kicker {
  display: inline-block;
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold);
  border: 1px solid rgba(224, 190, 108, 0.45);
  padding: 4px 12px;
  border-radius: 999px;
}

.title {
  margin: 14px 0 0;
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(60px, 11vw, 112px);
  line-height: 1;
  letter-spacing: -0.01em;
  color: var(--cream);
}

.lede {
  max-width: 31em;
  margin: 20px 0 28px;
  font-size: 19px;
  color: rgba(237, 230, 218, 0.88);
}

.btn-row { display: flex; flex-wrap: wrap; gap: 12px; }

.btn {
  display: inline-block;
  text-decoration: none;
  font-weight: 600;
  font-size: 16px;
  padding: 12px 22px;
  border-radius: 14px;
  background: var(--ink);
  color: var(--paper);
  border: 1px solid var(--ink);
}

.hero .btn { background: var(--cream); border-color: var(--cream); color: var(--night-2); }
.hero .btn:hover { background: #F7F2E9; }

.btn.alt { background: transparent; color: inherit; border-color: currentColor; }
.hero .btn.alt { background: transparent; color: var(--cream); border-color: rgba(237, 230, 218, 0.5); }
.hero .btn.alt:hover { background: rgba(237, 230, 218, 0.08); }

.hero-art {
  position: relative;
  display: flex;
  justify-content: center;
  padding: 24px 0;
}

.hero-art img {
  position: relative;
  z-index: 1;
  width: min(280px, 64vw);
  aspect-ratio: 1;
  border-radius: 22.5%;
  box-shadow: 0 0 0 1px rgba(224, 190, 108, 0.25), 0 24px 60px rgba(0, 0, 0, 0.5), 0 0 80px rgba(224, 190, 108, 0.14);
}

.floaty {
  position: absolute;
  width: 46px;
  height: 46px;
  border-radius: 12px;
  opacity: 0.95;
}

.f1 { background: var(--ly); top: 4%; inset-inline-start: 10%; transform: rotate(-12deg); }
.f2 { background: var(--lg); bottom: 6%; inset-inline-start: 2%; transform: rotate(10deg); width: 34px; height: 34px; }
.f3 { background: var(--lb); top: 14%; inset-inline-end: 4%; transform: rotate(14deg); width: 38px; height: 38px; }
.f4 { background: var(--lr); bottom: 10%; inset-inline-end: 10%; transform: rotate(-8deg); }
.f5 { background: var(--lp); top: 52%; inset-inline-end: -2%; transform: rotate(6deg); width: 28px; height: 28px; }

/* ---------- Sections ---------- */

section { padding: 68px 0 8px; }
main > section:last-of-type { padding-bottom: 72px; }

h2 {
  margin: 0;
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(30px, 5vw, 40px);
  line-height: 1.15;
}

.sub { margin: 10px 0 30px; max-width: 38em; color: var(--muted); }

.card {
  background: var(--white);
  border: 1px solid var(--hair);
  border-radius: 20px;
  padding: 24px;
}

.card h3 {
  margin: 0 0 6px;
  font-family: var(--display);
  font-weight: 600;
  font-size: 21px;
  line-height: 1.25;
}

.card p { margin: 0; color: var(--muted); font-size: 16px; }

h2 + .features { margin-top: 28px; }
.ltr { direction: ltr; unicode-bidi: isolate; }

.features { display: grid; gap: 16px; grid-template-columns: repeat(3, 1fr); }

/* Features */

.features .card { padding: 22px; }

.ico {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  margin-bottom: 12px;
  border-radius: 12px;
  background: var(--tile);
}

.ico svg { width: 22px; height: 22px; fill: none; stroke: var(--ink); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* Screens */

.shots {
  display: flex;
  gap: 22px;
  padding: 6px 20px 20px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
}

/* Centred when it fits; when it overflows both ends stay reachable (justify-content: center would clip the first). */
.shots img:first-child { margin-inline-start: auto; }
.shots img:last-child { margin-inline-end: auto; }

.shots img {
  flex: 0 0 auto;
  width: 250px;
  height: auto;
  border-radius: 30px;
  border: 1px solid var(--hair);
  box-shadow: 0 14px 34px rgba(38, 35, 31, 0.14);
  scroll-snap-align: center;
}

/* Screenshots right under the hero */

.shots-top { padding-top: 36px; }
.shots-top .shots { padding-bottom: 8px; }

/* The two games */

.games { display: grid; gap: 16px; grid-template-columns: 1fr 1fr; }

.games .card { padding: 26px; border-top: 8px solid var(--c); }
.games .connect { --c: var(--y); }
.games .guess { --c: var(--g); }

.tag {
  display: inline-block;
  margin-bottom: 12px;
  padding: 2px 12px;
  border-radius: 999px;
  background: var(--c);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.games .card p + p { margin-top: 10px; }

/* Languages */

.chips { display: flex; flex-wrap: wrap; gap: 10px; margin: 0; padding: 0; list-style: none; }

.chips li {
  padding: 8px 18px;
  border: 1px solid var(--hair);
  border-radius: 999px;
  background: var(--white);
  font-weight: 500;
}

/* Download */

.store-row { display: flex; flex-wrap: wrap; gap: 14px; }

.store-btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 10px 22px 10px 18px;
  border-radius: 14px;
  background: var(--ink);
  color: var(--paper);
  opacity: 0.55;
  cursor: default;
}

a.store-btn { opacity: 1; cursor: pointer; text-decoration: none; }
a.store-btn:hover { opacity: 0.9; }

.store-btn svg { width: 28px; height: 28px; fill: currentColor; }
.store-btn span { display: flex; flex-direction: column; line-height: 1.15; }
.store-btn small { font-size: 12px; opacity: 0.8; }
.store-btn b { font-weight: 600; font-size: 18px; }

.soon {
  display: inline-block;
  margin-top: 16px;
  font-size: 15px;
  color: var(--muted);
}

/* FAQ */

.faq { display: grid; gap: 10px; max-width: 760px; }

.faq details {
  background: var(--white);
  border: 1px solid var(--hair);
  border-radius: 16px;
}

.faq summary {
  cursor: pointer;
  list-style: none;
  padding: 16px 52px 16px 20px;
  font-weight: 600;
  position: relative;
}

[dir="rtl"] .faq summary { padding: 16px 20px 16px 52px; }

.faq summary::-webkit-details-marker { display: none; }

.faq summary::after {
  content: "+";
  position: absolute;
  inset-inline-end: 20px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--display);
  font-size: 24px;
  line-height: 1;
  color: var(--muted);
}

.faq details[open] summary::after { content: "\2212"; }

.faq .answer { padding: 0 20px 16px; }
.faq .answer p { margin: 0; color: var(--muted); font-size: 16px; }

/* Contact */

.contact {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  padding: 30px 32px;
  border-radius: 24px;
  color: var(--cream);
  background: linear-gradient(160deg, var(--night-1), var(--night-2));
}

.contact h2 { color: var(--cream); font-size: 30px; }
.contact p { margin: 6px 0 0; color: rgba(237, 230, 218, 0.85); max-width: 30em; }
.contact .btn { background: var(--cream); border-color: var(--cream); color: var(--night-2); }

/* Contact form (sent by /forms.js to /api/contact) */
.contact .or-mail { margin-top: 12px; }
.or-mail a { color: var(--cream); font-weight: 600; overflow-wrap: anywhere; text-underline-offset: 4px; }
.contact-form { flex: 1 1 100%; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.contact-form .wide, .contact-form .form-end { grid-column: 1 / -1; }
.contact-form label { display: grid; gap: 6px; font-weight: 600; font-size: 15px; }
.contact-form input, .contact-form textarea { font: 400 16px/1.4 inherit; color: var(--ink); background: var(--white); border: 1px solid var(--cream); border-radius: 12px; padding: 11px 14px; width: 100%; min-width: 0; }
.contact-form textarea { resize: vertical; min-height: 120px; }
.contact-form input:focus-visible, .contact-form textarea:focus-visible { outline: 3px solid var(--cream); outline-offset: 2px; }
.contact-form button.btn { cursor: pointer; }
.contact-form button.btn:disabled { opacity: .6; cursor: wait; }
.form-end { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; }
.contact .form-status { margin: 0; font-weight: 600; font-size: 15px; }
.form-status:empty { display: none; }
.hp { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@media (max-width: 560px) { .contact-form { grid-template-columns: minmax(0, 1fr); } }

/* Footer */

footer { margin-top: 24px; border-top: 1px solid var(--hair); font-size: 15px; color: var(--muted); }

footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px 24px; padding-top: 22px; padding-bottom: 28px; }
footer nav { display: flex; flex-wrap: wrap; gap: 6px 20px; }
footer a { text-decoration: none; }
footer a:hover { color: var(--ink); text-decoration: underline; }

/* ---------- Privacy page ---------- */

.page-head {
  position: relative;
  overflow: hidden;
  color: var(--cream);
  background: linear-gradient(160deg, var(--night-1), var(--night-2));
}

.page-head .wrap { padding-top: 48px; padding-bottom: 52px; }

.page-head h1 {
  margin: 12px 0 0;
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(38px, 7vw, 58px);
  line-height: 1.1;
  color: var(--cream);
}

.updated { margin: 10px 0 0; color: rgba(237, 230, 218, 0.75); font-size: 15px; }

.summary-card { margin-top: 36px; }
.summary-card ul { margin: 8px 0 0; padding-inline-start: 22px; }
.summary-card li { margin: 4px 0; }

.policy { max-width: 760px; padding-bottom: 36px; }

.policy h2 {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 40px 0 10px;
  font-size: 26px;
}

.policy h2 .num {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  font-size: 16px;
  line-height: 1;
}

.policy p, .policy li { color: #3B362F; }
.policy ul { padding-inline-start: 22px; }
.policy a { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Right to left (Arabic) ---------- */

[dir="rtl"] .kicker { letter-spacing: 0; }
[dir="rtl"] .brand,
[dir="rtl"] .title { direction: ltr; }
[dir="rtl"] h2,
[dir="rtl"] .card h3,
[dir="rtl"] .page-head h1 { line-height: 1.4; font-family: var(--body); font-weight: 700; }
[dir="rtl"] body { line-height: 1.85; }
[dir="rtl"] .lede { max-width: 28em; }

/* ---------- Narrow screens ---------- */

@media (max-width: 760px) {
  body { font-size: 16px; }
  .nav a.studio, .nav a.home { display: none; }
  .donate span { display: none; }
  .donate { padding: 6px 9px; }
  .hero .wrap { grid-template-columns: 1fr; gap: 8px; padding-top: 24px; padding-bottom: 30px; }
  .hero-art { order: -1; padding: 8px 0 14px; justify-content: flex-start; }
  .hero-art img { width: 96px; border-radius: 22px; }
  .floaty { display: none; }
  .features, .games { grid-template-columns: 1fr; }
  section { padding-top: 52px; }
  .shots-top { padding-top: 24px; }
}

@media (max-width: 480px) {
  .donate { display: none; }
  .topbar .wrap { gap: 6px; }
  .right { gap: 2px; }
  .nav { gap: 0; }
  .nav a { padding: 6px 7px; font-size: 14px; }
  .brand { font-size: 18px; gap: 7px; }
  .brand img { width: 28px; height: 28px; border-radius: 7px; }
  .lang summary { padding: 5px 8px; gap: 4px; }
  .contact { padding: 24px 20px; }
}
