@font-face {
  font-family: Vazirmatn;
  src: url("../fonts/Vazirmatn-Regular.cdc140628f11.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: Vazirmatn;
  src: url("../fonts/Vazirmatn-SemiBold.9260c1927872.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: Vazirmatn;
  src: url("../fonts/Vazirmatn-Bold.7958481fe611.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #ffffff;
  --secondary-bg: #f4f4f5;
  --text: #111114;
  --hint: #8a8a8e;
  --link: #2f6bed;
  --button: #2f6bed;
  --button-text: #ffffff;
  --section-bg: #ffffff;
  --border: rgba(0, 0, 0, 0.08);
  --destructive: #e0363a;
  --success: #2bb673;
  --pause: #2f6bed;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  --radius: 14px;
}

html[data-theme="dark"] {
  --bg: #17181c;
  --secondary-bg: #0f1012;
  --text: #f1f1f3;
  --hint: #8d8d93;
  --link: #6ea8fe;
  --button: #3a7bff;
  --button-text: #ffffff;
  --section-bg: #1f2024;
  --border: rgba(255, 255, 255, 0.08);
  --destructive: #ff6b6e;
  --success: #34c98a;
  --pause: #6ea8fe;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) {
    --bg: #17181c;
    --secondary-bg: #0f1012;
    --text: #f1f1f3;
    --hint: #8d8d93;
    --link: #6ea8fe;
    --button: #3a7bff;
    --button-text: #ffffff;
    --section-bg: #1f2024;
    --border: rgba(255, 255, 255, 0.08);
    --destructive: #ff6b6e;
    --success: #34c98a;
    --pause: #6ea8fe;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Vazirmatn", -apple-system, BlinkMacSystemFont, "Segoe UI", Tahoma, sans-serif;
  background: var(--bg);
  color: var(--text);
  transition: background 0.2s ease, color 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

#app { min-height: 100vh; display: flex; flex-direction: column; }

.hidden { display: none !important; }

/* Loading */
#view-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}
.loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--button);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Join channel screen */
#view-join {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}
.join-card {
  text-align: center;
  max-width: 320px;
}
.join-icon { font-size: 48px; margin-bottom: 8px; }
.join-card h2 { margin: 8px 0; font-size: 19px; }
.join-card p { color: var(--hint); margin: 4px 0 16px; font-size: 14px; }
.channel-name { color: var(--link); font-weight: 600; }

/* Top bar */
.topbar {
  padding: 14px 16px;
  font-size: 17px;
  font-weight: 700;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 5;
}

/* Content */
#content {
  flex: 1;
  padding: 16px 16px 90px;
  overflow-y: auto;
}

.view-title {
  font-size: 19px;
  font-weight: 700;
  margin: 4px 0 16px;
}

/* Bottom nav */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  background: var(--bg);
  border-top: 1px solid var(--border);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  z-index: 10;
}
.nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: none;
  border: none;
  color: var(--hint);
  font-family: inherit;
  font-size: 11px;
  padding: 6px 2px;
  border-radius: 10px;
  cursor: pointer;
}
.nav-btn.active { color: var(--button); background: var(--secondary-bg); }
.nav-icon { font-size: 19px; line-height: 1; }

/* Buttons */
.btn {
  display: block;
  width: 100%;
  text-align: center;
  padding: 12px 16px;
  border-radius: var(--radius);
  border: none;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  margin-top: 10px;
  box-sizing: border-box;
}
.btn-primary { background: var(--button); color: var(--button-text); }
.btn-outline { background: var(--secondary-bg); color: var(--text); }
.btn-destructive { background: var(--destructive); color: #fff; }

/* Cards */
.card {
  background: var(--section-bg);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}

/* Account */
.account-card { display: flex; flex-direction: column; gap: 10px; }
.account-row { display: flex; justify-content: space-between; align-items: center; font-size: 14px; }
.account-label { color: var(--hint); }
.account-value { font-weight: 600; }
.account-value.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; direction: ltr; }

/* Help / Support */
.help-card, .support-card { font-size: 14px; line-height: 1.9; }
.help-card h3 { font-size: 15px; margin: 14px 0 6px; }
.help-card ol { padding-right: 18px; margin: 0; }

/* Search list */
.card-list { display: flex; flex-direction: column; gap: 10px; }
.search-card {
  background: var(--section-bg);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
}
.search-card-title { font-weight: 600; font-size: 14px; margin-bottom: 10px; word-break: break-word; }
.search-card-actions { display: flex; gap: 8px; }
.search-card-actions button {
  flex: 1;
  border: none;
  border-radius: 10px;
  padding: 9px 6px;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  color: #fff;
}
.btn-pause { background: var(--pause); }
.btn-resume { background: var(--success); }
.btn-delete { background: var(--destructive); }

.empty-state { text-align: center; color: var(--hint); padding: 40px 12px; }
.empty-state p { margin-bottom: 6px; }

/* Wizard */
.step-indicator { display: flex; gap: 6px; justify-content: center; margin-bottom: 20px; }
.step-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
}
.step-dot.active { background: var(--button); }
.step-dot.done { background: var(--success); }

.wizard-label { font-size: 15px; font-weight: 600; margin-bottom: 12px; }

.text-input {
  width: 100%;
  padding: 13px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--secondary-bg);
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
}
.text-input:focus { outline: 2px solid var(--button); }

.choice-list { display: flex; flex-direction: column; gap: 8px; }
.choice-list.scrollable { max-height: 50vh; overflow-y: auto; }

.choice-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--secondary-bg);
  cursor: pointer;
  font-size: 14px;
  user-select: none;
}
.choice-item .check {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 2px solid var(--hint);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: transparent;
}
.choice-item.selected .check {
  background: var(--button);
  border-color: var(--button);
  color: #fff;
}
.choice-item.single .check { border-radius: 50%; }

.success-icon { font-size: 48px; text-align: center; margin-bottom: 10px; }
#wizard-success { text-align: center; }
#wizard-success-text { white-space: pre-line; font-size: 14px; line-height: 1.8; }
