@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("assets/fonts/inter-latin-400-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("assets/fonts/inter-latin-600-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("assets/fonts/inter-latin-700-normal.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Sans Arabic";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("assets/fonts/ibm-plex-sans-arabic-arabic-400-normal.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Sans Arabic";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("assets/fonts/ibm-plex-sans-arabic-arabic-600-normal.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Sans Arabic";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("assets/fonts/ibm-plex-sans-arabic-arabic-700-normal.woff2") format("woff2");
}

:root {
  --bg: #060a12;
  --bg-2: #0a1120;
  --panel: rgba(18, 27, 41, 0.82);
  --panel-2: rgba(12, 19, 30, 0.88);
  --line: #20304a;
  --line-soft: rgba(80, 120, 170, 0.18);
  --text: #e9f0f8;
  --muted: #93a6bd;
  --accent: #2ee68a;
  --accent-2: #16c46e;
  --accent-3: #35c9c0;
  --danger: #ff7a7a;
  --radius: 16px;
  --shadow: 0 18px 40px -24px rgba(0, 0, 0, 0.9);
  interpolate-size: allow-keywords;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1200px 700px at 50% -20%, #0d1830 0%, var(--bg) 60%),
    var(--bg);
  color: var(--text);
  font: 16px/1.65 "Inter", "IBM Plex Sans Arabic", system-ui, -apple-system, "Segoe UI", Tahoma, Roboto, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* decorative background */
.bg-aurora {
  position: fixed;
  inset: 0;
  z-index: -2;
  overflow: hidden;
  pointer-events: none;
}
.bg-aurora::before,
.bg-aurora::after {
  content: "";
  position: absolute;
  width: 64vmax;
  height: 64vmax;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.30;
}
.bg-aurora::before {
  top: -24vmax;
  inset-inline-start: -18vmax;
  background: radial-gradient(circle at 35% 35%, #1d4ed8 0%, rgba(29, 78, 216, 0) 62%);
  animation: drift-a 24s ease-in-out infinite alternate;
}
.bg-aurora::after {
  bottom: -28vmax;
  inset-inline-end: -20vmax;
  background: radial-gradient(circle at 65% 65%, #0e8f7a 0%, rgba(14, 143, 122, 0) 62%);
  animation: drift-b 30s ease-in-out infinite alternate;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(var(--line-soft) 1px, transparent 1px),
    linear-gradient(90deg, var(--line-soft) 1px, transparent 1px);
  background-size: 46px 46px;
  opacity: 0.35;
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 0%, transparent 75%);
  mask-image: radial-gradient(circle at 50% 30%, #000 0%, transparent 70%);
}
@keyframes drift-a {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(6vmax, 5vmax, 0) scale(1.15); }
}
@keyframes drift-b {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(-7vmax, -4vmax, 0) scale(1.1); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .bg-aurora::before, .bg-aurora::after { animation: none; }
}

code {
  background: rgba(8, 13, 22, 0.9);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1px 6px;
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 0.9em;
}

a { color: inherit; text-decoration: none; }
a:hover { color: #fff; }

.wrap { width: min(980px, 92vw); margin: 0 auto; }

/* nav */
.nav {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(12px);
  background: rgba(6, 10, 18, 0.72);
  border-bottom: 1px solid var(--line-soft);
}
.nav-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  height: 62px;
}
.brand {
  font-weight: 800;
  letter-spacing: 3px;
  font-size: 20px;
  background: linear-gradient(90deg, var(--accent), var(--accent-3));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  flex: none;
}
.nav-links {
  display: flex;
  gap: 20px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  margin-inline: auto;
}
.nav-links::-webkit-scrollbar { display: none; }
.nav-links a {
  color: var(--muted);
  white-space: nowrap;
  font-size: 15px;
  transition: color 0.15s ease;
}
.nav-links a:hover { color: var(--text); }
.lang-toggle {
  flex: none;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  border-radius: 999px;
  padding: 7px 14px;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.lang-toggle:hover { border-color: var(--accent); color: var(--accent); }

/* hero */
.hero { padding: 84px 0 48px; text-align: center; }
.eyebrow {
  display: inline-block;
  margin: 0 0 14px;
  padding: 5px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--accent);
  font-size: 13px;
  letter-spacing: 1px;
  direction: ltr;
}
.hero h1 {
  font-size: clamp(30px, 6vw, 52px);
  line-height: 1.2;
  margin: 0 0 10px;
  padding: 0.06em 0 0.18em;
  letter-spacing: -0.02em;
  background: linear-gradient(180deg, #ffffff 30%, #b9cbe0);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  overflow: visible;
}
.lead { color: var(--muted); font-size: clamp(1rem, 2.5vw, 1.14rem); max-width: 660px; margin: 0 auto 28px; }
.cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.hero .small { margin-top: 22px; }

/* buttons */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  padding: 12px 20px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
  min-height: 44px;
  overflow: hidden;
  transition: transform 0.12s ease, border-color 0.15s ease, box-shadow 0.2s ease, filter 0.15s ease;
}
.btn:hover { border-color: #33507a; transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(0.985); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(46, 230, 138, 0.35); }
.btn.primary {
  border-color: transparent;
  background: linear-gradient(180deg, #34f095, var(--accent-2));
  color: #04220f;
  box-shadow: 0 10px 24px -14px rgba(46, 230, 138, 0.85);
}
.btn.primary::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(115deg, transparent 32%, rgba(255, 255, 255, 0.45) 50%, transparent 68%);
  transform: translateX(-130%);
  transition: transform 0.6s ease;
}
.btn.primary:hover {
  filter: brightness(1.06);
  box-shadow: 0 0 0 1px rgba(46, 230, 138, 0.4), 0 14px 34px -8px rgba(46, 230, 138, 0.8);
}
.btn.primary:hover::after { transform: translateX(130%); }
.btn.ghost:hover { border-color: var(--accent); color: var(--text); box-shadow: 0 0 20px -6px rgba(46, 230, 138, 0.5); }
.btn.ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn.full { width: 100%; }
.btn:disabled { opacity: 0.6; cursor: default; }

/* sections */
.section { padding: 56px 0; }
.section h2 { font-size: clamp(22px, 3.4vw, 30px); margin: 0 0 18px; letter-spacing: -0.01em; }

.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 620px) { .grid.two { grid-template-columns: 1fr; } }

.card {
  background: linear-gradient(160deg, var(--panel), var(--panel-2));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}
.card h3 { margin: 0 0 8px; font-size: 18px; }
.card p { margin: 0; color: var(--muted); }
.card p + p { margin-top: 8px; }

/* pricing */
.price { display: flex; flex-direction: column; gap: 10px; }
.price .amount { font-size: 34px; font-weight: 800; color: var(--text); }
.price .amount span { font-size: 0.42em; font-weight: 600; color: var(--muted); letter-spacing: 0.06em; }
.price .btn { margin-top: auto; }

/* forms */
.form { display: flex; flex-direction: column; gap: 16px; }
.form.card { margin: 0; }
label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
  color: var(--muted);
  font-weight: 600;
}
input, select, textarea {
  width: 100%;
  background: rgba(8, 13, 22, 0.9);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  color: var(--text);
  font: inherit;
  font-size: 15px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(46, 230, 138, 0.16);
}
textarea { resize: vertical; }
select { appearance: none; background-image: none; }
.form > .btn { align-self: flex-start; }
.form-error { color: var(--danger); font-size: 14px; margin: 0; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 620px) { .two-col { grid-template-columns: 1fr; } }

/* results */
.result { margin-top: 20px; }
.result.card h3 { font-size: 18px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0 0 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 700; word-break: break-word; }
textarea[readonly] {
  height: auto;
  min-height: 92px;
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 13px;
  line-height: 1.5;
}
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row.between { justify-content: space-between; }

/* recover (smoothly expanding panel) */
.recover { padding: 0; overflow: hidden; }
.recover > summary {
  cursor: pointer;
  padding: 18px 20px;
  font-weight: 700;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.recover > summary::-webkit-details-marker { display: none; }
.recover > summary::after { content: "＋"; color: var(--muted); font-weight: 400; }
.recover[open] > summary::after { content: "－"; }
.recover-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 0 20px 26px;
}
.recover::details-content {
  block-size: 0;
  opacity: 0;
  overflow: hidden;
  transition: block-size 0.34s ease, opacity 0.34s ease, content-visibility 0.34s allow-discrete;
}
.recover[open]::details-content { block-size: auto; opacity: 1; }
@media (prefers-reduced-motion: reduce) {
  .recover::details-content { transition: none; }
}

/* crypto / sham cash checkout */
.pay { margin: 18px 0; }
.pay-tabs { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.pay-tab {
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--muted);
  border-radius: 999px;
  padding: 8px 16px;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
}
.pay-tab.active { border-color: var(--accent); color: var(--text); background: rgba(46, 230, 138, 0.12); }
.pay-body { display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; }
.pay-qr {
  width: 220px;
  height: 220px;
  object-fit: contain;
  background: #fff;
  border-radius: 14px;
  padding: 10px;
  border: 1px solid var(--line);
}
.pay-detail { flex: 1; min-width: 220px; display: flex; flex-direction: column; gap: 12px; }
.pay-detail code { word-break: break-all; }
.pay-status { color: var(--muted); font-size: 14px; }
.pay-status.ok { color: var(--accent); font-weight: 700; }
.pay-warning {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--danger);
  border-radius: 12px;
  color: var(--danger);
  background: rgba(255, 82, 82, 0.12);
  font-weight: 700;
  font-size: 14px;
  line-height: 1.5;
}
.pay-choose { margin: 16px 0; display: flex; flex-direction: column; gap: 12px; }
.pay-choose-q { margin: 0; font-weight: 700; }
.qr-ico { width: 16px; height: 16px; flex: none; }

/* instructions / steps */
#r-instructions { margin: 16px 0 0; }
.steps {
  margin: 10px 0 0;
  padding-inline-start: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.steps li { line-height: 1.6; }

/* QR lightbox */
.modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 20px; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.9); backdrop-filter: blur(4px); }
.modal-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  background: #000;
  padding: 20px;
  border-radius: 18px;
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.9);
}
.modal-card .pay-qr { width: min(76vw, 340px); height: auto; border: none; padding: 6px; }
.proof-input { flex: 1; min-width: 160px; max-width: 320px; }

/* messages */
.thread {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 16px 0;
  max-height: 420px;
  overflow-y: auto;
  padding-inline-end: 4px;
}
.bubble {
  max-width: 78%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 14px;
  background: var(--panel-2);
}
.bubble.mine { align-self: flex-end; border-color: rgba(46, 230, 138, 0.5); background: rgba(46, 230, 138, 0.10); }
.bubble.theirs { align-self: flex-start; }
.bubble p { margin: 4px 0 0; color: var(--text); white-space: pre-wrap; word-break: break-word; }
.bubble-meta { font-size: 12px; color: var(--muted); }

.footer { padding: 32px 0 48px; border-top: 1px solid var(--line-soft); margin-top: 24px; }
.footer-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; color: var(--muted); font-size: 14px; }
.api-url { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.api-url input { width: 220px; padding: 8px 12px; font-size: 13px; }

/* moderator */
.admin-layout { display: grid; grid-template-columns: 300px 1fr; gap: 16px; margin-top: 14px; }
@media (max-width: 720px) { .admin-layout { grid-template-columns: 1fr; } }
.thread-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.thread-item { border: 1px solid var(--line); border-radius: 14px; padding: 12px; background: var(--panel-2); cursor: pointer; }
.thread-item:hover { border-color: var(--accent); }
.thread-item.active { border-color: var(--accent); background: rgba(46, 230, 138, 0.08); }
.thread-item-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.badge { background: var(--accent); color: #04220f; border-radius: 999px; font-size: 12px; font-weight: 800; padding: 1px 8px; }
.thread-pane { min-height: 220px; }

.two-col { display: grid; gap: 16px; grid-template-columns: 1fr 1fr; }
@media (max-width: 560px) { .two-col { grid-template-columns: 1fr; } }

/* RTL niceties: isolate Latin runs, align fields/placeholders to the language */
html[dir="rtl"] bdi,
html[dir="rtl"] code,
html[dir="rtl"] .ltr { unicode-bidi: isolate; }
html[dir="rtl"] input,
html[dir="rtl"] textarea { direction: rtl; text-align: right; }
html[dir="rtl"] input[name="device_code"],
html[dir="rtl"] input[name="claim_code"],
html[dir="rtl"] #api-base,
html[dir="rtl"] code,
html[dir="rtl"] #c-token,
html[dir="rtl"] #rc-token,
html[dir="rtl"] #pay-address { direction: ltr; text-align: left; }
html[dir="rtl"] select,
html[dir="rtl"] select option { direction: rtl; }

/* mobile */
@media (max-width: 560px) {
  .nav-inner { gap: 10px; }
  .nav-links { gap: 16px; font-size: 14px; }
  .lang-toggle { padding: 6px 12px; }
  .hero { padding: 56px 0 36px; }
  .section { padding: 40px 0; }
  .pay-qr { width: 100%; max-width: 260px; height: auto; margin-inline: auto; }
  .pay-body { justify-content: center; }
  .card { padding: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .bg-aurora::before, .bg-aurora::after { animation: none; }
  html { scroll-behavior: auto; }
}
