:root {
  --bg: #f6f4ff;
  --surface: #ffffff;
  --surface-2: #f2effd;
  --text: #1d1838;
  --muted: #6b6790;
  --line: #e6e1f7;
  --c1: #6d4aff; --c2: #a34cff; --c3: #13b6a4;   /* set by the admin (Appearance) */
  --brand: var(--c1);
  --brand-2: var(--c3);
  --grad: linear-gradient(135deg, var(--c1) 0%, var(--c2) 50%, var(--c3) 100%);
  --err: #d92d4b;
  --err-bg: #fdecef;
  --ok: #13a07f;
  --tg: #2aa3e0;
  --shadow: 0 18px 40px -18px rgba(60, 40, 160, .35), 0 2px 8px rgba(60, 40, 160, .06);
  --radius: 26px;
  --font: "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f0d1c; --surface: #1a1730; --surface-2: #241f40; --text: #efeefe; --muted: #a6a2c6;
    --line: #2f2a4d; --brand: color-mix(in srgb, var(--c1) 72%, #fff); --brand-2: color-mix(in srgb, var(--c3) 85%, #fff); --err: #ff6b85; --err-bg: #3a1622;
    --shadow: 0 18px 40px -18px rgba(0, 0, 0, .7), 0 2px 8px rgba(0, 0, 0, .3);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--text);
  font: 17px/1.5 var(--font); overflow-x: hidden;
}
[dir="rtl"] body { --font: "Cairo", "Nunito", system-ui, sans-serif; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; }

/* soft colourful background */
.bg-blobs { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.bg-blobs i { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .45; }
.bg-blobs i:nth-child(1) { width: 380px; height: 380px; background: var(--c2); top: -140px; left: -120px; }
.bg-blobs i:nth-child(2) { width: 320px; height: 320px; background: var(--c3); top: 280px; right: -160px; }
.bg-blobs i:nth-child(3) { width: 300px; height: 300px; background: #ffb86b; bottom: -120px; left: 10%; opacity: .25; }
@media (prefers-color-scheme: dark) { .bg-blobs i { opacity: .25; } }

/* header */
.top { display: flex; align-items: center; justify-content: space-between; max-width: 640px; margin: 0 auto; padding: 14px 16px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); font-weight: 900; font-size: 1.3rem; letter-spacing: -.01em; }
.lang-btn {
  display: flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 99px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); font-weight: 700; font-size: .9rem; box-shadow: var(--shadow);
}

main { max-width: 640px; margin: 0 auto; padding: 0 16px; }

/* hero */
.hero { text-align: center; padding: 18px 0 8px; }
.demo-badge { display: inline-block; margin-bottom: 10px; padding: 3px 12px; border-radius: 99px; background: #fff1d6; color: #9a4a00; font-size: .8rem; font-weight: 800; }
h1 {
  margin: 0; font-size: clamp(1.9rem, 7vw, 2.7rem); line-height: 1.15; font-weight: 900; letter-spacing: -.02em;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-sub { margin: 12px auto 16px; max-width: 30em; color: var(--muted); font-size: 1.05rem; }
.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.chip { padding: 6px 14px; border-radius: 99px; background: var(--surface); border: 1px solid var(--line); font-size: .92rem; box-shadow: var(--shadow); }
.hero-art { display: block; width: 100%; max-width: 420px; margin: 18px auto 0; overflow: visible; }
.art-card { fill: var(--surface); stroke: var(--line); stroke-width: 2; }
.art-screen { fill: var(--surface-2); }
.art-line { fill: var(--line); }
.art-bubble { fill: var(--surface); stroke: var(--line); stroke-width: 2; }
.art-bubble-text { font: 900 18px var(--font); fill: var(--brand); }
.art-dot { fill: var(--surface); stroke: var(--line); stroke-width: 2; }
.letters text { fill: var(--brand); font-family: var(--font); }
.cycle text { font-family: "Nunito", "Cairo", sans-serif; opacity: 0; animation: cycle 10s infinite; }
.cycle text:nth-child(2) { animation-delay: 2s; }
.cycle text:nth-child(3) { animation-delay: 4s; }
.cycle text:nth-child(4) { animation-delay: 6s; }
.cycle text:nth-child(5) { animation-delay: 8s; }
@keyframes cycle { 0% { opacity: 0; transform: translateY(6px); } 4%, 18% { opacity: 1; transform: none; } 22%, 100% { opacity: 0; transform: translateY(-6px); } }
.cycle text { transform-box: fill-box; }
.waves path { stroke-dasharray: 60; animation: wave 1.8s ease-in-out infinite; }
.waves path:nth-child(2) { animation-delay: .2s; }
.waves path:nth-child(3) { animation-delay: .4s; }
@keyframes wave { 0%, 100% { opacity: .25; } 50% { opacity: 1; } }
.float-a { animation: float 5s ease-in-out infinite; }
.float-b { animation: float 6s ease-in-out infinite .8s; }
.float-c { animation: float 4.5s ease-in-out infinite 1.6s; }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }

/* wizard panel */
.panel {
  position: relative; margin: 22px 0; padding: 22px 18px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); scroll-margin-top: 12px;
}
.stepper { display: flex; justify-content: space-between; gap: 6px; list-style: none; margin: 0 0 20px; padding: 0; counter-reset: s; }
.stepper li { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: .82rem; font-weight: 700; color: var(--muted); position: relative; }
.stepper li:not(:last-child)::after {
  content: ""; position: absolute; top: 16px; inset-inline-start: calc(50% + 22px); width: calc(100% - 44px); height: 3px; border-radius: 3px; background: var(--line);
}
.stepper li.done:not(:last-child)::after { background: var(--brand-2); }
.stepper .dot {
  width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%;
  background: var(--surface-2); color: var(--muted); font-weight: 900; transition: .3s;
}
.stepper li.active { color: var(--text); }
.stepper li.active .dot { background: var(--grad); color: #fff; box-shadow: 0 6px 16px -6px var(--brand); transform: scale(1.1); }
.stepper li.done .dot { background: var(--brand-2); color: #fff; font-size: 0; }
.stepper li.done .dot::before { content: "✓"; font-size: 1rem; }

.screen { animation: slide .35s ease; }
@keyframes slide { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.screen-title { margin: 0 0 14px; text-align: center; font-size: 1.25rem; font-weight: 800; }

/* drop zone */
.drop {
  display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; cursor: pointer;
  padding: 34px 16px; border-radius: 22px; border: 2.5px dashed color-mix(in srgb, var(--brand) 40%, var(--line));
  background: linear-gradient(180deg, var(--surface-2), transparent); transition: .2s;
}
.drop:hover, .drop.over { border-color: var(--brand); transform: scale(1.01); }
.drop input { display: none; }
.drop-icon { animation: bounce 2.2s ease-in-out infinite; filter: drop-shadow(0 10px 14px rgba(109, 74, 255, .35)); }
@keyframes bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
.drop-title { font-size: 1.3rem; font-weight: 900; }
.drop-hint { color: var(--muted); font-size: .9rem; }

/* video + photo overlay: the wrapper hugs the video so the photo sits on the picture, not on black bars */
.video-wrap { position: relative; width: fit-content; max-width: 100%; margin: 0 auto; line-height: 0; }
.video-wrap video { display: block; width: auto; max-width: 100%; border-radius: 18px; background: #000; }
.picked .video-wrap video { max-height: 50vh; min-width: 200px; }
.ov {
  position: absolute; width: 22%; aspect-ratio: 1; margin: 4%; border-radius: 50%; pointer-events: none;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, .45)); animation: pop .35s ease;
}
.ov[data-pos="tl"] { top: 0; left: 0; }
.ov[data-pos="tr"] { top: 0; right: 0; }
.ov[data-pos="bl"] { bottom: 14%; left: 0; }
.ov[data-pos="br"] { bottom: 14%; right: 0; }
@keyframes pop { from { transform: scale(.6); opacity: 0; } to { transform: none; opacity: 1; } }

/* "Add your photo" card */
.photo-card { margin-top: 14px; padding: 14px; border-radius: 20px; background: var(--surface-2); border: 2px solid transparent; transition: .2s; }
.photo-card.has { border-color: color-mix(in srgb, var(--brand) 35%, var(--line)); background: color-mix(in srgb, var(--brand) 8%, var(--surface)); }
.photo-row { display: flex; align-items: center; gap: 14px; cursor: pointer; }
.photo-circle {
  position: relative; flex: none; width: 72px; height: 72px; border-radius: 50%; padding: 0; cursor: pointer;
  display: grid; place-items: center; color: var(--brand);
  border: 2.5px dashed color-mix(in srgb, var(--brand) 50%, var(--line)); background: var(--surface);
}
.photo-card.has .photo-circle { border: 3px solid #fff; box-shadow: 0 0 0 2.5px var(--brand), 0 8px 18px -8px var(--brand); }
.photo-circle img { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.photo-plus {
  position: absolute; bottom: -2px; inset-inline-end: -2px; width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center; background: var(--grad); color: #fff; font-weight: 900; font-size: 1.1rem; line-height: 1;
  border: 2px solid var(--surface);
}
.photo-card.has .photo-plus { font-size: .75rem; }
.photo-text { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; }
.photo-text b { font-size: 1.1rem; font-weight: 900; }
.photo-text small { color: var(--muted); font-size: .88rem; line-height: 1.35; }
.small-link { padding: 4px 0 0; font-size: .9rem; color: var(--err); }
.pos-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); font-weight: 800; }
.pos-picker {
  position: relative; width: 120px; height: 70px; flex: none; border-radius: 12px; background: #1d1838;
  display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; padding: 5px; gap: 4px;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .08);
}
.pos-picker button { display: grid; border: 0; padding: 0; background: transparent; cursor: pointer; border-radius: 8px; }
.pos-picker button::before {
  content: ""; width: 20px; height: 20px; border-radius: 50%; border: 2px dashed rgba(255, 255, 255, .45);
  background-size: cover; background-position: center; transition: .2s;
}
.pos-picker [data-pos="tl"]::before { justify-self: start; align-self: start; }
.pos-picker [data-pos="tr"]::before { justify-self: end; align-self: start; }
.pos-picker [data-pos="bl"]::before { justify-self: start; align-self: end; }
.pos-picker [data-pos="br"]::before { justify-self: end; align-self: end; }
.pos-picker button.sel::before { width: 26px; height: 26px; border: 2px solid #fff; background-image: var(--ph); box-shadow: 0 0 0 2px var(--brand-2); }
.pos-picker button:hover:not(.sel)::before { border-color: #fff; }
.picked-meta { display: flex; align-items: center; gap: 10px; margin-top: 10px; padding: 10px 12px; border-radius: 16px; background: var(--surface-2); }
.picked-meta > span { font-size: 1.5rem; }
.picked-meta div { flex: 1; min-width: 0; }
.picked-meta b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.picked-meta small { color: var(--muted); }
.link { background: none; border: 0; color: var(--brand); font-weight: 800; cursor: pointer; padding: 6px; white-space: nowrap; }

/* buttons */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 56px; margin-top: 14px;
  padding: 12px 18px; border: 0; border-radius: 18px; font-weight: 800; font-size: 1.05rem; cursor: pointer; text-decoration: none; transition: transform .15s, box-shadow .15s, opacity .2s;
}
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--grad); background-size: 150% 150%; color: #fff; box-shadow: 0 12px 24px -12px var(--brand); }
.btn.primary:not(:disabled):hover { box-shadow: 0 16px 30px -12px var(--brand); }
.btn.big { min-height: 64px; font-size: 1.15rem; animation: shimmer 4s ease infinite; }
@keyframes shimmer { 0%, 100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }
.btn.ghost { background: transparent; color: var(--muted); min-height: 48px; margin-top: 6px; }
.btn:disabled { opacity: .4; cursor: not-allowed; box-shadow: none; }
[dir="rtl"] .arrow { display: inline-block; transform: scaleX(-1); }

/* language pair */
.lang-pair { position: relative; display: grid; gap: 10px; }
.lang-pick {
  display: block; width: 100%; text-align: start; cursor: pointer; padding: 14px 18px; border-radius: 20px;
  border: 2px solid var(--line); background: var(--surface-2); transition: .2s;
}
.lang-pick:hover { border-color: var(--brand); }
.lang-pick.to { background: color-mix(in srgb, var(--brand) 10%, var(--surface)); border-color: color-mix(in srgb, var(--brand) 35%, var(--line)); }
.lang-pick small { color: var(--muted); font-weight: 700; font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; }
.lp-row { display: flex; align-items: center; gap: 12px; margin-top: 2px; }
.lp-row b { flex: 1; font-size: 1.25rem; font-weight: 900; }
.flag { font-size: 2rem; line-height: 1; }
.chev { color: var(--muted); }
.swap {
  position: absolute; top: 50%; inset-inline-end: 22px; transform: translateY(-50%); z-index: 2;
  width: 46px; height: 46px; display: grid; place-items: center; border-radius: 50%; cursor: pointer;
  border: 3px solid var(--surface); background: var(--grad); color: #fff; box-shadow: var(--shadow); transition: transform .3s;
}
.swap:hover:not(:disabled) { transform: translateY(-50%) rotate(180deg); }
.swap:disabled { opacity: .5; cursor: not-allowed; filter: grayscale(.6); }

/* voices */
.voices { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.voice input { position: absolute; opacity: 0; pointer-events: none; }
.voice-card {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 18px 10px; border-radius: 22px; cursor: pointer;
  border: 2.5px solid var(--line); background: var(--surface-2); transition: .2s; position: relative;
}
.avatar { font-size: 3rem; line-height: 1.1; }
.voice-card b { font-size: 1.1rem; }
.voice input:checked + .voice-card { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 12%, var(--surface)); box-shadow: 0 10px 22px -12px var(--brand); }
.voice input:checked + .voice-card::after {
  content: "✓"; position: absolute; top: 10px; inset-inline-end: 12px; width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center; background: var(--brand); color: #fff; font-size: .8rem; font-weight: 900;
}
.voice input:focus-visible + .voice-card { outline: 3px solid var(--brand); outline-offset: 2px; }

.eq { display: flex; align-items: flex-end; justify-content: center; gap: 4px; height: 18px; }
.eq i { width: 4px; height: 30%; border-radius: 2px; background: var(--brand); opacity: .35; }
.voice input:checked + .voice-card .eq i { opacity: 1; animation: eq 1s ease-in-out infinite; }
.eq i:nth-child(2) { animation-delay: .15s !important; }
.eq i:nth-child(3) { animation-delay: .3s !important; }
.eq i:nth-child(4) { animation-delay: .45s !important; }
.eq i:nth-child(5) { animation-delay: .6s !important; }
.eq i:nth-child(6) { animation-delay: .75s !important; }
.eq i:nth-child(7) { animation-delay: .9s !important; }
@keyframes eq { 0%, 100% { height: 25%; } 50% { height: 100%; } }

/* toggle switch */
.toggle { display: flex; align-items: center; gap: 12px; margin-top: 16px; padding: 14px 16px; border-radius: 18px; background: var(--surface-2); cursor: pointer; font-weight: 700; }
.toggle input { position: absolute; opacity: 0; }
.switch { flex: none; width: 50px; height: 30px; border-radius: 99px; background: var(--line); position: relative; transition: .25s; }
.switch::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .2); transition: .25s; }
.toggle input:checked + .switch { background: var(--brand-2); }
.toggle input:checked + .switch::after { inset-inline-start: 23px; }
.toggle input:focus-visible + .switch { outline: 3px solid var(--brand); outline-offset: 2px; }

/* progress */
.ring-wrap { position: relative; width: 170px; height: 170px; margin: 4px auto 6px; }
.ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 12; }
.ring-bg { stroke: var(--surface-2); }
.ring-fg { stroke: url(#hg); stroke-linecap: round; stroke-dasharray: 364.4; stroke-dashoffset: 364.4; transition: stroke-dashoffset .6s ease; }
.ring-center { position: absolute; inset: 0; display: grid; place-items: center; }
.ring-center b { font-size: 2.2rem; font-weight: 900; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stage { text-align: center; font-weight: 800; font-size: 1.15rem; margin: 6px 0 8px; min-height: 1.5em; }
.big-eq { height: 28px; margin-bottom: 14px; }
.big-eq i { width: 6px; opacity: 1; background: var(--grad); animation: eq 1s ease-in-out infinite; }
.steps { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 6px; }
.steps li { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 14px; color: var(--muted); font-weight: 700; transition: .3s; }
.steps .ico { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; background: var(--surface-2); font-size: 1.1rem; filter: grayscale(1); opacity: .6; transition: .3s; }
.steps li.active { background: color-mix(in srgb, var(--brand) 10%, var(--surface)); color: var(--text); }
.steps li.active .ico { filter: none; opacity: 1; animation: pulse 1.2s ease-in-out infinite; }
.steps li.done { color: var(--ok); }
.steps li.done .ico { filter: none; opacity: 1; }
.steps li.done::after { content: "✓"; margin-inline-start: auto; font-weight: 900; }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.12); } }

/* result */
.done-title { text-align: center; margin: 0 0 14px; font-size: 1.5rem; font-weight: 900; }
.video-frame { width: fit-content; max-width: 100%; margin: 0 auto; padding: 8px; border-radius: 24px; background: var(--grad); box-shadow: 0 18px 36px -18px var(--brand); }
.video-frame video { max-height: 60vh; min-width: 220px; }
.actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 10px; }
.act {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 76px; padding: 10px 6px;
  border-radius: 18px; border: 0; background: var(--surface-2); color: var(--text); text-decoration: none; font-weight: 800; font-size: .88rem; cursor: pointer; transition: .15s;
}
.act:active { transform: scale(.96); }
.act.tg { background: var(--tg); color: #fff; }
.act svg { color: var(--brand); }
.act.tg svg { color: #fff; }
.hint { text-align: center; color: var(--muted); font-size: .9rem; margin: 14px 0 0; }
.transcript { margin-top: 14px; border-radius: 16px; background: var(--surface-2); padding: 12px 14px; }
.transcript summary { cursor: pointer; font-weight: 800; }
.seg { border-top: 1px solid var(--line); padding: 10px 0; margin-top: 10px; }
.seg .src { color: var(--muted); font-size: .92rem; }
.seg .tr { font-weight: 700; }

.error { margin: 14px 0 0; padding: 12px 14px; border-radius: 14px; background: var(--err-bg); color: var(--err); font-weight: 700; text-align: center; }
.muted { color: var(--muted); }
.center { text-align: center; }
.small { font-size: .88rem; }

/* how it works */
.how { padding: 10px 0 20px; text-align: center; }
.how h2 { font-size: 1.4rem; font-weight: 900; margin: 0 0 14px; }
.how-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.how-card { position: relative; padding: 20px 8px 14px; border-radius: 22px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.how-num { position: absolute; top: -10px; inset-inline-start: 50%; transform: translateX(-50%); width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; background: var(--grad); color: #fff; font-weight: 900; font-size: .8rem; }
[dir="rtl"] .how-num { transform: translateX(50%); }
.how-ico { display: block; font-size: 2rem; margin-bottom: 6px; }
.how-card b { font-size: .92rem; }
.flag-strip { display: flex; justify-content: center; gap: clamp(2px, 1vw, 8px); margin-top: 18px; font-size: clamp(1.2rem, 6.5vw, 1.6rem); }
.flag-strip span { animation: float 4s ease-in-out infinite; }

.foot { text-align: center; color: var(--muted); font-size: .88rem; padding: 10px 16px calc(28px + env(safe-area-inset-bottom)); }

/* language sheet */
.sheet {
  width: 100%; max-width: 560px; max-height: 85vh; inset-inline: 0; margin: auto auto 0; padding: 0; border: 0; border-radius: 28px 28px 0 0;
  overflow-y: auto;
  background: var(--surface); color: var(--text); box-shadow: var(--shadow);
}
@media (min-width: 600px) { .sheet { margin: auto; border-radius: 28px; } }
.sheet[open] { animation: up .3s ease; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet::backdrop { background: rgba(15, 10, 40, .5); backdrop-filter: blur(3px); }
.sheet-head { position: sticky; top: 0; display: flex; align-items: center; justify-content: space-between; padding: 18px 18px 10px; background: var(--surface); }
.sheet-head h3 { margin: 0; font-size: 1.2rem; font-weight: 900; }
.sheet-close { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--surface-2); cursor: pointer; font-weight: 400; font-size: 1.1rem; line-height: 1; flex: none; margin-left: auto; }
.sheet-head, .cam-head { direction: ltr; }
.sheet-head h3, .cam-head h3 { unicode-bidi: plaintext; }
.tile-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; padding: 6px 18px calc(22px + env(safe-area-inset-bottom)); }
.tile {
  display: flex; align-items: center; gap: 8px; padding: 13px 10px; border-radius: 18px; cursor: pointer; text-align: start;
  border: 2px solid var(--line); background: var(--surface-2); font-weight: 800; font-size: .95rem; transition: .15s;
}
.tile .flag { font-size: 1.5rem; }
.tile span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile:hover { border-color: var(--brand); }
.tile.sel { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 14%, var(--surface)); }
.tile.sel::after { content: "✓"; margin-inline-start: auto; color: var(--brand); font-weight: 900; }
.tile.wide { grid-column: 1 / -1; }

#confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 50; }

@media (max-width: 380px) {
  .how-card b { font-size: .8rem; }
  .act { font-size: .78rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .cycle text:first-child { opacity: 1; }
}

/* branding + required photo */
.brand-logo { height: 36px; width: auto; max-width: 140px; object-fit: contain; }
.foot { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.admin-link { color: var(--brand); font-weight: 800; text-decoration: none; font-size: .85rem; }
.attention { animation: attention .6s ease 2; border-color: var(--err) !important; }
@keyframes attention { 0%, 100% { transform: none; } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

/* watch page */
.watch-langs { margin: 14px 0 0; text-align: center; font-weight: 800; color: var(--muted); white-space: pre; }

/* ---- Watch page: translate button, small icon actions, camera ---- */
.mini-actions { display: flex; justify-content: center; gap: 12px; margin-top: 14px; }
.icon-btn {
  width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--line);
  background: var(--surface-2); color: var(--muted); cursor: pointer; text-decoration: none; transition: .15s;
}
.icon-btn:hover { color: var(--brand); border-color: var(--brand); transform: translateY(-1px); }
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.mini-toast { text-align: center; margin: 8px 0 0; font-weight: 800; color: var(--ok); min-height: 1.4em; }

.cam { border: 0; padding: 0; width: min(94vw, 460px); max-height: 94vh; margin: auto; border-radius: 28px; background: var(--surface); color: var(--text); box-shadow: var(--shadow); overflow: hidden; }
.cam::backdrop { background: rgba(15, 10, 40, .65); backdrop-filter: blur(4px); }
.cam-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 6px; }
.cam-head h3 { margin: 0; font-size: 1.2rem; font-weight: 900; }
.cam-body { padding: 8px 16px 18px; }
.cam-frame { position: relative; width: 100%; aspect-ratio: 4 / 3; border-radius: 22px; overflow: hidden; background: #120f26; }
.cam-frame video, .cam-frame .cam-still { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cam-frame video { transform: scaleX(-1); }
.cam-guide { position: absolute; left: 50%; top: 46%; width: 46%; aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 50%; border: 3px dashed rgba(255, 255, 255, .7); pointer-events: none; }
.cam-count {
  position: absolute; left: 12px; top: 12px; min-width: 44px; height: 44px; padding: 0 12px; display: grid; place-items: center;
  border-radius: 22px; background: rgba(0, 0, 0, .55); color: #fff; font-weight: 900; font-size: 1.1rem; backdrop-filter: blur(4px);
}
.cam-flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
.cam-flash.go { animation: flash .45s ease; }
@keyframes flash { 0% { opacity: .9; } 100% { opacity: 0; } }
.cam-loader { position: absolute; display: grid; place-items: center; pointer-events: none; }
.cam-loader img { width: 100%; height: auto; display: block; }
.cam-loader .spin { width: 100%; aspect-ratio: 1; border-radius: 50%; border: 6px solid rgba(255, 255, 255, .35); border-top-color: #fff; animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.cam-loader[data-pos="tl"] { left: 3%; top: 3%; }       .cam-loader[data-pos="tc"] { left: 50%; top: 3%; transform: translateX(-50%); }
.cam-loader[data-pos="tr"] { right: 3%; top: 3%; }      .cam-loader[data-pos="cl"] { left: 3%; top: 50%; transform: translateY(-50%); }
.cam-loader[data-pos="c"]  { left: 50%; top: 50%; transform: translate(-50%, -50%); }
.cam-loader[data-pos="cr"] { right: 3%; top: 50%; transform: translateY(-50%); }
.cam-loader[data-pos="bl"] { left: 3%; bottom: 3%; }    .cam-loader[data-pos="bc"] { left: 50%; bottom: 3%; transform: translateX(-50%); }
.cam-loader[data-pos="br"] { right: 3%; bottom: 3%; }
.cam-msg { margin: 12px 0 0; text-align: center; font-weight: 800; color: var(--muted); }
.cam-msg.ok { color: var(--ok); }
.cam-msg.err { color: var(--err); }

/* ---- account dialog ---- */
.top-right { display: flex; gap: 8px; align-items: center; }
.acct-body { padding: 4px 18px 22px; }
.acct-why { color: var(--muted); font-size: .95rem; margin: 0 0 14px; line-height: 1.45; }
.field { display: block; margin-bottom: 14px; font-weight: 800; }
.field > span { display: block; margin-bottom: 6px; font-size: .92rem; }
.field input { width: 100%; box-sizing: border-box; min-height: 50px; padding: 0 14px; border-radius: 14px; border: 2px solid var(--line); background: var(--surface-2); color: var(--text); font: inherit; font-weight: 600; }
.field input:focus { outline: none; border-color: var(--brand); }
.key-get { display: inline-block; margin-top: 6px; font-size: .88rem; color: var(--brand); text-decoration: none; font-weight: 800; }
.key-saved { display: block; margin-top: 4px; color: var(--muted); font-weight: 700; }
.acct-email { font-weight: 900; font-size: 1.05rem; margin: 0 0 8px; word-break: break-all; }
.acct-sub { margin: 18px 0 6px; font-size: .9rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.my-videos { list-style: none; margin: 0 0 10px; padding: 0; }
.my-videos li { border-top: 1px solid var(--line); }
.my-videos a { display: flex; justify-content: space-between; gap: 10px; padding: 12px 2px; color: var(--text); text-decoration: none; font-weight: 700; }
.my-videos small { color: var(--muted); font-weight: 700; }
.btn.ghost.on { color: var(--brand); border: 2px solid var(--line); }

.tg-big { display: flex; align-items: center; justify-content: center; gap: 10px; text-decoration: none; margin-bottom: 10px; }
.btn.ghost.outline { border: 2px solid var(--brand); color: var(--brand); font-weight: 900; }
.qr-box { display: flex; justify-content: center; margin: 14px 0; }
.qr-box svg { border-radius: 16px; box-shadow: var(--shadow); max-width: 70vw; height: auto; }
.tg-wait { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 8px 0 2px; color: var(--muted); font-weight: 700; }
.tg-wait .dot { width: 14px; height: 14px; border-radius: 50%; background: var(--c3); animation: tgpulse 1.4s ease-in-out infinite; }
@keyframes tgpulse { 50% { opacity: .35; transform: scale(.8); } }
.acct-note { margin: 0 0 14px; padding: 12px 14px; border-radius: 14px; background: color-mix(in srgb, var(--brand) 10%, var(--surface)); font-weight: 700; line-height: 1.4; }
.center { text-align: center; }

.own-keys { margin: 14px 0 6px; border: 2px solid var(--line); border-radius: 18px; background: var(--surface-2); padding: 0 14px; }
.own-keys summary { cursor: pointer; padding: 14px 0; font-weight: 800; list-style: none; }
.own-keys summary::-webkit-details-marker { display: none; }
.own-keys[open] summary { border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.own-keys .toggle { margin: 4px 0 10px; }

/* admin-defined red X button */
.xbtn{display:inline-flex;align-items:center;gap:6px;color:var(--xfg,#fff);font-weight:800;text-decoration:none;border:2px solid var(--xbg,#e11d2e);border-radius:999px;padding:5px 12px;background:var(--xbg,#e11d2e);line-height:1}
.xbtn:hover{filter:brightness(1.1)}

/* Top button: pinned to the viewport itself (not inside the scrolling header), so it's visible without scrolling
   on any page, including the Telegram Mini App. Round, one glyph only, set in the page's second typeface (Cairo,
   normal weight) rather than the bold display font used elsewhere. */
.xtop{
  position:fixed; top:calc(env(safe-area-inset-top,0px) + 12px); right:calc(env(safe-area-inset-right,0px) + 12px);
  z-index:1000; width:42px; height:42px; padding:0; box-sizing:border-box;
  justify-content:center; align-items:center; gap:0; border-radius:50%;
  box-shadow:0 4px 14px rgba(225,29,46,.45);
}
.xtop-x{
  display:block; font-family:"Cairo", sans-serif; font-weight:400; font-style:normal;
  font-size:19px; line-height:1;
}

/* header no longer carries the X button, but must still never be wider than the screen (Telegram Mini App is narrow) */
.top{flex-wrap:wrap;gap:10px;box-sizing:border-box;width:100%}
.brand{min-width:0;flex:1 1 auto}
.brand > span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.top-right{flex:0 1 auto;flex-wrap:wrap;justify-content:flex-end;margin-inline-start:auto;max-width:100%;min-width:0}
.top-right .lang-btn{min-width:0;max-width:100%;padding:8px 12px}
.top-right .lang-btn span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:9em}
@media (max-width:520px){
  .top-right{flex:1 1 100%;justify-content:flex-end}
}

/* Bottom button: the word "CLOSE" (translated), not an icon */
.xfoot{text-align:center;padding:18px 16px calc(24px + env(safe-area-inset-bottom))}
.xbottom{padding:10px 22px;font-weight:800;letter-spacing:.04em;text-transform:uppercase}

/* a YouTube / Instagram / TikTok video shown inside the page */
.embed-wrap{position:relative;width:100%;aspect-ratio:var(--ratio,16/9);border-radius:18px;overflow:hidden;background:#000;margin:0 auto}
.embed-wrap.tall{max-width:420px}
.embed-wrap iframe{position:absolute;inset:0;width:100%;height:100%;border:0}
.video-frame.embed-mode{width:100%;max-width:720px}
.video-frame.embed-mode.tall{max-width:440px}
.video-frame.embed-mode .embed-wrap.tall{max-width:none}
