:root {
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  --bg: #07050C;
  --surface: #0F0B18;
  --surface-2: #151021;
  --ink: #EEEAF7;
  --muted: #9B93B2;
  --line: #251C3B;
  --hover: #1A1330;
  --brand: #8B5CF6;
  --brand-ink: #FFFFFF;
  --brand-soft: rgba(139, 92, 246, .14);
  --brand-strong: #B692FF;
  --cyan: #6F4CC8;
  --danger: #F0736E;
  --ok: #4CC49A;
  --code-bg: #0A0712;
  --code-ink: #DDD6F0;
  --code-dim: #8A82A3;
  --code-key: #B692FF;
  --code-val: #8FD6C2;
  --font: 'IBM Plex Sans Arabic', 'Segoe UI', Tahoma, system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, Menlo, Consolas, monospace;
  --radius: 8px;
  --card: var(--surface);
  --text: var(--ink);
  --a1: var(--brand);
  --a2: var(--cyan);
  --glow: var(--brand-soft);
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(env(safe-area-inset-top, 0px) + 80px);
}

*, *::before, *::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.75;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: 4px;
}

.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px;
}

h1, h2, h3, h4 {
  font-weight: 600;
}

h1 {
  font-size: clamp(30px, 4.2vw, 46px);
  line-height: 1.3;
  margin: 0 0 18px;
  color: #fff;
}

h2 {
  font-size: clamp(24px, 3vw, 30px);
  line-height: 1.35;
  margin: 0 0 10px;
}

section {
  padding: 80px 0;
}

.sub {
  color: var(--muted);
  max-width: 620px;
  margin: 0 0 36px;
}

.i {
  width: 1.2em;
  height: 1.2em;
  flex: none;
  vertical-align: -.2em;
  margin-inline: .15em;
}

.btn .i, .back .i, .mmenu .i {
  margin-inline: 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-family: inherit;
  font-weight: 600;
  font-size: 15px;
  line-height: 1.4;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color .15s, border-color .15s;
}

.btn.p {
  background: var(--brand);
  color: var(--brand-ink);
}

.btn.p:hover {
  background: var(--brand-strong);
}

.btn.g {
  background: var(--surface-2);
  border-color: var(--line);
  color: var(--ink);
}

.btn.g:hover {
  background: var(--hover);
  border-color: #33485a;
}

.btn.sm {
  padding: 8px 16px;
  font-size: 14px;
}

.btn:disabled {
  opacity: .6;
  cursor: default;
}

.pill {
  display: inline-block;
  font-size: 12px;
  padding: 2px 9px;
  border-radius: 4px;
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 600;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  padding: 6px 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius);
  font-weight: 500;
  font-size: 14px;
}

input, select, textarea {
  width: 100%;
  padding: 10px 13px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: #090E12;
  color: var(--ink);
  font-family: inherit;
  font-size: 15px;
}

input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--brand);
  outline-offset: -1px;
  border-color: var(--brand);
}

textarea {
  min-height: 80px;
  resize: vertical;
}

label {
  display: block;
  color: var(--muted);
  font-size: 14px;
}

label input[type=checkbox] {
  width: auto;
  margin-left: 6px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}

th, td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: right;
}

th {
  color: var(--muted);
  font-weight: 600;
  font-size: 13px;
}

td code, p code {
  direction: ltr;
  unicode-bidi: embed;
  background: var(--hover);
  padding: 1px 6px;
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--ink);
}

.tblw {
  overflow-x: auto;
}

.note {
  border-inline-start: 3px solid var(--brand);
  background: var(--hover);
  padding: 10px 14px;
  border-radius: 4px;
  color: var(--ink);
  font-size: 15px;
  margin: 12px 0;
}

.note.bad {
  border-inline-start-color: var(--danger);
  color: var(--danger);
}

.mo {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(4, 8, 10, .75);
  display: grid;
  place-items: center;
  padding: 20px;
  animation: fade .15s;
}

.mb {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 24px;
  animation: rise .18s;
}

.mt {
  font-size: 19px;
  font-weight: 600;
  margin-bottom: 10px;
}

.mr {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 15px;
}

.mr span {
  color: var(--muted);
}

.mr b {
  text-align: left;
  word-break: break-word;
  font-weight: 600;
}

.mw {
  color: var(--danger);
  margin: 12px 0 0;
  font-weight: 500;
}

.ma {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.ma .btn {
  flex: 1;
}

@keyframes fade {
  from { opacity: 0; }
}

@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; animation: none !important; }
}

html[dir=ltr] th, html[dir=ltr] td {
  text-align: left;
}

.off {
  display: none !important;
}

.note[hidden] {
  display: none;
}
