/* ئىجادخانا — mobile first, right to left, no external assets. */
:root {
  --brand: #0e7c7b;
  --brand2: #12a19f;
  --accent: #d9a62e;
  --bg: #f6f8fa;
  --ink: #16202a;
  --muted: #7c8894;
  --line: #e7edf1;
  --radius: 16px;
  --top: 56px;
  --tab: 62px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
/* Author rules such as `.boot{display:flex}` beat the UA rule for [hidden],
   so state it explicitly or overlays keep swallowing taps. */
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; height: 100%; }
html { background: var(--bg); }
body {
  background: transparent;
  color: var(--ink);
  font-family: "UKIJ Tor", -apple-system, "PingFang SC", sans-serif;
  font-size: 16px;
  line-height: 1.75;
  direction: rtl;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior-y: none;
}
/* page背景: a photo per page, with a page-colour wash so text stays readable */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image: var(--page-bg, none);
  background-size: cover; background-position: center;
  filter: blur(var(--bg-blur, 2px));
  transform: scale(1.06);                 /* hides the soft blur edge */
}
body::after {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: var(--bg); opacity: var(--bg-dim, .8);
}
.num { direction: ltr; unicode-bidi: isolate; display: inline-block; font-variant-numeric: tabular-nums; }
button, input, textarea, select { font: inherit; color: inherit; }
button { border: 0; background: none; cursor: pointer; }
h1, h2, h3, h4, p { margin: 0; }

/* ---------------------------------------------------------------- shell -- */
.boot { position: fixed; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 14px; background: var(--bg); z-index: 60; }
.boot-mark { width: 56px; height: 56px; border-radius: 18px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand), var(--brand2)); color: #fff; font-size: 26px;
  animation: pulse 1.4s ease-in-out infinite; }
.boot-text { color: var(--muted); }
@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: .55 } }

#app { min-height: 100%; padding-bottom: calc(var(--tab) + var(--safe-b)); }
.topbar { position: sticky; top: 0; z-index: 30; height: var(--top); display: flex;
  align-items: center; justify-content: space-between; padding: 0 16px;
  background: rgba(255,255,255,.94); backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line); }
.brand { font-size: 21px; color: var(--brand); }
.avatar { width: 34px; height: 34px; border-radius: 50%; flex: 0 0 34px;
  background: linear-gradient(135deg, var(--brand), var(--brand2)); color: #fff;
  display: grid; place-items: center; font-size: 15px; }
.avatar.on { box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent); }

/* bottom padding keeps the last control clear of the sticky button + tab bar */
.view { padding: 14px 14px 150px; display: flex; flex-direction: column; gap: 12px; }
.view-title { font-size: 22px; margin: 2px 2px 0; }
/* Titles sit straight on the photo, so they get a soft white halo. */
.view-title, .label, .view-sub { text-shadow: 0 1px 2px rgba(255,255,255,.95),
  0 0 10px rgba(255,255,255,.85), 0 0 20px rgba(255,255,255,.6); }
.view-sub { color: #55636f; font-size: 14px; margin: -6px 2px 0; }

.tabbar { position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  height: calc(var(--tab) + var(--safe-b)); padding-bottom: var(--safe-b);
  display: flex; align-items: center; justify-content: space-around;
  background: rgba(255,255,255,.96); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line); }
.tabbar button { flex: 1; display: flex; flex-direction: column; align-items: center;
  gap: 2px; color: #9aa6b1; font-size: 12px; padding: 6px 0; }
.tabbar button svg { width: 23px; height: 23px; }
.tabbar button.on { color: var(--brand); }

/* ---------------------------------------------------------------- cards -- */
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.card.row { display: flex; align-items: center; gap: 12px; }
.card .txt { flex: 1; min-width: 0; }
.card h3 { font-size: 17px; }
.card p { color: var(--muted); font-size: 13.5px; line-height: 1.6; }
.icon-box { width: 44px; height: 44px; flex: 0 0 44px; border-radius: 13px; display: grid;
  place-items: center; background: color-mix(in srgb, var(--brand) 12%, #fff); color: var(--brand); }
.icon-box svg { width: 22px; height: 22px; }
.icon-box.gold { background: color-mix(in srgb, var(--accent) 16%, #fff); color: #9a6c07; }
.icon-box.plum { background: #f3edfb; color: #7a55c2; }
.chev { color: #c3ccd4; font-size: 20px; }

.hero { border-radius: var(--radius); padding: 18px; color: #fff; position: relative;
  overflow: hidden; background: linear-gradient(135deg, var(--brand), var(--brand2) 72%, #2fc0ac);
  box-shadow: 0 12px 22px color-mix(in srgb, var(--brand) 28%, transparent); }
.hero:after { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(150px 150px at 8% -20%, rgba(255,255,255,.30), transparent 72%); }
.hero h1 { font-size: 20px; line-height: 1.6; margin-bottom: 14px; position: relative; }
.hero p { font-size: 14px; opacity: .92; margin: -8px 0 12px; }
.pill { display: inline-block; background: #fff; color: var(--brand);
  border-radius: 999px; padding: 9px 22px; font-size: 15px; position: relative; }

.wallet { border-radius: var(--radius); padding: 18px; color: #fff;
  background: linear-gradient(135deg, #b8860f, var(--accent) 58%, #f0c85c);
  box-shadow: 0 12px 22px color-mix(in srgb, var(--accent) 32%, transparent); }
.wallet .big { font-size: 34px; line-height: 1.2; margin: 4px 0 12px; }
.wallet .pill { color: #8a6508; }

/* ---------------------------------------------------------------- forms -- */
.field { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 13px 14px; }
.field textarea, .field input { width: 100%; border: 0; outline: none; background: none;
  resize: none; line-height: 1.8; }
.field textarea { min-height: 96px; }
.label { font-size: 14px; color: var(--muted); margin: 4px 2px -6px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 999px;
  padding: 8px 16px; font-size: 14px; color: #55636f; white-space: nowrap; }
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }

.rows { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.rows .r { display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 14px; border-bottom: 1px solid var(--line); font-size: 15px; }
.rows .r:last-child { border-bottom: 0; }
.rows .r .v { color: var(--brand); display: flex; align-items: center; gap: 8px; }
.stepper { display: flex; align-items: center; gap: 10px; }
.stepper button { width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line);
  color: var(--brand); font-size: 18px; line-height: 1; }

.badge { background: color-mix(in srgb, var(--brand) 12%, #fff); color: var(--brand);
  border-radius: 9px; padding: 3px 10px; font-size: 13px; white-space: nowrap; }
.badge.warn { background: #fdf5e2; color: #9a6c07; }
.badge.err { background: #fdeceb; color: #c0392b; }

input[type=range] { width: 100%; accent-color: var(--brand); }
.primary { width: 100%; border-radius: 15px; padding: 15px; color: #fff; font-size: 17px;
  background: linear-gradient(135deg, var(--brand), var(--brand2));
  box-shadow: 0 10px 20px color-mix(in srgb, var(--brand) 24%, transparent); }
.primary[disabled] { opacity: .5; box-shadow: none; }
.ghost { width: 100%; border-radius: 15px; padding: 14px; font-size: 16px;
  border: 1px solid var(--line); background: #fff; color: var(--ink); }
.ghost.danger { color: #c0392b; }
.sticky-cta { position: sticky; bottom: calc(var(--tab) + var(--safe-b) + 6px); padding-top: 6px;
  background: linear-gradient(transparent, var(--bg) 30%); }

.upload { height: 140px; border: 2px dashed color-mix(in srgb, var(--brand) 35%, #fff);
  border-radius: var(--radius); background: color-mix(in srgb, var(--brand) 7%, #fff);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; color: var(--brand); font-size: 15px; overflow: hidden; position: relative; }
.upload svg { width: 26px; height: 26px; }
.upload img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.thumb { border-radius: 14px; overflow: hidden; background: #eef2f5; aspect-ratio: 1/1; }
.thumb img, .thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
button.thumb { padding: 0; border: 0; }

/* scene row: picture on one side, time range on the other */
.scene { display: flex; align-items: center; gap: 12px; }
.scene-thumb { width: 64px; height: 64px; flex: 0 0 64px; border-radius: 12px;
  background: #eef2f5; color: var(--muted); display: grid; place-items: center; }
.scene-thumb svg { width: 22px; height: 22px; }
.scene-times { display: flex; gap: 10px; margin-top: 6px; }
.scene-times label { flex: 1; font-size: 12px; color: var(--muted); }
.scene-times input { width: 100%; border: 1px solid var(--line); border-radius: 9px;
  padding: 6px 8px; margin-top: 2px; direction: ltr; text-align: center; }

/* itemised price the user accepts before anything is charged */
.cost { background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; }
.cost-row { display: flex; justify-content: space-between; gap: 10px; font-size: 14px;
  color: #55636f; padding: 3px 0; }
.cost-row.total { border-top: 1px dashed var(--line); margin-top: 6px; padding-top: 9px;
  font-size: 16px; color: var(--ink); }
.cost-note { color: var(--muted); font-size: 12.5px; text-align: left; }
.rowlabel { display: flex; align-items: center; gap: 8px; }
.rowicon { color: var(--brand); display: inline-flex; }
.rowicon svg { width: 19px; height: 19px; }
.mini { border: 1px solid var(--line); border-radius: 9px; padding: 6px 12px; font-size: 13.5px;
  background: #fff; color: var(--ink); display: inline-block; }
.mini.ok { background: var(--brand); border-color: var(--brand); color: #fff; }
.pkg { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 12px 6px;
  text-align: center; }
.pkg.hot { border-color: var(--brand); box-shadow: 0 6px 14px color-mix(in srgb, var(--brand) 16%, transparent); }
.pkg .c { font-size: 17px; }
.pkg .p { color: var(--accent); font-size: 14px; }
.pkg .n { color: var(--muted); font-size: 12px; }
.pkg .bonus { color: var(--brand); font-size: 12px; }
.topup-row { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.topup-row input { flex: 1; border: 1px solid var(--line); border-radius: 12px;
  padding: 11px 14px; direction: ltr; text-align: left; font-size: 17px; }

.job { display: flex; gap: 12px; align-items: center; }
.job .meta { flex: 1; min-width: 0; }
.job .when { color: var(--muted); font-size: 12.5px; }
.empty { text-align: center; color: var(--muted); padding: 34px 10px; }
.empty .big { font-size: 30px; opacity: .5; }
.notice { margin: 10px 14px -2px; padding: 11px 14px; border-radius: 12px; font-size: 14px;
  background: #fdf5e2; color: #8a6508; }
.notice.err { background: #fdeceb; color: #c0392b; }

/* A generation keeps running after its window is closed. This strip is the
   way back to it - and the way to see that several are going at once. */
.jobsbar { position: sticky; top: var(--top); z-index: 26; width: 100%;
  display: flex; align-items: center; gap: 9px; padding: 9px 14px; text-align: right;
  background: color-mix(in srgb, var(--brand) 90%, #04191a); color: #fff; font-size: 14px; }
.jobsbar.ready { background: linear-gradient(135deg, var(--accent), #c08a12); }
.jobsbar svg { width: 17px; height: 17px; flex: 0 0 17px; }
.jobsbar .txt { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; }
.jobsbar .chev { opacity: .85; }
.jobsbar .dots { display: inline-flex; gap: 4px; }
.jobsbar .dots i { width: 6px; height: 6px; border-radius: 50%; background: #fff;
  opacity: .45; animation: blink 1.2s infinite; }
.jobsbar .dots i:nth-child(2) { animation-delay: .2s; }
.jobsbar .dots i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%,100% { opacity: .35 } 50% { opacity: 1 } }
.progress { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; }
.progress i { display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, var(--brand), var(--brand2)); transition: width .4s ease; }

/* ------------------------------------------------------------- overlays -- */
.sheet-wrap, .modal-wrap { position: fixed; inset: 0; z-index: 50; }
.sheet-backdrop, .modal-backdrop { position: absolute; inset: 0; background: rgba(12,20,26,.45); }
.sheet { position: absolute; bottom: 0; left: 0; right: 0; max-height: 92vh; overflow-y: auto;
  background: var(--bg); border-radius: 22px 22px 0 0; padding: 18px 16px calc(20px + var(--safe-b));
  animation: up .22s ease; }
@keyframes up { from { transform: translateY(18px); opacity: .6 } to { transform: none; opacity: 1 } }
.modal { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
  width: min(92vw, 420px); background: #fff; border-radius: 18px; padding: 18px;
  max-height: 86vh; overflow-y: auto; }
.sheet h3, .modal h3 { font-size: 19px; margin-bottom: 12px; }
.sheet-close { position: absolute; top: 12px; left: 14px; width: 34px; height: 34px;
  border-radius: 50%; background: rgba(22,32,42,.07); color: #55636f; font-size: 15px;
  line-height: 1; display: grid; place-items: center; }
.sheet .body, .modal .body { display: flex; flex-direction: column; gap: 12px; }
.sheet-actions { display: flex; gap: 10px; margin-top: 6px; }
.toast { position: fixed; left: 50%; top: calc(var(--top) + 14px);
  transform: translateX(-50%); background: rgba(22,32,42,.94); color: #fff;
  padding: 11px 18px; border-radius: 999px; font-size: 14.5px; z-index: 70; max-width: 88vw;
  text-align: center; }
.toast.err { background: #c0392b; }
