@font-face { font-family: "Inter"; src: url("/fonts/inter.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Vazirmatn"; src: url("/fonts/vazirmatn.woff2") format("woff2"); font-weight: 100 900; font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+200C-200D, U+FB50-FDFF, U+FE70-FEFF; }
@font-face { font-family: "JetBrains Mono"; src: url("/fonts/jetbrains-mono-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }

/* The canvas design (Nsinika · glass): near-black with one faint cool light,
   frosted panels, one quiet accent; colour only for states. Light mode is the
   canvas's light glass. */
:root {
  --ground: #080a0f;
  --text: rgba(255, 255, 255, 0.92);
  --muted: rgba(255, 255, 255, 0.62);
  --faint: rgba(255, 255, 255, 0.5);
  --glass: rgba(255, 255, 255, 0.055);
  --glass-soft: rgba(255, 255, 255, 0.04);
  --glass-hover: rgba(255, 255, 255, 0.08);
  --line: rgba(255, 255, 255, 0.11);
  --line-soft: rgba(255, 255, 255, 0.07);
  --bubble: rgba(255, 255, 255, 0.10);
  --accent: #bae6fd;
  --on-accent: #04111a;
  --glow-1: rgba(125, 211, 252, 0.09);
  --glow-2: rgba(148, 163, 184, 0.08);
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
  --menu: rgba(16, 20, 28, 0.96);
  --blur: 28px;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root {
    --ground: #f1f3f6;
    --text: #0f172a;
    --muted: rgba(15, 23, 42, 0.68);
    --faint: rgba(15, 23, 42, 0.58);
    --glass: rgba(255, 255, 255, 0.52);
    --glass-soft: rgba(255, 255, 255, 0.5);
    --glass-hover: rgba(255, 255, 255, 0.85);
    --line: rgba(15, 23, 42, 0.09);
    --line-soft: rgba(15, 23, 42, 0.07);
    --bubble: rgba(255, 255, 255, 0.85);
    --accent: #0f172a;
    --on-accent: #ffffff;
    --glow-1: rgba(125, 211, 252, 0.22);
    --glow-2: rgba(203, 213, 225, 0.45);
    --shadow: 0 20px 50px rgba(30, 41, 59, 0.10);
    --menu: rgba(255, 255, 255, 0.96);
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--ground); color: var(--text);
  font: 15px/1.55 Inter, Vazirmatn, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
.bg {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(1000px 700px at 15% 0%, var(--glow-1), transparent 60%),
    radial-gradient(900px 700px at 90% 20%, var(--glow-2), transparent 62%);
}
.glass {
  background: var(--glass); border: 1px solid var(--line);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), var(--shadow);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(140%); backdrop-filter: blur(var(--blur)) saturate(140%);
}
.glass-soft { background: var(--glass-soft); border: 1px solid var(--line-soft); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.grow { flex: 1; }
.fa { font-family: Vazirmatn, Inter, sans-serif; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* --- Shell: rail + main ---------------------------------------------------- */
.shell { display: flex; gap: 16px; padding: 16px; min-height: 100vh; }
.rail {
  position: sticky; top: 16px; align-self: flex-start; height: calc(100vh - 32px); min-height: 420px;
  flex: 0 0 64px; border-radius: 22px; padding: 14px 0; z-index: 30;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.rail-mark img { display: block; width: 34px; height: 34px; object-fit: contain; }
.rail-gap { height: 14px; }
.ibtn {
  width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; border-radius: 12px;
  border: 0; background: transparent; color: var(--faint); cursor: pointer; text-decoration: none;
}
.ibtn:hover { background: var(--glass-hover); color: var(--text); }
.ibtn.on { background: var(--glass-hover); color: var(--text); }
.ibtn[aria-disabled="true"] { cursor: default; opacity: 0.55; }
.ibtn[aria-disabled="true"]:hover { background: transparent; color: var(--faint); }
.main {
  flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 22px;
  padding: 40px 24px 24px;
}
.main > * { width: 100%; max-width: 820px; }

/* --- Phone: the rail becomes a bar along the top ---------------------------- */
@media (max-width: 720px) {
  .shell { flex-direction: column; padding: 10px; gap: 10px; }
  .rail {
    position: sticky; top: 10px; z-index: 10; height: auto; min-height: 0; width: 100%; flex-basis: auto;
    flex-direction: row; padding: 8px 10px; border-radius: 18px;
  }
  .rail .ibtn[aria-disabled="true"], .rail-gap { display: none; }
  .main { padding: 20px 6px; }
}

/* --- Hero ------------------------------------------------------------------ */
.hero { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.eyebrow { font-size: 13px; color: var(--faint); }
.hero h1 { margin: 0; font-size: clamp(30px, 5vw, 44px); line-height: 1.1; font-weight: 600; letter-spacing: -0.02em; }
.hero p { margin: 0; max-width: 620px; color: var(--muted); }
body.chatting .hero, body.chatting .ways, body.chatting .starters, body.chatting .panels { display: none; }
body.chatting .main { padding-top: 24px; }

/* --- Composer --------------------------------------------------------------- */
.composer { border-radius: 22px; padding: 14px 14px 12px 18px; }
.composer textarea {
  width: 100%; resize: none; border: 0; outline: none; background: transparent; color: var(--text);
  font: 16px/1.6 Inter, Vazirmatn, system-ui, sans-serif; min-height: 64px;
}
.composer textarea::placeholder { color: var(--faint); }
.composer textarea:focus-visible { outline: none; }
.composer:focus-within { border-color: var(--muted); }
.composer-row { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 10px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--glass-soft); color: var(--muted); font: 500 12px Inter, sans-serif;
}
.pill[aria-disabled="true"] { cursor: default; }
.hint { font-size: 12px; color: var(--faint); }
@media (max-width: 480px) { .hint { display: none; } }
.send {
  width: 42px; height: 42px; border-radius: 12px; border: 0; cursor: pointer;
  background: var(--accent); color: var(--on-accent); display: flex; align-items: center; justify-content: center;
}
.send:disabled { opacity: 0.5; cursor: default; }

/* --- Starters and ways ------------------------------------------------------ */
.starters { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.chip {
  min-height: 38px; border: 1px solid var(--line); background: var(--glass-soft); color: var(--muted);
  font: 13px Inter, Vazirmatn, sans-serif; padding: 0 14px; border-radius: 999px; cursor: pointer;
}
.chip:hover { color: var(--text); background: var(--glass-hover); }
.ways { display: flex; flex-wrap: wrap; gap: 12px; }
.way {
  flex: 1 1 220px; text-align: left; border-radius: 18px; padding: 18px; cursor: pointer; color: var(--text); font: inherit;
  display: flex; flex-direction: column; gap: 4px;
}
.way:hover { background: var(--glass-hover); }
.way-title { font-weight: 600; font-size: 14px; }
.way-text { font-size: 13px; color: var(--muted); line-height: 1.5; }

/* --- Panels (signed in) ----------------------------------------------------- */
.panels { display: flex; flex-wrap: wrap; gap: 16px; max-width: 1120px !important; margin-top: 10px; }
.panel { border-radius: 20px; padding: 16px; }
.panel h2 { margin: 0; font-size: 14px; font-weight: 600; }
.panel-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.panel-meta { font-size: 12px; color: var(--faint); }
.sites { flex: 999 1 520px; min-width: 0; }
.side { flex: 1 1 300px; display: flex; flex-direction: column; gap: 16px; }
.side .panel h2 { margin-bottom: 8px; }
.table-head {
  display: grid; grid-template-columns: minmax(0, 1.4fr) repeat(3, minmax(0, 1fr)); padding: 6px 10px;
  font-size: 12px; color: var(--faint); border-bottom: 1px solid var(--line-soft);
}
.empty { font-size: 13px; color: var(--muted); padding: 14px 10px 6px; line-height: 1.6; }
.side .empty { padding: 6px 0 2px; }
.meter { height: 6px; border-radius: 99px; background: var(--glass-hover); overflow: hidden; margin: 10px 0 8px; }
.meter-fill { width: 0; height: 100%; background: var(--accent); }

.foot { text-align: center; font-size: 12px; color: var(--faint); margin: 8px 0 0; }

/* --- Thread ----------------------------------------------------------------- */
.thread { display: flex; flex-direction: column; gap: 14px; }
.msg { max-width: 88%; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.75; }
.msg.user {
  align-self: flex-end; padding: 12px 14px; border-radius: 16px 16px 4px 16px;
  background: var(--bubble); border: 1px solid var(--line-soft);
}
.msg.note { align-self: flex-start; color: var(--muted); padding: 2px; }
.msg.note::before {
  content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 8px;
  background: var(--faint); vertical-align: middle;
}
.banner { border-radius: 16px; padding: 12px 14px; font-size: 14px; color: var(--muted); }

/* --- Account (rail bottom) -------------------------------------------------- */
.account { position: relative; }
.account-btn { padding: 0; border: 0; background: transparent; border-radius: 50%; cursor: pointer; display: block; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: 0 0 auto; display: flex; align-items: center; justify-content: center;
  font: 600 12px Inter, Vazirmatn, sans-serif; letter-spacing: 0.02em; color: var(--text);
  background: var(--glass-hover); border: 1px solid var(--line);
}
.account-btn:hover .avatar, .account-btn[aria-expanded="true"] .avatar { border-color: var(--muted); }
.avatar.big { width: 42px; height: 42px; font-size: 14px; }
.menu {
  position: absolute; left: calc(100% + 12px); bottom: 0; width: 280px; border-radius: 16px; padding: 8px;
  background: var(--menu); z-index: 20;
}
@media (max-width: 720px) { .menu { left: auto; right: 0; bottom: auto; top: calc(100% + 10px); } }
.menu-head { display: flex; align-items: center; gap: 12px; padding: 10px 8px 8px; }
.menu-who { min-width: 0; }
.menu-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-email { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-access { display: flex; align-items: center; gap: 8px; margin: 2px 8px 8px; font-size: 12px; color: var(--muted); }
.menu-access::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--dot, #34d399); }
.menu-access.closed { --dot: #fbbf24; }
.menu-sep { height: 1px; background: var(--line-soft); margin: 4px 0; }
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 40px; padding: 0 10px; border-radius: 10px;
  border: 0; background: transparent; color: var(--text); font: 14px Inter, sans-serif; text-decoration: none; cursor: pointer;
}
.menu-item:hover { background: var(--glass-hover); }
.menu-item svg { color: var(--muted); }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); max-width: calc(100% - 32px);
  padding: 12px 16px; border-radius: 14px; font-size: 14px; background: var(--menu);
}
@media (prefers-reduced-motion: no-preference) { .msg { animation: rise 0.2s ease-out; } }
@keyframes rise { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
