:root, [data-theme="dark"] {
  --bg: #161826;
  --surface: #1e2130;
  --surface2: #282c3d;
  --text: #e9e9ed;
  --muted: #989aab;
  --line: rgba(233, 233, 237, 0.11);
  --accent: #9184d9;
  --accent-dim: #b5abfc;
  --accent-soft: rgba(145, 132, 217, 0.13);
  --ok: #84d8ad;
  --ok-soft: rgba(132, 216, 173, 0.13);
  --danger: #e57373;
  --frame: #0c0d14;
}

[data-theme="light"] {
  --bg: #f5f5f9;
  --surface: #ffffff;
  --surface2: #ecedf4;
  --text: #1a1b25;
  --muted: #6b6d80;
  --line: rgba(26, 27, 37, 0.1);
  --accent: #6b5dc0;
  --accent-dim: #5d4fb0;
  --accent-soft: rgba(107, 93, 192, 0.09);
  --ok: #2c8f66;
  --ok-soft: rgba(44, 143, 102, 0.1);
  --frame: #d8d8e2;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, "Noto Sans SC", "Noto Sans Arabic", "Noto Sans Armenian", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
body { padding-bottom: calc(78px + env(safe-area-inset-bottom, 0px)); }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
.hidden { display: none !important; }

@keyframes mv-rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
@keyframes mv-breathe {
  0%, 100% { opacity: 0.32; transform: scale(1); }
  50% { opacity: 0.72; transform: scale(1.13); }
}
@keyframes mv-shimmer {
  0% { background-position: 0 0; }
  100% { background-position: 200px 0; }
}
@keyframes mv-toast {
  0% { opacity: 0; transform: translateY(12px); }
  12%, 78% { opacity: 1; transform: none; }
  100% { opacity: 0; transform: translateY(-6px); }
}

#boot {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--muted);
  font-size: 14px;
}
#boot .spin {
  width: 18px; height: 18px;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  position: relative;
  overflow: hidden;
}
.app::before {
  content: "";
  position: absolute;
  top: -120px; left: 50%;
  width: 420px; height: 280px;
  margin-left: -210px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent-soft) 0%, transparent 70%);
  pointer-events: none;
}

.header {
  position: relative;
  z-index: 3;
  padding: 14px 18px 10px;
  display: flex;
  align-items: center;
  gap: 11px;
}
.header img {
  width: 38px; height: 38px;
  border-radius: 11px;
  object-fit: cover;
  box-shadow: 0 2px 12px rgba(145, 132, 217, 0.35);
}
.header .brand { flex: 1; min-width: 0; }
.header .brand b {
  display: block;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.header .brand span {
  display: block;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.icon-btn, .chip-btn {
  height: 34px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--text);
  padding: 0 11px;
}
.icon-btn { width: 34px; padding: 0; position: relative; }
.icon-btn i, .chip-btn i { color: var(--accent); font-size: 15px; }
.icon-btn .dot {
  position: absolute;
  top: 6px; right: 6px;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent-dim);
  box-shadow: 0 0 0 2px var(--bg);
  animation: mv-breathe 2.2s ease-in-out infinite;
}

.main {
  position: relative;
  z-index: 2;
  padding: 6px 18px 26px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: mv-rise 0.34s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.card {
  border-radius: 20px;
  padding: 17px;
  background: linear-gradient(155deg, var(--surface) 0%, var(--surface2) 100%);
  border: 1px solid var(--line);
  position: relative;
  overflow: hidden;
}
.card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(120% 90% at 100% 0%, var(--accent-soft) 0%, transparent 60%);
  pointer-events: none;
}
.card > * { position: relative; z-index: 1; }

.muted { color: var(--muted); font-size: 11px; }
.kicker {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.row { display: flex; align-items: center; gap: 10px; }
.grow { flex: 1; min-width: 0; }
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 27px;
  padding: 0 11px;
  border-radius: 9px;
  background: var(--ok-soft);
  color: var(--ok);
  font-size: 12px;
  font-weight: 500;
}
.status-pill.off {
  background: var(--surface2);
  color: var(--muted);
}
.status-pill .live {
  position: relative;
  width: 7px; height: 7px;
}
.status-pill .live::before,
.status-pill .live::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--ok);
}
.status-pill .live::after {
  inset: -4px;
  animation: mv-breathe 2.4s ease-in-out infinite;
}
.traffic-bar {
  margin-top: 9px;
  height: 7px;
  border-radius: 4px;
  overflow: hidden;
  background: var(--surface2);
}
.traffic-bar > i {
  display: block;
  height: 100%;
  width: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-dim) 50%, var(--accent) 100%);
  background-size: 200px 100%;
  animation: mv-shimmer 2.6s linear infinite;
  opacity: 0.85;
}

.section-title {
  margin: 6px 0 0;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 600;
}
.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}
.dev-tile, .list-row, .panel {
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  text-align: start;
  transition: border-color 0.22s, background 0.22s, transform 0.12s;
}
.dev-tile {
  min-height: 76px;
  padding: 13px 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  font-family: inherit;
}
.dev-tile i { font-size: 19px; color: var(--accent); }
.dev-tile span { font-size: 13px; font-weight: 500; }
.dev-tile:active, .list-row:active, .btn:active { transform: scale(0.985); }
.dev-tile:hover, .list-row:hover { border-color: var(--accent); background: var(--surface2); }

.list-row {
  min-height: 58px;
  width: 100%;
  padding: 0 15px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: inherit;
}
.list-row i.lead { font-size: 19px; color: var(--accent); }
.list-row .meta b { display: block; font-size: 14px; font-weight: 500; }
.list-row .meta small { display: block; font-size: 11px; color: var(--muted); margin-top: 1px; }
.list-row i.trail { font-size: 15px; color: var(--muted); margin-left: auto; }

.btn {
  width: 100%;
  min-height: 50px;
  border-radius: 14px;
  border: 1px solid var(--accent);
  background: var(--accent-soft);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
}
.btn i { color: var(--accent); font-size: 17px; }
.btn.ghost { background: transparent; }
.btn.block { margin-top: 14px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.mono {
  font: 400 12px/1.5 ui-monospace, Menlo, monospace;
  color: var(--muted);
  word-break: break-all;
  padding: 13px 14px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px dashed var(--line);
}
.big-num {
  font-size: 38px;
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 1;
}
.stat {
  padding: 14px 13px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
}
.stat i { font-size: 16px; color: var(--accent); }
.stat .v { font-size: 21px; font-weight: 500; letter-spacing: -0.025em; margin-top: 9px; }
.stat .l { font-size: 11px; color: var(--muted); margin-top: 2px; line-height: 1.35; }

.tabs {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 20;
  max-width: 480px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0px));
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
}
.tabs button {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px 4px;
  font-size: 10.5px;
  font-weight: 500;
}
.tabs button.on { color: var(--accent); }
.tabs button i { font-size: 20px; }
.tabs .glyph {
  font-size: 17px;
  font-weight: 600;
  line-height: 20px;
  height: 20px;
}

.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.sheet {
  width: 100%;
  max-width: 480px;
  max-height: min(88vh, 760px);
  overflow: auto;
  background: var(--bg);
  border-radius: 24px 24px 0 0;
  border: 1px solid var(--line);
  border-bottom: 0;
  padding: 12px 18px 28px;
  animation: mv-rise 0.28s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.sheet-handle {
  width: 36px; height: 4px;
  border-radius: 99px;
  background: var(--line);
  margin: 0 auto 14px;
}
.sheet h3 {
  margin: 0 0 14px;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.pick {
  min-height: 64px;
  border-radius: 15px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 4px;
  padding: 0 14px;
}
.pick.on, .method.on {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.pick small { font-size: 12px; color: var(--muted); }
.pick b { font-size: 16px; font-weight: 500; letter-spacing: -0.02em; }
.method {
  min-height: 50px;
  width: 100%;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 14px;
  margin-bottom: 7px;
}
.method i { color: var(--accent); font-size: 18px; }
.session {
  min-height: 62px;
  border-radius: 15px;
  border: 1px solid var(--line);
  background: var(--surface);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 13px;
  margin-bottom: 8px;
}
.session .ico {
  width: 36px; height: 36px;
  border-radius: 11px;
  background: var(--surface2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.session .ico i { color: var(--accent); font-size: 18px; }
.session .drop {
  width: 36px; height: 36px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.faq-item {
  border-radius: 15px;
  border: 1px solid var(--line);
  background: var(--surface);
  overflow: hidden;
  margin-bottom: 8px;
}
.faq-item button {
  width: 100%;
  min-height: 52px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 13px 14px;
  text-align: start;
}
.faq-item p {
  margin: 0;
  padding: 0 14px 14px;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.6;
}
.step {
  padding: 14px 15px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  margin-bottom: 9px;
}
.step .sn {
  width: 21px; height: 21px;
  border-radius: 7px;
  background: var(--accent-soft);
  color: var(--accent);
  font: 600 11px/21px Inter, system-ui, sans-serif;
  text-align: center;
  flex: none;
}
.app-link {
  min-height: 46px;
  border-radius: 12px;
  background: var(--surface2);
  border: 1px solid transparent;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 13px;
  margin-top: 6px;
}
.app-link i { color: var(--accent); }
.app-link small { margin-left: auto; color: var(--muted); font-size: 10.5px; }
.qr-frame {
  border-radius: 18px;
  background: #fff;
  padding: 14px;
  display: flex;
  justify-content: center;
}
.qr-frame img { width: 220px; height: 220px; display: block; }

.toast {
  position: fixed;
  left: 0; right: 0;
  bottom: calc(92px + env(safe-area-inset-bottom, 0px));
  z-index: 50;
  display: flex;
  justify-content: center;
  pointer-events: none;
}
.toast > div {
  max-width: 86%;
  padding: 11px 16px;
  border-radius: 13px;
  background: var(--surface2);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 500;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  animation: mv-toast 2.2s ease both;
  display: flex;
  align-items: center;
  gap: 9px;
}
.toast i { color: var(--ok); font-size: 16px; }

.theme-opt {
  min-height: 48px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: transparent;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  cursor: pointer;
  margin-bottom: 8px;
  font-family: inherit;
  color: var(--text);
}
.theme-opt.on { border-color: var(--accent); background: var(--accent-soft); }
.lang-opt {
  min-height: 52px;
  width: 100%;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 14px;
  cursor: pointer;
  margin-bottom: 8px;
  font-family: inherit;
  color: var(--text);
}
.lang-opt.on { border-color: var(--accent); background: var(--accent-soft); }
.empty {
  padding: 26px 0;
  text-align: center;
  font-size: 12.5px;
  color: var(--muted);
}
.pay-hist {
  border-radius: 15px;
  border: 1px solid var(--line);
  background: var(--surface);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px;
  margin-bottom: 8px;
}
.pay-hist .ico {
  width: 34px; height: 34px;
  border-radius: 11px;
  background: var(--surface2);
  display: flex;
  align-items: center;
  justify-content: center;
}
.pay-hist .ico i { color: var(--ok); }
[dir="rtl"] .list-row i.trail { margin-left: 0; margin-right: auto; }
[dir="rtl"] .app-link small { margin-left: 0; margin-right: auto; }
