@font-face {
  font-family: Vazirmatn;
  src: url('/assets/vazirmatn-arabic-400-normal.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: Vazirmatn;
  src: url('/assets/vazirmatn-arabic-700-normal.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
}
:root {
  color-scheme: light;
  --bg: #f7f8fc;
  --surface: #fff;
  --subtle: #f7f7fc;
  --line: #e5e7f1;
  --text: #171b36;
  --muted: #5c6279;
  --accent: #5b3bdf;
  --accent-hover: #492ac2;
  --accent-text: #5235ca;
  --accent-bg: #eeeaff;
  --good: #10765e;
  --good-bg: #e9faf4;
  --danger: #a72b43;
  --danger-bg: #fff0f3;
  --shadow: 0 6px 24px #25225108;
}
:root[data-theme='dark'] {
  color-scheme: dark;
  --bg: #111223;
  --surface: #1a1b30;
  --subtle: #1f2038;
  --line: #30334d;
  --text: #f3f1ff;
  --muted: #b3b5cc;
  --accent: #6b4cef;
  --accent-hover: #573adb;
  --accent-text: #bbadff;
  --accent-bg: #322858;
  --good: #77dec0;
  --good-bg: #183a37;
  --danger: #ffa4b6;
  --danger-bg: #451f36;
  --shadow: 0 8px 30px #07081635;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) { color-scheme: dark; }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 400 1rem/1.65 Vazirmatn, Tahoma, system-ui, sans-serif;
}
h1, h2, p { margin: 0; }
a { color: var(--accent-text); text-decoration: none; }
button, input { font: inherit; }
button, summary { cursor: pointer; }
button:disabled { opacity: .54; cursor: default; }
:focus-visible { outline: 3px solid #8a72f7; outline-offset: 4px; }
svg:not(.orbits) { width: 1.25rem; height: 1.25rem; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.shell { width: min(100% - 64px, 1120px); margin-inline: auto; }
.top { min-height: 96px; display: flex; justify-content: space-between; align-items: center; gap: .8rem; }
.brand { display: inline-flex; align-items: center; gap: .65rem; color: var(--text); font: 750 1.46rem/1 system-ui, sans-serif; letter-spacing: -.065em; }
.brand img { border-radius: 10px; }
.brand span span { color: var(--accent-text); }
.top-actions, .online-state { display: flex; align-items: center; gap: .6rem; }
.online-state { padding-inline: .7rem .4rem; color: var(--muted); font-size: .83rem; white-space: nowrap; }
.online-state i { width: .48rem; height: .48rem; border-radius: 50%; background: #23ad88; box-shadow: 0 0 0 3px var(--good-bg); }
.online-state[data-offline] i { background: #cf6a32; box-shadow: 0 0 0 3px var(--danger-bg); }
.icon-button, .primary, .secondary, .danger, .download {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: .45rem;
  min-height: 44px;
  padding: .55rem 1rem;
  border: 1px solid transparent;
  border-radius: 11px;
  font-weight: 700;
  font-size: .9rem;
  transition: background .18s ease, border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}
.icon-button { width: 44px; padding: 0; background: var(--surface); border-color: var(--line); color: var(--muted); }
.icon-button:hover, .secondary:hover { border-color: var(--accent-text); color: var(--accent-text); }
.primary { background: var(--accent); color: #fff; box-shadow: 0 5px 14px #4b2cda24; }
.primary:hover:not(:disabled) { background: var(--accent-hover); }
.secondary { color: var(--text); background: var(--surface); border-color: var(--line); }
.danger { color: var(--danger); background: var(--danger-bg); }
.danger:hover { border-color: var(--danger); }
:root[data-theme='light'] .sun, :root[data-theme='dark'] .moon { display: none; }

.hero {
  min-height: 368px;
  display: grid;
  grid-template-columns: 1.04fr 1fr;
  align-items: center;
  overflow: hidden;
  isolation: isolate;
  border: 1px solid #29234d;
  border-radius: 28px;
  color: #fff;
  background:
    radial-gradient(ellipse at 15% 48%, #372578 0, transparent 56%),
    linear-gradient(128deg, #171433 0%, #1e1844 46%, #14152e 100%);
  box-shadow: 0 14px 36px #1d173422;
}
.hero-copy { z-index: 1; padding: 2.65rem clamp(1.5rem, 4.7vw, 4.25rem) 2.65rem 0; }
.hero h1 { font-size: clamp(2.05rem, 4vw, 3.65rem); font-weight: 700; line-height: 1.35; letter-spacing: -.032em; }
.hero em { color: #c1b5ff; font-style: normal; }
.hero p { color: #d6d2eb; font-size: clamp(.93rem, 1.4vw, 1.05rem); line-height: 1.9; margin-top: 1.25rem; max-width: 23rem; }
.orbit-art { position: relative; aspect-ratio: 520 / 320; margin: 0 0 0 .7rem; user-select: none; }
.orbit-art::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 47% 49%, #7150e85a 0, transparent 52%),
    radial-gradient(circle, #b8a5ff48 1px, transparent 1.35px) 0 0 / 20px 20px;
  mask-image: radial-gradient(ellipse, #000 0%, #0006 49%, transparent 74%);
}
.orbits { position: absolute; inset: 0; width: 100%; height: 100%; }
.art-hub, .art-device {
  position: absolute;
  display: grid;
  place-items: center;
  border: 1px solid #aa97ff72;
  color: #ece6ff;
  background: linear-gradient(145deg, #534195, #2b2256);
  box-shadow: 0 9px 28px #0b071c77, inset 0 1px #d7cbff2b;
}
.art-hub { inset: 50% auto auto 48%; width: 22%; aspect-ratio: 1; border-radius: 27%; transform: translate(-50%, -50%) rotate(-9deg); box-shadow: 0 0 41px #8664f36b, inset 0 1px #d7cbff3c; }
.art-hub img { width: 73%; height: auto; }
.art-device { width: 13%; aspect-ratio: 1; border-radius: 24%; }
.art-device svg { width: 49% !important; height: 49% !important; }
.art-laptop { top: 56%; left: 14%; transform: rotate(-12deg); animation: float 5s ease-in-out infinite alternate; }
.art-phone { top: 22%; left: 72%; transform: rotate(12deg); animation: float 6s ease-in-out infinite alternate-reverse; }
.art-packet { position: absolute; display: block; width: 2%; aspect-ratio: 1; border-radius: 28%; background: #c6b4ff; box-shadow: 0 0 20px #b193ff; transform: rotate(35deg); animation: pulse 3s ease-in-out infinite; }
.packet-one { left: 30%; top: 57%; }
.packet-two { left: 65%; top: 39%; animation-delay: 1.3s; }
@keyframes float { to { translate: 0 -9px; } }
@keyframes pulse { 50% { opacity: .35; scale: .76; } }
@keyframes enter { from { opacity: .35; transform: translateY(7px); } }
.choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-top: 22px; }
.choice {
  display: flex;
  width: 100%;
  align-items: center;
  text-align: start;
  gap: 1rem;
  padding: 1.3rem 1.35rem;
  min-height: 111px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 19px;
  box-shadow: var(--shadow);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.choice:hover { transform: translateY(-3px); border-color: var(--accent-text); box-shadow: 0 12px 26px #5a42ce20; }
.choice:active { transform: translateY(0); }
.choice-icon { display: grid; flex: 0 0 auto; width: 51px; height: 51px; place-items: center; border-radius: 15px; color: var(--accent-text); background: var(--accent-bg); }
.choice-icon svg { width: 1.5rem !important; height: 1.5rem !important; }
.receive-icon { color: var(--good); background: var(--good-bg); }
.choice-copy { flex: 1; }
.choice strong { display: block; font-size: 1.16rem; }
.choice small { display: block; color: var(--muted); font-size: .88rem; margin-top: .2rem; }
.choice-arrow { display: flex; color: var(--muted); }
.footer { margin-top: auto; padding-block: 2.3rem 1.6rem; }
.footer p { display: flex; align-items: center; justify-content: center; gap: .55rem; color: var(--muted); min-height: 3.2rem; border-top: 1px solid var(--line); font-size: .85rem; }
.footer svg { color: var(--good); width: 1.05rem !important; height: 1.05rem !important; }
.notice { margin-bottom: .85rem; padding: .75rem 1rem; border: 1px solid var(--line); background: var(--surface); border-radius: 10px; font-size: .9rem; }
#offline { color: var(--danger); background: var(--danger-bg); }

.panel {
  max-width: 790px;
  margin-inline: auto;
  padding: clamp(1.1rem, 4vw, 2.45rem);
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: var(--shadow);
  animation: enter .28s ease both;
}
.panel h1 { font-size: clamp(1.65rem, 4vw, 2.24rem); margin: .43rem 0 .25rem; }
.back { display: inline-flex; align-items: center; gap: .38rem; color: var(--muted); font-size: .87rem; }
.back:hover { color: var(--accent-text); }
.back svg { width: .95rem !important; height: .95rem !important; }
.muted { color: var(--muted); font-size: .88rem; }
.steps { padding: 0; display: flex; list-style: none; margin: 1.2rem 0 1.3rem; gap: .42rem; }
.steps li { flex: 1; min-width: 0; color: var(--muted); font-size: .82rem; }
.steps li span { display: block; height: 4px; border-radius: 20px; background: var(--line); margin-bottom: .38rem; }
.steps li[data-done] span { background: var(--good); }
.steps li[aria-current] { color: var(--accent-text); }
.steps li[aria-current] span { background: var(--accent); }
.status { display: flex; gap: .72rem; align-items: center; margin-block: 0 .95rem; padding: .75rem .9rem; border-radius: 11px; background: var(--accent-bg); color: var(--accent-text); font-size: .9rem; }
.status-icon { flex: 0 0 .88rem; width: .88rem; height: .88rem; border: 2px solid currentColor; border-radius: 50%; }
.status[data-tone='busy'] .status-icon { border-inline-end-color: transparent; animation: spin .78s linear infinite; }
.status[data-tone='success'] { color: var(--good); background: var(--good-bg); }
.status[data-tone='success'] .status-icon { border-radius: 0; border-width: 0 0 2px 2px; height: .49rem; transform: rotate(-45deg) translateY(-1px); }
.status[data-tone='error'] { color: var(--danger); background: var(--danger-bg); }
@keyframes spin { to { transform: rotate(360deg); } }
.dropzone { display: grid; justify-items: center; text-align: center; gap: .37rem; position: relative; padding: 1.65rem .9rem; border-radius: 16px; border: 1px dashed var(--accent-text); background: var(--subtle); cursor: pointer; transition: background .18s ease; }
.dropzone:hover, .dropzone.drag, .dropzone:focus-within { background: var(--accent-bg); }
.dropzone:focus-within { outline: 2px solid var(--accent-text); outline-offset: 2px; }
.dropzone strong { margin-top: .25rem; }
.dropzone input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.dropzone:has(input:disabled) { opacity: .65; cursor: default; }
.selection-summary { margin-top: .72rem; }
#selection > button { margin-top: .85rem; width: 100%; }
#code-form { display: grid; gap: .55rem; max-width: 360px; }
#code-form label, .invite-info label { font-size: .9rem; font-weight: 700; }
#code-form button { margin-top: .2rem; }
input:not([type='file']) { background: var(--subtle); color: var(--text); border: 1px solid var(--line); border-radius: 10px; min-height: 44px; padding: .6rem .75rem; min-width: 0; }
#input-code { width: 100%; text-align: center; letter-spacing: .25em; font-size: 1.4rem; font-weight: 700; }
.invite-grid { display: grid; grid-template-columns: minmax(120px, 178px) minmax(0, 1fr); align-items: center; gap: clamp(.8rem, 3vw, 1.8rem); padding: 1rem; border: 1px solid var(--line); border-radius: 16px; background: var(--subtle); }
.qr-area { display: grid; gap: .45rem; text-align: center; }
.qr-frame { display: grid; place-items: center; aspect-ratio: 1; border-radius: 12px; background: #fff; border: 1px solid #e2dff2; }
.qr-frame canvas { display: block; width: 100%; height: auto; border-radius: inherit; image-rendering: pixelated; }
.invite-info { display: grid; gap: .48rem; }
.link-row, .invite-code { display: flex; align-items: center; gap: .55rem; }
.link-row input { flex: 1; width: 0; font: .8rem system-ui, sans-serif; background: var(--surface); }
.link-row button { flex: 0 0 auto; }
.invite-code { justify-content: space-between; margin-top: .25rem; }
.code { display: block; width: fit-content; color: var(--accent-text); font: 700 1.55rem/1.45 ui-monospace, monospace; letter-spacing: .1em; }
.share { justify-self: start; }
.approval { display: grid; justify-items: start; gap: .78rem; padding: .95rem 1rem; border: 1px solid var(--line); border-radius: 13px; margin-top: .85rem; background: var(--subtle); }
.actions { display: flex; align-items: center; flex-wrap: wrap; gap: .55rem; }
.controls { margin-top: .9rem; }
.controls:not(:has(button:not([hidden]))) { display: none; }
.overview { margin-top: .9rem; padding: .9rem 1rem; background: var(--subtle); border: 1px solid var(--line); border-radius: 13px; }
.overview div { display: flex; justify-content: space-between; align-items: baseline; }
.overview output { color: var(--accent-text); font-weight: 700; }
progress { appearance: none; display: block; width: 100%; height: .42rem; border: 0; border-radius: 20px; background: var(--line); overflow: hidden; }
progress::-webkit-progress-bar { background: var(--line); }
progress::-webkit-progress-value { background: var(--accent); border-radius: 20px; transition: width .17s linear; }
progress::-moz-progress-bar { background: var(--accent); border-radius: 20px; }
.overview progress { margin: .52rem 0 .46rem; }
.metrics { min-height: 1.43rem; font-variant-numeric: tabular-nums; }
.file-list { display: grid; gap: .55rem; padding: 0; margin: .9rem 0 0; list-style: none; }
.file-list li { min-width: 0; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: .22rem .7rem; padding: .68rem .78rem; border: 1px solid var(--line); border-radius: 12px; }
.file-symbol { grid-row: span 2; align-self: center; display: grid; place-items: center; width: 35px; height: 35px; border-radius: 9px; color: var(--accent-text); background: var(--accent-bg); }
.file-list li[data-saved] .file-symbol { color: var(--good); background: var(--good-bg); }
.file-list bdi { grid-column: 2; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; justify-self: start; max-width: 100%; font-weight: 700; font-size: .92rem; }
.file-list li > span:not(.file-symbol) { grid-row: 2; grid-column: 2; color: var(--muted); font-size: .81rem; }
.file-list progress { grid-column: 2 / -1; margin-top: .22rem; }
.download { grid-column: 3; grid-row: 1 / span 2; background: var(--accent-bg); color: var(--accent-text); min-height: 38px; padding: .35rem .7rem; font-size: .82rem; }
.download:hover { border-color: var(--accent-text); }
details { padding-top: .8rem; font-size: .88rem; color: var(--muted); }
details p { margin-top: .35rem; }
dialog { width: min(90%, 390px); border: 1px solid var(--line); border-radius: 17px; padding: 1.3rem; background: var(--surface); color: var(--text); }
dialog::backdrop { background: #0a082781; }
dialog p { color: var(--muted); margin: .55rem 0 1rem; }
@media (max-width: 750px) {
  .shell { width: calc(100% - 36px); }
  .top { min-height: 82px; }
  .hero { min-height: 292px; }
  .hero h1 { font-size: clamp(1.65rem, 4.55vw, 2.25rem); }
  .choices { gap: .7rem; margin-top: .85rem; }
  .choice { padding: .9rem .78rem; gap: .64rem; }
  .choice small { font-size: .8rem; }
}
@media (max-width: 560px) {
  .shell { width: calc(100% - 28px); }
  .top { min-height: 69px; }
  .top-actions { gap: .4rem; }
  .brand { font-size: 1.23rem; gap: .4rem; }
  .brand img { width: 33px; height: 33px; }
  .hero { min-height: 0; grid-template-columns: 1fr; border-radius: 21px; }
  .hero-copy { padding: 1.5rem 1.25rem 0; }
  .hero h1 { font-size: clamp(1.72rem, 7vw, 2.35rem); }
  .hero p { margin-top: .5rem; }
  .orbit-art { width: min(91%, 305px); margin: -.2rem auto -.25rem; }
  .choices { grid-template-columns: 1fr; }
  .choice { min-height: 78px; border-radius: 14px; }
  .choice-icon { width: 45px; height: 45px; border-radius: 12px; }
  .online-state { font-size: .77rem; padding-inline: 0 .17rem; gap: .27rem; }
  .install { width: 44px; padding-inline: 0; }
  .install span { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; }
  .footer { padding-block: 1.25rem .55rem; }
  .panel { border-radius: 17px; }
  .invite-grid { grid-template-columns: 1fr; }
  .qr-area { width: min(100%, 152px); margin-inline: auto; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
