/* Ali Alkhathami: site styles */
:root {
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
  --bg: #110f1c;
  --surface: #1a1729;
  --surface2: #221e36;
  --line: #2f2a47;
  --text: #f3f0ff;
  --muted: #a9a3c7;
  --sun: #ffcc4d;
  --pink: #ff6b9e;
  --mint: #4fe0c8;
  --lav: #9d8cff;
  --on-bright: #17142a;
  --sel: #0d99ff;
  --guide: #ff3b5c;
  --ghost: rgba(170, 160, 220, .14);
  --bar-bg: rgba(26, 23, 41, .86);
  --bar-solid: #1a1729;
  --bar-line: rgba(255, 255, 255, .09);
  --btn-bg: rgba(255, 255, 255, .08);
}
/* The site is dark by design; these keep it dark in every viewer setting, with a light variant only on request. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { color-scheme: dark; }
}
:root[data-theme="dark"] { color-scheme: dark; }
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f6f4fb;
  --surface: #ffffff;
  --surface2: #efecf7;
  --line: #dedaea;
  --text: #17142a;
  --muted: #5d5878;
  --sun: #a86f00;
  --pink: #c2185b;
  --mint: #00806f;
  --lav: #5b47d6;
  --on-bright: #ffffff;
  --ghost: rgba(110, 100, 150, .14);
  --bar-bg: rgba(255, 255, 255, .88);
  --bar-solid: #ffffff;
  --bar-line: rgba(0, 0, 0, .08);
  --btn-bg: rgba(0, 0, 0, .06);
}
html { scroll-padding-top: env(safe-area-inset-top, 0px); }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
*, *::before, *::after { box-sizing: inherit; }
html.pre #site { opacity: 0; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Instrument Sans", "IBM Plex Sans Arabic", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16.5px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 120px;
  overflow-x: hidden;
}
h1, h2, h3, .num-big, .brand, .zero strong, .year, .vote-q { font-family: "Bricolage Grotesque", "IBM Plex Sans Arabic", "Instrument Sans", system-ui, sans-serif; }
a { color: inherit; }
.wrap { max-width: 1160px; margin: 0 auto; padding: 0 clamp(18px, 4vw, 36px); }
:where(a, button):focus-visible { outline: 2px solid var(--sel); outline-offset: 3px; }

/* header */
.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 20px 0; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; text-decoration: none; letter-spacing: -.01em; }
.brand svg { width: 24px; height: 24px; }
.mk-1 { fill: var(--sun); } .mk-2 { fill: var(--pink); } .mk-3 { fill: var(--mint); }
.nav { display: flex; gap: 26px; }
.nav a { color: var(--muted); text-decoration: none; font-size: 14.5px; }
.nav a:hover { color: var(--text); }
@media (max-width: 780px) { .nav { display: none; } }

.btn { display: inline-flex; align-items: center; padding: 11px 18px; border-radius: 999px; font-weight: 600; font-size: 14.5px; text-decoration: none; border: 1px solid var(--line); background: transparent; }
.btn.solid { background: var(--sun); color: var(--on-bright); border-color: var(--sun); }

/* hero */
.hero { display: grid; grid-template-columns: 1.1fr 1fr; gap: clamp(32px, 5vw, 64px); align-items: center; padding: clamp(48px, 8vw, 104px) 0 56px; }
.hi { margin: 0 0 16px; font-size: 19px; font-weight: 600; color: var(--sun); }
h1 { font-size: clamp(50px, 8.6vw, 112px); font-weight: 720; font-stretch: 86%; line-height: .92; letter-spacing: -.035em; margin: 0 0 26px; max-width: 9ch; }
.lede { font-size: clamp(17px, 1.6vw, 19.5px); color: var(--muted); max-width: 44ch; margin: 0 0 30px; }
.lede strong { color: var(--text); font-weight: 600; }
.ctas { display: flex; gap: 12px; flex-wrap: wrap; }

.stack { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 6px 18px; }
.layer { display: grid; grid-template-columns: 100px 1fr; gap: 12px; align-items: center; padding: 15px 0; }
.layer + .layer { border-top: 1px solid var(--line); }
.lname { margin: 0; font-size: 13.5px; font-weight: 600; }
.l1 .lname { color: var(--sun); } .l2 .lname { color: var(--pink); } .l3 .lname { color: var(--mint); } .l4 .lname { color: var(--lav); } .l5 .lname { color: var(--muted); }
.cap { margin: 14px 4px 0; color: var(--muted); font-size: 15px; }
@media (max-width: 880px) { .hero { grid-template-columns: 1fr; } }
@media (max-width: 420px) { .layer { grid-template-columns: 1fr; gap: 8px; } }

.chips { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.chips li { font-size: 12.5px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); line-height: 1.4; }
.chips.strong li { color: var(--text); }

/* numbers */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 28px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 16px 20px 20px; }
.badge { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 3px 9px; border-radius: 999px; color: var(--on-bright); background: var(--c); }
.num-big { display: block; font-size: clamp(34px, 4.2vw, 50px); font-weight: 700; font-stretch: 86%; line-height: 1.05; letter-spacing: -.02em; color: var(--c); margin-top: 14px; }
.stat span.lbl { display: block; color: var(--muted); font-size: 14px; margin-top: 4px; }
.s1 { --c: var(--sun); } .s2 { --c: var(--mint); } .s3 { --c: var(--pink); } .s4 { --c: var(--lav); }
@media (max-width: 760px) { .stats { grid-template-columns: repeat(2, 1fr); } }

/* sections */
.block { padding: clamp(64px, 8vw, 92px) 0; border-top: 1px solid var(--line); }
.sec-head { display: grid; grid-template-columns: 1fr 1.1fr; gap: 24px; align-items: end; margin-bottom: 36px; }
h2 { font-size: clamp(34px, 4.8vw, 58px); font-weight: 700; font-stretch: 88%; line-height: 1; letter-spacing: -.025em; margin: 0; max-width: 15ch; }
.sec-head p { color: var(--muted); margin: 0; max-width: 50ch; font-size: 17px; }
@media (max-width: 780px) { .sec-head { grid-template-columns: 1fr; } }

.pill { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 600; padding: 4px 11px; border-radius: 999px; color: var(--c); border: 1px solid var(--c); }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.p-live { --c: var(--mint); } .p-poc { --c: var(--lav); } .p-home { --c: var(--pink); } .p-dept { --c: var(--sun); }

/* Databank */
.feature { background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: clamp(22px, 3.6vw, 44px); display: grid; grid-template-columns: 1fr 1fr; gap: clamp(28px, 4vw, 56px); align-items: start; }
.feature h3 { font-size: clamp(40px, 5.2vw, 64px); font-weight: 720; font-stretch: 86%; letter-spacing: -.03em; line-height: 1; margin: 18px 0 10px; }
.client { margin: 0 0 14px; font-weight: 600; }
.feature .desc { color: var(--muted); margin: 0; max-width: 44ch; }
.zero { background: var(--surface2); border-radius: 18px; padding: 24px 26px; margin: 0 0 18px; }
.zero strong { display: block; font-size: clamp(72px, 9vw, 120px); line-height: .9; font-weight: 760; font-stretch: 86%; color: var(--sun); letter-spacing: -.04em; }
.zero span { display: block; font-size: 18px; font-weight: 600; margin-top: 10px; }
.zero em { display: block; font-style: normal; color: var(--muted); font-size: 15.5px; margin-top: 6px; }
.caps { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.caps li { border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.caps strong { display: block; font-size: 16px; }
.caps span { display: block; color: var(--muted); font-size: 15px; }
@media (max-width: 880px) { .feature { grid-template-columns: 1fr; } }

.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 14px; margin-top: 14px; }
.pcard { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 26px; }
.pcard h3 { font-size: 27px; font-weight: 700; font-stretch: 88%; letter-spacing: -.02em; line-height: 1.05; margin: 16px 0 10px; }
.pcard p { color: var(--muted); margin: 0; font-size: 15.5px; }
.mods { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 16px; }
.mod { background: var(--surface2); border-radius: 10px; padding: 10px 12px; font-size: 14px; font-weight: 600; }

/* how I think */
.eng { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.eitem { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 24px 26px; }
.eitem h3 { font-size: 23px; font-weight: 680; font-stretch: 90%; line-height: 1.15; margin: 0 0 8px; color: var(--c); }
.eitem p { color: var(--muted); margin: 0; max-width: 50ch; font-size: 15.5px; }
.e1 { --c: var(--sun); } .e2 { --c: var(--pink); } .e3 { --c: var(--mint); } .e4 { --c: var(--lav); }
@media (max-width: 760px) { .eng { grid-template-columns: 1fr; } }

/* interests */
.likes { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 28px 24px; }
.like { border-top: 3px solid var(--c); padding-top: 18px; }
.like h3 { font-size: 21px; font-weight: 680; font-stretch: 90%; line-height: 1.2; margin: 0 0 8px; }
.like p { color: var(--muted); margin: 0; font-size: 15.5px; }
.k1 { --c: var(--mint); } .k2 { --c: var(--sun); } .k3 { --c: var(--pink); } .k4 { --c: var(--lav); }

/* story */
.timeline { list-style: none; padding: 0; margin: 0; max-width: 760px; }
.timeline li { display: grid; grid-template-columns: 96px 1fr; gap: 18px; padding: 20px 0; border-top: 1px solid var(--line); }
.year { font-size: 26px; font-weight: 700; font-stretch: 88%; color: var(--c); line-height: 1.1; }
.timeline p { margin: 0; color: var(--muted); }
.timeline p strong { display: block; color: var(--text); font-size: 17.5px; }
.t1 { --c: var(--lav); } .t2 { --c: var(--mint); } .t3 { --c: var(--pink); } .t4 { --c: var(--sun); } .t5 { --c: var(--muted); }
.aside { margin: 28px 0 0; color: var(--muted); }

/* contact */
.contact h2 { font-size: clamp(38px, 6.4vw, 78px); max-width: 14ch; margin-bottom: 20px; }
.contact p { color: var(--muted); font-size: 17.5px; margin: 0 0 28px; max-width: 44ch; }

.foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; padding: 22px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: 13.5px; }
.foot p { margin: 0; }

/* ---------- states the builders put elements in ---------- */
.ghost { opacity: 0 !important; }
.ghost-frame { background-color: transparent !important; border-color: transparent !important; box-shadow: none !important; }

/* ---------- builder layers ---------- */
#fx, #crew { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
#fx { z-index: 50; }
#crew { z-index: 70; }
.paused #crew *, .paused #fx * { animation-play-state: paused !important; }

/* ---------- bottom bar ---------- */
.dock { position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; display: flex; justify-content: center; padding: 0 12px calc(14px + env(safe-area-inset-bottom, 0px)); pointer-events: none; }
.bar { pointer-events: auto; display: flex; align-items: center; gap: 10px; padding: 6px 6px 6px 12px; border-radius: 14px; background: var(--bar-bg); -webkit-backdrop-filter: blur(16px) saturate(1.4); backdrop-filter: blur(16px) saturate(1.4); border: 1px solid var(--bar-line); box-shadow: 0 10px 30px rgba(0, 0, 0, .25); font-size: 13px; color: var(--muted); max-width: 100%; }
#st { white-space: nowrap; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
#st b { color: var(--text); font-weight: 650; }
.prog { flex: 0 0 auto; width: 64px; height: 3px; border-radius: 2px; background: var(--line); overflow: hidden; }
#pg { display: block; height: 100%; background: linear-gradient(90deg, var(--sun), var(--pink), var(--mint)); transform-origin: 0 50%; transform: scaleX(0); transition: transform .25s; }
.bar button { font: inherit; font-weight: 600; font-size: 13px; line-height: 1; border: 0; cursor: pointer; color: var(--text); }
.bar button:focus-visible { outline: 2px solid var(--sel); outline-offset: 2px; }
.bar .icon { flex: 0 0 auto; width: 34px; height: 34px; display: grid; place-items: center; padding: 0; border-radius: 9px; background: var(--btn-bg); }
.bar .icon svg { width: 14px; height: 14px; }
.ctrl { display: flex; gap: 4px; }

.crew-switch { flex: 0 0 auto; display: flex; gap: 2px; padding: 3px; border-radius: 11px; background: var(--btn-bg); }
.crew-switch button { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 7px; border-radius: 8px; background: transparent; color: var(--muted); }
.crew-switch svg { width: 20px; height: 20px; display: block; }
.crew-switch .lbl { display: none; }
.crew-switch button[aria-pressed="true"] { background: rgba(255, 255, 255, .13); }
.crew-switch button[aria-pressed="true"] .lbl { color: var(--text); }
.crew-switch [data-crew="robots"][aria-pressed="true"] { color: var(--pink); }
.crew-switch [data-crew="bars"][aria-pressed="true"] { color: var(--mint); }
.crew-switch button:not([aria-pressed="true"]):hover { color: var(--text); }
@media (min-width: 640px) { .crew-switch .lbl { display: inline; } .crew-switch button { padding: 0 10px 0 7px; } }

#reopen { display: none; align-items: center; gap: 7px; height: 34px; padding: 0 12px; border-radius: 9px; background: var(--btn-bg); }
#reopen svg { width: 13px; height: 13px; }
.bar.collapsed > :not(#mark):not(#reopen) { display: none !important; }
.bar.collapsed #reopen { display: inline-flex; }
@media (max-width: 560px) { .prog { display: none; } }
@media (max-width: 340px) { #st { display: none; } }
@media print { .dock, #crew, #fx { display: none !important; } }

/* ---------- the logo is home ---------- */
#mark { flex: 0 0 auto; display: inline-flex; flex-direction: column; gap: 3px; position: relative; padding: 1px 0; }
#mark i { display: block; width: 22px; height: 5px; border-radius: 1.5px; background: var(--c); position: relative; }
#mark i:nth-child(1) { --c: #ffcc4d; --d: rgba(255, 204, 77, .22); }
#mark i:nth-child(2) { --c: #ff6b9e; --d: rgba(255, 107, 158, .22); }
#mark i:nth-child(3) { --c: #4fe0c8; --d: rgba(79, 224, 200, .22); }
#mark u { display: none; }
#mark i.give { animation: give .3s ease; }
#mark i.take { animation: take .38s ease; }
@keyframes give { 40% { transform: scaleX(.55); } }
@keyframes take { 30% { transform: scale(1.25, 1.6); filter: brightness(1.6); } }

/* ---------- crew 1: tiny robots (the logo bars are their charging docks) ---------- */
.crew-robots #mark i { background: var(--d); }
.crew-robots #mark i::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: var(--c); transform-origin: 0 50%; transform: scaleX(var(--f, 1)); transition: transform .35s ease; }
.crew-robots.built #mark i { animation: charged 1.6s ease 2; }
@keyframes charged { 50% { box-shadow: 0 0 10px var(--c); filter: brightness(1.4); } }
.b2 { position: absolute; left: 0; top: 0; width: 28px; height: 32px; transform-origin: 14px 16px; will-change: transform; }
.b2 .bob { animation: bob 1.1s ease-in-out infinite alternate; }
@keyframes bob { from { transform: translateY(-1.5px); } to { transform: translateY(1.5px); } }
.b2 svg { display: block; overflow: visible; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .4)); }
.b2 .eyes circle { transform-box: fill-box; transform-origin: center; animation: blink 3.8s var(--bd, 0s) infinite; }
.b2 .flame { fill: #ffd27a; transform-box: fill-box; transform-origin: 50% 0; animation: flick .12s infinite alternate; }
@keyframes flick { from { transform: scaleY(.65); opacity: .7; } to { transform: scaleY(1.15); opacity: 1; } }
.b2.busy .ant { animation: ant .25s infinite alternate; }
@keyframes ant { to { fill: #fff; } }
@keyframes blink { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.1); } }
.beam { position: absolute; left: 0; top: 0; opacity: 0; transition: opacity .15s; }
.scanline { position: absolute; left: 0; top: 0; height: 2px; border-radius: 1px; opacity: 0; transition: opacity .15s; }
.spark { position: absolute; left: -1.5px; top: -1.5px; width: 3px; height: 3px; border-radius: 1px; }

/* ---------- crew 2: bars with eyes ---------- */
.b3 { position: absolute; left: 0; top: 0; transform-origin: 50% 100%; will-change: transform; }
.b3 .jb { width: 100%; height: 100%; border-radius: 6px; background: var(--c); position: relative; box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .18), 0 3px 8px rgba(0, 0, 0, .3); }
.b3 .je { position: absolute; right: 3px; top: 50%; transform: translateY(-50%); display: flex; gap: 1.5px; }
.b3 .eye { width: 6px; height: 6px; border-radius: 50%; background: #fff; position: relative; display: block; animation: blink 4s var(--bd, 0s) infinite; }
.b3 .eye i { position: absolute; width: 3px; height: 3px; border-radius: 50%; background: #17142a; left: calc(1.5px + var(--px, 0px)); top: calc(1.5px + var(--py, 0px)); }
.b3.happy .eye { height: 2.5px; border-radius: 3px 3px 1px 1px; animation: none; }
.b3.happy .eye i { display: none; }
.crew-bars #mark u { display: block; position: absolute; right: 3px; top: 1.5px; width: 2px; height: 2px; border-radius: 50%; background: #17142a; box-shadow: -4px 0 0 #17142a; opacity: 0; transition: opacity .2s; }
.crew-bars #mark i.awake u { opacity: 1; animation: blink 3.4s infinite; }
.crew-bars.built #mark i u { opacity: 1; animation: nap 1.8s ease forwards; }
@keyframes nap { 0%, 30% { transform: scaleY(1); } 38% { transform: scaleY(.1); } 46% { transform: scaleY(1); } 85%, 100% { transform: scaleY(.25); } }
.crew-bars.built #mark::after { content: "z"; position: absolute; left: calc(100% + 2px); top: -8px; font: 700 10px/1 "Instrument Sans", system-ui, sans-serif; color: var(--muted); opacity: 0; animation: zz 2.4s 1.6s infinite; }
@keyframes zz { 0% { opacity: 0; transform: translate(0, 4px); } 30% { opacity: 1; } 100% { opacity: 0; transform: translate(8px, -12px); } }

/* ---------- props the moves use ---------- */
.ribbon { position: absolute; left: 0; top: 0; height: 2px; border-radius: 1px; }
.trace { position: absolute; left: 0; top: 0; overflow: visible; }
.caret { position: absolute; left: 0; top: 0; width: 2px; border-radius: 1px; opacity: 0; transition: opacity .15s; animation: caretBlink .6s steps(1) infinite; }
@keyframes caretBlink { 50% { visibility: hidden; } }
.dragbox { position: absolute; left: 0; top: 0; border: 1.5px solid; }
.sw { display: inline-block; transform-origin: 50% 100%; }
/* ---------- header actions + language ---------- */
.top-actions { display: flex; align-items: center; gap: 8px; }
.lang-btn { font: inherit; font-size: 14.5px; font-weight: 600; line-height: 1.2; padding: 10px 14px; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--muted); cursor: pointer; }
.lang-btn:hover { color: var(--text); }
.lang-btn:lang(ar) { font-family: "IBM Plex Sans Arabic", system-ui, sans-serif; }
@media (max-width: 420px) {
  .top { gap: 10px; }
  .brand { font-size: 16px; }
  .top .btn, .lang-btn { padding: 8px 11px; font-size: 13px; }
}

/* Arabic reads better a touch larger, with no negative tracking (it breaks joined letters). */
html[lang="ar"] body { font-size: 17px; line-height: 1.75; }
html[lang="ar"] :is(h1, h2, h3, .brand, .num-big, .zero strong, .year, .hi) { letter-spacing: 0; }
html[lang="ar"] h1 { line-height: 1.2; }
html[lang="ar"] h2 { line-height: 1.3; }
html[lang="ar"] .eitem h3, html[lang="ar"] .like h3 { line-height: 1.45; }
html[lang="ar"] .lede, html[lang="ar"] .sec-head p { line-height: 1.8; }

/* ---------- live numbers + vote ---------- */
.live-stats { margin-bottom: 0; }
.live-tile .num-big { font-size: clamp(28px, 3.4vw, 40px); overflow-wrap: anywhere; }
.vote-q { display: block; font-size: 19px; font-weight: 680; line-height: 1.25; margin: 12px 0 12px; color: var(--text); }
.vote-btns { display: grid; gap: 8px; }
.vote-btns button { position: relative; overflow: hidden; display: flex; justify-content: space-between; align-items: center; gap: 10px; min-height: 38px; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface2); color: var(--text); font: inherit; font-weight: 600; font-size: 14px; cursor: pointer; }
.vote-btns button::before { content: ""; position: absolute; inset: 0; transform-origin: 0 50%; transform: scaleX(var(--p, 0)); transition: transform .5s ease; }
html[dir="rtl"] .vote-btns button::before { transform-origin: 100% 50%; }
.vote-btns [data-vote="robots"]::before { background: rgba(255, 107, 158, .2); }
.vote-btns [data-vote="bars"]::before { background: rgba(79, 224, 200, .2); }
.vote-btns button > * { position: relative; }
.vote-btns b { font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 650; }
.vote-btns [aria-pressed="true"] { border-color: var(--text); }
.vote-btns button:focus-visible, .ask-chips button:focus-visible, .lang-btn:focus-visible { outline: 2px solid var(--sel); outline-offset: 2px; }

/* ---------- ask my site ---------- */
.ask-form { display: flex; gap: 8px; max-width: 760px; }
.ask-form input { flex: 1; min-width: 0; font: inherit; font-size: 16px; padding: 12px 18px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--text); }
.ask-form input::placeholder { color: var(--muted); opacity: .8; }
.ask-form input:focus-visible { outline: 2px solid var(--sel); outline-offset: 2px; }
.ask-form button { cursor: pointer; flex: 0 0 auto; }
.ask-form button[disabled] { opacity: .55; cursor: progress; }
.ask-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; max-width: 760px; }
.ask-chips button { font: inherit; font-size: 13.5px; line-height: 1.3; padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--muted); cursor: pointer; }
.ask-chips button:hover { color: var(--text); }
.ask-out { margin-top: 20px; max-width: 760px; display: grid; gap: 10px; }
.ask-out:empty { display: none; }
.ask-q { margin: 0; color: var(--muted); font-size: 15px; }
.ask-a { margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px; white-space: pre-wrap; overflow-wrap: anywhere; }
.ask-a.err { border-color: var(--pink); color: var(--muted); }
.ask-a.wait::after { content: ""; display: inline-block; width: 1.2em; text-align: start; animation: dots 1.2s steps(4, end) infinite; }
@keyframes dots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }

.hint { color: var(--muted); opacity: .75; }

/* ---------- chaos mode ---------- */
#chaos-btn { display: none; flex: 0 0 auto; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: 9px; background: rgba(255, 59, 92, .15); color: #ff8fa3; }
#chaos-btn svg { width: 14px; height: 14px; }
#chaos-btn:hover { background: rgba(255, 59, 92, .24); }
.bar[data-mode="done"] #chaos-btn { display: inline-flex; }
@media (max-width: 560px) { .bar[data-mode="done"] #st { display: none; } }
.crash { animation: crash .75s cubic-bezier(.55, 0, .8, .2) both; outline: 1.5px dashed var(--guide); outline-offset: 4px; }
@keyframes crash {
  0% { transform: none; filter: none; }
  10% { transform: translateX(-4px); filter: drop-shadow(-2px 0 #ff2d55) drop-shadow(2px 0 #00e5ff); }
  20% { transform: translateX(4px); }
  30% { transform: translateX(-3px) skewX(-4deg); }
  42% { transform: translateX(2px); opacity: 1; filter: drop-shadow(2px 0 #ff2d55) drop-shadow(-2px 0 #00e5ff); }
  100% { transform: translateY(28px) rotate(var(--rot, 4deg)); opacity: 0; filter: blur(2px); }
}

/* ---------- bars with eyes face the reading direction ---------- */
html[dir="rtl"] .b3 .je { right: auto; left: 3px; flex-direction: row-reverse; }
html[dir="rtl"] .crew-bars #mark u { right: auto; left: 3px; box-shadow: 4px 0 0 #17142a; }

/* ---------- hidden terminal ---------- */
.term { position: fixed; z-index: 90; left: 50%; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); width: min(720px, calc(100% - 24px)); height: min(460px, 64dvh); display: flex; flex-direction: column; background: #0c0a14; border: 1px solid #2f2a47; border-radius: 14px; box-shadow: 0 24px 60px rgba(0, 0, 0, .55); color: #d9d4f5; font: 13px/1.55 ui-monospace, "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace; direction: ltr; text-align: left; }
.term[hidden] { display: none; }
.term-head { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 12px; border-bottom: 1px solid #2f2a47; color: #8f89b3; }
.term-head .dots { display: inline-flex; gap: 5px; }
.term-head .dots i { width: 10px; height: 10px; border-radius: 50%; }
.term-head .dots i:nth-child(1) { background: #ffcc4d; } .term-head .dots i:nth-child(2) { background: #ff6b9e; } .term-head .dots i:nth-child(3) { background: #4fe0c8; }
.term-head span { flex: 1; }
.term-head button { width: 30px; height: 30px; display: grid; place-items: center; border: 0; border-radius: 8px; background: rgba(255, 255, 255, .06); color: #d9d4f5; cursor: pointer; }
.term-head button svg { width: 12px; height: 12px; }
.term-out { flex: 1; overflow-y: auto; padding: 12px 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.term-line { margin: 0; }
.term-line.cmd { color: #fff; } .term-line.cmd::before { content: "ali@edge:~$ "; color: #4fe0c8; }
.term-line.err { color: #ff8fa3; } .term-line.ok { color: #4fe0c8; } .term-line.dim { color: #8f89b3; } .term-line.warn { color: #ffcc4d; }
.term-form { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-top: 1px solid #2f2a47; }
.term-form label { color: #4fe0c8; white-space: nowrap; }
.term-form input { flex: 1; min-width: 0; background: transparent; border: 0; color: #fff; font: inherit; font-size: 16px; caret-color: #ffcc4d; }
.term-form input:focus { outline: none; }
.term:focus-within { border-color: #4a4370; }
@media (min-width: 700px) { .term-form input { font-size: 13.5px; } }
