/* Stili condivisi dalle pagine (login.html e index.html) */

:root { color-scheme: dark; }
* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html, body {
  height: 100%; background: #000;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

video { width: 100%; height: 100%; object-fit: contain; background: #000; display: block; }

.overlay {
  position: fixed; inset: 0; z-index: 20;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 18px; padding: 28px; text-align: center; color: #fff;
  background: rgba(0,0,0,.82);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
}
.overlay h1 { font-size: clamp(19px, 5.2vw, 30px); font-weight: 650; line-height: 1.25; }
.overlay p  { font-size: clamp(14px, 3.6vw, 17px); opacity: .78; max-width: 32ch; line-height: 1.55; }

button {
  font: inherit; font-weight: 650; font-size: clamp(16px, 4.6vw, 20px);
  color: #000; background: #fff; border: 0; border-radius: 999px;
  padding: 17px 34px; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
button:active { transform: scale(.97); }

.spinner {
  width: 44px; height: 44px; border: 4px solid rgba(255,255,255,.22);
  border-top-color: #fff; border-radius: 50%; animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.hint {
  position: fixed; left: 0; right: 0; z-index: 5;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 10px);
  text-align: center; font-size: 12px; color: rgba(255,255,255,.5);
  padding: 6px; pointer-events: none;
}

/* ---------- pannello chat richiudibile (index.html) ---------- */

#chatToggle {
  position: fixed; z-index: 16;
  right: calc(env(safe-area-inset-right, 0px) + 16px);
  bottom: calc(env(safe-area-inset-bottom, 0px) + 16px);
  width: 56px; height: 56px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; line-height: 1; padding: 0;
  background: rgba(28,28,31,.85); color: #fff; border: 1px solid rgba(255,255,255,.18);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  box-shadow: 0 4px 16px rgba(0,0,0,.4);
}

#chatBadge {
  position: absolute; top: -2px; right: -2px; min-width: 20px; height: 20px;
  border-radius: 999px; background: #ff4d4d; color: #fff; font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; padding: 0 5px;
}

#chatPanel {
  position: fixed; inset: 0 0 0 auto; z-index: 15;
  width: min(400px, 100vw);
  background: #0b0b0d; border-left: 1px solid rgba(255,255,255,.12);
  display: flex; flex-direction: column;
  transform: translateX(100%);
  transition: transform .25s ease;
}
#chatPanel.open { transform: translateX(0); }

.chat-header {
  flex: 0 0 auto;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 14px 10px;
  font-size: 13px; font-weight: 700; letter-spacing: .02em;
  color: rgba(255,255,255,.6);
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.chat-header .actions { display: flex; align-items: center; gap: 14px; }
.chat-header .status { font-weight: 500; color: #ffcf5c; font-size: 12px; }
.chat-header .rename { color: rgba(255,255,255,.45); font-weight: 500; text-decoration: underline; cursor: pointer; }
.chat-header .close {
  background: none; border: 0; color: rgba(255,255,255,.7); font-size: 18px;
  padding: 0; width: 24px; height: 24px; line-height: 1; cursor: pointer;
}

.chat-messages {
  flex: 1 1 auto; min-height: 0; overflow-y: auto;
  padding: 8px 4px;
  -webkit-overflow-scrolling: touch;
}
.msg { padding: 5px 14px; font-size: 14.5px; line-height: 1.45; overflow-wrap: anywhere; color: #eee; }
.msg .name { font-weight: 700; color: #8ecbff; margin-right: 6px; }
.msg .time { font-size: 11px; color: rgba(255,255,255,.38); margin-left: 6px; }
.msg .text { display: inline; }
.msg.system { text-align: center; color: rgba(255,255,255,.4); font-size: 12px; padding: 10px 14px; }

.chat-form {
  flex: 0 0 auto;
  display: flex; gap: 8px;
  padding: 10px 12px calc(env(safe-area-inset-bottom, 0px) + 10px);
  border-top: 1px solid rgba(255,255,255,.08);
  background: #0b0b0d;
}
.chat-form input {
  flex: 1 1 auto; min-width: 0;
  font: inherit; font-size: 16px; color: #fff; background: #1c1c1f;
  border: 1px solid rgba(255,255,255,.14); border-radius: 999px;
  padding: 11px 16px; outline: none;
}
.chat-form input::placeholder { color: rgba(255,255,255,.4); }
.chat-form button {
  flex: 0 0 auto; font-size: 14px; padding: 10px 20px;
}

/* ---------- pagina di login ---------- */

.loginCenter { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 24px; }
.loginCard { max-width: 360px; width: 100%; text-align: center; display: flex; flex-direction: column; gap: 16px; color: #fff; }
.loginCard h1 { font-size: clamp(20px, 5.5vw, 28px); font-weight: 700; }
.loginCard p { font-size: 15px; opacity: .75; line-height: 1.55; }
.loginCard .err { color: #ff8a8a; }
.loginCard form { display: flex; flex-direction: column; gap: 14px; }
.loginCard input[type="text"] {
  font: inherit; font-size: 16px; color: #fff; background: #1c1c1f;
  border: 1px solid rgba(255,255,255,.16); border-radius: 999px;
  padding: 14px 18px; text-align: center; outline: none;
}
