:root {
  --bg: #081526;
  --bg-2: #0d1f36;
  --card: #112741;
  --card-2: #17314f;
  --line: #24415f;
  --text: #eef1f8;
  --muted: #8fa6bf;
  --accent: #2d8057;
  --accent-2: #94bc48;
  --host: #f6931d;
  --ok: #2fd47e;
  --warn: #ffb547;
  --radius: 20px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { margin: 0; min-height: 100%; }

body {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background:
    radial-gradient(1200px 600px at 110% -10%, rgba(45, 128, 87, .30), transparent 60%),
    radial-gradient(900px 500px at -20% 110%, rgba(246, 147, 29, .14), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

.app {
  max-width: 520px;
  margin: 0 auto;
  padding: 20px 16px 40px;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* ── Header ─────────────────────────────────────────── */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.brand-logo {
  width: 38px; height: 38px; border-radius: 12px;
  display: grid; place-items: center; font-size: 20px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 6px 18px rgba(45, 128, 87, .45);
}
.brand-name { font-weight: 800; font-size: 20px; letter-spacing: .3px; }
.brand-name small { display: block; font-weight: 500; font-size: 11px; color: var(--muted); letter-spacing: .4px; }
.back { color: var(--muted); text-decoration: none; font-size: 14px; }

/* ── Pills ──────────────────────────────────────────── */
.pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px; border-radius: 999px;
  background: var(--card); border: 1px solid var(--line);
  font-size: 13px; color: var(--muted); white-space: nowrap;
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.pill.live { color: var(--text); border-color: rgba(47, 212, 126, .4); }
.pill.live .dot { background: var(--ok); box-shadow: 0 0 0 0 rgba(47, 212, 126, .7); animation: ping 1.6s infinite; }
.pill.rec { color: var(--text); border-color: rgba(246, 147, 29, .5); }
.pill.rec .dot { background: var(--host); animation: ping-red 1.2s infinite; }

@keyframes ping { 0% { box-shadow: 0 0 0 0 rgba(47, 212, 126, .7); } 100% { box-shadow: 0 0 0 10px rgba(47, 212, 126, 0); } }
@keyframes ping-red { 0% { box-shadow: 0 0 0 0 rgba(255, 107, 107, .7); } 100% { box-shadow: 0 0 0 10px rgba(255, 107, 107, 0); } }

/* ── Cards ──────────────────────────────────────────── */
.card {
  background: linear-gradient(180deg, var(--card), var(--bg-2));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}
.card h2 { margin: 0 0 6px; font-size: 18px; }
.card p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.5; }
.label { font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); margin-bottom: 10px; font-weight: 600; }

/* ── Home ───────────────────────────────────────────── */
.hero { text-align: center; padding: 18px 0 4px; }
.hero h1 { font-size: 30px; line-height: 1.15; margin: 0 0 10px; letter-spacing: -.5px; }
.hero h1 span { background: linear-gradient(90deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { color: var(--muted); margin: 0; font-size: 15px; }

.role {
  display: flex; align-items: center; gap: 16px;
  text-decoration: none; color: var(--text);
  transition: transform .15s ease, border-color .15s ease, opacity .2s;
}
.role:active { transform: scale(.98); }
.role .icon {
  width: 64px; height: 64px; border-radius: 18px; flex: none;
  display: grid; place-items: center; font-size: 30px;
}
.role.host .icon { background: linear-gradient(135deg, #f6931d, #ffb45c); box-shadow: 0 8px 22px rgba(246, 147, 29, .35); }
.role.guest .icon { background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 8px 22px rgba(45, 128, 87, .35); }
.role .body { flex: 1; min-width: 0; }
.role .body .pill { margin-top: 10px; }
.role .chev { color: var(--muted); font-size: 22px; }
.role.disabled { opacity: .5; pointer-events: none; }

/* ── Buttons ────────────────────────────────────────── */
.btn {
  appearance: none; border: 0; cursor: pointer;
  width: 100%; padding: 17px 20px; border-radius: 16px;
  font: inherit; font-weight: 700; font-size: 17px; color: #fff;
  background: linear-gradient(135deg, var(--accent), #53b148);
  box-shadow: 0 10px 24px rgba(45, 128, 87, .35);
  transition: transform .12s ease, opacity .2s, filter .2s;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.btn.host { background: linear-gradient(135deg, #f6931d, #ffb45c); box-shadow: 0 10px 24px rgba(246, 147, 29, .35); }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--muted); box-shadow: none; font-weight: 600; font-size: 15px; padding: 14px; }
.btn.small { width: auto; padding: 10px 14px; font-size: 14px; border-radius: 12px; }

/* ── Language picker ────────────────────────────────── */
.langs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.lang {
  appearance: none; font: inherit; color: var(--text); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 12px 6px; border-radius: 14px;
  background: var(--card-2); border: 1.5px solid transparent;
  transition: border-color .15s, background .15s, transform .12s;
}
.lang:active { transform: scale(.96); }
.lang .flag { font-size: 26px; line-height: 1; }
.lang .name { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.lang.selected { border-color: var(--accent-2); background: rgba(148, 188, 72, .14); }
.lang.selected .name { color: var(--text); }

select.select {
  width: 100%; padding: 14px; border-radius: 14px; font: inherit; font-size: 16px;
  background: var(--card-2); color: var(--text); border: 1px solid var(--line);
}

/* ── Mic (host) ─────────────────────────────────────── */
.stage { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 10px 0; }
.mic {
  position: relative; width: 170px; height: 170px; border-radius: 50%;
  border: 0; cursor: pointer; color: #fff; font-size: 60px;
  background: radial-gradient(circle at 30% 30%, #2a4a70, #14304f);
  box-shadow: inset 0 0 0 2px var(--line), 0 20px 40px rgba(0, 0, 0, .45);
  transition: transform .15s, background .3s;
}
.mic:active { transform: scale(.97); }
.mic.on { background: radial-gradient(circle at 30% 30%, #ffb45c, #e07b0c); box-shadow: 0 20px 50px rgba(246, 147, 29, .5); }
.mic .ring {
  position: absolute; inset: 0; border-radius: 50%;
  border: 2px solid rgba(246, 147, 29, .6); opacity: 0; pointer-events: none;
}
.mic.on .ring { animation: ring 2s infinite; }
.mic.on .ring:nth-child(2) { animation-delay: .66s; }
.mic.on .ring:nth-child(3) { animation-delay: 1.33s; }
@keyframes ring { 0% { transform: scale(1); opacity: .8; } 100% { transform: scale(1.7); opacity: 0; } }
.mic-hint { color: var(--muted); font-size: 14px; text-align: center; min-height: 20px; }

/* ── Transcript / captions ──────────────────────────── */
.feed { display: flex; flex-direction: column; gap: 10px; max-height: 46vh; overflow-y: auto; scroll-behavior: smooth; }
.feed:empty::before { content: attr(data-empty); color: var(--muted); font-size: 14px; text-align: center; padding: 20px 0; }
.line {
  padding: 12px 14px; border-radius: 14px; background: var(--card-2);
  font-size: 16px; line-height: 1.45; animation: pop .25s ease;
}
.line .orig { display: block; margin-top: 6px; font-size: 12.5px; color: var(--muted); }
.line.interim { opacity: .6; font-style: italic; background: transparent; border: 1px dashed var(--line); }
.line.playing { background: linear-gradient(135deg, rgba(45, 128, 87, .30), rgba(246, 147, 29, .14)); box-shadow: inset 0 0 0 1px rgba(148, 188, 72, .45); }
@keyframes pop { from { transform: translateY(6px); opacity: 0; } to { transform: none; opacity: 1; } }

.caption-big { font-size: 22px; line-height: 1.4; font-weight: 600; min-height: 62px; }

/* ── Stats ──────────────────────────────────────────── */
.stats { display: flex; gap: 10px; }
.stat { flex: 1; text-align: center; padding: 12px; border-radius: 14px; background: var(--card-2); }
.stat b { display: block; font-size: 24px; }
.stat span { font-size: 12px; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip { padding: 4px 10px; border-radius: 999px; background: var(--card-2); font-size: 13px; }

/* ── QR ─────────────────────────────────────────────── */
.qr-wrap { display: flex; gap: 14px; align-items: center; }
.qr { background: #fff; padding: 8px; border-radius: 12px; width: 112px; height: 112px; flex: none; }
.qr svg, .qr img { width: 100%; height: 100%; display: block; }
.qr-url { font-size: 13px; color: var(--muted); word-break: break-all; }

/* ── Equalizer (guest) ──────────────────────────────── */
.eq { display: flex; align-items: flex-end; gap: 4px; height: 28px; }
.eq i { width: 5px; height: 6px; border-radius: 3px; background: var(--accent-2); transition: height .2s; }
.eq.on i { animation: eq .9s ease-in-out infinite; }
.eq.on i:nth-child(2) { animation-delay: .15s; }
.eq.on i:nth-child(3) { animation-delay: .3s; }
.eq.on i:nth-child(4) { animation-delay: .45s; }
.eq.on i:nth-child(5) { animation-delay: .6s; }
@keyframes eq { 0%, 100% { height: 6px; } 50% { height: 28px; } }

.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.center { text-align: center; }
.muted { color: var(--muted); }
.hidden { display: none !important; }
.spacer { flex: 1; }

.notice {
  padding: 12px 14px; border-radius: 14px; font-size: 14px; line-height: 1.45;
  background: rgba(255, 181, 71, .1); border: 1px solid rgba(255, 181, 71, .35); color: #ffd79a;
}
.notice.error { background: rgba(255, 107, 107, .1); border-color: rgba(255, 107, 107, .4); color: #ffb3b3; }

.waiting { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 26px 10px; text-align: center; }
.spinner { width: 42px; height: 42px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent-2); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px);
  background: #000c; color: #fff; padding: 12px 18px; border-radius: 12px; font-size: 14px;
  opacity: 0; transition: .25s; pointer-events: none; max-width: calc(100% - 32px); z-index: 50;
}
.toast.show { opacity: 1; transform: translateX(-50%); }

.footer { margin-top: auto; text-align: center; font-size: 12px; color: var(--muted); padding-top: 10px; }

/* ── Лого ───────────────────────────────────────────── */
.brand-mark { width: 44px; height: auto; display: block; filter: drop-shadow(0 4px 10px rgba(0, 0, 0, .35)); }
.hero-logo { width: 150px; height: auto; display: block; margin: 0 auto 14px; filter: drop-shadow(0 10px 24px rgba(0, 0, 0, .45)); }

/* ── Поле за име ────────────────────────────────────── */
.input {
  width: 100%; padding: 14px; border-radius: 14px; font: inherit; font-size: 16px;
  background: var(--card-2); color: var(--text); border: 1px solid var(--line); outline: none;
}
.input:focus { border-color: var(--accent-2); }

/* ── Камера на гида ─────────────────────────────────── */
.cam-host { display: flex; gap: 14px; align-items: center; }
.cam-preview {
  width: 120px; aspect-ratio: 3 / 4; border-radius: 14px; overflow: hidden; flex: none;
  background: var(--card-2); display: grid; place-items: center; color: var(--muted); font-size: 28px;
  position: relative;
}
.cam-preview video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); display: block; }

/* Карта на гида при госта */
.guide { display: flex; gap: 14px; align-items: center; }
.guide-photo {
  position: relative; width: 96px; aspect-ratio: 3 / 4; border-radius: 14px; overflow: hidden; flex: none;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: grid; place-items: center; font-size: 34px; font-weight: 800; color: #fff;
}
.guide-photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.guide-photo .live-tag {
  position: absolute; left: 6px; top: 6px; z-index: 2;
  background: #e53935; color: #fff; font-size: 10px; font-weight: 800; letter-spacing: .5px;
  padding: 2px 6px; border-radius: 6px;
}
.guide.big { flex-direction: column; align-items: stretch; }
.guide.big .guide-photo { width: 100%; aspect-ratio: 4 / 3; max-height: 60vh; }
.guide-name { font-size: 18px; font-weight: 700; }
.guide-role { font-size: 13px; color: var(--muted); margin-top: 2px; }

/* ── Радио режим (задръж за говор) ──────────────────── */
.mic { user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: none; }
.mic.on:not(.ready) { filter: saturate(.6) brightness(.9); }   /* микрофонът още се включва */
.mic.ptt.on { transform: scale(.95); }

.seg { display: inline-flex; padding: 4px; gap: 4px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); }
.seg button {
  appearance: none; border: 0; cursor: pointer; font: inherit; font-size: 13px; font-weight: 600;
  padding: 8px 12px; border-radius: 10px; background: transparent; color: var(--muted);
}
.seg button.active { background: var(--card-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }

/* ── Настройки ──────────────────────────────────────── */
.opts { display: flex; flex-direction: column; gap: 8px; }
.opt {
  display: flex; gap: 12px; align-items: flex-start; cursor: pointer;
  padding: 12px 14px; border-radius: 14px; background: var(--card-2); border: 1.5px solid transparent;
  transition: border-color .15s, background .15s;
}
.opt input { margin-top: 3px; accent-color: var(--accent-2); width: 18px; height: 18px; flex: none; }
.opt-body { display: flex; flex-direction: column; gap: 3px; }
.opt-body b { font-size: 15px; }
.opt-body small { font-size: 12.5px; color: var(--muted); line-height: 1.4; }
.opt.selected { border-color: var(--accent-2); background: rgba(148, 188, 72, .12); }
.opt.disabled { opacity: .45; cursor: not-allowed; }
.badge { font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 6px; background: rgba(246, 147, 29, .18); color: #ffc680; margin-left: 6px; }
.settings-link { color: var(--muted); text-decoration: none; font-size: 14px; text-align: center; display: block; }

/* ── Всички езици (гост) ────────────────────────────── */
#more { display: flex; flex-direction: column; gap: 10px; }
#more.hidden { display: none; }
.lang-list { display: flex; flex-direction: column; max-height: 50vh; overflow-y: auto; border-radius: 14px; background: var(--card-2); }
.lang-row {
  appearance: none; border: 0; background: transparent; color: var(--text); font: inherit; cursor: pointer; text-align: left;
  display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-bottom: 1px solid var(--line);
}
.lang-row:last-child { border-bottom: 0; }
.lang-row .flag { font-size: 22px; width: 28px; text-align: center; flex: none; }
.lang-row .nm { flex: 1; min-width: 0; }
.lang-row .nm small { display: block; color: var(--muted); font-size: 12px; }
.lang-row.selected { background: rgba(148, 188, 72, .14); }
.tag { font-size: 11px; color: var(--muted); white-space: nowrap; }
.lang .tag { margin-top: -2px; }
.seg button:disabled { opacity: .35; cursor: not-allowed; }
