/* Theme borrowed from tii.ae: FS Albert Pro, slate navy #233746,
 * signature aqua #7eddd3, orange #ff5622, Material Symbols icons. */

@font-face {
  font-family: "FS Albert Pro";
  src: url("https://files-prod.tii.ae/static/FSAlbertPro.woff2") format("woff2"),
       url("https://files-prod.tii.ae/static/FSAlbertPro.woff") format("woff");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "FS Albert Pro";
  src: url("https://files-prod.tii.ae/static/FSAlbertPro-Bold.woff2") format("woff2"),
       url("https://files-prod.tii.ae/static/FSAlbertPro-Bold.woff") format("woff");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #f4f7f8;
  --card: #ffffff;
  --navy: #233746;
  --navy-deep: #18262f;
  --aqua: #7eddd3;
  --aqua-soft: #e4f9f6;
  --aqua-text: #0c7d70;      /* aqua darkened for readable text on white */
  --orange: #ff5622;
  --orange-deep: #e64a1c;
  --ink: #233746;
  --muted: #5f7181;
  --bluegrey: #9dafbd;
  --accent: var(--navy);
  --accent-soft: var(--aqua-soft);
  --green: #198754;
  --red: #dc3545;
  --border: #dde5e9;
  --radius: 16px;
  --shadow: 0 1px 3px rgba(35, 55, 70, .08), 0 8px 24px rgba(35, 55, 70, .06);
  --font-ui: "FS Albert Pro", Helvetica, Arial, sans-serif;
  --font-ar: "Noto Naskh Arabic", "Geeza Pro", serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 15.5px;
  line-height: 1.55;
}

.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* Material Symbols (TII's icon set) */
.msym {
  font-family: "Material Symbols Outlined";
  font-weight: normal;
  font-style: normal;
  font-size: 1.25em;
  line-height: 1;
  display: inline-block;
  vertical-align: -0.25em;
  letter-spacing: normal;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  background: var(--navy);
  color: #fff;
  border-bottom: 3px solid var(--aqua);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { font-weight: 700; font-size: 17px; }
.brand .msym { color: var(--aqua); margin-right: 6px; }
.brand-sub { font-weight: 400; font-size: 13px; color: var(--bluegrey); margin-left: 8px; }
.session-info { display: flex; align-items: center; gap: 12px; font-size: 13.5px; }
.topbar .link-btn { color: var(--aqua); }

/* ---------- Layout ---------- */
.screen {
  max-width: 760px;
  margin: 32px auto 80px;
  padding: 0 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
#screen-record { max-width: 1180px; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 26px 28px;
}
.card h1 { margin: 0 0 10px; font-size: 27px; }
.card h2 { margin: 0 0 6px; font-size: 21px; }
.card h3 { margin: 0 0 12px; font-size: 16px; }

.intro-card {
  background: linear-gradient(120deg, var(--navy-deep) 0%, var(--navy) 45%, #2d6e6e 85%, #49b3a6 100%);
  color: #fff;
  border: none;
}
.intro-card h1 { color: var(--aqua); }
.intro-card p { margin: 0; opacity: .95; font-size: 16px; }

/* ---------- Forms ---------- */
.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 18px;
  margin: 18px 0;
}
label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 700; }
input, select {
  font: inherit;
  font-weight: 400;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #f8fafb;
  outline: none;
  color: var(--ink);
}
input:focus, select:focus { border-color: var(--aqua); background: #fff; box-shadow: 0 0 0 3px rgba(126, 221, 211, .25); }
.checkbox-row {
  flex-direction: row;
  align-items: center;
  gap: 10px;
  font-weight: 400;
  margin-top: 8px;
}
.checkbox-row input { width: 18px; height: 18px; accent-color: var(--navy); }
.consent {
  background: var(--aqua-soft);
  border: 1px solid #bfeee8;
  border-radius: 10px;
  padding: 12px 14px;
  margin: 6px 0 18px;
}
.resume-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  border-top: 4px solid var(--aqua);
}
.resume-card h2 { margin-bottom: 4px; }
.resume-card p { margin: 4px 0 0; }

/* ---------- Buttons ---------- */
.btn {
  font: inherit;
  font-weight: 700;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  padding: 10px 18px;
  cursor: pointer;
  transition: transform .06s, box-shadow .12s, background .12s;
}
.btn:hover { box-shadow: var(--shadow); }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.primary:hover { background: var(--navy-deep); }
.btn.ghost { background: transparent; }
.btn.big { width: 100%; padding: 14px; font-size: 16px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.link-btn {
  background: none; border: none; color: var(--aqua-text);
  font: inherit; font-size: 13.5px; cursor: pointer; padding: 4px;
}

/* ---------- Pills & alerts ---------- */
.pill {
  background: var(--aqua);
  color: var(--navy);
  font-size: 12px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 99px;
}
.pill.subtle { background: #eef2f4; color: var(--muted); }
.alert {
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 14px;
  margin-bottom: 14px;
}
.alert.warn { background: #fff0ea; color: #a33a12; border: 1px solid #ffc9b3; }

/* ---------- Mic setup ---------- */
.meter-wrap { margin: 18px 0; }
.meter-label { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
canvas { width: 100%; border-radius: 10px; background: var(--navy-deep); display: block; }
.tips-list { margin: 14px 0 8px; padding-left: 20px; color: var(--muted); font-size: 14.5px; }
.tips-list li { margin: 4px 0; }

/* ---------- Studio layout ---------- */
.studio-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 20px;
  align-items: start;
}
@media (max-width: 900px) { .studio-layout { grid-template-columns: 1fr; } }
.studio-main { display: flex; flex-direction: column; gap: 16px; }

/* ---------- Text queue ---------- */
.queue-card { padding: 18px; position: sticky; top: 76px; max-height: calc(100vh - 110px); overflow-y: auto; }
.queue-item {
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  border: 1px solid transparent;
  margin-bottom: 6px;
}
.queue-item:hover { background: #f2f6f7; }
.queue-item.active { background: var(--aqua-soft); border-color: var(--aqua); }
.queue-item .q-text {
  font-family: var(--font-ar);
  font-size: 15px;
  direction: rtl;
  text-align: right;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.queue-item .q-meta { font-size: 12px; color: var(--muted); display: flex; gap: 6px; margin-top: 3px; }
.q-done { color: var(--aqua-text); font-weight: 700; }

/* ---------- Prompt ---------- */
.prompt-card { padding-bottom: 20px; border-top: 4px solid var(--aqua); }
.prompt-header { display: flex; justify-content: space-between; align-items: center; }
.arabic-text {
  font-family: var(--font-ar);
  font-size: 34px;
  line-height: 1.9;
  margin: 18px 0 14px;
  text-align: right;
}
.emotion-row { display: flex; flex-wrap: wrap; gap: 8px; }
.emotion-chip {
  font: inherit;
  font-size: 14px;
  font-weight: 400;
  padding: 7px 14px;
  border-radius: 99px;
  border: 1.5px solid var(--border);
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  transition: all .12s;
}
.emotion-chip:hover { border-color: var(--navy); }
.emotion-chip.selected { background: var(--navy); border-color: var(--navy); color: #fff; }
.emotion-chip.done { border-color: var(--aqua); background: var(--aqua-soft); }
.emotion-chip.done::after { content: " ✓"; color: var(--aqua-text); font-weight: 700; }
.emotion-chip.selected.done { background: var(--navy); }
.emotion-chip.selected.done::after { color: var(--aqua); }

/* ---------- Coach card ---------- */
.coach-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--aqua-soft);
  border-color: #bfeee8;
  padding: 18px 22px;
}
.coach-emoji { font-size: 38px; }
.coach-scenario { font-weight: 700; font-size: 16px; margin-bottom: 3px; }
.coach-tip { color: var(--muted); font-size: 14.5px; }
.coach-card .link-btn { margin-left: auto; font-size: 20px; }

/* ---------- Record card ---------- */
.rehearse-row { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.rehearse-step {
  font-size: 13px;
  color: var(--muted);
  background: #eef2f4;
  padding: 5px 12px;
  border-radius: 99px;
}
.record-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 18px; margin-top: 14px; }
.record-btn {
  background: var(--orange);
  border-color: var(--orange);
  color: #fff;
  font-size: 16px;
  padding: 13px 30px;
  border-radius: 99px;
}
.record-btn:hover { background: var(--orange-deep); }
.record-btn.recording { animation: pulse 1.2s infinite; }
.finish-btn { margin-left: auto; }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 86, 34, .45); }
  50% { box-shadow: 0 0 0 12px rgba(255, 86, 34, 0); }
}
.rec-timer { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 18px; }

/* ---------- Self-assessment (no playback) ---------- */
.assess-panel { margin-top: 18px; border-top: 1px dashed var(--border); padding-top: 16px; }
.assess-q { font-weight: 700; font-size: 16.5px; margin-bottom: 14px; }
.review-actions { display: flex; gap: 12px; justify-content: flex-end; }
#quality-flags .alert { margin: 0 0 10px; }

/* ---------- Voice check (setup) ---------- */
.warmup-line { font-size: 24px; line-height: 1.8; margin: 14px 0; }
.test-review { margin: 16px 0; }
.test-review audio { width: 100%; margin-bottom: 8px; }
.center { text-align: center; margin-top: 8px; }

/* ---------- Gamification ---------- */
.pill.streak { background: var(--orange); color: #fff; }
.emotion-chip.bonus { border-style: dashed; border-color: #ffb59e; background: #fff5f0; }
.emotion-chip.bonus.selected { background: var(--orange); border-color: var(--orange); border-style: solid; color: #fff; }

/* ---------- Summary ---------- */
.summary-hero p { margin: 0; opacity: .95; font-size: 16px; }
.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0;
}
.summary-stat {
  background: #f6f9fa;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
}
.summary-value {
  display: block;
  font-size: 26px;
  font-weight: 700;
  line-height: 1.1;
  color: var(--navy);
}
.summary-label {
  display: block;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.25;
  margin-top: 6px;
}
.summary-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 18px; }

/* ---------- Leaderboard ---------- */
.lb-banner { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.lb-banner h2 { margin: 0; }
.lb-banner p { margin: 4px 0 0; }
.lb-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid transparent;
}
.lb-row:nth-child(odd) { background: #f6f9fa; }
.lb-row.lb-self { background: var(--aqua-soft); border-color: var(--aqua); }
.lb-rank { width: 42px; font-size: 18px; font-weight: 700; text-align: center; }
.lb-name { font-weight: 700; flex: 1; }
.lb-stats { display: flex; gap: 14px; color: var(--muted); font-size: 13.5px; }
.lb-points { font-weight: 700; color: var(--aqua-text); min-width: 90px; text-align: right; }
.lb-explainer { border-top: 4px solid var(--aqua); }
@media (max-width: 640px) { .lb-stats { display: none; } }
@media (max-width: 640px) {
  .resume-card { align-items: stretch; flex-direction: column; }
  .summary-grid { grid-template-columns: 1fr 1fr; }
  .finish-btn { width: 100%; margin-left: 0; }
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--navy);
  color: #fff;
  padding: 12px 22px;
  border-radius: 12px;
  font-size: 14.5px;
  box-shadow: var(--shadow);
  z-index: 50;
}
.toast.success { background: var(--aqua); color: var(--navy); font-weight: 700; }
