/* Layout: a warm working canvas with a floating top bar, a side drawer, and a live phone. */
:root {
  --cream: #FFF8EC; --paper: #FFFDF8; --ink: #1C1F2B; --soft: #625D52; --line: #EADFC9;
  --y: #FFC52E; --y2: #FFE08A; --y3: #FFF2CC;
  --green: #0B6B49; --green-bg: #DDF3E7; --amber: #7A4A00; --amber-bg: #FFE7B3; --red: #B3301B; --red-bg: #FDE3DC;
  --bubble: #DFF7CF; --wa: #EFE7DC;
  --display: "Rubik", "IBM Plex Sans Arabic", Tahoma, sans-serif;
  --body: "IBM Plex Sans Arabic", "Rubik", Tahoma, sans-serif;
  --shadow: 0 10px 30px rgba(60, 45, 10, .10);
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--cream); color: var(--ink); font: 400 15px/1.5 var(--body); }
#app { height: 100%; direction: rtl; }
button { font: inherit; color: inherit; cursor: pointer; background: none; border: 0; }
button:focus-visible, input:focus-visible, textarea:focus-visible, a:focus-visible { outline: 3px solid #1C1F2B; outline-offset: 2px; }
h1, h2, h3, p { margin: 0; }
.d { font-family: var(--display); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 8px 18px; border-radius: 12px; font-weight: 600; border: 2px solid var(--ink); background: var(--y); }
.btn:hover { background: var(--y2); }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--y3); }
.btn.sm { min-height: 38px; padding: 5px 12px; font-size: 14px; }
.chip { display: inline-flex; align-items: center; gap: 5px; border-radius: 8px; padding: 2px 9px; font-size: 13px; font-weight: 600; background: var(--y3); white-space: nowrap; }
.chip.a { background: var(--amber-bg); color: var(--amber); } .chip.g { background: var(--green-bg); color: var(--green); } .chip.r { background: var(--red-bg); color: var(--red); }
.logo { display: inline-flex; align-items: center; gap: 7px; font: 700 25px/1 var(--display); direction: ltr; }
.logo i { display: grid; gap: 3px; width: 26px; justify-items: center; }
.logo i b { display: block; height: 6px; background: var(--y); border-radius: 4px; }
.logo i b:nth-child(1) { width: 26px; } .logo i b:nth-child(2) { width: 17px; } .logo i b:nth-child(3) { width: 9px; }

/* start */
.start { min-height: 100%; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); }
.start .l { padding: 32px 56px 40px; display: flex; flex-direction: column; gap: 22px; min-width: 0; }
.start .r { background: var(--y); padding: 36px 40px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.start h1 { font: 700 clamp(36px, 4.6vw, 62px)/1.13 var(--display); text-wrap: balance; }
.lead { font-size: 19px; color: var(--soft); max-width: 34em; }
.presets { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; }
.preset { text-align: right; background: var(--paper); border: 1.5px solid var(--line); border-radius: 16px; padding: 14px; display: grid; gap: 2px; min-height: 84px; transition: transform .15s, border-color .15s; }
.preset:hover { border-color: var(--ink); transform: translateY(-2px); }
.preset b { font: 700 17px var(--display); }
.preset span { color: var(--soft); font-size: 14px; }
.q { display: grid; gap: 14px; }
.q h2 { font: 700 30px/1.25 var(--display); text-wrap: balance; }
.opts { display: flex; flex-wrap: wrap; gap: 8px; }
.opt { border: 1.5px solid var(--ink); border-radius: 12px; padding: 9px 14px; min-height: 44px; font-weight: 500; background: var(--paper); }
.opt:hover { background: var(--y3); }
.opt.on { background: var(--y); font-weight: 600; }
.field { display: grid; gap: 4px; }
.field label { font-weight: 600; font-size: 14px; }
.field input, .field textarea { font: 400 16px var(--body); border: 1.5px solid #CDBFA4; border-radius: 12px; padding: 10px 12px; background: #fff; color: var(--ink); width: 100%; direction: rtl; resize: vertical; }
.progress { height: 8px; border-radius: 8px; background: var(--line); overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--ink); transition: width .25s; }
.build { background: var(--paper); border: 2px solid var(--ink); border-radius: 20px; padding: 16px; display: grid; gap: 2px; }
.build .row { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 9px 2px; border-bottom: 1px solid var(--line); }
.build .row:last-child { border: 0; }
.build small { color: var(--soft); font-size: 13px; font-weight: 600; }
.build b { font-weight: 600; text-align: left; }
.build .wait { color: var(--soft); font-weight: 400; }

/* studio */
.studio { position: relative; height: 100%; overflow: hidden; background-color: var(--cream); background-image: radial-gradient(#E5D9C0 1.1px, transparent 1.2px); background-size: 22px 22px; }
.top { position: absolute; z-index: 30; inset: 12px 12px auto 12px; display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; background: var(--paper); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); padding: 8px 12px; }
.top .grow { flex: 1 1 auto; min-width: 0; }
.top h1 { font: 700 18px/1.2 var(--display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top small { color: var(--soft); }
.health { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; font-size: 14px; border-radius: 10px; padding: 5px 10px; background: var(--green-bg); color: var(--green); white-space: nowrap; }
.health.bad { background: var(--red-bg); color: var(--red); }
.health.idle { background: var(--y3); color: var(--amber); }
.health i { width: 9px; height: 9px; border-radius: 50%; background: currentColor; }
.zoom { position: absolute; z-index: 30; bottom: 16px; left: 16px; display: flex; flex-direction: column; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); overflow: hidden; }
.zoom button { width: 44px; height: 44px; font: 700 20px var(--display); }
.zoom button:hover { background: var(--y3); }
.viewport { position: absolute; inset: 0; cursor: grab; touch-action: none; }
.viewport.drag { cursor: grabbing; }
.world { position: absolute; left: 0; top: 0; transform-origin: 0 0; direction: ltr; }
.world.smooth { transition: transform .55s cubic-bezier(.3, .8, .3, 1); }
.lane { position: absolute; border-radius: 22px; }
.lane b { position: absolute; right: 20px; top: 14px; font: 700 20px var(--display); direction: rtl; }
.lane span { position: absolute; right: 20px; top: 42px; width: 156px; color: var(--soft); font-size: 13.5px; line-height: 1.4; direction: rtl; text-align: right; }
.colh { position: absolute; height: 42px; background: var(--ink); color: var(--y); border-radius: 12px; display: flex; align-items: center; justify-content: center; font: 700 16px var(--display); direction: rtl; width: 236px; }
.colh.skip { background: transparent; color: var(--soft); border: 1.5px dashed #BFB39A; font-weight: 500; font-size: 14px; }
svg.edges { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; }
svg.edges path { fill: none; stroke: var(--ink); stroke-width: 2.2; stroke-linecap: round; }
svg.edges path.soft { stroke-dasharray: 6 7; stroke: #8A7D62; }
svg.edges path.human { stroke: #A66A00; }
svg.edges path.lit { stroke: #D79A00; stroke-width: 4; }
svg.edges path.draw { stroke-dasharray: 1200; stroke-dashoffset: 1200; animation: draw .8s ease forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
circle.token { fill: var(--y); stroke: var(--ink); stroke-width: 3; }
.node { position: absolute; width: 236px; direction: rtl; background: var(--paper); border: 1.5px solid var(--ink); border-radius: 18px; padding: 10px 12px 11px; display: grid; gap: 6px; cursor: pointer; box-shadow: 0 4px 0 rgba(28, 31, 43, .08); transition: box-shadow .2s, background .2s; user-select: none; }
.node.pop { animation: pop .42s cubic-bezier(.2, 1.3, .4, 1) both; }
@keyframes pop { from { opacity: 0; transform: scale(.86) translateY(12px); } }
.node:hover { box-shadow: 0 8px 18px rgba(60, 45, 10, .16); }
.node.sel { box-shadow: 0 0 0 3px var(--ink); }
.node.active { background: var(--y3); box-shadow: 0 0 0 4px var(--y); }
.node.hold { border-style: dashed; border-color: #A66A00; }
.node.err { border-color: var(--red); background: var(--red-bg); }
.node.money { border-color: var(--green); background: var(--green-bg); }
.node .kind { display: flex; align-items: center; justify-content: space-between; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--soft); }
.node h3 { font: 700 16px/1.3 var(--display); }
.node .count { font: 700 13px var(--display); background: var(--ink); color: var(--y); border-radius: 8px; padding: 1px 8px; }
.pv { border-radius: 11px; overflow: hidden; font-size: 13px; line-height: 1.35; pointer-events: none; }
.pv.ad { background: var(--y); padding: 9px 10px; display: grid; gap: 5px; }
.pv.ad b { font: 700 14px/1.3 var(--display); }
.pv .cta { background: var(--ink); color: var(--y); border-radius: 7px; padding: 2px 8px; font-weight: 600; font-size: 12px; justify-self: start; }
.pv.page { border: 1px solid var(--line); background: #fff; }
.pv.page .h { background: var(--y); padding: 6px 9px; font: 700 13px/1.3 var(--display); }
.pv.page .c { padding: 6px 9px; display: grid; gap: 4px; color: var(--soft); }
.pv.chat { background: var(--wa); padding: 7px; display: grid; gap: 4px; }
.bub { background: #fff; border-radius: 10px; padding: 5px 8px; max-width: 92%; justify-self: end; }
.bub.me { background: var(--bubble); justify-self: start; }
.pv.note { background: var(--y3); padding: 7px 9px; }
.pv.search { background: #fff; border: 1px solid var(--line); padding: 6px 9px; display: grid; gap: 1px; }
.pv.search b { color: #1B4FA8; font-weight: 600; }
.pv.search small { color: var(--soft); font-size: 11.5px; }
.lad { display: inline-flex; gap: 3px; border-radius: 10px; overflow: hidden; font-size: 13.5px; font-weight: 500; }
.lad span { background: var(--cream); padding: 5px 9px; white-space: nowrap; }
.lad span.a { background: var(--amber-bg); color: var(--amber); }
.lad span.g { background: var(--green-bg); color: var(--green); }
.lad b { font: 700 14px var(--display); }
.pv.quiz { background: #fff; border: 1px solid var(--line); padding: 7px 9px; display: grid; gap: 4px; }
.pv.quiz i { display: block; height: 6px; border-radius: 4px; background: var(--line); overflow: hidden; }
.pv.quiz i::after { content: ""; display: block; width: 45%; height: 100%; background: var(--ink); }
.pv.rcpt { background: #fff; border: 1px dashed #BFB39A; padding: 7px 9px; display: grid; justify-items: center; }
.pv.rcpt b { font: 700 16px var(--display); }
.pv.list { display: grid; gap: 3px; }
.pv.list span { background: var(--cream); border-radius: 7px; padding: 3px 7px; }

/* drawer */
.drawer { position: absolute; z-index: 40; top: 76px; bottom: 12px; left: 12px; width: min(420px, calc(100vw - 24px)); background: var(--paper); border: 1.5px solid var(--ink); border-radius: 20px; box-shadow: var(--shadow); display: flex; flex-direction: column; overflow: hidden; animation: slide .22s ease; }
@keyframes slide { from { transform: translateX(-24px); opacity: 0; } }
.drawer header { padding: 14px 16px 0; display: grid; gap: 6px; }
.drawer header h2 { font: 700 21px/1.3 var(--display); }
.tabs { display: flex; gap: 4px; padding: 10px 12px 0; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tab { padding: 8px 12px; min-height: 40px; border-radius: 10px 10px 0 0; font-weight: 600; font-size: 14px; color: var(--soft); white-space: nowrap; }
.tab.on { background: var(--y); color: var(--ink); }
.pane { padding: 14px 16px; overflow-y: auto; flex: 1; display: grid; gap: 12px; align-content: start; }
.pane h3 { font: 700 15px var(--display); }
.pane ul { margin: 0; padding-inline-start: 18px; display: grid; gap: 3px; }
.ev { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; padding: 1px 7px; font-size: 12px; font-weight: 600; color: var(--soft); }
.ev.r { border-color: var(--green); color: var(--green); }
.ev.t { border-style: dashed; }
.alt { width: 100%; text-align: right; border: 1.5px solid var(--line); border-radius: 12px; padding: 9px 11px; display: grid; gap: 2px; background: #fff; }
.alt:hover:not(:disabled) { border-color: var(--ink); }
.alt:disabled { opacity: .62; cursor: not-allowed; }
.alt b { font-weight: 600; }
.alt small { color: var(--soft); }
.x { position: absolute; top: 10px; left: 10px; width: 40px; height: 40px; border-radius: 10px; font: 700 18px var(--display); }
.x:hover { background: var(--y3); }

/* simulator */
.sim { position: absolute; z-index: 40; top: 76px; bottom: 12px; left: 12px; width: min(390px, calc(100vw - 24px)); display: flex; flex-direction: column; gap: 8px; animation: slide .22s ease; }
.phone { flex: 1; min-height: 0; display: flex; flex-direction: column; border: 8px solid var(--ink); border-radius: 34px; overflow: hidden; background: var(--wa); box-shadow: var(--shadow); }
.phone .ph { background: #0F6C5C; color: #fff; padding: 10px 14px; font-weight: 600; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.phone .ph button { color: #fff; font-size: 13px; text-decoration: underline; min-height: 28px; }
.msgs { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 7px; }
.msgs .bub { align-self: flex-end; animation: pop .25s ease both; }
.msgs .bub.me { align-self: flex-start; }
.msgs .sys { align-self: center; background: rgba(28, 31, 43, .78); color: #fff; font-size: 12.5px; border-radius: 8px; padding: 3px 9px; text-align: center; animation: pop .25s ease both; }
.say { background: var(--paper); padding: 10px; display: grid; gap: 6px; border-top: 1px solid var(--line); }
.say small { color: var(--soft); font-weight: 600; }
.say button { border: 1.5px solid var(--ink); border-radius: 11px; min-height: 42px; padding: 6px 10px; font-weight: 600; text-align: right; background: #fff; }
.say button:hover { background: var(--y3); }
.say .next { background: var(--y); text-align: center; }
.why { background: var(--ink); color: #FFF8EC; border-radius: 14px; padding: 10px 12px; font-size: 14px; }
.why b { color: var(--y); display: block; font-weight: 600; }

/* coach */
.coach { position: absolute; z-index: 25; right: 16px; bottom: 16px; width: 330px; max-width: calc(100vw - 90px); background: var(--paper); border: 1.5px solid var(--ink); border-radius: 18px; box-shadow: var(--shadow); padding: 10px 12px; display: flex; gap: 10px; align-items: center; }
.coach img { width: 64px; flex: none; }
.coach b { font: 700 15px var(--display); display: block; }
.coach p { font-size: 14px; color: var(--soft); }
.coach button { font-weight: 600; text-decoration: underline; min-height: 30px; }
.toast { position: absolute; z-index: 60; top: 84px; right: 50%; transform: translateX(50%); background: var(--ink); color: #FFF8EC; padding: 8px 14px; border-radius: 10px; font-weight: 500; animation: pop .25s ease both; }
@media (max-width: 860px) {
  .start { grid-template-columns: minmax(0, 1fr); }
  .start .l { padding: 22px 16px; }
  .start .r { padding: 22px 16px; }
  .coach { display: none; }
  .drawer, .sim { top: 124px; }
  .lad { order: 5; }
  .top h1 { font-size: 15px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before { animation: none !important; transition: none !important; }
  svg.edges path.draw { stroke-dashoffset: 0; }
}
