/* VI Iraq — studio UI */
:root {
  --bg: #0f1114;
  --bg2: #15181d;
  --card: #1b1f25;
  --card2: #22272f;
  --line: #2b313a;
  --line2: #3a414c;
  --text: #eef0f3;
  --muted: #9aa3b0;
  --sand: #e4b363;
  --sand2: #f3cf8a;
  --teal: #4fd1c5;
  --red: #ff6b6b;
  --green: #5ad28f;
  --user: #2d4a73;
  --r: 18px;
  --font: "IBM Plex Sans Arabic", system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { overflow-x: hidden; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); line-height: 1.6; min-height: 100dvh; }
body::before { content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: .5;
  background: radial-gradient(900px 500px at 85% -10%, rgba(228,179,99,.14), transparent 60%), radial-gradient(700px 400px at 0% 100%, rgba(79,209,197,.10), transparent 60%); }
a { color: var(--sand2); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
::selection { background: rgba(228,179,99,.35); }

/* ---------- header ---------- */
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px clamp(14px, 3vw, 32px); background: rgba(15,17,20,.82); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.mark { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; font-weight: 700; letter-spacing: .5px; direction: ltr;
  background: linear-gradient(145deg, var(--sand), #c98a3a); color: #1a1205; box-shadow: 0 6px 18px rgba(228,179,99,.25); }
.word { font-weight: 700; font-size: 1.15rem; direction: ltr; display: flex; align-items: baseline; gap: 8px; }
.word small { color: var(--muted); font-weight: 500; font-size: .75rem; direction: rtl; }
.nav { display: flex; gap: 2px; background: var(--bg2); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.tab { border: 0; background: transparent; color: var(--muted); padding: 7px 16px; border-radius: 999px; font-weight: 600; font-size: .92rem; }
.tab.on { background: var(--card2); color: var(--text); }
.tab:hover:not(.on) { color: var(--text); }

/* ---------- page ---------- */
.page { position: relative; z-index: 1; max-width: 1240px; margin: 0 auto; padding: clamp(14px, 2.5vw, 26px) clamp(14px, 3vw, 32px) 90px; }
.view { display: none; }
.view.on { display: block; animation: fade .3s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } }
.section-head { margin: 4px 0 18px; }
.section-head h2 { margin: 0 0 4px; font-size: 1.5rem; }
.section-head p { margin: 0; color: var(--muted); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 18px 20px; }

/* ---------- studio layout ---------- */
.studio { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.chat { display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden;
  box-shadow: 0 30px 60px -30px rgba(0,0,0,.7); min-height: 560px; height: calc(100dvh - 130px); max-height: 860px; }
.chat-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--bg2); }
.who { display: flex; align-items: center; gap: 10px; }
.who strong { display: block; font-size: .95rem; }
.who small { color: var(--muted); font-size: .75rem; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: conic-gradient(from 200deg, var(--sand), var(--teal), var(--sand)); position: relative; }
.avatar::after { content: ""; position: absolute; inset: 3px; border-radius: 50%; background: var(--bg2); }
.summary { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.summary span { font-size: .74rem; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 2px 9px; white-space: nowrap; }

.stage { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.messages { flex: 1; min-height: 0; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; scroll-behavior: smooth; }

/* showcase (before first message) */
.showcase { position: absolute; inset: 0; z-index: 2; overflow: hidden; display: grid; transition: opacity .5s ease, transform .5s ease; }
.showcase.off { opacity: 0; transform: scale(1.02); pointer-events: none; }
.showcase.gone { display: none; }
.mosaic { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(2, 1fr); gap: 3px; }
.mosaic .cell { position: relative; overflow: hidden; background: #000; }
.mosaic video, .mosaic img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .9s ease; }
.mosaic .cell.ready video { opacity: 1; }
.mosaic .cell img { opacity: .9; }
.showcase::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(15,17,20,.25), rgba(15,17,20,.65) 55%, rgba(15,17,20,.92)); }
.hello { position: relative; z-index: 3; align-self: end; padding: 22px 22px 20px; }
.hello h1 { margin: 0 0 6px; font-size: clamp(1.4rem, 3vw, 2rem); line-height: 1.25; }
.hello p { margin: 0 0 14px; color: #d7dce3; max-width: 520px; }
.starters { display: flex; flex-wrap: wrap; gap: 8px; }
.starters button { border: 1px solid rgba(255,255,255,.22); background: rgba(15,17,20,.55); color: #fff; padding: 7px 13px; border-radius: 999px; font-size: .86rem; backdrop-filter: blur(6px); }
.starters button:hover { border-color: var(--sand); color: var(--sand2); }

/* messages */
.msg { max-width: 80%; padding: 10px 14px; border-radius: 16px; white-space: pre-wrap; word-break: break-word; animation: pop .22s ease; font-size: .96rem; }
@keyframes pop { from { opacity: 0; transform: translateY(6px); } }
.msg.user { align-self: flex-start; background: var(--user); border-bottom-right-radius: 6px; }
.msg.bot { align-self: flex-end; background: var(--card2); border-bottom-left-radius: 6px; }
.msg.sys { align-self: center; max-width: 92%; background: transparent; border: 1px dashed var(--line2); color: var(--muted); font-size: .82rem; text-align: center; }
.msg.sys.ok { border-color: rgba(90,210,143,.5); color: var(--green); }
.msg.sys.ids { color: var(--text); }
.msg.sys.ids code { display: inline-block; direction: ltr; background: var(--card2); border: 1px solid var(--line2); border-radius: 8px; padding: 1px 8px; margin: 2px; font-size: .85rem; }
.botlink { display: inline-block; margin: 8px 0 4px; background: #2aabee; color: #fff !important; text-decoration: none; font-weight: 600; padding: 8px 14px; border-radius: 999px; font-size: .86rem; }
.botlink:hover { background: #3cb8f5; }
/* order status card */
.msg.sys.status { width: min(92%, 460px); border-style: solid; text-align: right; display: grid; gap: 8px; }
.msg.sys.status .steps { display: flex; gap: 4px; margin: 6px 0 4px; }
.msg.sys.status .steps span { flex: 1; text-align: center; font-size: .74rem; padding: 4px 2px; border-radius: 999px; border: 1px solid var(--line2); color: var(--muted); }
.msg.sys.status .steps span.done { border-color: rgba(90,210,143,.5); color: var(--green); }
.msg.sys.status .steps span.now { background: var(--green); border-color: var(--green); color: #0f1114; font-weight: 600; }
.msg.sys.status .stmsg { color: var(--text); }
.msg.sys.status video.result { width: 100%; border-radius: 10px; background: #000; }
/* "confirm on Telegram" dialog after sending an order */
.botdlg { width: min(92vw, 420px); border: 1px solid var(--line2); border-radius: 18px; background: var(--card); color: var(--text); padding: 22px 20px 16px; text-align: center; }
.botdlg::backdrop { background: rgba(5,6,8,.7); backdrop-filter: blur(3px); }
.botdlg .bd-icon { font-size: 2rem; }
.botdlg h3 { margin: 6px 0 8px; font-size: 1.08rem; }
.botdlg p { margin: 0 0 12px; color: var(--muted); font-size: .9rem; line-height: 1.8; }
.botdlg code { direction: ltr; display: inline-block; background: var(--card2); border: 1px solid var(--line2); border-radius: 8px; padding: 0 6px; color: var(--text); }
.botlink.big { display: block; padding: 12px 16px; font-size: 1rem; }
.botdlg .bd-later { margin-top: 6px; border: 0; background: transparent; color: var(--muted); font-size: .85rem; padding: 6px 12px; }
.note a { color: var(--sand2); }
.msg .tag { display: block; margin-top: 4px; font-size: .7rem; color: rgba(255,255,255,.55); direction: ltr; text-align: right; }
.msg.typing { display: flex; gap: 4px; padding: 14px 16px; }
.msg.typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: blink 1s infinite; }
.msg.typing span:nth-child(2) { animation-delay: .2s } .msg.typing span:nth-child(3) { animation-delay: .4s }
@keyframes blink { 50% { opacity: .3; transform: translateY(-3px); } }
.msg .files { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.msg .files figure { margin: 0; position: relative; }
.msg .files img { width: 132px; height: 132px; object-fit: cover; border-radius: 10px; display: block; }
.msg .files video { width: min(100%, 300px); max-height: 220px; border-radius: 10px; background: #000; display: block; }
.msg .files figcaption { position: absolute; top: 6px; right: 6px; font-size: .68rem; background: rgba(0,0,0,.65); color: #fff; padding: 2px 7px; border-radius: 999px; }
.msg .files a.doc { color: #fff; background: rgba(0,0,0,.25); padding: 6px 10px; border-radius: 10px; font-size: .82rem; text-decoration: none; direction: ltr; }

/* tray + composer */
.tray { display: flex; gap: 8px; flex-wrap: wrap; padding: 10px 14px; border-top: 1px solid var(--line); background: var(--bg2); }
.tray[hidden] { display: none; }
.att { position: relative; display: flex; align-items: center; gap: 8px; background: var(--card2); border: 1px solid var(--line); border-radius: 12px; padding: 5px 6px 5px 8px; font-size: .8rem; max-width: 290px; overflow: hidden; }
.att img, .att video { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; background: #000; flex: none; }
.att .ic { width: 44px; height: 44px; display: grid; place-items: center; font-size: 1.3rem; flex: none; }
.att .body { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.att .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; direction: ltr; text-align: right; }
.att select { background: var(--bg2); border: 1px solid var(--line2); border-radius: 8px; padding: 2px 6px; font-size: .76rem; color: var(--sand2); }
.att .x { border: 0; background: transparent; color: var(--muted); font-size: 1rem; padding: 0 4px; flex: none; }
.att .x:hover { color: var(--red); }
.att.uploading { opacity: .6; }
.att .prog { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--sand); transition: width .2s; }
.composer { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line); background: var(--bg2); }
.composer textarea { flex: 1; resize: none; max-height: 140px; background: var(--card2); border: 1px solid var(--line); border-radius: 14px; padding: 11px 14px; line-height: 1.5; }
.composer textarea:focus { outline: none; border-color: var(--sand); box-shadow: 0 0 0 3px rgba(228,179,99,.18); }
.icon { flex: none; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; border: 1px solid var(--line); background: var(--card2); color: var(--muted); }
.icon:hover { color: var(--text); border-color: var(--line2); }
.icon.send { background: var(--sand); border-color: var(--sand); color: #1a1205; }
.icon.send:hover { background: var(--sand2); }
.icon.send svg { transform: scaleX(-1); }

/* ---------- order panel ---------- */
.panel { position: sticky; top: 78px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.panel h2 { margin: 0 0 2px; font-size: 1.1rem; }
.field label { display: block; font-size: .82rem; color: var(--muted); margin-bottom: 6px; font-weight: 600; }
.field label b { color: var(--text); }
.field.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.req { font-size: .68rem; color: var(--sand); border: 1px solid rgba(228,179,99,.4); border-radius: 999px; padding: 0 7px; margin-inline-start: 4px; font-weight: 500; }
.hint { display: block; margin-top: 5px; color: var(--muted); font-size: .74rem; }
select, .prefixed input { width: 100%; background: var(--card2); border: 1px solid var(--line); border-radius: 12px; padding: 9px 12px; }
select:focus, .prefixed:focus-within { outline: none; border-color: var(--sand); box-shadow: 0 0 0 3px rgba(228,179,99,.18); }
.prefixed { display: flex; align-items: center; background: var(--card2); border: 1px solid var(--line); border-radius: 12px; direction: ltr; overflow: hidden; }
.prefixed span { padding: 0 10px 0 12px; color: var(--muted); font-weight: 600; border-right: 1px solid var(--line); line-height: 40px; }
.prefixed input { border: 0; border-radius: 0; background: transparent; direction: ltr; }
.prefixed input:focus { outline: none; }
.prefixed.bad { border-color: var(--red); box-shadow: 0 0 0 3px rgba(255,107,107,.18); }
.seg { display: flex; gap: 4px; background: var(--card2); border: 1px solid var(--line); border-radius: 12px; padding: 3px; }
.seg button { flex: 1; border: 0; border-radius: 9px; padding: 8px 4px; background: transparent; color: var(--muted); font-weight: 600; }
.seg button.on { background: var(--sand); color: #1a1205; }
input[type="range"] { width: 100%; appearance: none; height: 6px; border-radius: 6px; direction: ltr; outline: none; margin: 6px 0 8px;
  background: linear-gradient(90deg, var(--sand) var(--fill, 10%), var(--line2) var(--fill, 10%)); }
input[type="range"]::-webkit-slider-thumb { appearance: none; width: 22px; height: 22px; border-radius: 50%; background: #fff; border: 4px solid var(--sand); cursor: grab; }
input[type="range"]::-moz-range-thumb { width: 22px; height: 22px; border-radius: 50%; background: #fff; border: 4px solid var(--sand); }
.chips { display: flex; gap: 6px; }
.chips button { flex: 1; background: var(--card2); border: 1px solid var(--line); border-radius: 999px; padding: 5px; font-size: .82rem; color: var(--muted); font-weight: 600; }
.chips button.on { background: rgba(228,179,99,.15); border-color: var(--sand); color: var(--sand2); }
.price { text-align: center; padding: 12px; border-radius: 14px; background: linear-gradient(160deg, rgba(228,179,99,.12), rgba(79,209,197,.08)); border: 1px solid rgba(228,179,99,.25); }
.price small { color: var(--muted); font-size: .74rem; }
.amount { font-size: 2.1rem; font-weight: 700; line-height: 1.1; direction: ltr; color: var(--sand2); transition: transform .15s; }
.amount.bump { transform: scale(1.08); }
.price .meta { color: var(--muted); font-size: .8rem; }
.cta { border: 0; border-radius: 14px; padding: 13px 16px; background: var(--sand); color: #1a1205; font-weight: 700; font-size: 1rem; display: flex; justify-content: space-between; align-items: center; }
.cta:hover { background: var(--sand2); }
.cta:disabled { opacity: .6; cursor: wait; }
.cta-price { background: rgba(0,0,0,.18); padding: 2px 10px; border-radius: 999px; direction: ltr; }
.note { margin: 0; font-size: .8rem; color: var(--muted); text-align: center; min-height: 1.2em; }
.note.ok { color: var(--green); } .note.err { color: var(--red); }

/* mobile bar */
.mbar { display: none; }

/* ---------- works grid ---------- */
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.tile .frame { position: relative; background: #000; aspect-ratio: 16 / 9; }
.tile video { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile .frame::before { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(100deg, #15181d 28%, #22272f 50%, #15181d 72%); background-size: 220% 100%; animation: shim 1.2s linear infinite; transition: opacity .35s; }
.tile .frame.ready::before { opacity: 0; animation: none; }
@keyframes shim { from { background-position: 120% 0; } to { background-position: -120% 0; } }
.tile .meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 14px; }
.tile .meta b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile .meta a { color: var(--muted); font-size: .78rem; text-decoration: none; white-space: nowrap; }
.tile .meta a:hover { color: var(--sand2); }
.tile.empty { padding: 40px; text-align: center; color: var(--muted); grid-column: 1 / -1; }

/* ---------- prices ---------- */
.prices { width: 100%; border-collapse: collapse; text-align: center; }
.prices th { color: var(--muted); font-weight: 600; padding: 10px; border-bottom: 1px solid var(--line); }
.prices td { padding: 14px; border-bottom: 1px solid var(--line); font-weight: 600; direction: ltr; }
.prices tr:last-child td { border-bottom: 0; }
.prices td.hi { color: var(--sand2); }

/* ---------- footer + toast ---------- */
.foot { position: relative; z-index: 1; display: flex; justify-content: space-between; gap: 12px; max-width: 1240px; margin: 0 auto; padding: 0 clamp(14px, 3vw, 32px) 24px; color: var(--muted); font-size: .78rem; }
.foot a { color: var(--muted); }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: #fff; color: #111; padding: 10px 18px; border-radius: 999px; font-weight: 600; z-index: 50; box-shadow: 0 10px 30px rgba(0,0,0,.5); max-width: 92vw; text-align: center; }
.toast[hidden] { display: none; }

/* ---------- responsive ---------- */
@media (max-width: 1000px) { .grid { grid-template-columns: repeat(2, 1fr); } .studio { grid-template-columns: minmax(0, 1fr) 310px; } }
@media (max-width: 820px) {
  .word small { display: none; }
  .studio { grid-template-columns: 1fr; }
  .chat { height: calc(100dvh - 140px); min-height: 480px; }
  .panel { position: static; }
  .summary { display: none; }
  .mosaic { grid-template-columns: repeat(2, 1fr); }
  .mosaic .cell:nth-child(n+5) { display: none; }
  .hello { padding: 16px; }
  .msg { max-width: 88%; }
  .grid { grid-template-columns: 1fr; }
  .mbar { display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; align-items: center; justify-content: space-between; gap: 12px;
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); background: rgba(15,17,20,.92); backdrop-filter: blur(12px); border-top: 1px solid var(--line); }
  .mbar small { display: block; color: var(--muted); font-size: .7rem; }
  .mbar strong { font-size: 1.2rem; direction: ltr; color: var(--sand2); }
  .mbar button { border: 0; background: var(--sand); color: #1a1205; font-weight: 700; padding: 10px 16px; border-radius: 12px; }
  .mbar.hide { display: none; }
  .foot { padding-bottom: 80px; }
}
@media (max-width: 400px) { .tab { padding: 7px 11px; font-size: .86rem; } .field.two { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
