/* ═══ expo.css — ظاهر موبایلی (عمودی ۹:۱۶) برنامه‌ی نمایشگاه ═══
   کارکتر (ویدیو) پس‌زمینه‌ی تمام‌صفحه است و پاسخ‌ها روی نیمه‌ی پایین می‌آیند.
   روی صفحه‌ی عریض (لپ‌تاپ/تلویزیون)، یک قاب عمودی ۹:۱۶ وسط صفحه نمایش داده می‌شود.
   همه‌چیز با rem است و اندازه‌ی ریشه از عرض قاب می‌آید، پس روی هر اندازه‌ای یکسان دیده می‌شود. */
:root {
  --sky: #2FA8E8; --sky-dark: #0E76BC; --sky-light: #AEE0F7; --sky-pale: #E4F4FC;
  --text: #243447; --muted: #5F6B7A; --coral: #E8836B;
  --frame: min(100vw, 56.25vh);
}
@supports (height: 100dvh) { :root { --frame: min(100vw, 56.25dvh); } }
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { font-size: calc(var(--frame) / 24); }
body {
  font-family: 'IRANSansFaNum', 'IranSansFanum', 'Vazirmatn', 'Segoe UI', Tahoma, sans-serif;
  color: var(--text); height: 100vh; overflow: hidden;
  background: linear-gradient(160deg, #0E76BC, #2FA8E8 60%, #7CCBF1);
  display: flex; justify-content: center; align-items: stretch;
  -webkit-user-select: none; user-select: none;
}
@supports (height: 100dvh) { body { height: 100dvh; } }
button { font: inherit; cursor: pointer; color: inherit; border: 0; background: none; }
input, select { font: inherit; }
[hidden] { display: none !important; }

/* ── قاب برنامه ── */
.app { position: relative; width: var(--frame); height: 100%; overflow: hidden; background: #cfe8f5; box-shadow: 0 0 3rem rgba(0,0,0,.35); display: flex; flex-direction: column; }

/* ویدیو */
.stage { position: absolute; inset: 0; z-index: 0; background: #cfe8f5; }
.ch-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 18%; opacity: 0; transition: opacity .45s ease; pointer-events: none; }
.ch-video.on { opacity: 1; }
.ans-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 18%; opacity: 0; transition: opacity .3s ease; z-index: 2; background: #cfe8f5; }
.ans-video.on { opacity: 1; }
.shade-top { position: absolute; inset: 0 0 auto 0; height: 7rem; z-index: 1; background: linear-gradient(180deg, rgba(14,118,188,.88), rgba(14,118,188,0)); pointer-events: none; }
.shade-bottom { position: absolute; inset: auto 0 0 0; height: 62%; z-index: 1; background: linear-gradient(180deg, rgba(228,244,252,0) 0%, rgba(228,244,252,.82) 38%, rgba(228,244,252,.97) 100%); pointer-events: none; }

/* ── بالا ── */
.top { position: relative; z-index: 3; display: flex; align-items: center; justify-content: space-between; gap: .6rem; padding: .7rem .9rem .2rem; color: #fff; }
.top-brand { display: flex; align-items: center; gap: .6rem; min-width: 0; }
.top-logo { height: 2.2rem; width: auto; flex: none; }
.top-title { font-size: 1rem; font-weight: 800; line-height: 1.25; text-shadow: 0 1px 6px rgba(0,0,0,.25); }
.top-sub { font-size: .68rem; opacity: .95; margin-top: .05rem; }
.gear { width: 2.1rem; height: 2.1rem; border-radius: 50%; background: rgba(255,255,255,.2); font-size: 1.1rem; color: #fff; flex: none; }
.gear:hover { background: rgba(255,255,255,.34); }

.status-row { position: relative; z-index: 3; display: flex; flex-direction: column; align-items: flex-start; gap: .35rem; padding: .35rem .9rem 0; }
.char-state { font-size: .78rem; font-weight: 800; color: var(--sky-dark); background: rgba(255,255,255,.92); padding: .25rem .8rem; border-radius: 999px; box-shadow: 0 .1rem .5rem rgba(14,118,188,.2); }
body[data-state="listening"] .char-state { color: #fff; background: var(--coral); }
body[data-state="talking"] .char-state { color: #fff; background: var(--sky-dark); }
.top-status { font-size: .66rem; background: rgba(255,255,255,.85); color: var(--sky-dark); padding: .2rem .7rem; border-radius: 999px; max-width: 100%; }
.top-status:empty { display: none; }
.top-status.bad { background: #fff3cd; color: #7a5b00; font-weight: 700; }

/* ── پایین (پاسخ، سؤال‌ها، میکروفون) ── */
.sheet { position: relative; z-index: 3; margin-top: auto; display: flex; flex-direction: column; gap: .55rem; padding: 0 .8rem .6rem; max-height: 62%; min-height: 0; }
.you { align-self: flex-start; max-width: 92%; font-size: .85rem; background: var(--sky); color: #fff; padding: .3rem .9rem; border-radius: 1rem 1rem 1rem .25rem; box-shadow: 0 .15rem .6rem rgba(14,118,188,.3); }
.you-label { opacity: .85; font-weight: 700; }
.you.interim { opacity: .75; }

.answer { flex: 0 1 auto; min-height: 5rem; overflow-y: auto; background: rgba(255,255,255,.95); border-radius: 1.1rem; padding: .85rem 1rem; box-shadow: 0 .3rem 1.2rem rgba(14,118,188,.22); line-height: 1.85; border: 1px solid rgba(174,224,247,.8); scrollbar-width: thin; scrollbar-color: var(--sky-light) transparent; -webkit-user-select: text; user-select: text; }
.answer.size-xl { font-size: 1.3rem; }
.answer.size-l { font-size: 1.05rem; }
.answer.size-m { font-size: .92rem; }
.answer.size-s { font-size: .82rem; line-height: 1.8; }
.answer-body b { color: var(--sky-dark); }
.hello-title { font-size: 1.25rem; font-weight: 800; color: var(--sky-dark); margin-bottom: .3rem; }
.hello-text { font-size: .95rem; }

.chips { flex: none; display: grid; grid-template-rows: repeat(2, 2.35rem); grid-auto-flow: column; grid-auto-columns: max-content; gap: .4rem; overflow-x: auto; padding: .1rem .05rem .3rem; scrollbar-width: none; -webkit-overflow-scrolling: touch; scroll-snap-type: x proximity; }
.chips::-webkit-scrollbar { display: none; }
.chip { scroll-snap-align: start; background: #fff; color: var(--sky-dark); border: 1px solid var(--sky-light); border-radius: 999px; padding: 0 .95rem; font-size: .82rem; font-weight: 800; white-space: nowrap; box-shadow: 0 .1rem .5rem rgba(14,118,188,.12); }
.chip:active { background: var(--sky-light); transform: scale(.97); }

.mic-row { flex: none; display: flex; align-items: center; gap: .7rem; min-height: 4.3rem; }
.mic { position: relative; width: 4.2rem; height: 4.2rem; border-radius: 50%; color: #fff; flex: none;
  background: radial-gradient(circle at 35% 30%, #5CC3F5, var(--sky) 55%, var(--sky-dark)); box-shadow: 0 .3rem 1rem rgba(14,118,188,.5); display: grid; place-items: center; transition: transform .15s; }
.mic:active { transform: scale(.95); }
.mic-ico { width: 2rem; height: 2rem; position: relative; z-index: 1; }
.mic-ring { position: absolute; inset: 0; border-radius: 50%; border: .18rem solid var(--sky); opacity: 0; }
body[data-state="idle"] .mic .mic-ring { animation: ring 2.6s ease-out infinite; }
body[data-state="idle"] .mic .mic-ring.r2 { animation-delay: 1.3s; }
body[data-state="listening"] .mic { background: radial-gradient(circle at 35% 30%, #F4A590, var(--coral) 55%, #C4573E); box-shadow: 0 .3rem 1.1rem rgba(232,131,107,.65); }
body[data-state="listening"] .mic .mic-ring { border-color: var(--coral); animation: ring 1.1s ease-out infinite; }
body[data-state="listening"] .mic .mic-ring.r2 { animation: ring 1.1s ease-out .5s infinite; }
body[data-state="talking"] .mic, body[data-state="thinking"] .mic { opacity: .6; }
@keyframes ring { 0% { transform: scale(1); opacity: .65 } 100% { transform: scale(1.7); opacity: 0 } }
.mic-text { flex: 1; min-width: 0; }
.mic-title { font-size: .98rem; font-weight: 800; color: var(--sky-dark); line-height: 1.4; }
.mic-sub { font-size: .72rem; color: var(--muted); margin-top: .1rem; min-height: 1.3em; line-height: 1.5; }
.mic-sub.warn { color: #9a5b00; background: #fff3cd; border-radius: .5rem; padding: .05rem .5rem; display: inline-block; }
.kb { width: 2.6rem; height: 2.6rem; border-radius: 50%; background: #fff; color: var(--sky-dark); font-size: 1.3rem; border: 1px solid var(--sky-light); box-shadow: 0 .1rem .5rem rgba(14,118,188,.15); flex: none; }
.typebox { flex: 1; display: flex; background: #fff; border-radius: 999px; border: 1px solid var(--sky-light); overflow: hidden; box-shadow: 0 .1rem .6rem rgba(14,118,188,.14); -webkit-user-select: text; user-select: text; }
.typebox input { border: 0; outline: 0; padding: .6rem 1rem; width: 100%; min-width: 0; font-size: .9rem; background: transparent; color: var(--text); }
.typebox button { padding: 0 1rem; font-size: 1.2rem; color: var(--sky-dark); }
.foot { flex: none; text-align: center; font-size: .66rem; color: var(--muted); font-weight: 700; min-height: 1em; }

/* ── صفحه‌ی شروع ── */
.start { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: linear-gradient(150deg, var(--sky) 0%, var(--sky-dark) 100%); transition: opacity .5s; }
.start.gone { opacity: 0; pointer-events: none; visibility: hidden; transition: opacity .5s, visibility 0s .5s; }
.start-card { text-align: center; color: #fff; width: min(92vw, 30rem); padding: 1rem; }
.start-logo { height: 5.2rem; width: auto; margin-bottom: .8rem; }
.start-card h1 { font-size: 1.7rem; font-weight: 800; margin-bottom: .4rem; }
.start-sub { font-size: 1rem; opacity: .95; margin-bottom: 1.4rem; }
.btn-start { background: #fff; color: var(--sky-dark); font-size: 1.5rem; font-weight: 800; padding: .7rem 3.4rem; border-radius: 999px; box-shadow: 0 .4rem 1.4rem rgba(0,0,0,.25); }
.start-checks { list-style: none; margin: 1.4rem auto 0; display: flex; flex-direction: column; gap: .4rem; text-align: right; font-size: .82rem; }
.start-checks li { background: rgba(255,255,255,.16); padding: .35rem .8rem; border-radius: .7rem; }
.start-checks li.bad { background: #fff3cd; color: #7a5b00; font-weight: 700; }
.start-hint { margin-top: 1rem; font-size: .74rem; opacity: .88; }

/* ── تنظیمات ── */
.settings { position: absolute; inset: 3.4rem .6rem auto .6rem; z-index: 40; }
.settings-card { background: #fff; border-radius: 1rem; padding: .8rem .95rem; box-shadow: 0 .8rem 2.4rem rgba(0,0,0,.35); font-size: .82rem; max-height: 82vh; overflow-y: auto; -webkit-user-select: text; user-select: text; }
.settings-head { display: flex; justify-content: space-between; align-items: center; font-size: 1rem; margin-bottom: .4rem; color: var(--sky-dark); }
.settings-head button { font-size: 1.1rem; padding: .1rem .5rem; border-radius: .4rem; }
.row { display: flex; align-items: center; justify-content: space-between; gap: .8rem; padding: .45rem 0; border-bottom: 1px solid #eef3f7; }
.row.col { flex-direction: column; align-items: stretch; gap: .3rem; }
.row.wrap { flex-wrap: wrap; justify-content: flex-start; gap: .4rem; }
.row input[type=checkbox] { width: 1.15rem; height: 1.15rem; flex: none; }
.row select { padding: .35rem; border-radius: .4rem; border: 1px solid var(--sky-light); max-width: 100%; }
.small { background: var(--sky-pale); color: var(--sky-dark); padding: .35rem .75rem; border-radius: .5rem; font-size: .78rem; font-weight: 700; text-decoration: none; }
.as-btn { display: inline-block; }
.note { color: var(--muted); font-size: .72rem; margin-top: .5rem; line-height: 1.7; }
kbd { background: #eef3f7; border-radius: .25rem; padding: 0 .3rem; font-family: inherit; border: 1px solid #d5dee6; }

/* قاب‌های خیلی کوتاه (گوشی افقی): بالا فشرده‌تر */
@media (max-height: 520px) { .shade-bottom { height: 75%; } .sheet { max-height: 70%; } }
@media (prefers-reduced-motion: reduce) { .mic-ring { animation: none !important; } .ch-video { transition: none; } }
