/* The Games Tome — O Jogo (versão web)
   Palco fixo de 1280×720, escalado para caber na janela (ver main.js). */

:root {
  --bg:            rgb(8, 8, 22);
  --bg-2:          rgb(18, 18, 42);
  --card:          rgb(28, 28, 58);
  --card-hover:    rgb(40, 40, 80);
  --border:        rgb(65, 65, 110);
  --border-bright: rgb(110, 110, 180);

  --primary:       rgb(240, 70, 100);
  --primary-dark:  rgb(190, 45, 70);
  --secondary:     rgb(90, 55, 145);
  --accent-blue:   rgb(60, 160, 230);
  --accent-green:  rgb(50, 215, 120);
  --accent-gold:   rgb(250, 200, 20);
  --accent-purple: rgb(170, 90, 200);

  --text:          rgb(250, 250, 255);
  --text-2:        rgb(185, 185, 215);
  --text-muted:    rgb(110, 110, 150);

  --success:       rgb(50, 215, 120);
  --warning:       rgb(250, 200, 20);
  --danger:        rgb(235, 80, 65);

  --live-red:      rgb(255, 50, 50);
  --live-bg:       rgb(14, 4, 8);
  --live-bar:      rgb(20, 5, 10);

  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  width: 100%;
  height: 100%;
  background: #000;
  overflow: hidden;
  font-family: var(--font);
  color: var(--text);
}

#stage {
  position: fixed;   /* fixo: não "estica" a página no telemóvel */
  left: 50%;
  top: 50%;
  width: 1280px;
  height: 720px;
  transform-origin: center center;
  overflow: hidden;
  background: var(--bg);
  user-select: none;
  white-space: pre-wrap;   /* mantém os espaços duplos dos textos ("😴  Descansar") */
}

/* ── Utilitários ───────────────────────────────────────────────────────── */

.scene { position: absolute; inset: 0; display: flex; flex-direction: column; }
.center { text-align: center; }
.secondary { color: var(--text-2); }
.muted { color: var(--text-muted); }
.small { font-size: 14px; }
.tiny { font-size: 12px; }
.bold { font-weight: 700; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 30px; }
h2 { font-size: 22px; }
h3 { font-size: 16px; }
.big-num { font-size: 28px; font-weight: 700; }

.backdrop {
  position: absolute; inset: 0;
  background-size: cover; background-position: center;
  opacity: 0; pointer-events: none;
  transition: opacity .4s;
}
.picture img { width: 100%; height: 100%; object-fit: contain; display: block; }

.bg-grid {
  position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(to right, rgba(65,65,110,.12) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(65,65,110,.12) 1px, transparent 1px);
  background-size: 72px 72px;
}
.bg-grid.breathe { background-size: 64px 64px; animation: breathe 25s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: .5; } }

.pulse { animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .55; } }
.bob { animation: bob 9s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-5px); } }
.fade-in { animation: fadeIn 2.5s ease-out both; }
@keyframes fadeIn { from { opacity: 0; } }

/* ── Botões / cartões / inputs ─────────────────────────────────────────── */

.btn {
  font: inherit; font-size: 18px; color: var(--text);
  border: 2px solid transparent; border-radius: 8px;
  padding: 10px 22px; cursor: pointer;
  transition: background .12s, border-color .12s, transform .08s;
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn-primary { background: var(--primary); }
.btn-primary:hover:not(:disabled) { background: rgb(195, 45, 65); }
.btn-ghost { background: rgb(35, 35, 60); border-color: var(--border); }
.btn-ghost:hover:not(:disabled) { background: rgb(55, 55, 85); }
.btn:disabled { background: rgb(50, 50, 70); color: var(--text-muted); border-color: transparent; cursor: default; }
.btn-danger, .btn-danger:hover:not(:disabled) { background: var(--danger) !important; border-color: var(--danger) !important; }
.btn-large { font-size: 20px; padding: 12px 34px; min-width: 260px; }
.btn-small { font-size: 14px; padding: 5px 14px; }

.card {
  font: inherit; color: var(--text);
  background: var(--card); border: 2px solid var(--border); border-radius: 12px;
  transition: background .12s, border-color .12s;
}
button.card { cursor: pointer; }
button.card:hover { background: var(--card-hover); border-color: var(--border-bright); }
button.card.selected { border-color: var(--primary); background: rgb(40, 40, 75); }

.panel { background: var(--bg-2); border: 1px solid var(--border); border-radius: 12px; }

.text-input {
  font: inherit; font-size: 24px; color: var(--text);
  width: 480px; height: 56px; padding: 0 14px;
  background: var(--card-hover); border: 2px solid var(--primary); border-radius: 8px; outline: none;
}
.text-input::placeholder { color: var(--text-muted); }

.avatar {
  flex: none; position: relative;
  border-radius: 50%; border: 2px solid; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; background: var(--bg-2);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }

.progress { height: 8px; border-radius: 4px; background: var(--border); overflow: hidden; }
.progress-fill { height: 100%; width: 0; border-radius: 4px; }
.progress-fill.live { background: var(--live-red); }

.energy-bar { width: 180px; height: 8px; border-radius: 4px; background: var(--border); overflow: hidden; }
.energy-bar > div { height: 100%; border-radius: 4px; }

.scene-header {
  position: relative; flex: none;
  background: var(--bg-2); border-bottom: 1px solid var(--border);
  text-align: center; padding: 16px 30px;
  display: flex; flex-direction: column; gap: 6px; align-items: center;
}
.scene-footer {
  position: relative; flex: none;
  display: flex; justify-content: space-between; align-items: center;
  padding: 0 28px 14px;
}

/* ── Intro ─────────────────────────────────────────────────────────────── */

.intro { align-items: center; }
.intro-logo {
  position: relative; margin-top: 28px; font-size: 44px; font-weight: 800; color: var(--primary);
  border-bottom: 3px solid var(--primary); padding-bottom: 4px;
}
.intro-dialogue { position: relative; margin-top: 90px; width: 760px; cursor: pointer; }
.intro-row { display: flex; align-items: center; gap: 30px; }
.intro-speaker { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 110px; }
.intro-bubble {
  position: relative; flex: 1; min-height: 150px;
  background: var(--bg-2); border: 2px solid; border-radius: 14px;
  padding: 20px; display: flex; flex-direction: column; justify-content: space-between;
}
.intro-bubble::before {
  content: ""; position: absolute; left: -12px; top: 50%; width: 20px; height: 20px;
  background: var(--bg-2); border-left: 2px solid var(--bubble-color); border-bottom: 2px solid var(--bubble-color);
  transform: translateY(-50%) rotate(45deg);
}
.intro-text { font-size: 21px; line-height: 1.35; }
.intro-bubble-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; }
.intro-hint { color: var(--text-muted); font-size: 14px; }
.intro-history { margin-top: 24px; display: flex; flex-direction: column; gap: 6px; align-items: center; font-size: 14px; }
.intro-name { position: relative; margin-top: 130px; display: flex; flex-direction: column; align-items: center; gap: 18px; }
.intro-name h1 { font-size: 38px; }
.intro-skip { position: absolute; right: 14px; bottom: 12px; }

/* ── Menu ──────────────────────────────────────────────────────────────── */

.menu { align-items: center; }
.particles { position: absolute; inset: 0; pointer-events: none; }
.particle {
  position: absolute; width: 3px; height: 3px; background: var(--primary); opacity: .45;
  animation: drift linear infinite;
}
@keyframes drift { to { transform: translate(260px, 130px); opacity: .1; } }
.menu-center { position: relative; margin-top: 150px; display: flex; flex-direction: column; align-items: center; }
.menu-title h1 { font-size: 68px; font-weight: 800; letter-spacing: 1px; }
.menu-underline { height: 4px; background: var(--primary); border-radius: 2px; margin-top: 6px; }
.menu-subtitle { font-size: 26px; color: var(--text-2); margin-top: 16px; }
.menu-ep { color: var(--primary); margin-top: 16px; }
.menu-subs { color: var(--accent-gold); margin-top: 6px; }
.menu-buttons { margin-top: 40px; display: flex; flex-direction: column; gap: 16px; }
.menu-footer { position: absolute; bottom: 12px; width: 100%; text-align: center; color: var(--text-muted); font-size: 14px; }

/* ── Escolha do tema ───────────────────────────────────────────────────── */

.theme-body { position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; }
.cat-row, .theme-row { display: flex; gap: 22px; margin: 26px 0; }
.cat-card { width: 340px; height: 76px; font-size: 18px; }
.theme-card { width: 360px; height: 120px; font-size: 17px; padding: 18px 14px; text-align: left; position: relative; overflow: hidden; }
.theme-card::before { content: ""; position: absolute; left: 0; top: 0; right: 0; height: 4px; background: var(--secondary); }
.theme-card.selected::before { background: var(--primary); }
.theme-card.selected { font-weight: 700; }
.sub-list { display: flex; flex-direction: column; gap: 10px; margin: 20px 0; }
.sub-card { width: 680px; height: 48px; font-size: 16px; border-radius: 8px; }
.sub-card.selected { background: var(--secondary); }
.theme-row { flex-wrap: nowrap; }
.theme-row .theme-card { width: 270px; }
.theme-custom { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  border-style: dashed; text-align: center; }
.theme-custom-icon { font-size: 26px; }
.theme-custom.selected { border-style: solid; }
.theme-input { width: 100%; height: 38px; font-size: 15px; }
.sub-input { width: 100%; height: 100%; font-size: 16px; border: none; background: transparent; }
.sub-custom { border-style: dashed; }
.step { margin-top: 10px; }

/* ── Preparação semanal ────────────────────────────────────────────────── */

.week-header { padding: 8px 30px 10px; gap: 4px; }
.week-title { font-size: 20px; font-weight: 700; }
.week-theme { font-size: 18px; font-weight: 700; max-width: 1200px; }
.day-dots { display: flex; gap: 30px; margin-top: 8px; }
.day-dot-wrap { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 26px; }
.day-dot { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--border); }
.day-dot.done { background: var(--success); border-color: var(--success); }
.day-dot.current { background: var(--primary); border-color: var(--primary); width: 18px; height: 18px; }
.day-dot-label { font-size: 11px; color: var(--text-muted); }
.day-dot-label.current { color: var(--text-2); }

.week-body { position: relative; flex: 1; display: flex; gap: 14px; padding: 8px 10px 8px 8px; min-height: 0; }
.member-rows { flex: none; width: 752px; display: flex; flex-direction: column; gap: 6px; }
.member-row {
  flex: 1; display: flex; align-items: center; gap: 10px;
  background: var(--card); border: 1px solid var(--border); border-left: 6px solid var(--member-color);
  border-radius: 8px; padding: 0 10px 0 12px;
}
.member-row-id { display: flex; align-items: center; gap: 12px; width: 236px; }
.member-row-name { font-size: 20px; font-weight: 700; margin-bottom: 8px; }
.task-pick { flex: 1; display: flex; flex-direction: column; gap: 6px; padding-right: 6px; }
.task-select {
  width: 100%; height: 40px; padding: 0 40px 0 12px;
  font: inherit; font-size: 17px; font-weight: 700; color: var(--text);
  background: var(--bg-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23b9b9d7' stroke-width='2'/%3E%3C/svg%3E") no-repeat right 14px center;
  border: 1px solid var(--border); border-radius: 8px; cursor: pointer;
  appearance: none; -webkit-appearance: none;
}
.task-select:hover { border-color: var(--border-bright); }
.task-select:focus { outline: none; border-color: var(--primary); }
.task-select option { background: var(--bg-2); color: var(--text); font-weight: 400; }
.task-desc { font-size: 13px; color: var(--text-2); padding-left: 13px; }

.metrics-panel { flex: 1; padding: 16px 16px; display: flex; flex-direction: column; gap: 26px; }
.metrics-random { margin-top: auto; display: flex; flex-direction: column; gap: 6px; }
.btn-random { width: 100%; font-size: 16px; }
.metric-head { display: flex; justify-content: space-between; font-size: 14px; color: var(--text-2); margin-bottom: 8px; }
.metric-pct { font-weight: 700; }
.metric-bar { height: 14px; border-radius: 7px; background: var(--border); overflow: hidden; }
.metric-bar > div { height: 100%; border-radius: 7px; }

/* WhatsApp */
.overlay { position: absolute; inset: 0; z-index: 20; background: rgba(0, 0, 0, .43); }
.wa-phone {
  /* Sempre ao centro do ecrã; proporção da imagem original (921×2048) */
  position: absolute; left: 50%; top: 18px; transform: translateX(-50%);
  width: 274px; height: 610px;
  border-radius: 18px; overflow: hidden; outline: 3px solid rgb(40, 40, 40); outline-offset: 2px;
  background: rgb(229, 221, 213);
  box-shadow: 0 20px 60px rgba(0,0,0,.6);
}
.wa-continue { position: absolute; left: 50%; top: 646px; transform: translateX(-50%); min-width: 240px; }
.wa-continue:active:not(:disabled) { transform: translateX(-50%) translateY(1px); }
.wa-continue.wa-btn-hidden { visibility: hidden; }
.wa-phone .backdrop.has-image { opacity: 1; }
.wa-phone .backdrop:not(.has-image) { top: 0; bottom: auto; height: 15%; background: rgb(7, 94, 84); opacity: 1; }
.wa-day {
  position: absolute; top: calc(15% + 6px); left: 50%; transform: translateX(-50%);
  background: rgba(225, 245, 254, .95); color: #555; font-size: 11px; padding: 2px 10px; border-radius: 6px;
}
.wa-chat {
  position: absolute; left: 0; right: 0; top: calc(15% + 30px); bottom: 13%;
  padding: 0 8px 4px 4px; display: flex; flex-direction: column; justify-content: flex-end; gap: 6px; overflow: hidden;
}
.wa-msg-out { justify-content: flex-end; }
.wa-bubble-out { flex: 0 1 85%; background: #d9fdd3; }
.wa-bubble-out::before { left: auto; right: -6px; border-right: none; border-left: 7px solid #d9fdd3; }
.wa-name-out { color: #1f8f4e; }
.wa-msg { display: flex; align-items: flex-start; gap: 7px; animation: waIn .35s ease-out both; }
@keyframes waIn { from { opacity: 0; transform: translateY(8px); } }
.wa-msg .avatar { border-width: 1.5px; }
.wa-bubble {
  position: relative; flex: 1; background: #fff; border-radius: 7px; padding: 5px 7px 3px;
  box-shadow: 0 1px 1px rgba(0,0,0,.12);
}
.wa-bubble::before {
  content: ""; position: absolute; left: -6px; top: 8px;
  border-top: 5px solid transparent; border-bottom: 5px solid transparent; border-right: 7px solid #fff;
}
.wa-name { font-size: 11px; font-weight: 700; display: flex; justify-content: space-between; gap: 6px; }
.wa-tag { font-size: 9px; font-weight: 700; text-transform: uppercase; padding: 1px 5px; border-radius: 4px; color: #fff; }
.wa-tag-ready { background: #25a35a; }
.wa-tag-late { background: #d98c00; }
.wa-tag-absent { background: #c0392b; }
.wa-text { font-size: 12.5px; color: rgb(30, 30, 30); line-height: 1.3; }
.wa-time { font-size: 10px; color: rgb(140, 140, 140); text-align: right; }

/* ── Transmissão ───────────────────────────────────────────────────────── */

.broadcast { background: var(--live-bg); }
.live-badge { background: var(--live-red); color: #fff; font-weight: 700; font-size: 14px; padding: 4px 10px; border-radius: 4px; letter-spacing: .5px; }
.live-badge.off { background: rgb(70, 70, 90); }

.bc-top {
  flex: none; height: 44px; padding: 0 16px;
  display: flex; align-items: center; justify-content: space-between;
  background: var(--live-bar); border-bottom: 1px solid rgb(60, 20, 20);
}
.bc-top-left { display: flex; align-items: center; gap: 12px; width: 260px; }
.bc-clock { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.bc-viewers { width: 260px; text-align: right; font-size: 18px; font-weight: 700; color: var(--accent-green); font-variant-numeric: tabular-nums; }

.bc-layout { flex: 1; display: flex; gap: 12px; padding: 10px 12px 10px; min-height: 0; }
.bc-left { flex: none; width: 976px; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }
/* Tamanho fixo (16:9): alguns browsers esticavam a vista e tapavam o painel */
.bc-player { flex: none; position: relative; width: 976px; height: 549px; border-radius: 8px; overflow: hidden; box-shadow: 0 10px 40px rgba(0,0,0,.6); }

.bc-info { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.bc-info-title { font-size: 17px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bc-info-row { display: flex; justify-content: space-between; align-items: center; }
.bc-channel { display: flex; align-items: center; gap: 10px; }
.bc-channel-logo {
  width: 36px; height: 36px; border-radius: 50%; background: var(--primary); overflow: hidden; flex: none;
  display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 800;
}
.bc-channel-logo.has-image { background: #fff; }
.bc-channel-logo img { width: 100%; height: 100%; object-fit: contain; }
.bc-info-stats { display: flex; gap: 8px; }
.pill { background: var(--card); border-radius: 16px; padding: 5px 14px; font-size: 14px; font-variant-numeric: tabular-nums; }

/* Painel de produção */
.bc-panel {
  position: relative; z-index: 2;
  flex: 1; min-width: 0; background: var(--bg-2); border: 1px solid var(--border); border-radius: 12px;
  padding: 14px; display: flex; flex-direction: column; gap: 10px; overflow: hidden;
}
.bc-panel h3 { font-size: 17px; }
.panel-kicker { font-size: 11px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--primary); }
.panel-members { display: flex; flex-direction: column; gap: 6px; }
.panel-member { display: flex; align-items: center; gap: 10px; padding: 6px 10px; text-align: left; border-radius: 10px; font-size: 15px; }
.panel-member-info { flex: 1; min-width: 0; }
.panel-energy { width: 48px; height: 6px; border-radius: 3px; background: var(--border); overflow: hidden; }
.panel-energy > div { height: 100%; }
.panel-member.unavailable { opacity: .45; cursor: not-allowed; }
.panel-member.unavailable:hover { background: var(--card); border-color: var(--border); }
.panel-news { display: flex; flex-direction: column; gap: 6px; }
.panel-news-msg { background: var(--card); border-radius: 8px; padding: 6px 9px; font-size: 12.5px; line-height: 1.3; }
.panel-news-head { display: flex; justify-content: space-between; margin-bottom: 2px; }
.panel-delay { border-left: 3px solid var(--danger); }
.panel-news-tag { font-size: 10px; font-weight: 700; text-transform: uppercase; color: var(--warning); }
.panel-btn { width: 100%; font-size: 16px; }
.panel-history { margin-top: auto; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.panel-hist-row { display: flex; justify-content: space-between; }
.bc-score { text-align: center; opacity: 0; transform: scale(.9); transition: opacity .3s, transform .3s; }
.bc-score.show { opacity: 1; transform: none; }
.bc-score-label { font-size: 30px; font-weight: 800; }


/* ── Vista do espectador (js/stream.js) ─────────────────────────────────
   Unidades --u = 1px da imagem original 1920×1080. */

.stream {
  position: absolute; inset: 0; overflow: hidden;
  container-type: inline-size;
  background: #000 linear-gradient(to right, rgba(255,255,255,.08) 1px, transparent 1px) 0 0 / 3% 5.33%;
  font-family: "IBM Plex Sans", var(--font);
  white-space: nowrap;
}
.stream > * { --u: calc(100cqw / 1920); }
.stream .backdrop.stream-bg { opacity: 0; }

.stream-cam { position: absolute; overflow: hidden; background: #232323; }
.stream-cam.entering { animation: camOn .35s ease-out; }
@keyframes camOn { from { opacity: 0; filter: brightness(3); } }
.stream-cam .stream-cam-photo {
  width: 100% !important; height: 100% !important; border: none; border-radius: 0;
  font-size: calc(120 * var(--u)) !important; background: #232323;
}
.stream-cam-photo img { object-position: center 35%; }
/* "Já venho": enquadrar mais abaixo, para se ver bem a placa */
.stream-cam-away img { width: 100%; height: 100%; object-fit: cover; object-position: center 78%; display: block; }
.stream-cam.late .stream-cam-name { background: rgba(0, 0, 0, .8); color: #ffd23f; }
.stream-cam-name {
  position: absolute; left: 0; bottom: 0;
  background: rgba(0, 0, 0, .65); color: #fff;
  font-size: calc(22 * var(--u)); font-weight: 500; padding: calc(4 * var(--u)) calc(12 * var(--u));
}
.stream-cam.speaking {
  z-index: 2;
  box-shadow: 0 0 0 calc(6 * var(--u)) var(--member-color), 0 0 calc(40 * var(--u)) var(--member-color);
}
.stream-cam.speaking .stream-cam-name { background: var(--member-color); color: #000; font-weight: 700; }

.stream-share { position: absolute; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.share-slide { display: flex; flex-direction: column; align-items: center; gap: calc(16 * var(--u)); white-space: normal; text-align: center; padding: 0 calc(60 * var(--u)); }
.share-slide-emoji { font-size: calc(150 * var(--u)); }
.share-slide-kicker { font-size: calc(34 * var(--u)); font-weight: 700; color: #eefc00; text-transform: uppercase; letter-spacing: calc(3 * var(--u)); }
.share-slide-title { font-size: calc(92 * var(--u)); font-weight: 700; line-height: 1.1; }
.share-slide-sub { font-size: calc(46 * var(--u)); color: #bbb; }

.share-pn { display: flex; gap: calc(20 * var(--u)); }
.share-pn-card {
  width: calc(232 * var(--u)); height: calc(420 * var(--u)); background: #1a1a1a;
  border: calc(4 * var(--u)) solid; border-radius: calc(14 * var(--u));
  display: flex; flex-direction: column; align-items: center; gap: calc(8 * var(--u)); padding: calc(20 * var(--u)) calc(12 * var(--u));
}
.share-pn-card .share-pn-avatar { width: calc(120 * var(--u)) !important; height: calc(120 * var(--u)) !important; font-size: calc(50 * var(--u)) !important; }
.share-pn-name { font-size: calc(30 * var(--u)); font-weight: 700; }
.share-pn-count { font-size: calc(44 * var(--u)); font-weight: 700; }
.share-pn-title { font-size: calc(22 * var(--u)); color: #aaa; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }

.stream-tag { position: absolute; }
.stream-tag img { width: 100%; height: 100%; display: block; }
.stream-ticker {
  position: absolute; text-align: right; overflow: hidden; text-overflow: ellipsis;
  font-size: calc(var(--fs) * var(--u)); font-weight: 500; color: #fff; line-height: calc(var(--lh) * var(--u));
}

.stream-chat { position: absolute; padding: calc(24 * var(--u)); display: flex; flex-direction: column; justify-content: flex-end; overflow: hidden; }
.stream-chat-list { display: flex; flex-direction: column; gap: calc(10 * var(--u)); }
.stream-chat-msg { font-size: calc(24 * var(--u)); color: #e6e6e6; white-space: normal; line-height: 1.3; }
.stream-chat-msg.new { animation: waIn .3s ease-out; }
.stream-chat-name { font-weight: 700; }

.stream-overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 5; }
.stream-soon {
  background: rgba(0, 0, 0, .78); border-left: calc(10 * var(--u)) solid #eefc00;
  padding: calc(40 * var(--u)) calc(80 * var(--u)); text-align: center;
}
.stream-soon-title { font-size: calc(76 * var(--u)); font-weight: 700; }
.stream-soon-theme { font-size: calc(40 * var(--u)); color: #bbb; margin-top: calc(12 * var(--u)); white-space: normal; }

/* ── Resultados ────────────────────────────────────────────────────────── */

.res-rings { position: absolute; inset: 0; pointer-events: none; }
.res-rings span {
  position: absolute; left: 50%; top: 50%;
  width: calc(360px + var(--i) * 160px); height: calc(360px + var(--i) * 160px);
  border: 2px solid var(--primary); border-radius: 50%;
  opacity: calc(.06 - var(--i) * .01);
  transform: translate(-50%, -50%);
  animation: ringFloat calc(14s + var(--i) * 3s) ease-in-out infinite;
}
@keyframes ringFloat { 50% { transform: translate(calc(-50% + 20px), calc(-50% - 15px)); } }

.results .scene-header { padding: 12px 30px; gap: 4px; }
.res-grid {
  position: relative; flex: 1; padding: 14px 24px 10px;
  display: grid; grid-template-columns: 340px 400px 1fr; grid-template-rows: 1fr 232px; gap: 14px;
}
.res-grid h3 { margin-bottom: 12px; }
.res-overall { grid-row: 1 / span 2; padding: 18px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.res-overall-label { font-size: 36px; font-weight: 800; }
.res-ring {
  width: 140px; height: 140px; border-radius: 50%; margin: 12px 0;
  background: conic-gradient(var(--c) calc(var(--p) * 1%), var(--border) 0);
  display: flex; align-items: center; justify-content: center; position: relative;
}
.res-ring::before { content: ""; position: absolute; inset: 10px; border-radius: 50%; background: var(--bg-2); }
.res-ring span { position: relative; font-size: 30px; font-weight: 800; }
.res-chat { width: 100%; margin-top: auto; display: flex; flex-direction: column; gap: 5px; font-size: 13px; }
.res-chat-row { display: flex; align-items: center; gap: 8px; }
.res-chat-pos { width: 16px; font-weight: 700; color: var(--text-2); }
.res-chat-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.res-crown { margin-left: 6px; background: #7c3aed; color: #fff; font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 8px; }
.res-stats { display: flex; flex-direction: column; gap: 12px; }
.res-stat { padding: 10px 18px; flex: 1; display: flex; flex-direction: column; justify-content: center; }
.res-team { padding: 14px 16px; }
.res-member { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.res-member .dot { width: 14px; height: 14px; border-radius: 50%; }
.res-member-name { width: 70px; }
.res-member .energy-bar { flex: 1; }
.res-segs { grid-column: 2 / span 2; padding: 14px 20px; }
.res-seg { display: flex; align-items: center; gap: 14px; margin-bottom: 8px; font-size: 14px; }
.res-seg-name { width: 210px; }
.res-seg-bar { flex: 1; height: 24px; border-radius: 4px; background: var(--border); overflow: hidden; }
.res-seg-bar > div { height: 100%; }
.res-seg-score { width: 130px; }

/* ── Canal do YouTube ──────────────────────────────────────────────────── */

.scene-footer .footer-group { display: flex; gap: 10px; align-items: center; }
.week-day { margin-right: 8px; }
.st-empty { padding: 24px; }
.channel { background: #0f0f0f; }
.yt-header { position: relative; display: flex; align-items: center; gap: 22px; padding: 22px 40px 10px; }
.yt-header h1 { font-size: 30px; }
.yt-logo { width: 88px; height: 88px; border-radius: 50%; overflow: hidden; background: #fff; flex: none;
  display: flex; align-items: center; justify-content: center; color: #000; font-weight: 800; }
.yt-logo img { width: 100%; height: 100%; object-fit: contain; }
.yt-tabs { position: relative; padding: 0 40px; border-bottom: 1px solid #333; display: flex; gap: 24px; }
.yt-tabs span { padding: 10px 0; font-weight: 600; color: #aaa; }
.yt-tabs .active { color: #fff; border-bottom: 2px solid #fff; }
.yt-grid {
  position: relative; flex: 1; min-height: 0; overflow-y: auto;
  padding: 18px 40px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px 16px; align-content: start;
}
.yt-card { display: flex; flex-direction: column; gap: 6px; }
.yt-thumb { position: relative; aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden; background: #1c1c1c;
  display: flex; flex-direction: column; justify-content: center; padding: 0 14px; }
.yt-thumb .backdrop.has-image { filter: blur(1px); }
.yt-thumb-ep { position: relative; font-size: 34px; font-weight: 800; color: #eefc00; line-height: 1; }
.yt-thumb-theme { position: relative; font-size: 13px; font-weight: 700; color: #fff; margin-top: 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.yt-thumb-badge { position: absolute; right: 8px; bottom: 8px; background: rgba(0,0,0,.8); color: #fff;
  font-size: 11px; padding: 2px 6px; border-radius: 4px; }
.yt-title { font-size: 14px; font-weight: 600; line-height: 1.3; }
.yt-meta { font-size: 12.5px; color: #aaa; }
.yt-split { display: flex; gap: 10px; font-size: 11.5px; color: #888; }

/* ── YouTube Studio (resultados) ───────────────────────────────────────── */

.studio { background: #1f1f1f; color: #f1f1f1; font-family: "Roboto", var(--font); }
.st-muted { color: #aaa; }
.st-top { flex: none; height: 50px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 18px; background: #282828; border-bottom: 1px solid #3a3a3a; }
.st-brand { display: flex; align-items: center; gap: 6px; font-size: 19px; font-weight: 700; letter-spacing: -.3px; }
.st-play { background: #ff0000; color: #fff; font-size: 11px; width: 26px; height: 18px; border-radius: 5px;
  display: inline-flex; align-items: center; justify-content: center; }
.st-search { width: 420px; height: 32px; border: 1px solid #3a3a3a; border-radius: 4px; background: #121212;
  display: flex; align-items: center; padding: 0 12px; color: #888; font-size: 13px; }
.st-avatar { width: 32px; height: 32px; border-radius: 50%; overflow: hidden; background: #fff; color: #000;
  display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; }
.st-avatar img, .st-side-logo img { width: 100%; height: 100%; object-fit: contain; }
.st-body { flex: 1; min-height: 0; display: flex; }
.st-side { flex: none; width: 190px; background: #282828; border-right: 1px solid #3a3a3a;
  display: flex; flex-direction: column; align-items: center; padding: 16px 0; gap: 4px; }
.st-side-logo { width: 76px; height: 76px; border-radius: 50%; overflow: hidden; background: #fff; margin-bottom: 6px;
  display: flex; align-items: center; justify-content: center; color: #000; font-weight: 700; }
.st-side-title { font-size: 14px; font-weight: 600; }
.st-nav { align-self: stretch; margin-top: 14px; display: flex; flex-direction: column; }
.st-nav-item { padding: 9px 20px; font-size: 13.5px; color: #ddd; }
.st-nav-item.active { background: #1f1f1f; color: #3ea6ff; border-left: 3px solid #3ea6ff; padding-left: 17px; font-weight: 600; }
.st-main { flex: 1; min-width: 0; padding: 12px 20px 12px; display: flex; flex-direction: column; gap: 9px; overflow: hidden; }
.st-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.st-head h1 { font-size: 20px; font-weight: 600; }
.st-actions { display: flex; gap: 8px; flex: none; }
.st-tabs { display: flex; gap: 22px; border-bottom: 1px solid #3a3a3a; font-size: 13.5px; }
.st-tabs span { padding-bottom: 7px; color: #aaa; }
.st-tabs .active { color: #fff; border-bottom: 2px solid #fff; font-weight: 600; }
.st-kpis { display: grid; grid-template-columns: repeat(5, 1fr); border: 1px solid #3a3a3a; border-radius: 8px; overflow: hidden; }
.st-kpi { padding: 9px 12px; border-right: 1px solid #3a3a3a; }
.st-kpi:last-child { border-right: none; }
.st-kpi-label { font-size: 11.5px; color: #aaa; }
.st-kpi-value { font-size: 22px; font-weight: 600; margin: 2px 0; white-space: nowrap; }
.st-kpi-note { font-size: 11px; color: #888; }
.st-card { background: #282828; border: 1px solid #3a3a3a; border-radius: 8px; padding: 10px 14px; min-width: 0; overflow: hidden; }
.st-card-title { font-size: 13.5px; font-weight: 600; margin-bottom: 6px; }
.st-grid-main { display: grid; grid-template-columns: 1.55fr 1fr; gap: 10px; }
.st-grid-bottom { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr 1fr 1.2fr; gap: 10px; }
.st-chart { width: 100%; height: auto; display: block; }
.st-grid { stroke: #3a3a3a; stroke-width: 1; }
.st-axis { fill: #888; font-size: 10px; }
.st-mark { stroke: #666; stroke-dasharray: 3 3; }
.st-mark-label { font-size: 11px; }
.st-area { fill: rgba(62, 166, 255, .15); }
.st-line { fill: none; stroke: #3ea6ff; stroke-width: 2; }
.st-score { display: flex; align-items: baseline; gap: 8px; margin-bottom: 6px; flex-wrap: wrap; }
.st-score-value { font-size: 26px; font-weight: 700; }
.st-score-label { font-weight: 700; }
.st-seg { display: grid; grid-template-columns: 1fr 60px 70px 30px; align-items: center; gap: 8px; font-size: 12.5px; margin-bottom: 6px; }
.st-seg-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-seg-who { color: #aaa; font-size: 11.5px; }
.st-seg-bar { height: 6px; border-radius: 3px; background: #3a3a3a; overflow: hidden; }
.st-seg-bar > div { height: 100%; }
.st-seg-score { text-align: right; font-weight: 700; }
.st-chat-row { display: flex; align-items: center; gap: 8px; font-size: 12.5px; margin-bottom: 4px; }
.st-chat-pos { width: 14px; color: #aaa; font-weight: 700; }
.st-chat-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-member { display: flex; align-items: center; gap: 8px; font-size: 12.5px; margin-bottom: 4px; }
.st-member .avatar { border-width: 1.5px; }
.st-member-name { width: 48px; }
.st-energy { flex: 1; height: 6px; border-radius: 3px; background: #3a3a3a; overflow: hidden; }
.st-energy > div { height: 100%; }
.st-tip { border-color: rgba(62, 166, 255, .5); line-height: 1.45; }

/* ── Telemóvel / ecrãs táteis (não afeta o desktop) ────────────────────── */
@media (pointer: coarse) {
  body { position: fixed; inset: 0; touch-action: manipulation; -webkit-text-size-adjust: 100%; }
  /* iOS faz zoom ao escrever em campos com letra < 16px */
  .text-input, .theme-input, .sub-input, .task-select { font-size: 16px !important; }
}

/* Top 10 de jogadores (Studio) */
.st-nav-item.clickable { cursor: pointer; }
.st-side-back { margin-top: auto; align-self: stretch; margin-left: 14px; margin-right: 14px; }
.st-nav-item.clickable:hover:not(.active) { background: #333; }
.st-top10 { flex: 1; display: flex; flex-direction: column; gap: 4px; overflow-y: auto; }
.st-top10-row {
  display: grid; grid-template-columns: 50px 1fr 130px 90px 130px; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 8px; font: inherit; font-size: 14px; color: #f1f1f1; text-align: left;
  background: transparent; border: none;
}
button.st-top10-row { cursor: pointer; }
button.st-top10-row:hover { background: #333; }
.st-top10-row.me { background: rgba(62, 166, 255, .12); }
.st-top10-head { color: #aaa; font-size: 12px; border-bottom: 1px solid #3a3a3a; border-radius: 0; }
.st-top10-pos { font-size: 18px; font-weight: 700; text-align: center; }
.st-top10-pos.long { font-size: 13px; }
.st-top10-name { display: flex; align-items: center; gap: 10px; font-weight: 600; min-width: 0; }
.st-top10-avatar { width: 30px; height: 30px; border-radius: 50%; background: #3ea6ff; color: #000; flex: none;
  display: flex; align-items: center; justify-content: center; font-weight: 800; }
.st-top10-me { background: #3ea6ff; color: #000; font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 8px; }
.st-top10-hint { margin-top: 6px; }
.st-top10-row.pinned { position: sticky; bottom: 0; z-index: 1; background: #1d2a38; box-shadow: 0 -6px 12px rgba(0,0,0,.5); }
.st-top10-gap { text-align: left; padding: 0 0 0 22px; color: #777; font-size: 18px; line-height: 1; }

/* ══════════════════════════════════════════════════════════════════════════
   INTERFACE DE TELEMÓVEL (body.mobile — só em ecrãs táteis pequenos).
   O palco deixa de ser 1280×720 escalado: usa o ecrã ao tamanho real, com
   os blocos empilhados na vertical e scroll. O desktop não é afetado.
   ══════════════════════════════════════════════════════════════════════════ */

body.mobile #stage {
  position: fixed; inset: 0; left: 0; top: 0; width: auto; height: auto;
  transform: none !important; overflow-x: hidden; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding-bottom: env(safe-area-inset-bottom);
}
body.mobile .scene { position: relative; inset: auto; min-height: 100%; }
body.mobile h1 { font-size: 22px; }
body.mobile h2 { font-size: 18px; }
body.mobile .btn { font-size: 16px; padding: 11px 18px; }
body.mobile .btn-large { min-width: 0; font-size: 17px; padding: 12px 22px; }
body.mobile .overlay { position: fixed; }

/* Cabeçalhos e rodapés (botões sempre à mão, fixos no fundo) */
body.mobile .scene-header { padding: 12px 16px; }
body.mobile .scene-footer {
  position: sticky; bottom: 0; z-index: 5; padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  background: var(--bg); border-top: 1px solid var(--border); gap: 10px;
}
body.mobile .scene-footer .btn { flex: 1; }
body.mobile .scene-footer { flex-wrap: wrap; }
body.mobile .scene-footer .footer-group { flex: 1 1 100%; flex-wrap: wrap; }
body.mobile .week-day { flex: 1 1 100%; margin: 0; }

/* Intro */
body.mobile .intro-logo { font-size: 26px; margin-top: 22px; }
body.mobile .intro-dialogue { width: auto; margin: 36px 16px 0; }
body.mobile .intro-row { flex-direction: column; gap: 14px; }
body.mobile .intro-speaker { width: auto; }
body.mobile .intro-bubble { min-height: 130px; width: 100%; }
body.mobile .intro-bubble::before { left: 50%; top: -12px; transform: translateX(-50%) rotate(135deg); }
body.mobile .intro-text { font-size: 18px; }
body.mobile .intro-history { font-size: 12.5px; padding: 0 6px; text-align: center; }
body.mobile .intro-name { margin: 60px 16px 0; }
body.mobile .intro-name h1 { font-size: 26px; text-align: center; }
body.mobile .text-input { width: 100%; }
body.mobile .intro-skip { position: fixed; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); }

/* Menu */
body.mobile .menu-center { margin: 90px 16px 0; text-align: center; }
body.mobile .menu-title h1 { font-size: 38px; }
body.mobile .menu-buttons { width: 100%; max-width: 360px; }

/* Escolha do tema */
body.mobile .theme-body { justify-content: flex-start; padding: 16px 14px 10px; }
body.mobile .cat-row, body.mobile .theme-row { flex-direction: column; width: 100%; gap: 10px; margin: 14px 0; }
body.mobile .cat-card { width: 100%; height: 60px; }
body.mobile .theme-row .theme-card, body.mobile .theme-card { width: 100%; height: auto; min-height: 64px; padding: 14px; }
body.mobile .sub-list { width: 100%; }
body.mobile .sub-card { width: 100%; height: auto; min-height: 50px; padding: 10px 12px; }

/* Preparação da semana */
body.mobile .week-header { padding: 10px 12px; }
body.mobile .week-title { font-size: 15px; }
body.mobile .week-theme { font-size: 15px; }
body.mobile .day-dots { gap: 14px; }
body.mobile .week-body { flex-direction: column; padding: 8px 10px; gap: 10px; }
body.mobile .member-rows { width: 100%; gap: 8px; }
body.mobile .member-row { flex-direction: column; align-items: stretch; gap: 8px; padding: 10px 12px; }
body.mobile .member-row-id { width: auto; }
body.mobile .member-row-name { margin-bottom: 5px; }
body.mobile .energy-bar { width: 140px; }
body.mobile .task-pick { padding-right: 0; }
body.mobile .task-desc { padding-left: 2px; }
body.mobile .metrics-panel { gap: 14px; }
body.mobile .metrics-random { margin-top: 4px; }

/* WhatsApp: telemóvel a ocupar o ecrã, botão por baixo */
body.mobile .wa-phone {
  top: 12px; height: calc(100% - 96px - env(safe-area-inset-bottom));
  width: min(92vw, calc((100vh - 96px) * 0.45)); min-width: 280px;
}
body.mobile .wa-continue { top: auto; bottom: calc(18px + env(safe-area-inset-bottom)); width: min(92vw, 340px); }
body.mobile .wa-text { font-size: 14px; }
body.mobile .wa-name { font-size: 12px; }

/* Transmissão: vídeo a toda a largura, régie por baixo */
body.mobile .bc-top { height: auto; flex-wrap: wrap; gap: 4px 10px; padding: 8px 12px; }
body.mobile .bc-top-left { width: auto; }
body.mobile .bc-top-center { display: none; }
body.mobile .bc-viewers { width: auto; font-size: 15px; }
body.mobile .bc-layout { flex-direction: column; padding: 0 0 12px; gap: 10px; }
body.mobile .bc-left { width: 100%; overflow: visible; }
body.mobile .bc-player { width: 100%; height: auto; aspect-ratio: 16 / 9; border-radius: 0; }
body.mobile .bc-info { padding: 0 12px; }
body.mobile .bc-info-row { flex-wrap: wrap; gap: 8px; }
body.mobile .bc-panel { margin: 0 10px; overflow: visible; }
body.mobile .panel-members { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
body.mobile .panel-member { padding: 8px; }

/* YouTube Studio */
body.mobile .st-top { padding: 0 12px; }
body.mobile .st-search { display: none; }
body.mobile .st-body { flex-direction: column; }
body.mobile .st-side { width: 100%; flex-direction: row; flex-wrap: wrap; padding: 8px 10px; gap: 8px;
  border-right: none; border-bottom: 1px solid #3a3a3a; }
body.mobile .st-side-logo, body.mobile .st-side-title, body.mobile .st-side > .st-muted,
body.mobile .st-side-back { display: none; }
body.mobile .st-nav { flex-direction: row; overflow-x: auto; margin: 0; gap: 4px; }
body.mobile .st-nav-item { white-space: nowrap; padding: 8px 12px; border-radius: 16px; }
body.mobile .st-nav-item.active { border-left: none; padding-left: 12px; background: #3ea6ff; color: #000; }
body.mobile .st-main { overflow: visible; padding: 12px; }
body.mobile .st-head { flex-direction: column; }
body.mobile .st-actions { flex-wrap: wrap; }
body.mobile .st-kpis { grid-template-columns: 1fr 1fr; }
body.mobile .st-kpi { border-bottom: 1px solid #3a3a3a; }
body.mobile .st-grid-main, body.mobile .st-grid-bottom { grid-template-columns: 1fr; }
body.mobile .st-top10-row { grid-template-columns: 34px 1fr 80px; }
body.mobile .st-top10-row > :nth-child(4), body.mobile .st-top10-row > :nth-child(5) { display: none; }

/* Canal */
body.mobile .yt-header { padding: 16px 14px 8px; gap: 14px; }
body.mobile .yt-header h1 { font-size: 22px; }
body.mobile .yt-logo { width: 62px; height: 62px; }
body.mobile .yt-tabs { padding: 0 14px; }
body.mobile .yt-grid { grid-template-columns: 1fr; padding: 14px; overflow: visible; }

/* Chat da transmissão no telemóvel: toca para aumentar; com o chat aberto, qualquer toque fecha */
.stream-chat-hint, .chat-big { display: none; }
body.mobile .stream-chat { cursor: pointer; }
body.mobile .stream-chat-hint {
  display: flex; justify-content: center; align-items: flex-start; position: absolute; z-index: 3;
  padding-top: 4%; pointer-events: none;
}
body.mobile .stream-chat-toggle {
  pointer-events: auto; cursor: pointer; border: none; font: inherit;
  background: rgba(62, 166, 255, .96); color: #000; font-size: 13px; font-weight: 700;
  padding: 6px 12px; border-radius: 14px; box-shadow: 0 2px 10px rgba(0,0,0,.6);
  animation: pulse 2s ease-in-out infinite; white-space: nowrap;
}
body.mobile .chat-big {
  display: block; position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, .45);
}
body.mobile .chat-big-panel {
  position: absolute; left: 0; right: 0; bottom: 0; height: 62vh; display: flex; flex-direction: column;
  background: rgba(18, 18, 18, .97); border-top: 2px solid #3ea6ff; border-radius: 14px 14px 0 0;
  padding: 0 16px calc(14px + env(safe-area-inset-bottom)); box-shadow: 0 -10px 30px rgba(0,0,0,.6);
  font-family: "IBM Plex Sans", var(--font);
}
body.mobile .chat-big-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 0 10px;
  font-weight: 700; color: #fff; border-bottom: 1px solid #333; }
body.mobile .chat-big-close { background: #3ea6ff; color: #000; font-size: 12px; padding: 4px 10px; border-radius: 10px; }
body.mobile .chat-big-list { flex: 1; min-height: 0; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; padding-top: 8px; }
body.mobile .chat-big .stream-chat-list { gap: 8px; }
body.mobile .chat-big .stream-chat-msg { font-size: 15px; }

/* Playing Now no telemóvel: lista dos jogos em letra grande no painel */
.panel-pn { display: none; }
body.mobile .panel-pn { display: flex; flex-direction: column; gap: 10px; margin: 12px 0; }
body.mobile .panel-pn-member { background: rgba(255,255,255,.04); border-left: 4px solid; border-radius: 10px; padding: 10px 12px; }
body.mobile .panel-pn-head { display: flex; align-items: center; gap: 10px; font-size: 18px; margin-bottom: 6px; }
body.mobile .panel-pn-count { margin-left: auto; font-weight: 700; font-size: 16px; }
body.mobile .panel-pn-title { font-size: 17px; line-height: 1.35; padding: 3px 0; color: #eee; }
