/* Mobile-first, fără librării externe. */
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
:root {
  --bg: #101418;
  --card: #1a2027;
  --card2: #232b34;
  --text: #eef2f6;
  --muted: #93a1b0;
  --accent: #2f9e6e;
  --accent2: #38b981;
  --danger: #d9534f;
  --warn: #e2a93b;
  --radius: 14px;
}
html, body { height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 17px; line-height: 1.45;
  display: flex; flex-direction: column;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.screen { display: none; flex-direction: column; gap: 16px; padding: 18px; max-width: 560px; margin: 0 auto; width: 100%; flex: 1; }
.screen.active { display: flex; }

.bar { display: flex; align-items: center; gap: 10px; }
.bar h2 { font-size: 1.25rem; flex: 1; }

.hint { color: var(--muted); font-size: .92rem; }
.hint.center { text-align: center; }

.card { background: var(--card); border-radius: var(--radius); padding: 16px; }
.card.notice { border: 1px solid var(--accent); }

.row { display: flex; gap: 10px; }
.row > * { flex: 1; }

/* butoane */
button { font: inherit; color: inherit; border: 0; cursor: pointer; border-radius: var(--radius); }
.btn-primary { background: var(--accent); color: #fff; padding: 14px 18px; font-weight: 600; }
.btn-primary:active { background: var(--accent2); }
.btn-primary:disabled { opacity: .45; }
.btn-primary.big { font-size: 1.15rem; padding: 18px; width: 100%; }
.btn-secondary { background: var(--card2); color: var(--text); padding: 13px 16px; }
.btn-ghost { background: transparent; color: var(--muted); padding: 8px 12px; font-size: 1rem; }
.btn-round { width: 64px; height: 64px; border-radius: 50%; background: var(--card2); font-size: 1.5rem; }
.btn-round.danger { background: var(--danger); color: #fff; }
.btn-round.off { background: var(--warn); }

/* ── login ── */
#screen-login { justify-content: center; }
.login-box { display: flex; flex-direction: column; align-items: center; gap: 18px; }
.brand { font-size: 1.25rem; text-align: center; }
.login-label { text-align: center; color: var(--muted); }
.pin-dots { display: flex; gap: 12px; height: 20px; }
.pin-dots span { width: 16px; height: 16px; border-radius: 50%; background: var(--card2); }
.pin-dots span.on { background: var(--accent2); }
.login-msg { min-height: 1.4em; color: var(--danger); text-align: center; font-size: .95rem; }
.keypad { display: grid; grid-template-columns: repeat(3, 84px); gap: 12px; }
.keypad button {
  height: 72px; font-size: 1.6rem; background: var(--card);
  border-radius: 50%; font-weight: 600;
}
.keypad button:active { background: var(--card2); }
.keypad .key-aux { background: transparent; color: var(--muted); font-size: 1.2rem; }
.shake { animation: shake .35s; }
@keyframes shake { 20%,60% { transform: translateX(-7px); } 40%,80% { transform: translateX(7px); } }
.register-link { margin-top: 8px; text-align: center; line-height: 1.35; }

/* ── înregistrare ── */
#screen-register { justify-content: center; }
#screen-register .login-box { align-items: stretch; width: 100%; max-width: 380px; }
#screen-register .brand { margin-bottom: 4px; }
.reg-label { color: var(--muted); font-size: .9rem; margin: 6px 2px -4px; }
.reg-input {
  background: var(--card); color: var(--text); border: 1px solid var(--card2);
  border-radius: var(--radius); padding: 14px 16px; font-size: 1.1rem; width: 100%;
}
.reg-input:focus { outline: 2px solid var(--accent); border-color: var(--accent); }
.pin-input { letter-spacing: .35em; text-align: center; font-variant-numeric: tabular-nums; }
.lang-choice { display: flex; gap: 10px; }
.lang-choice .lang-btn {
  flex: 1; background: var(--card); padding: 16px; font-size: 1.05rem; font-weight: 600;
  border: 2px solid transparent;
}
.lang-choice .lang-btn.selected { border-color: var(--accent); background: var(--card2); }
.reg-hint { text-align: center; line-height: 1.35; }

/* ── voci ── */
.voice-list { display: flex; flex-direction: column; gap: 10px; overflow-y: auto; }
.voice-item { background: var(--card); border-radius: var(--radius); padding: 12px 14px; display: flex; align-items: center; gap: 12px; }
.voice-item.selected { outline: 2px solid var(--accent); }
.voice-meta { flex: 1; min-width: 0; }
.voice-name { font-weight: 600; }
.voice-tags { color: var(--muted); font-size: .82rem; }
.voice-item button { padding: 10px 14px; }
.voice-item .btn-play { background: var(--card2); border-radius: 50%; width: 46px; height: 46px; flex: none; }

/* ── acasă ── */
.usage-title { font-size: .9rem; color: var(--muted); }
.usage-bar { height: 10px; background: var(--card2); border-radius: 6px; margin: 8px 0; overflow: hidden; }
#usage-fill { height: 100%; background: var(--accent); width: 0; border-radius: 6px; transition: width .4s; }
#usage-fill.warn { background: var(--warn); }
#usage-fill.over { background: var(--danger); }
.usage-text { font-size: .9rem; color: var(--muted); }

/* ── cameră ── */
.room-link { word-break: break-all; font-size: .9rem; color: var(--muted); margin-bottom: 10px; }
.room-status { text-align: center; font-size: 1.05rem; padding: 12px 0; }

/* ── conversație ── */
#screen-talk { padding-bottom: 12px; }
.talk-top { display: flex; align-items: center; justify-content: space-between; }
.countdown { font-size: 2.4rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.countdown.low { color: var(--danger); }
.talk-status { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .95rem; }
.pulse { width: 12px; height: 12px; border-radius: 50%; background: var(--accent2); animation: pulse 1.4s infinite; }
.talk-status.playing .pulse { background: #4aa3df; animation: none; }
.talk-status.muted .pulse { background: var(--warn); animation: none; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .3; } }

.banner { background: var(--warn); color: #1c1608; border-radius: 10px; padding: 10px 12px; font-size: .92rem; }

.subtitles { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; padding: 6px 2px; }
.sub { background: var(--card); border-radius: var(--radius); padding: 10px 14px; max-width: 92%; }
.sub.mine { align-self: flex-end; background: var(--card2); }
.sub .who { font-size: .78rem; color: var(--muted); margin-bottom: 3px; }
.sub .orig { color: var(--muted); font-size: .92rem; }
.sub .tran { font-size: 1.05rem; margin-top: 2px; }
.sub [dir="rtl"] { text-align: right; }

.talk-controls { display: flex; justify-content: center; gap: 26px; padding: 6px 0; }

/* overlay final */
.overlay { position: fixed; inset: 0; background: rgba(8,10,13,.82); display: flex; align-items: center; justify-content: center; padding: 24px; z-index: 30; }
.overlay[hidden] { display: none !important; }   /* atributul hidden trebuie să învingă display:flex */
.overlay-card { background: var(--card); border-radius: var(--radius); padding: 26px 20px; width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 16px; text-align: center; }

/* toast */
.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%);
  background: var(--card2); color: var(--text); padding: 12px 18px;
  border-radius: 12px; font-size: .95rem; z-index: 40; max-width: 90%;
  box-shadow: 0 6px 22px rgba(0,0,0,.4); text-align: center;
}

/* RTL: direcția documentului se setează din JS pentru utilizatorii he */
[dir="rtl"] .bar h2 { text-align: right; }
