/* AL SAADI — tablet kiosk. One visual world: royal-blue velvet + gold foil. */
:root {
  --velvet: #0c1b58;
  --velvet-deep: #071037;
  --velvet-raised: #16287a;
  --gold: #d7b262;
  --gold-hi: #f3dea2;
  --gold-lo: #9c7632;
  --ivory: #f5efe0;
  --plinth: #f3ede0;
  --muted: #aeb6d8;
  --line: rgba(215, 178, 98, 0.32);
  --foil: linear-gradient(100deg, #a8803a 0%, #f2dc9c 32%, #c89c4c 52%, #f6e3ac 74%, #b08638 100%);
  --ff-display-ar: "Amiri", "Noto Naskh Arabic", "Times New Roman", serif;
  --ff-display-en: "Cormorant Garamond", "Amiri", Georgia, serif;
  --ff-body-ar: "Tajawal", "Segoe UI", Tahoma, sans-serif;
  --ff-body-en: "Jost", "Tajawal", "Segoe UI", sans-serif;
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--velvet-deep);
  color: var(--ivory);
  font-family: var(--ff-body-ar);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}
html[lang="en"] body { font-family: var(--ff-body-en); }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--gold-hi); outline-offset: 3px; }

/* ---------- velvet stage ---------- */
.stage {
  position: fixed; inset: 0;
  display: flex; flex-direction: column;
  padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
  background:
    radial-gradient(120% 80% at 50% 0%, rgba(40, 64, 170, .55), transparent 60%),
    radial-gradient(90% 70% at 15% 100%, rgba(5, 10, 40, .9), transparent 70%),
    radial-gradient(70% 60% at 90% 80%, rgba(28, 46, 140, .5), transparent 70%),
    var(--velvet);
  overflow: hidden;
}
.stage::before {
  /* velvet nap */
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .38; mix-blend-mode: soft-light;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .5 0 0 0 0 .55 0 0 0 0 .9 0 0 0 .9 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.stage::after {
  /* soft light pools, like fabric folds */
  content: ""; position: absolute; inset: -20%; pointer-events: none; opacity: .5;
  background:
    radial-gradient(40% 25% at 30% 30%, rgba(90, 120, 230, .18), transparent 70%),
    radial-gradient(35% 30% at 75% 60%, rgba(0, 0, 0, .35), transparent 70%);
  animation: folds 26s ease-in-out infinite alternate;
}
@keyframes folds { to { transform: translate3d(4%, -3%, 0) rotate(4deg); } }

.topbar {
  position: relative; z-index: 2;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 18px clamp(16px, 4vw, 44px) 0;
  min-height: 64px;
}
.brandmark { display: flex; align-items: center; gap: 12px; }
.brandmark svg { width: 38px; height: 38px; }
.brandmark .wm { white-space: nowrap; display: flex; flex-direction: column; line-height: 1; direction: ltr; }
.brandmark .wm b { font-family: var(--ff-display-en); font-weight: 600; font-size: 19px; letter-spacing: .12em; background: var(--foil); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brandmark .wm small { font-family: var(--ff-body-en); font-size: 9.5px; letter-spacing: .42em; color: var(--gold); margin-top: 4px; }
.top-actions { display: flex; gap: 8px; align-items: center; }
.chip-btn {
  border: 1px solid var(--line); border-radius: 999px; padding: 9px 16px; font-size: 15px; color: var(--gold-hi);
  background: rgba(7, 16, 55, .35); backdrop-filter: blur(6px); display: inline-flex; align-items: center; gap: 8px;
}
.chip-btn svg { width: 18px; height: 18px; }
.chip-btn:active { transform: scale(.97); }

.screen {
  position: relative; z-index: 1; flex: 1; min-height: 0;
  display: flex; flex-direction: column;
  padding: 0 clamp(16px, 5vw, 64px);
  overflow-y: auto; overflow-x: hidden;
  animation: enter .55s var(--ease) both;
}
.screen.leaving { animation: leave .28s ease-in both; }
@keyframes enter { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes leave { to { opacity: 0; transform: translateY(-10px); } }

.foil { background: var(--foil); background-size: 200% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; }
.display { font-family: var(--ff-display-ar); font-weight: 700; line-height: 1.25; text-wrap: balance; margin: 0; }
html[lang="en"] .display { font-family: var(--ff-display-en); font-weight: 600; letter-spacing: .01em; line-height: 1.1; }
.eyebrow { font-family: var(--ff-body-en); font-size: 12px; letter-spacing: .38em; text-transform: uppercase; color: var(--gold); direction: ltr; }
.lede { color: var(--muted); font-size: clamp(17px, 2.1vw, 21px); line-height: 1.75; max-width: 34em; margin: 0; text-wrap: pretty; }

.btn-gold {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 12px;
  min-height: 64px; padding: 0 44px; border-radius: 999px;
  font-size: 21px; font-weight: 700; color: #1a1406;
  background: var(--foil); background-size: 180% 100%;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .35), inset 0 1px 0 rgba(255, 255, 255, .55), inset 0 -2px 0 rgba(90, 60, 10, .35);
  transition: transform .15s var(--ease), background-position .8s var(--ease);
}
.btn-gold:hover { background-position: 100% 0; }
.btn-gold:active { transform: scale(.97); }
.btn-gold svg { width: 22px; height: 22px; }
html[dir="rtl"] .btn-gold .arrow { transform: scaleX(-1); }
.btn-ghost { min-height: 56px; padding: 0 26px; border-radius: 999px; border: 1px solid var(--line); color: var(--gold-hi); font-size: 18px; }
.btn-ghost:active { transform: scale(.97); }

/* ---------- welcome ---------- */
.welcome { align-items: center; justify-content: center; text-align: center; gap: 22px; padding-bottom: 6vh; }
.welcome .emblem { width: clamp(120px, 20vmin, 190px); height: auto; filter: drop-shadow(0 12px 28px rgba(0, 0, 0, .45)); }
.welcome .emblem .draw { stroke-dasharray: 100; stroke-dashoffset: 100; animation: draw 1.8s var(--ease) .15s forwards; }
.welcome .emblem .draw.d2 { animation-delay: .45s; }
.welcome .emblem .draw.d3 { animation-delay: .75s; }
.welcome .emblem .letter { opacity: 0; animation: fadeUp .9s var(--ease) 1.1s forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.welcome h1 { font-size: clamp(44px, 7.6vw, 86px); }
.welcome .lede { text-align: center; }
.welcome .cta { margin-top: 8px; }
.welcome .facts { display: flex; gap: 12px 28px; flex-wrap: wrap; justify-content: center; color: var(--gold); font-size: 15px; margin-top: 6px; }
.welcome .facts span { display: inline-flex; align-items: center; gap: 8px; }
.welcome .facts svg { width: 18px; height: 18px; }
.shimmer { animation: shimmer 5s ease-in-out infinite; }
@keyframes shimmer { 0%, 100% { background-position: 0 0; } 50% { background-position: 100% 0; } }

/* ---------- name / mode ---------- */
.ask { justify-content: center; align-items: center; text-align: center; gap: 26px; padding-bottom: 8vh; }
.ask .hello { color: var(--gold); font-size: 22px; min-height: 1.4em; }
.ask h2 { font-size: clamp(36px, 5.6vw, 60px); }
.name-input {
  width: min(560px, 100%); min-height: 76px; padding: 0 26px; border-radius: 20px;
  background: rgba(5, 12, 45, .55); border: 1px solid var(--line); color: var(--ivory);
  font: 500 clamp(24px, 3.2vw, 32px) var(--ff-body-ar); text-align: center; user-select: text; -webkit-user-select: text;
}
html[lang="en"] .name-input { font-family: var(--ff-body-en); }
.name-input::placeholder { color: rgba(174, 182, 216, .55); }
.row { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; align-items: center; }
.mode-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(14px, 2.4vw, 26px); width: min(820px, 100%); }
.mode-card {
  display: flex; flex-direction: column; align-items: center; gap: 12px; padding: clamp(24px, 4vw, 40px) 18px;
  border-radius: 26px; border: 1px solid var(--line);
  background: linear-gradient(160deg, rgba(34, 56, 160, .55), rgba(8, 16, 60, .65));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06), 0 16px 40px rgba(0, 0, 0, .3);
  transition: transform .18s var(--ease), border-color .2s;
}
.mode-card svg { width: clamp(48px, 7vw, 68px); height: clamp(48px, 7vw, 68px); color: var(--gold); }
.mode-card b { font-family: var(--ff-display-ar); font-size: clamp(28px, 3.8vw, 40px); }
html[lang="en"] .mode-card b { font-family: var(--ff-display-en); }
.mode-card span { color: var(--muted); font-size: 17px; }
.mode-card:active { transform: scale(.97); border-color: var(--gold); }

/* ---------- question ---------- */
.quiz { gap: clamp(16px, 3vh, 30px); padding-top: clamp(8px, 2vh, 24px); padding-bottom: 28px; }
.progress { display: flex; align-items: center; gap: 16px; }
.progress .track { flex: 1; height: 2px; background: rgba(215, 178, 98, .18); border-radius: 2px; overflow: hidden; }
.progress .fill { height: 100%; background: var(--foil); border-radius: 2px; transition: width .6s var(--ease); }
.progress .count { font-variant-numeric: tabular-nums; color: var(--gold); font-size: 17px; min-width: 4.5em; text-align: center; }
.progress .back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 16px; padding: 10px 4px; }
.progress .back svg { width: 20px; height: 20px; }
html[dir="rtl"] .progress .back svg { transform: scaleX(-1); }
.qhead { display: flex; flex-direction: column; gap: 10px; margin-top: clamp(4px, 2vh, 18px); }
.qhead .kind { color: var(--gold); font-size: 15px; letter-spacing: .04em; }
html[lang="en"] .qhead .kind { letter-spacing: .28em; text-transform: uppercase; font-size: 12px; }
.qhead h2 { font-size: clamp(34px, 5vw, 56px); max-width: 18em; }
.options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(12px, 2vw, 20px); margin-top: auto; margin-bottom: auto; }
.options.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.opt {
  position: relative; display: flex; align-items: center; gap: 18px; text-align: start;
  min-height: clamp(96px, 14vh, 132px); padding: 18px clamp(18px, 2.4vw, 28px);
  border-radius: 22px; border: 1px solid rgba(215, 178, 98, .22);
  background: linear-gradient(165deg, rgba(30, 50, 150, .5), rgba(8, 16, 62, .62));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05), 0 10px 26px rgba(0, 0, 0, .22);
  font-size: clamp(19px, 2.3vw, 24px); font-weight: 500; line-height: 1.4;
  transition: transform .16s var(--ease), border-color .2s, background .25s;
}
.opt .ic { flex: none; width: clamp(48px, 6vw, 60px); height: clamp(48px, 6vw, 60px); border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--line); color: var(--gold); background: rgba(7, 16, 55, .45); }
.opt .ic svg { width: 58%; height: 58%; }
.opt .sw { flex: none; width: clamp(48px, 6vw, 60px); height: clamp(48px, 6vw, 60px); border-radius: 50%; border: 1px solid rgba(255, 255, 255, .25); box-shadow: inset 0 2px 6px rgba(0,0,0,.25); }
.opt:active { transform: scale(.975); }
.opt.chosen { border-color: var(--gold); background: linear-gradient(165deg, rgba(215, 178, 98, .28), rgba(20, 34, 110, .7)); }
.opt.chosen .ic { background: var(--foil); color: #20180a; border-color: transparent; }
.opt.was { border-color: rgba(215, 178, 98, .6); }

/* ---------- analysing ---------- */
.analyse { align-items: center; justify-content: center; text-align: center; gap: 28px; padding-bottom: 8vh; }
.analyse .emblem { width: clamp(130px, 22vmin, 200px); height: auto; }
.analyse .emblem .draw { stroke-dasharray: 100; stroke-dashoffset: 100; animation: draw 2.2s var(--ease) infinite alternate; }
.analyse .emblem .draw.d2 { animation-delay: .3s; }
.analyse .emblem .draw.d3 { animation-delay: .6s; }
.analyse .emblem .letter { animation: pulse 2.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .45; } }
.analyse .line { font-family: var(--ff-display-ar); font-size: clamp(26px, 3.6vw, 38px); min-height: 1.6em; }
html[lang="en"] .analyse .line { font-family: var(--ff-display-en); font-style: italic; }
.analyse .line span { display: inline-block; animation: enter .6s var(--ease) both; }
.analyse .dots { display: flex; gap: 10px; }
.analyse .dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); opacity: .25; animation: dot 1.2s infinite; }
.analyse .dots i:nth-child(2) { animation-delay: .2s; }
.analyse .dots i:nth-child(3) { animation-delay: .4s; }
@keyframes dot { 40% { opacity: 1; transform: translateY(-3px); } }

/* ---------- result ---------- */
.result { gap: 22px; padding-top: 10px; padding-bottom: 32px; }
.persona { display: flex; flex-direction: column; gap: 8px; max-width: 46em; }
.persona .for { color: var(--gold); font-size: 18px; }
.persona h2 { font-size: clamp(40px, 6.2vw, 72px); }
.persona p { color: var(--ivory); opacity: .92; font-size: clamp(18px, 2.2vw, 22px); line-height: 1.8; margin: 0; max-width: 36em; text-wrap: pretty; }
.res-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); gap: clamp(16px, 2.4vw, 26px); align-items: start; }
.hero-card {
  display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: clamp(16px, 2.4vw, 28px);
  padding: clamp(16px, 2.4vw, 26px); border-radius: 28px;
  background: linear-gradient(160deg, rgba(38, 60, 170, .55), rgba(6, 13, 52, .8));
  border: 1px solid var(--line);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .38), inset 0 1px 0 rgba(255, 255, 255, .07);
}
.plinth {
  position: relative; border-radius: 20px; background: radial-gradient(90% 70% at 50% 35%, #fffdf7, var(--plinth) 70%, #e6dcc6);
  aspect-ratio: 3 / 4; overflow: hidden; display: grid; place-items: center; max-width: 100%;
  box-shadow: inset 0 -18px 30px rgba(120, 90, 40, .12);
}
.hero-card .plinth { max-height: min(52vh, 440px); }
.plinth img { width: 92%; height: 92%; object-fit: contain; mix-blend-mode: multiply; }
.plinth img.photo { width: 100%; height: 100%; object-fit: cover; mix-blend-mode: normal; }
.plinth .ph { width: 70%; height: 80%; }
.plinth .badge { position: absolute; top: 12px; inset-inline-start: 12px; padding: 6px 12px; border-radius: 999px; background: #0c1b58; color: var(--gold-hi); font-size: 13px; font-weight: 700; }
.hero-info { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.hero-info .brand { font-family: var(--ff-body-en); letter-spacing: .3em; text-transform: uppercase; font-size: 13px; color: var(--gold); direction: ltr; text-align: start; }
html[dir="rtl"] .hero-info .brand { text-align: right; }
.hero-info h3 { margin: 0; font-family: var(--ff-display-en); font-weight: 600; font-size: clamp(30px, 3.8vw, 46px); line-height: 1.05; direction: ltr; }
html[dir="rtl"] .hero-info h3 { text-align: right; }
.hero-info .ar-name { font-family: var(--ff-display-ar); font-size: clamp(20px, 2.4vw, 26px); color: var(--gold-hi); margin-top: -4px; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag { padding: 6px 12px; border-radius: 999px; font-size: 14px; border: 1px solid var(--line); color: var(--gold-hi); background: rgba(7, 16, 55, .4); }
.meter { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 14px; }
.meter i { width: 16px; height: 5px; border-radius: 3px; background: rgba(215, 178, 98, .2); }
.meter i.on { background: var(--foil); }
.notes-line { font-size: 16px; color: var(--muted); line-height: 1.7; }
.notes-line b { color: var(--gold); font-weight: 500; }
.why { margin-top: 4px; padding: 14px 16px; border-radius: 16px; background: rgba(215, 178, 98, .09); border: 1px solid rgba(215, 178, 98, .2); font-size: clamp(17px, 1.9vw, 19px); line-height: 1.75; }
.why b { display: block; color: var(--gold); font-size: 14px; font-weight: 500; margin-bottom: 4px; }
.alts { display: flex; flex-direction: column; gap: 14px; }
.alts > .label { color: var(--gold); font-size: 16px; }
.alt { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 14px; align-items: center; padding: 12px; border-radius: 20px; border: 1px solid rgba(215, 178, 98, .2); background: rgba(7, 16, 55, .45); }
.alt .plinth { aspect-ratio: 3 / 4; border-radius: 14px; }
.alt .brand { font-family: var(--ff-body-en); letter-spacing: .24em; text-transform: uppercase; font-size: 11px; color: var(--gold); direction: ltr; }
html[dir="rtl"] .alt .brand { text-align: right; }
.alt h4 { margin: 2px 0 0; font-family: var(--ff-display-en); font-weight: 600; font-size: 23px; line-height: 1.1; direction: ltr; }
html[dir="rtl"] .alt h4 { text-align: right; }
.alt .ar-name { font-family: var(--ff-display-ar); color: var(--gold-hi); font-size: 17px; }
.alt p { margin: 6px 0 0; color: var(--muted); font-size: 15px; line-height: 1.6; }
.res-foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding-top: 6px; border-top: 1px solid rgba(215, 178, 98, .16); }
.res-foot .ask-staff { display: flex; align-items: center; gap: 12px; color: var(--gold-hi); font-size: 17px; }
.res-foot .ask-staff svg { width: 26px; height: 26px; color: var(--gold); flex: none; }
.countdown { color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }

.notice { align-items: center; justify-content: center; text-align: center; gap: 18px; }
.notice h2 { font-size: clamp(30px, 4vw, 44px); }

@media (max-width: 1000px) {
  .res-grid { grid-template-columns: minmax(0, 1fr); }
  .alts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .alts > .label { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  .hero-card { grid-template-columns: minmax(0, 1fr); }
  .hero-card .plinth { width: min(260px, 100%); justify-self: center; }
  .alts { display: flex; }
}
@media (max-width: 560px) {
  .options, .options.three { grid-template-columns: minmax(0, 1fr); }
  .opt { min-height: 78px; }
  .brandmark .wm small { display: none; }
  .brandmark .wm b { font-size: 16px; }
  .chip-btn { padding: 8px 12px; font-size: 14px; }
  .chip-btn .txt { display: none; }
  .mode-grid { grid-template-columns: minmax(0, 1fr); }
  .alt { grid-template-columns: 76px minmax(0, 1fr); }
}
@media (max-height: 620px) and (min-width: 700px) {
  .opt { min-height: 78px; }
  .qhead h2 { font-size: 32px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .welcome .emblem .draw, .analyse .emblem .draw { stroke-dashoffset: 0; }
  .welcome .emblem .letter { opacity: 1; }
}
