/* Members area 2.0 — an app-like room: profile card with stats, a tab bar (bottom on phones),
   a reader for the story, and cleaner cards for ideas and debates. Builds on style.css. */
.lounge .wrap { gap: 18px; max-width: 720px; }
.lounge .langbar { margin-bottom: 0; }
.room, .pane { display: flex; flex-direction: column; gap: 16px; }
.pane[hidden], .room[hidden], .gate[hidden] { display: none !important; }

/* ---------- gate (log in / create account) ---------- */
.gate { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.gate-logo { width: min(300px, 70%); border-radius: 6px; -webkit-mask-image: radial-gradient(ellipse at center, #000 60%, transparent 100%); mask-image: radial-gradient(ellipse at center, #000 60%, transparent 100%); }
.gate h1 { background: linear-gradient(180deg, #fff3c4, #d9b44a 60%, #9a7420); -webkit-background-clip: text; background-clip: text; color: transparent; }
.gate-card { width: 100%; max-width: 440px; text-align: start; background: linear-gradient(180deg, #121c16, #0a110d); border: 1px solid rgba(217,180,74,.4); border-radius: 18px; padding: 16px; display: flex; flex-direction: column; gap: 14px; box-shadow: 0 24px 60px rgba(0,0,0,.5); margin-top: 6px; }
.gate-card form { background: none; border: 0; padding: 0; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; background: rgba(0,0,0,.5); border: 1px solid var(--line); border-radius: 12px; }
.seg button { font: 600 .9rem var(--body); color: var(--muted); background: none; border: 0; border-radius: 9px; padding: 10px 8px; min-height: 44px; cursor: pointer; }
.seg button[aria-selected=true] { background: var(--emerald); color: #04140b; }
.seg button:focus-visible { outline: 2px solid var(--emerald); outline-offset: 2px; }

/* ---------- profile card ---------- */
.profile { position: relative; overflow: hidden; border-radius: 18px; border: 1px solid var(--line); background: linear-gradient(180deg, #121c16, #0a110d); padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.profile::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 72px; background: linear-gradient(120deg, color-mix(in srgb, var(--house, var(--emerald)) 70%, #000), transparent 85%); opacity: .55; pointer-events: none; }
.profile-top { position: relative; display: flex; align-items: center; gap: 12px; }
.profile .av { width: 64px; height: 64px; font-size: 1.7rem; border: 2px solid rgba(255,255,255,.25); box-shadow: 0 6px 18px rgba(0,0,0,.45); flex: none; }
.profile-id { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 3px; }
.eyebrow { margin: 0; font: 600 .68rem var(--body); letter-spacing: .14em; text-transform: uppercase; color: #ffe7a3; }
.profile-name { margin: 0; font: 700 1.25rem/1.2 var(--body); color: #f6f8f6; overflow-wrap: anywhere; }
.chip { margin: 0; align-self: flex-start; font: 600 .75rem var(--body); color: #f2f5f3; background: color-mix(in srgb, var(--house, var(--emerald)) 35%, rgba(0,0,0,.4)); border: 1px solid color-mix(in srgb, var(--house, var(--emerald)) 70%, transparent); border-radius: 999px; padding: 2px 10px; }
.stats { position: relative; margin: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.stats > div { background: rgba(0,0,0,.4); border: 1px solid var(--line); border-radius: 12px; padding: 10px 8px; text-align: center; display: flex; flex-direction: column-reverse; gap: 2px; }
.stats dt { font-size: .7rem; color: var(--muted); line-height: 1.25; text-wrap: balance; }
.stats dd { margin: 0; font: 700 1.2rem var(--body); color: #ffe7a3; font-variant-numeric: tabular-nums; }
:lang(ar) .eyebrow, :lang(hi) .eyebrow { letter-spacing: 0; }

/* ---------- tab bar ---------- */
.mtabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; padding: 4px; background: rgba(8,13,10,.92); border: 1px solid var(--line); border-radius: 16px; position: sticky; top: 8px; z-index: 4; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.mtabs button { font: 600 .82rem var(--body); color: var(--muted); background: none; border: 0; border-radius: 12px; padding: 8px 4px; min-height: 52px; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-width: 0; }
.mtabs button span:last-child { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mtabs .ic { font-size: 1.15rem; line-height: 1; filter: grayscale(.6); opacity: .8; }
.mtabs button[aria-selected=true] { color: #f6f8f6; background: linear-gradient(180deg, rgba(47,191,113,.28), rgba(47,191,113,.1)); box-shadow: inset 0 0 0 1px rgba(47,191,113,.55); }
.mtabs button[aria-selected=true] .ic { filter: none; opacity: 1; }
.mtabs button:focus-visible { outline: 2px solid var(--emerald); outline-offset: 2px; }
@media (max-width: 560px) {
  .mtabs { position: fixed; top: auto; left: 10px; right: 10px; bottom: max(10px, env(safe-area-inset-bottom, 0px)); box-shadow: 0 12px 34px rgba(0,0,0,.65); }
  .lounge .wrap { padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }
  .gate-logo { width: min(240px, 64%); }
}

/* ---------- welcome ---------- */
.lounge .welcome { border-radius: 18px; padding: 20px 16px; }
.lounge .welcome h2 { font-size: clamp(1.4rem, 5.4vw, 1.8rem); background: linear-gradient(180deg, #fff3c4, #d9b44a 60%, #9a7420); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lounge .welcome video { border-radius: 12px; box-shadow: 0 12px 30px rgba(0,0,0,.5); }

/* ---------- the story: downloads + reader ---------- */
.story-head h2 { font-size: clamp(1.4rem, 5vw, 1.7rem); color: #f2f5f3; }
.story-head .fine { margin-top: 4px; }
.book { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.book-title { margin: 0; font-weight: 600; color: #f2f5f3; }
.book-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.pill-btn { font: 600 .9rem var(--body); color: #ffe7a3; background: rgba(217,180,74,.12); border: 1px solid rgba(217,180,74,.55); border-radius: 999px; padding: 10px 16px; min-height: 44px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.pill-btn:hover, .pill-btn:focus-visible { background: rgba(217,180,74,.24); outline: none; }
.pill-btn:disabled { opacity: .55; cursor: wait; }
.pill-btn.on { background: var(--emerald); border-color: transparent; color: #04140b; }
.pill-btn.ghost { color: var(--silver); background: var(--panel-2); border-color: var(--line); }
.book .msg { min-height: 0; }
.lounge .chapter { border-radius: 14px; overflow: hidden; background: linear-gradient(180deg, #111a15, #0b120e); }
.lounge .chapter summary { list-style: none; display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 12px 14px; }
.lounge .chapter summary::-webkit-details-marker { display: none; }
.ch-badge { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font: 700 1.05rem var(--body); color: #ffe7a3; background: rgba(217,180,74,.12); border: 1px solid rgba(217,180,74,.45); font-variant-numeric: tabular-nums; }
.ch-main { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ch-main .ch-t { font-weight: 600; color: #f2f5f3; }
.ch-meta { font-size: .78rem; color: var(--muted); display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.ch-chev { color: var(--muted); transition: transform .2s; }
.chapter[open] .ch-chev { transform: rotate(180deg); }
.reader-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 14px; border-block: 1px solid var(--line); background: rgba(0,0,0,.35); position: sticky; top: 0; z-index: 2; }
.reader-bar .sp { flex: 1; }
.size-btn { width: 44px; height: 44px; border-radius: 50%; font: 600 .95rem var(--serif); color: var(--silver); background: var(--panel-2); border: 1px solid var(--line); cursor: pointer; }
.size-btn:hover, .size-btn:focus-visible { border-color: var(--emerald); outline: none; }
.lounge .ch-text { padding: 18px 16px 22px; font-size: calc(1.08rem * var(--read, 1)); }
.lounge .ch-text p { border-radius: 6px; transition: background .2s; scroll-margin: 120px; }
.lounge .ch-text p.speaking { background: rgba(217,180,74,.16); box-shadow: 0 0 0 6px rgba(217,180,74,.16); }

/* ---------- ideas and debates ---------- */
.composer { border-radius: 16px; padding: 14px; gap: 10px; background: linear-gradient(180deg, #121c16, #0b120e); }
.composer textarea, .composer input { background: rgba(0,0,0,.45); }
.composer-foot { display: flex; align-items: center; gap: 12px; }
.composer-foot .fine { flex: 1; font-size: .78rem; }
.composer-foot .btn { padding: 12px 22px; flex: none; }
.composer .msg { min-height: 0; }
.lounge .post { border-radius: 16px; padding: 14px; gap: 10px; background: linear-gradient(180deg, #111a15, #0b120e); }
.lounge .post h3 { font-size: 1.1rem; color: #f6f8f6; }
.lounge .post .text { font-size: 1rem; line-height: 1.55; color: #e6eae7; }
.lounge .byline { gap: 10px; }
.lounge .byline .av { width: 36px; height: 36px; font-size: 1.05rem; }
.by-id { min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.by-id b { color: #f2f5f3; overflow-wrap: anywhere; }
.by-id small { color: var(--muted); font-size: .76rem; }
.lounge .post-actions { gap: 8px; padding-top: 2px; }
.lounge .post-actions .sp { flex: 1; }
.act { font: 600 .88rem var(--body); color: var(--silver); background: rgba(0,0,0,.4); border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; min-height: 40px; cursor: pointer; font-variant-numeric: tabular-nums; display: inline-flex; align-items: center; gap: 6px; }
.act:hover, .act:focus-visible { border-color: var(--emerald); outline: none; }
.act.like[aria-pressed=true] { border-color: #ff7a66; color: #ffd9d2; background: rgba(255,90,68,.14); }
.act:disabled { opacity: .6; }
.lounge .replies { border-inline-start: 2px solid rgba(217,180,74,.3); gap: 12px; margin-top: 2px; }
.lounge .reply .byline .av { width: 28px; height: 28px; font-size: .85rem; }
.lounge .reply .text { font-size: .95rem; color: #dfe4e1; }
.lounge .reply-form textarea { background: rgba(0,0,0,.45); border-radius: 12px; }
.top-idea { align-self: flex-start; font: 600 .7rem var(--body); letter-spacing: .08em; text-transform: uppercase; color: #04140b; background: linear-gradient(180deg, #ffe7a3, #d9b44a); border-radius: 999px; padding: 2px 10px; }
:lang(ar) .top-idea, :lang(hi) .top-idea { letter-spacing: 0; }

/* ---------- ranking + notifications + footer ---------- */
.cta { text-align: center; text-decoration: none; display: block; }
.lounge .notifs { border-radius: 16px; }
.foot-out { margin: 4px 0 0; text-align: center; }
.part { margin: 10px 0 0; font: 400 1.05rem var(--display); letter-spacing: .04em; color: var(--gold); text-align: center; }
.book-langs { display: flex; flex-wrap: wrap; gap: 8px; }
.book-langs img { border-radius: 2px; }
/* link to the avatar mini-course */
.course { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; align-items: center; gap: 12px; text-decoration: none; color: inherit; background: linear-gradient(120deg, rgba(47,191,113,.18), #0b120e 70%); border: 1px solid rgba(47,191,113,.5); border-radius: 16px; padding: 14px; }
.course:hover, .course:focus-visible { border-color: var(--emerald); outline: none; }
.course-ic { width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; font-size: 1.5rem; background: rgba(0,0,0,.35); }
.course b { display: block; color: #f6f8f6; font-weight: 600; line-height: 1.3; }
.course small { color: var(--emerald); font-weight: 600; }
.course-go { color: var(--emerald); font-size: 1.3rem; }
[dir=rtl] .course-go { transform: scaleX(-1); }
.join-rank { display: block; text-decoration: none; color: #ffe7a3; font-weight: 600; background: rgba(217,180,74,.12); border: 1px solid rgba(217,180,74,.55); border-radius: 14px; padding: 12px 14px; text-wrap: balance; }
.join-rank:hover, .join-rank:focus-visible { background: rgba(217,180,74,.22); outline: none; }

.voice-pick { display: inline-flex; align-items: center; gap: 6px; color: var(--silver); }
.voice-pick select { font: 600 .9rem var(--body); color: var(--silver); background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px; padding: 10px 12px; min-height: 44px; max-width: 220px; }
#book-langs .voice-pick { display: inline-flex; flex-direction: row; align-items: center; gap: 6px; width: auto; margin: 0; white-space: nowrap; }
#book-langs .voice-pick select { width: auto; margin: 0; }
