/* Halaqa. Layout: one phone-width column. One large profile at a time, actions at thumb reach, three tabs.
   Palette: cream ground, three tones of sand for big boxes, soft orange accent, brown for lines and quiet details. */
:root {
  --bg: #F6EEDF;
  --surface: #FCF7EC;
  --surface-2: #EFE3CC;
  --surface-3: #E5D4B4;
  --ink: #3B2A1E;
  --muted: #7A6350;
  --line: #C9AE86;
  --brown: #8A6240;
  --accent: #DB8C4E;
  --accent-ink: #3B2A1E;
  --accent-soft: #F3D9BC;
  --live: #5E8A4A;
  --live-soft: #DCE8CC;
  --display: "Readex Pro", "IBM Plex Sans Arabic", system-ui, sans-serif;
  --body: "IBM Plex Sans Arabic", "Readex Pro", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #211812; --surface: #2C2118; --surface-2: #382A1E; --surface-3: #46352578;
    --ink: #F3E8D4; --muted: #BBA68C; --line: #5C4631; --brown: #C79C6E;
    --accent: #E39A5F; --accent-ink: #2A1D12; --accent-soft: #4A3321; --live: #8CC070; --live-soft: #2F3B22;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font-family: var(--body); font-size: 15px; line-height: 1.5;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px);
  -webkit-tap-highlight-color: transparent;
}
button, input, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--brown); outline-offset: 2px; }
.ic { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
#app { height: 100%; max-width: 540px; margin-inline: auto; display: flex; flex-direction: column; min-height: 0; }
#view { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding-block: 2px 12px; }

/* header */
.top { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-block: 10px; flex: none; }
.brand { display: flex; align-items: center; gap: 8px; font-family: var(--display); font-weight: 600; font-size: 22px; }
.brand svg { width: 34px; height: 34px; color: var(--brown); fill: none; stroke: currentColor; stroke-width: 2; }
.tools { display: flex; gap: 8px; }
.tbtn { min-height: 42px; min-width: 42px; padding: 0 14px; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; font-weight: 500;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.tbtn.coffee { color: var(--brown); padding: 0 12px; }
.prog { display: flex; gap: 6px; padding-bottom: 10px; flex: none; }
.prog i { flex: 1; height: 4px; border-radius: 4px; background: var(--surface-3); }
.prog i.on { background: var(--accent); }

/* type */
h1.big { font-family: var(--display); font-weight: 600; font-size: 28px; line-height: 1.25; margin: 0 0 8px; text-wrap: balance; }
.lead { color: var(--muted); margin: 0 0 18px; max-width: 46ch; }
.lab { font-size: 12px; font-weight: 600; color: var(--muted); margin: 18px 0 8px; letter-spacing: .08em; text-transform: uppercase; }
:lang(ar) .lab, :lang(ur) .lab, :lang(zh) .lab, :lang(hi) .lab { letter-spacing: 0; text-transform: none; font-size: 13px; }

/* buttons */
.btn { min-height: 56px; border-radius: 16px; border: 1px solid var(--line); background: var(--surface); font-weight: 600; font-size: 16px;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; padding: 0 20px; cursor: pointer; text-align: center; text-decoration: none; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.danger { border-color: #B5523A; color: #B5523A; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.actions { display: flex; gap: 12px; padding-block: 12px; flex: none; }
.actions .btn { flex: 1; }
.actions .primary { flex: 1.7; }
.actions.col { flex-direction: column; }
.linkbtn { background: none; border: 0; color: var(--muted); text-decoration: underline; cursor: pointer; padding: 8px; min-height: 40px; }

/* welcome */
.hero { padding-block: 4px 8px; }
.greet { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 16px; margin: 6px 0 20px; font-family: var(--display); font-weight: 600; line-height: 1.15; }
.greet span { display: inline-flex; align-items: center; gap: 16px; color: var(--ink); }
.greet span::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c); flex: none; }
.greet span:last-child::after { display: none; }
.g1 { font-size: 46px; } .g2 { font-size: 30px; } .g3 { font-size: 36px; } .g4 { font-size: 28px; } .g5 { font-size: 32px; } .g6 { font-size: 26px; }
.conf { display: flex; gap: 14px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; min-height: 60px; font-weight: 500; cursor: pointer; }
.conf input { width: 26px; height: 26px; accent-color: var(--accent); flex: none; margin: 0; }
.fine { color: var(--muted); font-size: 13px; margin: 10px 4px 0; }
.credit { color: var(--muted); font-size: 12.5px; text-align: center; padding: 10px 0 14px; }
.gbtn { gap: 12px; }
.gbtn svg { width: 22px; height: 22px; }

/* inputs and option rows */
.inp { width: 100%; min-height: 60px; font-family: var(--display); font-size: 21px; padding: 0 18px; border-radius: 18px; border: 1px solid var(--line); background: var(--surface); }
.ta { width: 100%; min-height: 96px; font-size: 16px; padding: 14px 16px; border-radius: 18px; border: 1px solid var(--line); background: var(--surface); resize: vertical; }
.lrow { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 14px; display: flex; flex-direction: column; gap: 10px; margin-bottom: 10px; }
.lrow.on { border-color: var(--brown); box-shadow: inset 0 0 0 1px var(--brown); background: var(--surface-2); }
.lname { display: flex; align-items: baseline; gap: 10px; font-family: var(--display); font-weight: 600; font-size: 18px; }
.lname small { color: var(--muted); font-family: var(--body); font-weight: 400; font-size: 14px; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; }
.seg button { min-height: 46px; border: 1px solid var(--line); background: var(--bg); border-radius: 12px; cursor: pointer; font-weight: 500; padding: 0 6px; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.opt { display: flex; gap: 14px; align-items: center; width: 100%; text-align: start; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 14px 16px; margin-bottom: 10px; min-height: 72px; cursor: pointer; }
.opt[aria-pressed="true"] { border-color: var(--brown); box-shadow: inset 0 0 0 1px var(--brown); background: var(--accent-soft); }
.opt .ic { width: 26px; height: 26px; color: var(--brown); }
.opt b { display: block; font-family: var(--display); font-size: 17px; font-weight: 600; }
.opt span { color: var(--muted); font-size: 14px; }

/* badges */
.bd { display: inline-flex; align-items: center; gap: 7px; padding: 5px 12px; border-radius: 999px; font-size: 13px; font-weight: 500; background: var(--surface); border: 1px solid var(--line); white-space: nowrap; }
.bd.live { background: var(--live-soft); border-color: transparent; }
.bd.style { color: var(--brown); border-color: var(--brown); background: transparent; font-weight: 600; }
.bd .ic { width: 16px; height: 16px; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); opacity: .55; flex: none; }
.dot.live { background: var(--live); opacity: 1; animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--live) 55%, transparent); } 70% { box-shadow: 0 0 0 8px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.lvl { display: inline-flex; align-items: center; gap: 9px; font-weight: 500; font-size: 14px; }
.bars { display: inline-flex; align-items: flex-end; gap: 2px; height: 16px; }
.bars i { width: 5px; border-radius: 2px; background: var(--surface-3); }
.bars i:nth-child(1) { height: 6px; } .bars i:nth-child(2) { height: 11px; } .bars i:nth-child(3) { height: 16px; }
.bars i.on { background: var(--accent); }
.nt { font-size: 12px; font-weight: 600; padding: 3px 11px; border-radius: 999px; border: 1px solid var(--brown); color: var(--brown); }
.nt.n { background: var(--brown); color: var(--surface); }
.row { display: flex; flex-wrap: wrap; gap: 8px; }

/* discover */
.chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding-bottom: 10px; flex: none; }
.chip { min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-weight: 500; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; }
.chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.cnt { margin-inline-start: auto; color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 26px; overflow: hidden; }
.panel { position: relative; background: color-mix(in srgb, var(--hue, var(--accent)) 24%, var(--surface-2)); padding: 16px; display: flex; flex-direction: column; gap: 14px; min-height: 230px; overflow: hidden; }
.panel > * { position: relative; z-index: 1; }
.panel .big-i { position: absolute; z-index: 0; inset-inline-end: 10px; top: 28px; font-family: var(--display); font-weight: 600; font-size: 150px; line-height: 1; color: var(--hue, var(--accent)); opacity: .35; pointer-events: none; }
.ptop { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.ex { font-size: 12px; color: var(--muted); }
.pname { margin-top: auto; }
.pname h2 { font-family: var(--display); font-weight: 600; font-size: 38px; line-height: 1.1; margin: 0; }
.cbody { padding: 16px; }
.swap { display: flex; gap: 12px; align-items: flex-start; background: var(--accent-soft); border-radius: 18px; padding: 14px; }
.swap.part { background: var(--surface-2); }
.swap .ic { width: 26px; height: 26px; color: var(--brown); margin-top: 2px; }
.swap b { display: block; font-family: var(--display); font-size: 17px; font-weight: 600; }
.swap p { margin: 2px 0 0; }
.bio { font-size: 17px; margin: 16px 0 0; }
.lang-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-radius: 16px; background: var(--surface-2); font-family: var(--display); font-size: 18px; font-weight: 600; margin-bottom: 8px; }
.lang-row.hit { background: var(--accent-soft); }
.lang-row .row { flex-wrap: nowrap; align-items: center; gap: 10px; }
.hitm { font-family: var(--body); font-size: 12px; font-weight: 600; color: var(--brown); display: flex; align-items: center; gap: 4px; }
.hitm .ic { width: 14px; height: 14px; }
.notebox { background: var(--surface-2); border: 1.5px solid var(--brown); border-radius: 18px; padding: 14px; margin-top: 12px; display: flex; flex-direction: column; gap: 10px; }
.notebox p { margin: 0; font-weight: 500; }
.notebox .ta { min-height: 76px; background: var(--surface); }
.quote { background: var(--accent-soft); border-radius: 18px; padding: 12px 14px; margin-top: 16px; }
.quote small { display: block; color: var(--brown); font-weight: 600; margin-bottom: 2px; }
.empty { text-align: center; padding: 48px 8px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.empty h2 { font-family: var(--display); font-size: 22px; margin: 0; text-wrap: balance; }
.empty p { color: var(--muted); margin: 0 0 8px; max-width: 36ch; }
.empty .btn { min-width: 220px; }

/* matches */
.mi { background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 16px; margin-bottom: 12px; display: flex; flex-direction: column; gap: 12px; }
.mtop { display: flex; gap: 14px; align-items: center; }
.mtop > div:nth-child(2) { flex: 1; min-width: 0; }
.av { width: 56px; height: 56px; border-radius: 50%; flex: none; display: grid; place-items: center; font-family: var(--display); font-weight: 600; font-size: 24px; background: color-mix(in srgb, var(--hue) 32%, var(--surface-2)); }
.mtop h3 { font-family: var(--display); font-size: 20px; font-weight: 600; margin: 0 0 4px; }
.pair { font-weight: 500; }
.mact { display: flex; gap: 10px; }
.mact .btn { flex: 1; min-height: 52px; }
.wait { color: var(--muted); text-align: center; font-size: 14px; padding: 6px 0; }
.big-name { font-family: var(--display); font-weight: 600; font-size: 30px; margin: 0 0 4px; }
.dots { background: none; border: 0; cursor: pointer; padding: 8px; color: var(--muted); min-width: 40px; min-height: 40px; }

/* chat */
.chat { display: flex; flex-direction: column; gap: 8px; height: min(52vh, 420px); overflow-y: auto; padding: 4px 2px; }
.bub { max-width: 82%; padding: 10px 14px; border-radius: 18px; background: var(--surface-2); align-self: flex-start; overflow-wrap: anywhere; }
.bub.mine { align-self: flex-end; background: var(--accent); color: var(--accent-ink); }
.chat-empty { color: var(--muted); text-align: center; margin: auto; }
.compose { display: flex; gap: 8px; }
.compose .inp { min-height: 52px; font-size: 16px; font-family: var(--body); }
.compose .btn { min-height: 52px; padding: 0 16px; }

/* call */
.callbox { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; padding: 8px 0; }
.callbox .av { width: 104px; height: 104px; font-size: 44px; }
.callbox h2 { font-size: 26px; }
.timer { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 18px; }

/* nav */
.nav { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding-block: 8px; flex: none; border-top: 1px solid var(--line); }
.nav button { min-height: 58px; border: 0; background: transparent; border-radius: 16px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 13px; font-weight: 500; color: var(--muted); cursor: pointer; position: relative; }
.nav button[aria-current="page"] { color: var(--ink); background: var(--accent-soft); }
.nbadge { position: absolute; top: 6px; inset-inline-start: calc(50% + 6px); min-width: 18px; height: 18px; border-radius: 9px; background: var(--accent); color: var(--accent-ink); font-size: 11px; font-weight: 600; display: grid; place-items: center; padding: 0 5px; }

/* sheets and toast */
.scrim { position: fixed; inset: 0; background: rgba(40, 24, 12, .55); display: flex; align-items: flex-end; justify-content: center; z-index: 20;
  padding: 16px max(16px, env(safe-area-inset-right, 0px)) calc(16px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); }
.sheet { width: 100%; max-width: 520px; max-height: 100%; overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 26px; padding: 22px 20px 20px; display: flex; flex-direction: column; gap: 12px; }
.sheet h2 { font-family: var(--display); font-size: 24px; font-weight: 600; margin: 0; text-wrap: balance; }
.sheet p { margin: 0; color: var(--muted); }
.sheet .ring { width: 56px; height: 56px; color: var(--brown); fill: none; stroke: currentColor; stroke-width: 2; }
.sheet .poem { white-space: pre-line; font-family: var(--display); font-size: 17px; line-height: 1.7; color: var(--ink); background: var(--surface-2); border-radius: 18px; padding: 16px; margin: 0; }
.sheet .poem:lang(ar) { text-align: start; }
.picklist { display: flex; flex-direction: column; gap: 8px; }
.pick { min-height: 54px; border: 1px solid var(--line); background: var(--bg); border-radius: 14px; display: flex; align-items: center; justify-content: space-between; padding: 0 16px; font-size: 17px; font-weight: 500; cursor: pointer; text-align: start; }
.pick[aria-pressed="true"] { border-color: var(--brown); background: var(--accent-soft); }
.toast { position: fixed; left: 0; right: 0; bottom: calc(92px + env(safe-area-inset-bottom, 0px)); display: flex; justify-content: center; pointer-events: none; padding-inline: 16px; z-index: 30; opacity: 0; transform: translateY(8px); transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: none; }
.toast span { background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 14px; font-weight: 500; max-width: 100%; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
