body.player { font-size: 17px; }
.topbar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.9rem;
  border-bottom: 1px solid var(--line);
  background: rgba(10, 13, 20, 0.6);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar .brand { font-size: 1.3em; }
.topbar .me { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.topbar button { padding: 0.45em 0.8em; min-height: 40px; }
main { padding: 1rem 0.9rem 6.5rem; max-width: 560px; margin: 0 auto; }
.view { animation: fade 0.25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.join h1 { font-size: 1.8em; }
.join input.codein { text-transform: uppercase; font-size: 1.6em; letter-spacing: 0.3em; text-align: center; font-weight: 800; }
.error { color: var(--danger); min-height: 1.3em; }

.phase-head { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.6rem; }
.phase-head span.icon { font-size: 2em; line-height: 1; }
.phase-head h1 { font-size: 1.5em; margin: 0; flex: 1; }
.phase-head .timer { font-size: 1.6em; }
.status { margin: 0.4rem 0 0.8rem; color: var(--muted); }
.status.strong { color: var(--text); font-weight: 600; }
.status.danger { color: var(--danger); font-weight: 700; font-size: 1.2em; }

.options { display: flex; flex-direction: column; gap: 0.5rem; }
.opt {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 56px;
  text-align: start;
  font-size: 1.05em;
  background: var(--panel);
  border: 2px solid var(--line);
}
.opt .name { flex: 1; font-weight: 600; }
.opt.selected { border-color: var(--accent); background: rgba(242, 193, 78, 0.12); }
.opt.selected::after { content: '✓'; color: var(--accent); font-weight: 900; }
.opt.abstain { border-style: dashed; color: var(--muted); }
.opt .sub { font-size: 0.8em; color: var(--muted); }

.rolecard {
  position: relative;
  border-radius: 20px;
  /* Înălțime fixă: cardul acoperit arată identic indiferent de rol (conținutul nu îl poate dimensiona). */
  height: 320px;
  background: linear-gradient(160deg, #1d2740, #10141f);
  border: 2px solid var(--line);
  text-align: center;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: none;
  cursor: pointer;
  overflow: hidden;
}
.rolecard .cover { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.4rem; background: repeating-linear-gradient(135deg, #1b2439 0 12px, #161e30 12px 24px); transition: opacity 0.12s ease; }
.rolecard .cover .big { font-size: 2.4em; }
.rolecard.revealed .cover { opacity: 0; pointer-events: none; }
.rolecard .content { position: absolute; inset: 0; overflow: auto; padding: 1.2rem; display: flex; flex-direction: column; gap: 0.3rem; align-items: center; justify-content: safe center; }
.rolecard .content .emoji { font-size: 3em; line-height: 1; }
.rolecard .content .rname { font-size: 1.8em; font-weight: 900; }
.rolecard .content .team { font-size: 0.9em; }
.rolecard .content .desc { color: var(--muted); font-size: 0.95em; }
/* Culoarea echipei apare doar cât timp cardul este dezvăluit. */
.rolecard.revealed.mafia { border-color: rgba(229, 72, 77, 0.6); }
.rolecard.revealed.town { border-color: rgba(79, 156, 245, 0.5); }
.rolecard .mates { margin-top: 0.4rem; font-weight: 600; }
.rolecard .inv { margin-top: 0.4rem; text-align: start; font-size: 0.95em; }
.rolecard .inv li { list-style: none; }
.rolecard .inv ul { padding: 0; margin: 0.2rem 0 0; }

.sub-strip {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  padding: 0.8rem 0.9rem calc(0.8rem + env(safe-area-inset-bottom));
  background: rgba(8, 10, 16, 0.92);
  border-top: 1px solid var(--line);
  z-index: 9;
  min-height: 3.6em;
}
.sub-strip .label { color: var(--muted); font-size: 0.75em; text-transform: uppercase; letter-spacing: 0.1em; }
.sub-strip .current { font-size: 1.02em; }

.roster-list { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.result-table { width: 100%; border-collapse: collapse; }
.result-table td { padding: 0.5em 0.4em; border-bottom: 1px solid var(--line); }
.winner { font-size: 1.5em; font-weight: 900; text-align: center; margin: 0.4rem 0 0.8rem; }
.deadnote { background: rgba(229, 72, 77, 0.12); border: 1px solid rgba(229, 72, 77, 0.45); border-radius: 14px; padding: 0.9rem 1rem; margin-bottom: 0.8rem; }
.okbtn { width: 100%; margin-top: 0.8rem; }
.link { background: none; color: var(--muted); text-decoration: underline; padding: 0.4em; min-height: 36px; }

.result-table { table-layout: fixed; }
.result-table td:first-child { overflow-wrap: anywhere; word-break: break-word; }
.opt .name, .opt .sub, .player-chip .name, .rolecard .mates { overflow-wrap: anywhere; }
.rolecard .nightinfo { margin-top: 0.4rem; font-size: 0.95em; }

/* ---- faza 2 ---- */
.iconbtn { padding: 0.4em 0.6em; min-width: 40px; }
.home h1 { font-size: 2.4em; letter-spacing: 0.04em; margin-bottom: 0.2em; }
.home .big { width: 100%; justify-content: flex-start; display: flex; gap: 0.6rem; align-items: center; text-align: start; }
.home .big span:first-child { font-size: 1.3em; }
.big-num { font-size: 2em; font-weight: 800; margin: 0.2em 0; }
.spinner { font-size: 2.6em; animation: spin 6s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.qr { background: #fff; border-radius: 14px; padding: 3%; margin: 0 auto 0.6rem; width: min(100%, 320px); aspect-ratio: 1 / 1; }
.qr svg { width: 100%; height: 100%; display: block; }
.join-url { font-weight: 700; word-break: break-all; color: var(--accent-2); font-size: 0.95em; }
.big-code { font-size: 2em; color: var(--accent-2); margin-top: 0.3rem; }
.host-bar {
  position: fixed; left: 0; right: 0; bottom: var(--substrip-h, 3.9em);
  display: flex; gap: 0.5rem; padding: 0.5rem 0.9rem; background: rgba(10, 13, 20, 0.92); border-top: 1px solid var(--line); z-index: 9;
}
.host-bar button { flex: 1 1 0; min-width: 0; min-height: 44px; padding: 0.5em 0.4em; font-size: 0.86em; line-height: 1.15; overflow-wrap: anywhere; }
.host-bar #hb-extend { flex: 0 0 auto; white-space: nowrap; }
.host-bar #hb-next { flex: 1.4 1 0; }
body.hostbar main { padding-bottom: 10rem; }
.ad-slot { margin: 1rem 0 0; min-height: 60px; border: 1px dashed var(--line); border-radius: 12px; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 0.8em; }
.ad-slot.adfree { border-style: solid; color: var(--ok); }
.tabs { display: flex; gap: 0.4rem; margin-bottom: 0.8rem; }
.tabs .tab { flex: 1; background: var(--panel); border: 1px solid var(--line); }
.tabs .tab.active { background: var(--accent); color: #1a1405; font-weight: 700; }
.info h2 { font-size: 1.3em; margin-top: 1rem; }
.info .panel { margin-bottom: 0.7rem; }
.info ul { padding-left: 1.2em; }
.info li { margin-bottom: 0.5em; }
.settings .settings-grid { display: grid; grid-template-columns: 1fr; gap: 0.7rem; }
.settings h3 { color: var(--accent); margin: 0.6rem 0 0; font-size: 1em; }
.settings .check { display: flex; align-items: center; gap: 0.6rem; min-height: 44px; cursor: pointer; color: var(--text); }
.settings input[type="checkbox"] { width: 22px; height: 22px; accent-color: var(--accent); }
.settings input[type="number"] { width: 100%; padding: 0.6em 0.8em; border-radius: 10px; border: 1px solid var(--line); background: var(--bg-2); color: var(--text); min-height: 44px; }
.overlay .panel { max-height: 92vh; overflow: auto; }
.player-chip .bot { font-size: 0.9em; }
.player-chip .host { color: var(--accent); }
[dir="rtl"] .host .big { text-align: right; }

.topbar #btn-role { white-space: nowrap; font-size: 0.9em; padding: 0.4em 0.6em; }
.topbar .me { font-size: 0.95em; }

/* ---- faza 3: Pro, confidențialitate, raportare, actualizare ---- */
.badge.pro { background: var(--accent); color: #1a1405; font-weight: 800; font-size: 0.75em; padding: 0.1em 0.5em; border-radius: 999px; letter-spacing: 0.04em; }
.pro-entry { display: inline-flex; align-items: center; gap: 0.5rem; margin-top: 0.8rem; font-size: 0.9em; text-decoration: none; }
.legal-note { margin: 0.4rem 0 0; font-size: 0.78em; line-height: 1.35; text-align: start; }
.legal-note a { color: var(--muted); text-decoration: underline; }
.legal-panel { display: flex; flex-direction: column; gap: 0.4rem; margin-top: 1rem; align-items: flex-start; }
.legal-panel a { color: var(--muted); text-decoration: underline; padding: 0.4em; min-height: 36px; display: inline-flex; align-items: center; }
.legal-panel .link { text-align: start; }
.pro-panel h2 { display: flex; align-items: center; gap: 0.5rem; margin-top: 0; }
.pro-benefits { padding-inline-start: 1.2em; margin: 0.6rem 0; }
.pro-benefits li { margin-bottom: 0.35em; }
.pro-status { font-weight: 600; margin: 0.4rem 0; min-height: 1.3em; }
.pro-status.on { color: var(--ok); }
.pro-status.off { color: var(--muted); }
.pro-price { font-size: 1.3em; font-weight: 800; text-align: center; min-height: 1.2em; }
.report-box { margin-top: 1rem; }
.report-box summary { color: var(--muted); font-size: 0.85em; cursor: pointer; }
.report-box .row { flex-wrap: wrap; gap: 0.4rem; margin-top: 0.4rem; }
.report-btn { font-size: 0.85em; color: var(--muted); }
.player-chip .report-btn { min-height: 28px; padding: 0 0.3em; }

/* ---- chat ---- */
.chatbtn { position: relative; }
.chatbtn .unread { position: absolute; top: 2px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--danger); color: #fff; font-size: 0.7em; font-weight: 800; display: flex; align-items: center; justify-content: center; }
.chat-panel {
  position: fixed; inset: 0; z-index: 20; display: flex; flex-direction: column;
  background: var(--bg); padding-top: env(safe-area-inset-top);
}
.chat-head { display: flex; align-items: center; gap: 0.6rem; padding: 0.6rem 0.9rem; border-bottom: 1px solid var(--line); }
.chat-head b { flex: 1; font-size: 1.1em; }
.chat-head .badge.mafia { background: rgba(229, 72, 77, 0.2); color: var(--danger); }
.chat-head .badge.dead { background: rgba(255, 255, 255, 0.08); color: var(--muted); }
.chat-list { flex: 1; overflow-y: auto; padding: 0.7rem 0.9rem; display: flex; flex-direction: column; gap: 0.45rem; }
.chat-list .empty { color: var(--muted); text-align: center; margin: auto; }
.msg { max-width: 86%; align-self: flex-start; background: var(--panel); border: 1px solid var(--line); border-radius: 14px 14px 14px 4px; padding: 0.45rem 0.7rem; }
.msg.mine { align-self: flex-end; border-radius: 14px 14px 4px 14px; background: rgba(242, 193, 78, 0.12); border-color: rgba(242, 193, 78, 0.4); }
.msg.mafia { border-color: rgba(229, 72, 77, 0.5); }
.msg.dead { opacity: 0.75; }
.msg .from { display: flex; align-items: center; gap: 0.4rem; font-size: 0.78em; color: var(--muted); margin-bottom: 0.1rem; }
.msg .from b { color: var(--accent-2); }
.msg .from .ch { font-size: 0.9em; }
.msg .from .mutebtn { background: none; border: 0; color: var(--muted); padding: 0 0.2em; min-height: 0; font-size: 1em; }
.msg .text { overflow-wrap: anywhere; white-space: pre-wrap; }
.msg.system { align-self: center; background: none; border: 0; color: var(--muted); font-size: 0.85em; text-align: center; }
.chat-form { display: flex; gap: 0.5rem; padding: 0.6rem 0.9rem calc(0.6rem + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--bg-2); }
.chat-form input { flex: 1; min-height: 44px; }
.chat-form input:disabled { opacity: 0.6; }
.chat-form button { min-width: 44px; }

/* Bara de sus nu are voie să lățească pagina (altfel telefonul micșorează tot ecranul). */
.topbar { flex-wrap: nowrap; min-width: 0; }
.topbar .me { min-width: 0; flex: 1 1 auto; }
.topbar .code { flex: 0 0 auto; }
.topbar button { flex: 0 0 auto; }
@media (max-width: 430px) {
  .topbar { gap: 0.35rem; padding-inline: 0.6rem; }
  .topbar button { padding: 0.4em 0.5em; }
  .topbar #btn-role span:last-child { display: none; } /* doar 🃏 pe ecrane înguste */
  .topbar .me { font-size: 0.9em; }
}
