/* geomega-téma: data-theme (light|dark) a hub-bridge.js-ből; automatikus = a rendszer szerint */
:root {
  --brand: #006039;
  --brand-2: #a37e2c;
  --accent: #006039;
  --bg: #f5f3f1;
  --panel: #ffffff;
  --text: #1d1b1a;
  --muted: #6b6560;
  --line: #e4dfdb;
  --ok: #18a058;
  --warn: #e0a100;
  --live: #e53935;
  --shadow: 0 1px 3px rgba(0, 0, 0, .08), 0 4px 16px rgba(0, 0, 0, .05);
  --radius: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
:root:not([data-theme="light"]) {
    --bg: #141211;
    --panel: #1f1c1b;
    --text: #f1ecea;
    --muted: #b5ada8;
    --line: #36302d;
    --shadow: 0 1px 3px rgba(0, 0, 0, .4);
    --accent: #d4af37;
    color-scheme: dark;
  }
}
:root[data-theme="dark"], :root[data-theme="black"] {
    --bg: #141211;
    --panel: #1f1c1b;
    --text: #f1ecea;
    --muted: #b5ada8;
    --line: #36302d;
    --shadow: 0 1px 3px rgba(0, 0, 0, .4);
    --accent: #d4af37;
    color-scheme: dark;
  }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
h1, h2 { margin: 0 0 8px; }
h2 { font-size: 15px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.hint { color: var(--muted); font-size: 13px; margin: 6px 0 12px; }
.error { color: var(--live); }
kbd { border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; font-size: 12px; }

.btn {
  display: inline-flex; align-items: center; gap: 6px; justify-content: center;
  border: 1px solid var(--line); background: var(--panel); color: var(--text);
  padding: 8px 14px; border-radius: 10px; font: inherit; cursor: pointer; text-decoration: none;
}
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-2); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.small { padding: 4px 9px; }
.btn.big { padding: 14px 22px; font-size: 17px; font-weight: 600; }

/* belépés */
.login { min-height: 100%; display: grid; place-items: center; padding: 16px; }
.login-card { background: var(--panel); border-radius: 20px; box-shadow: var(--shadow); padding: 32px 24px; max-width: 380px; width: 100%; text-align: center; }
.login-logo { width: 72px; height: 72px; border-radius: 18px; }
.login-card p { color: var(--muted); }

/* keret */
.app { min-height: 100%; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 12px;
  padding: 8px 16px; padding-top: max(8px, env(safe-area-inset-top));
  background: var(--panel); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; white-space: nowrap; }
.brand img { width: 28px; height: 28px; border-radius: 7px; }
.tabs { display: flex; gap: 4px; margin-left: 12px; }
.tabs button {
  position: relative; display: flex; align-items: center; gap: 6px; border: 0; background: none; color: var(--muted);
  padding: 8px 14px; border-radius: 10px; font: inherit; font-weight: 600; cursor: pointer;
}
.tabs button[aria-selected="true"] { color: var(--accent); background: color-mix(in srgb, var(--brand) 10%, transparent); }
.badge { background: var(--live); color: #fff; border-radius: 9px; font-size: 11px; padding: 0 6px; min-width: 18px; text-align: center; }
.me { margin-left: auto; position: relative; display: flex; align-items: center; gap: 8px; }
.conn { width: 9px; height: 9px; border-radius: 50%; background: var(--warn); }
.conn.ok { background: var(--ok); }
.conn.bad { background: var(--live); }
.me-btn { border: 1px solid var(--line); background: var(--panel); color: var(--text); border-radius: 18px; padding: 5px 12px; font: inherit; cursor: pointer; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu { position: absolute; right: 0; top: 40px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 6px; min-width: 220px; z-index: 20; }
.menu button { display: block; width: 100%; text-align: left; border: 0; background: none; color: var(--text); padding: 9px 10px; border-radius: 8px; font: inherit; cursor: pointer; }
.menu button:hover { background: var(--bg); }
.menu-foot { color: var(--muted); font-size: 12px; padding: 6px 10px 2px; }
.banner { display: flex; gap: 12px; align-items: center; justify-content: center; flex-wrap: wrap; padding: 10px 16px; background: color-mix(in srgb, var(--warn) 18%, var(--panel)); }
main { flex: 1; width: 100%; max-width: 1200px; margin: 0 auto; padding: 16px; }

/* rádió */
.radio { display: grid; grid-template-columns: 340px 1fr; gap: 16px; align-items: start; }
.radio-channels, .ptt-card, .history, .people, .call-log { background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.channel-list, .history-list, .people-list, .log-list { list-style: none; margin: 0; padding: 0; }
.channel {
  display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 12px; border: 2px solid transparent; cursor: pointer;
}
.channel + .channel { margin-top: 4px; }
.channel:hover { background: var(--bg); }
.channel.tx { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 7%, transparent); }
.channel .ch-main { flex: 1; min-width: 0; }
.channel .ch-name { font-weight: 600; }
.channel .ch-sub { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.channel .ch-sub.live { color: var(--live); font-weight: 600; }
.listen { border: 1px solid var(--line); background: var(--panel); border-radius: 10px; width: 40px; height: 36px; cursor: pointer; font-size: 17px; opacity: .45; }
.listen.on { opacity: 1; border-color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, var(--panel)); }
.ch-state { width: 8px; height: 8px; border-radius: 50%; background: var(--line); flex: none; }
.ch-state.connected { background: var(--ok); }
.ch-state.connecting { background: var(--warn); }
.ch-state.live { background: var(--live); animation: pulse 1s infinite; }

.radio-main { display: grid; gap: 16px; }
.ptt-card { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 24px 16px; }
.tx-label { font-size: 16px; }
.busy { color: var(--live); font-weight: 600; margin-left: 6px; }
.ptt {
  position: relative; width: 210px; height: 210px; border-radius: 50%; border: 0; cursor: pointer; touch-action: none; user-select: none; -webkit-user-select: none;
  background: radial-gradient(circle at 35% 30%, #1f8f5f, var(--brand) 60%, #00432a); color: #fff; font-weight: 800; font-size: 19px; letter-spacing: .05em;
  box-shadow: 0 10px 30px color-mix(in srgb, var(--brand) 40%, transparent), inset 0 -6px 16px rgba(0, 0, 0, .25);
  transition: transform .08s ease;
}
.ptt:active, .ptt.on { transform: scale(.96); }
.ptt.on { background: radial-gradient(circle at 35% 30%, #ff5252, #e10000 60%, #8a0000); }
.ptt.busy-other { background: radial-gradient(circle at 35% 30%, #777, #555 60%, #333); }
.ptt.wait { opacity: .8; }
.ptt-ring { position: absolute; inset: -10px; border-radius: 50%; border: 4px solid transparent; pointer-events: none; }
.ptt.on .ptt-ring { border-color: #ff5252; animation: ring 1.1s infinite; }
.ptt-text { pointer-events: none; }
.ptt-hint { color: var(--muted); font-size: 13px; text-align: center; }
@keyframes ring { from { transform: scale(1); opacity: 1; } to { transform: scale(1.18); opacity: 0; } }
@keyframes pulse { 50% { opacity: .35; } }

.history-head { display: flex; align-items: center; justify-content: space-between; }
.history-list { max-height: 46vh; overflow: auto; }
.clip { display: flex; align-items: center; gap: 10px; padding: 8px 4px; border-bottom: 1px solid var(--line); }
.clip:last-child { border-bottom: 0; }
.clip .play { width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--brand); color: #fff; cursor: pointer; flex: none; }
.clip .play.playing { background: var(--ok); }
.clip .who { font-weight: 600; }
.clip .meta { color: var(--muted); font-size: 12.5px; }
.empty { color: var(--muted); padding: 12px 4px; }

/* hívások */
.calls { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.people-head input { width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font: inherit; }
.group-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; padding: 10px; border-radius: 10px; background: var(--bg); }
.people-list { margin-top: 10px; max-height: 62vh; overflow: auto; }
.person { display: flex; align-items: center; gap: 10px; padding: 8px 4px; border-bottom: 1px solid var(--line); }
.person:last-child { border-bottom: 0; }
.person input { width: 18px; height: 18px; accent-color: var(--brand); }
.avatar { position: relative; width: 38px; height: 38px; border-radius: 50%; background: color-mix(in srgb, var(--brand) 18%, var(--panel)); color: var(--brand); display: grid; place-items: center; font-weight: 700; flex: none; }
.avatar .dot { position: absolute; right: -1px; bottom: -1px; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--panel); background: #b5ada8; }
.avatar .dot.online { background: var(--ok); }
.avatar .dot.incall { background: var(--live); }
.person .p-main { flex: 1; min-width: 0; }
.person .p-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person .p-sub { color: var(--muted); font-size: 12.5px; }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel); cursor: pointer; font-size: 17px; }
.icon-btn:hover { border-color: var(--ok); }
.log-item { display: flex; align-items: center; gap: 10px; padding: 8px 4px; border-bottom: 1px solid var(--line); }
.log-item .l-main { flex: 1; min-width: 0; }
.log-item .l-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.log-item .l-meta { color: var(--muted); font-size: 12.5px; }
.log-item.missed .l-name, .log-item.missed .l-meta b { color: var(--live); }

/* hívás képernyő */
.call {
  position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; background: #0b0d10; color: #fff;
  padding: max(12px, env(safe-area-inset-top)) 12px max(16px, env(safe-area-inset-bottom));
}
.call-top { text-align: center; padding: 8px; }
.call-title { font-size: 22px; font-weight: 700; }
.call-status { color: #b9bec8; }
.call-stage { flex: 1; display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); align-content: center; min-height: 0; overflow: auto; }
.tile { position: relative; background: #1b1f26; border-radius: 16px; overflow: hidden; aspect-ratio: 4/3; max-height: calc(100dvh - 200px); display: grid; place-items: center; border: 3px solid transparent; }
.tile.speaking { border-color: var(--ok); }
.tile video { width: 100%; height: 100%; object-fit: cover; }
.tile.screen { aspect-ratio: 16/9; background: #000; }
.tile.screen video { object-fit: contain; }
.tile .t-avatar { width: 96px; height: 96px; border-radius: 50%; background: #2c323c; display: grid; place-items: center; font-size: 36px; font-weight: 700; }
.tile .t-name { position: absolute; left: 10px; bottom: 8px; background: rgba(0, 0, 0, .55); padding: 2px 8px; border-radius: 8px; font-size: 13px; }
.call-stage.sharing { grid-template-columns: 1fr; }
.fs-btn { position: absolute; right: 10px; bottom: 8px; width: 42px; height: 42px; border-radius: 10px; border: 0; background: rgba(0, 0, 0, .6); color: #fff; display: grid; place-items: center; cursor: pointer; }
.fs-btn svg { width: 26px; height: 26px; fill: currentColor; }
.call-stage:fullscreen { background: #000; padding: 0; grid-template-columns: 1fr; align-content: stretch; }
.call-stage:fullscreen .tile { aspect-ratio: auto; height: 100vh; border-radius: 0; border: 0; }
/* telefonon nincs elem-szintű teljes képernyő (iPhone): a színpad tölti ki az ablakot */
.call-stage.pseudo-fs { position: fixed; inset: 0; z-index: 56; background: #000; padding: 0; grid-template-columns: 1fr; align-content: stretch; }
.call-stage.pseudo-fs .tile.screen, .call-stage:fullscreen .tile.screen { aspect-ratio: auto; height: 100dvh; max-height: none; border-radius: 0; border: 0; }
/* megosztás közben a kamerák kicsiben; teljes képernyőn a kép fölött, jobb alul */
.cam-strip { display: flex; gap: 8px; overflow-x: auto; justify-content: center; }
.cam-strip .tile { flex: none; width: 168px; min-height: 0; aspect-ratio: 4/3; border-radius: 12px; }
.cam-strip .t-avatar { width: 52px; height: 52px; font-size: 20px; }
.cam-strip .t-name { font-size: 11.5px; left: 6px; bottom: 5px; }
.call-stage:fullscreen .cam-strip, .call-stage.pseudo-fs .cam-strip { position: absolute; right: 12px; bottom: 64px; max-width: calc(100% - 24px); }
.call-stage:fullscreen .cam-strip .tile, .call-stage.pseudo-fs .cam-strip .tile { height: auto; width: 140px; }
/* saját kamera kicsiben (elöl tükrözve) + eszközök: váltás, vaku, fénykép */
.call-self { position: absolute; right: 16px; bottom: calc(108px + env(safe-area-inset-bottom)); z-index: 52; display: flex; align-items: flex-end; gap: 6px; }
.self-video { width: 200px; aspect-ratio: 4/3; border-radius: 12px; overflow: hidden; background: #1b1f26; box-shadow: 0 6px 20px rgba(0, 0, 0, .5); border: 2px solid rgba(255, 255, 255, .2); transition: filter .2s; }
.self-video video { width: 100%; height: 100%; object-fit: cover; display: block; }
.call-self.mirror .self-video video { transform: scaleX(-1); }
.call-self.snap .self-video { filter: brightness(2.2); }
.self-tools { display: flex; flex-direction: column; gap: 6px; }
.mini { width: 40px; height: 40px; border-radius: 50%; border: 0; display: grid; place-items: center; cursor: pointer; background: rgba(42, 47, 55, .9); color: #fff; }
.mini svg { width: 22px; height: 22px; fill: currentColor; }
.mini.toggle.on { background: #ffd54a; color: #111; }
.call-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 16px; padding: 14px 0 4px; }
.round { width: 60px; height: 60px; border-radius: 50%; border: 0; display: grid; place-items: center; cursor: pointer; background: #2a2f37; color: #fff; transition: background .15s, color .15s; }
.round svg { width: 28px; height: 28px; fill: currentColor; }
/* kapcsolók: kikapcsolva szürke és áthúzott ikon, bekapcsolva fehér és világos */
.round.toggle { background: #23272e; color: #6f7682; }
.round.toggle.on { background: #fff; color: #111; box-shadow: 0 0 0 3px rgba(255, 255, 255, .18); }
.round.accept { background: var(--ok); color: #fff; }
.round.decline { background: var(--live); color: #fff; }
.out-menu { position: fixed; left: 50%; bottom: calc(100px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 55; background: #1b1f26; color: #fff; border-radius: 14px; padding: 6px; min-width: 260px; max-width: calc(100% - 32px); box-shadow: 0 8px 30px rgba(0, 0, 0, .5); }
.out-title { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: #b5ada8; padding: 6px 10px; }
.out-menu button { display: block; width: 100%; text-align: left; padding: 11px 12px; background: none; border: 0; color: #fff; font: inherit; border-radius: 9px; cursor: pointer; }
.out-menu button:hover { background: #262b33; }
.out-menu button.active { background: #1f4d34; }

.toast { position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); transform: translateX(-50%); background: #222; color: #fff; padding: 10px 16px; border-radius: 10px; z-index: 60; max-width: calc(100% - 32px); pointer-events: none; } /* csak jelzés: a hívás gombjait nem takarhatja el */

@media (max-width: 820px) {
  .radio, .calls { grid-template-columns: 1fr; }
  .radio-main { order: -1; }
  .topbar { gap: 6px; padding-left: 10px; padding-right: 10px; }
  .tabs button { padding: 8px 10px; }
  .me-btn { max-width: 30vw; padding: 5px 10px; }
  .brand span { display: none; }
  .tabs { margin-left: 0; }
  .tabs .ico { font-size: 17px; }
  .ptt { width: 190px; height: 190px; }
  .desktop-only { display: none; }
  .call-stage { grid-template-columns: 1fr; }
  .tile { aspect-ratio: auto; min-height: 30vh; }
  .tile.screen { min-height: 0; aspect-ratio: 16/9; }
  .call-actions { gap: 10px; }
  .round { width: 54px; height: 54px; }
  .self-video { width: 96px; aspect-ratio: 3/4; }
  .call-self { right: 10px; bottom: calc(150px + env(safe-area-inset-bottom)); }
  .cam-strip .tile { width: 112px; }
  .round { width: 56px; height: 56px; }
}
@media (hover: none) { .ptt-hint .desk { display: none; } }

/* mikrofon-engedély (Rádió) */
.mic-banner { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; background: color-mix(in srgb, #e0a100 16%, var(--panel)); border: 1px solid color-mix(in srgb, #e0a100 45%, transparent); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 12px; }
.mic-banner.denied { background: color-mix(in srgb, #d32f2f 12%, var(--panel)); border-color: color-mix(in srgb, #d32f2f 45%, transparent); }
.mic-text { flex: 1 1 220px; display: grid; gap: 4px; font-size: 14px; line-height: 1.4; }
.mic-text b { font-size: 15px; }
