/* Free Tell X Capital — clean professional theme: white/sand, emerald, gold */
:root {
  --emerald: #0B6B4F;
  --emerald-dark: #084f3a;
  --gold: #C9A227;
  --gold-soft: #f3e7c0;
  --sand: #F7F3E9;
  --ink: #17211c;
  --muted: #6b7a72;
  --card: #ffffff;
  --line: #e5e0d2;
  --danger: #b3261e;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(23,33,28,.08);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: 'Cairo', 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--sand);
  color: var(--ink);
  font-size: 16px;
}
html[dir="ltr"] body { font-family: 'Inter', 'Cairo', system-ui, sans-serif; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.error { color: var(--danger); font-size: .9rem; margin: 8px 0 0; }
.hint { color: var(--muted); font-size: .82rem; margin: 6px 0 0; line-height: 1.5; }

/* Screens */
.screen { display: none; min-height: 100dvh; flex-direction: column; }
.screen.active { display: flex; }

/* Splash */
#screen-splash {
  align-items: center; justify-content: center; text-align: center;
  background: linear-gradient(160deg, #fdfcf8 0%, var(--sand) 55%, #efe8d3 100%);
  padding: 24px;
}
.splash-inner { max-width: 420px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.brand-mark { filter: drop-shadow(0 6px 16px rgba(11,107,79,.25)); margin-bottom: 6px; }
.brand-name { margin: 0; font-size: 1.7rem; font-weight: 800; color: var(--emerald-dark); letter-spacing: .3px; }
.brand-name-ar { margin: 0; font-size: 1.25rem; font-weight: 700; color: var(--gold); }
.tagline { font-size: 1.05rem; line-height: 1.7; margin: 14px 0 0; }
.tagline-sub { color: var(--muted); margin: 0 0 18px; font-size: .9rem; }

/* Buttons */
.btn {
  border: none; border-radius: 12px; padding: 12px 22px; font-size: 1rem;
  font-family: inherit; font-weight: 700; cursor: pointer; transition: transform .08s, box-shadow .15s;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--emerald); color: #fff; box-shadow: 0 4px 14px rgba(11,107,79,.3); }
.btn-primary:hover { background: var(--emerald-dark); }
.btn-lg { padding: 15px 40px; font-size: 1.1rem; }
.btn-block { width: 100%; margin-top: 16px; }
.btn-ghost { background: #f1eee2; color: var(--ink); }
.btn-danger { background: var(--danger); color: #fff; }
.lang-toggle {
  margin-top: 10px; background: none; border: 1px solid var(--line); border-radius: 20px;
  padding: 6px 16px; color: var(--muted); font-family: inherit; font-size: .85rem; cursor: pointer;
}

/* Cards & forms */
.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 24px; margin: auto; width: min(480px, calc(100% - 32px));
}
#screen-age, #screen-terms, #screen-login { padding: 24px 0 40px; justify-content: center; }
.form-card h2 { margin: 0 0 6px; color: var(--emerald-dark); }
.field-label { display: block; font-size: .85rem; font-weight: 700; margin: 14px 0 5px; color: var(--ink); }
.input {
  width: 100%; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 10px;
  font-family: inherit; font-size: 1rem; background: #fff; color: var(--ink);
}
.input:focus { outline: none; border-color: var(--emerald); box-shadow: 0 0 0 3px rgba(11,107,79,.12); }
.input-sm { padding: 8px 10px; font-size: .85rem; width: auto; min-width: 0; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.check-row { display: flex; align-items: flex-start; gap: 10px; margin: 14px 0; cursor: pointer; line-height: 1.5; }
.check-row input { width: 20px; height: 20px; accent-color: var(--emerald); flex-shrink: 0; margin-top: 2px; }
.google-btn {
  width: 100%; margin: 14px 0 4px; display: flex; align-items: center; justify-content: center; gap: 10px;
  background: #fff; color: #3c4043; border: 1.5px solid #dadce0; padding: 12px;
}
.google-btn:hover { background: #f8f9fa; }
.tabs { display: flex; gap: 8px; margin: 14px 0 4px; }
.tab {
  flex: 1; padding: 10px; border: 1.5px solid var(--line); background: #fff; border-radius: 10px;
  font-family: inherit; font-weight: 700; cursor: pointer; color: var(--muted);
}
.tab.active { border-color: var(--emerald); color: var(--emerald); background: #f2f8f5; }
.gender-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.gender-card {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px; border: 2px solid var(--line); border-radius: 12px; background: #fff;
  font-family: inherit; font-size: 1.05rem; font-weight: 700; cursor: pointer;
}
.gender-card.selected { border-color: var(--emerald); background: #f2f8f5; color: var(--emerald-dark); }
.gender-ic { font-size: 1.3rem; color: var(--gold); }
.terms-card { max-height: 92dvh; display: flex; flex-direction: column; }
.terms-body { overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; padding: 6px 16px; margin-top: 8px; background: #fdfcf8; }
.terms-body li { margin: 12px 0; line-height: 1.8; }

/* Chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips-col { flex-direction: column; align-items: stretch; }
.chip {
  border: 1.5px solid var(--line); background: #fff; border-radius: 20px; padding: 7px 14px;
  font-family: inherit; font-size: .9rem; cursor: pointer; color: var(--ink);
}
.chip.selected { border-color: var(--emerald); background: var(--emerald); color: #fff; }
.locked-chip {
  display: inline-flex; align-items: center; gap: 5px; background: var(--gold-soft); color: #7a611a;
  border-radius: 20px; padding: 7px 12px; font-size: .8rem; font-weight: 700; white-space: nowrap;
}

/* Header */
.app-header {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 16px; background: var(--card); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.header-brand { display: flex; align-items: center; gap: 8px; font-weight: 800; color: var(--emerald-dark); }
.header-actions { display: flex; align-items: center; gap: 8px; }
.header-actions .lang-toggle { margin-top: 0; }
.profile-chip {
  display: flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--sand);
  border-radius: 20px; padding: 6px 12px; font-family: inherit; font-size: .85rem; font-weight: 700; cursor: pointer;
}

/* Filters */
.filters-bar {
  display: flex; gap: 8px; padding: 10px 16px; overflow-x: auto; background: var(--card);
  border-bottom: 1px solid var(--line); align-items: center; scrollbar-width: none;
}
.filters-bar::-webkit-scrollbar { display: none; }
.filters-bar .input-sm { flex-shrink: 0; }

/* Lobby */
.lobby-main { padding: 16px; max-width: 900px; margin: 0 auto; width: 100%; }
.section-title { margin: 18px 0 10px; color: var(--emerald-dark); font-size: 1.1rem; }
.room-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.room-card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px; display: flex; flex-direction: column; gap: 8px; border-top: 4px solid var(--emerald);
}
.room-card.closed { border-top-color: var(--gold); }
.room-card h4 { margin: 0; font-size: 1.05rem; }
.room-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.meta-tag {
  background: var(--sand); border-radius: 14px; padding: 3px 10px; font-size: .78rem; color: var(--muted); font-weight: 600;
}
.room-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 4px; }
.participant-count { font-size: .85rem; color: var(--muted); font-weight: 700; }
.join-btn { padding: 8px 18px; font-size: .9rem; }
.knock-btn { background: var(--gold); color: #4a3a08; box-shadow: none; }
.badge {
  font-size: .75rem; font-weight: 700; border-radius: 12px; padding: 3px 10px;
  background: #e8f4ee; color: var(--emerald);
}
.badge.closed { background: var(--gold-soft); color: #7a611a; }

/* FAB */
.fab {
  position: fixed; bottom: 22px; inset-inline-end: 22px; width: 58px; height: 58px; border-radius: 50%;
  background: var(--emerald); color: #fff; font-size: 1.7rem; border: none; cursor: pointer;
  box-shadow: 0 6px 18px rgba(11,107,79,.4); z-index: 30;
}

/* Room screen */
.room-header { gap: 8px; }
.room-title-wrap { flex: 1; min-width: 0; }
.room-title { font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.room-sub { font-size: .8rem; color: var(--muted); }
.icon-btn {
  background: var(--sand); border: none; border-radius: 10px; width: 38px; height: 38px;
  font-size: 1.1rem; cursor: pointer; flex-shrink: 0;
}
.demo-banner {
  background: var(--gold-soft); color: #6d560e; font-size: .82rem; padding: 8px 16px; text-align: center;
  border-bottom: 1px solid #e8dca8;
}
.room-main { flex: 1; padding: 16px; overflow-y: auto; }
.participants-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 14px;
  max-width: 640px; margin: 0 auto;
}
.participant {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 6px;
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  cursor: pointer; border: 2px solid transparent; position: relative;
}
.participant.speaking { border-color: var(--emerald); }
.participant.muted-p .avatar { opacity: .55; }
.avatar {
  width: 52px; height: 52px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 1.25rem; color: #fff; background: var(--emerald);
}
.avatar.alt { background: var(--gold); color: #4a3a08; }
.participant .p-name { font-size: .85rem; font-weight: 700; text-align: center; word-break: break-word; }
.participant .p-flag { font-size: .8rem; color: var(--muted); }
.p-status { position: absolute; top: 8px; inset-inline-end: 8px; font-size: .75rem; }
.host-crown { position: absolute; top: 6px; inset-inline-start: 8px; font-size: .8rem; }

.mic-meter { display: flex; align-items: center; gap: 10px; padding: 8px 18px; font-size: .8rem; color: var(--muted); }
.meter { flex: 1; height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.meter-fill { height: 100%; width: 0%; background: var(--emerald); transition: width .1s linear; }

.room-controls {
  display: flex; justify-content: center; gap: 16px; padding: 14px; background: var(--card);
  border-top: 1px solid var(--line); position: sticky; bottom: 0;
}
.ctrl-btn {
  width: 54px; height: 54px; border-radius: 50%; border: none; font-size: 1.4rem; cursor: pointer;
  background: var(--sand); box-shadow: var(--shadow);
}
.ctrl-btn.off { background: var(--danger); }
.ctrl-danger { background: var(--danger); }

/* Modals */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(20,28,24,.45); z-index: 50;
  display: flex; align-items: flex-end; justify-content: center;
}
@media (min-width: 560px) { .modal-backdrop { align-items: center; } }
.modal {
  background: var(--card); border-radius: 18px 18px 0 0; padding: 22px; width: 100%; max-width: 440px;
  max-height: 88dvh; overflow-y: auto;
}
@media (min-width: 560px) { .modal { border-radius: 18px; } }
.modal h3 { margin: 0 0 12px; color: var(--emerald-dark); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.modal-actions-col { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.knock-anim { font-size: 3rem; text-align: center; animation: knock 1.2s infinite; margin: 12px 0; }
@keyframes knock { 0%,100% { transform: rotate(0); } 20% { transform: rotate(-8deg); } 40% { transform: rotate(0); } }

/* Games */
.games-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.games-row-col { grid-template-columns: 1fr; }
.game-card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
  display: flex; flex-direction: column;
}
.game-art {
  height: 90px; display: flex; align-items: center; justify-content: center; font-size: 2.4rem;
  background: linear-gradient(135deg, var(--emerald) 0%, var(--emerald-dark) 100%);
}
.game-art.gold { background: linear-gradient(135deg, #2b2b2b 0%, #111 100%); }
.game-body { padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.game-body h4 { margin: 0; font-size: .95rem; }
.game-body p { margin: 0; font-size: .8rem; color: var(--muted); flex: 1; }
.game-body .btn { margin-top: 8px; padding: 8px; font-size: .85rem; }

/* Safety warning */
.video-slot {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  border: 2px dashed var(--gold); border-radius: 12px; background: #fdf9ec;
  min-height: 150px; margin: 12px 0; color: #7a611a; font-size: .85rem; font-weight: 700; text-align: center; padding: 12px;
}
.video-slot-ic {
  width: 44px; height: 44px; border-radius: 50%; background: var(--gold); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 1.1rem;
}
.safety-text {
  background: #fdf4f3; border: 1px solid #f0d4d1; border-radius: 10px;
  padding: 14px 16px; line-height: 1.9; font-weight: 600; color: #7a2e28;
}

/* ID upload */
.id-upload-row { display: flex; align-items: center; gap: 12px; }
.id-upload-btn { font-size: .9rem; padding: 10px 16px; }
.id-preview { width: 64px; height: 64px; object-fit: cover; border-radius: 10px; border: 2px solid var(--emerald); }

/* Toast */
.toast {
  position: fixed; bottom: 96px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 12px 22px; border-radius: 12px;
  font-size: .9rem; z-index: 80; max-width: calc(100% - 40px); text-align: center; line-height: 1.6;
  box-shadow: 0 8px 24px rgba(0,0,0,.3);
}
.preview-badge {
  position: fixed; top: 10px; inset-inline-start: 10px; z-index: 90;
  background: var(--gold); color: #4a3a08; font-size: .72rem; font-weight: 800;
  padding: 4px 12px; border-radius: 14px; box-shadow: var(--shadow);
}

/* tabs */
.tabs-bar{display:flex;gap:8px;padding:8px 16px;background:var(--card,#fff);border-bottom:1px solid #e5e0d5}
.tab-btn{flex:1;padding:10px;border:none;border-radius:10px;background:#f3efe6;font-family:inherit;font-weight:700;font-size:15px;color:#6b6455;cursor:pointer}
.tab-btn.active{background:#0B6B4F;color:#fff}
.sub-title{font-size:15px;font-weight:700;color:#0B6B4F;margin:16px 0 8px}
.room-grid-inner,.learn-grid-inner{display:grid;grid-template-columns:repeat(auto-fill,minmax(160px,1fr));gap:12px}
/* learn */
.learn-grid{display:block}
.mascot{display:flex;justify-content:center;margin:8px 0 4px}
.learn-card{background:#fff;border:1px solid #e5e0d5;border-radius:14px;padding:16px;text-align:center;cursor:pointer;transition:box-shadow .15s}
.learn-card:hover{box-shadow:0 4px 14px rgba(11,107,79,.15)}
.learn-flag{font-size:30px;display:block;margin-bottom:6px}
.learn-name{font-weight:700;font-size:16px}
.learn-sub2{font-size:12px;color:#6b6455;margin-top:2px}
.learn-count{font-size:12px;color:#0B6B4F;font-weight:600;margin-top:6px}
.quran-card{border-color:#C9A227;background:#fffdf5}
.lesson-btn{margin:8px 0;text-align:start}
.lesson-items{display:flex;flex-direction:column;gap:10px;margin-top:12px}
.lesson-item{display:flex;align-items:center;gap:12px;background:#fff;border:1px solid #e5e0d5;border-radius:12px;padding:12px 14px}
.lesson-icon{font-size:26px}
.lesson-word{font-size:20px;font-weight:800;min-width:90px}
.lesson-mean{flex:1;color:#444;font-size:14px}
.listen-btn{white-space:nowrap}
