* { box-sizing: border-box; }

:root {
  color-scheme: dark;
  --bg: #12141a;
  --panel: #1b1f29;
  --panel-2: #242938;
  --text: #f0f1f5;
  --muted: #9aa1b1;
  --accent: #6ea8ff;
  --danger: #ff6e6e;
  --ok: #57d38c;
}

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

body.kiosk {
  touch-action: manipulation;
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

header {
  padding: 16px 20px;
  border-bottom: 1px solid #2a3040;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

header h1 {
  font-size: 18px;
  margin: 0;
}

main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
  gap: 20px;
}

.status {
  font-size: 13px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--muted);
  white-space: nowrap;
}
.status.ok { color: var(--ok); }
.status.warn { color: var(--danger); }

.card {
  background: var(--panel);
  border-radius: 16px;
  padding: 24px;
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: stretch;
}

.role-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  max-width: 420px;
}

.role-btn {
  background: var(--panel);
  border: 1px solid #2a3040;
  border-radius: 16px;
  padding: 24px;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.role-btn:hover { border-color: var(--accent); }
.role-btn .emoji { font-size: 28px; }
.role-btn .desc { color: var(--muted); font-size: 13px; }

label { font-size: 13px; color: var(--muted); }

input[type="text"], input[type="number"] {
  background: var(--panel-2);
  border: 1px solid #2a3040;
  color: var(--text);
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 20px;
  letter-spacing: 4px;
  text-align: center;
  width: 100%;
}

button.primary {
  background: var(--accent);
  color: #0b1220;
  border: none;
  padding: 14px;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}
button.primary:disabled { opacity: 0.5; cursor: not-allowed; }

button.secondary {
  background: transparent;
  border: 1px solid #2a3040;
  color: var(--text);
  padding: 10px;
  border-radius: 10px;
  cursor: pointer;
}

.room-code {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: 3px;
  text-align: center;
  background: var(--panel-2);
  border-radius: 12px;
  padding: 16px;
  word-break: break-all;
}

.live-area {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

video {
  width: 100%;
  max-width: 100%;
  background: #000;
  border-radius: 16px;
  height: 65vh;
  max-height: 70vh;
  object-fit: cover;
}

.video-wrap {
  position: relative;
  width: 100%;
}

.offline-overlay {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 20px;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  background: rgba(18, 20, 26, 0.75);
  border-radius: 16px;
}
.offline-overlay.show { display: flex; }

.meter {
  width: 100%;
  max-width: 480px;
  height: 10px;
  background: var(--panel-2);
  border-radius: 999px;
  overflow: hidden;
}
.meter-fill {
  height: 100%;
  width: 0%;
  background: var(--ok);
  transition: width 80ms linear;
}
.meter-fill.hot { background: var(--danger); }

.talk-btn {
  width: 100%;
  max-width: 480px;
  padding: 22px;
  border-radius: 16px;
  border: none;
  font-size: 18px;
  font-weight: 700;
  background: var(--panel-2);
  color: var(--text);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}
.talk-btn.active {
  background: var(--accent);
  color: #0b1220;
}

.alert-banner {
  width: 100%;
  max-width: 480px;
  padding: 16px;
  border-radius: 12px;
  background: var(--danger);
  color: #2a0000;
  font-weight: 700;
  text-align: center;
  display: none;
}
.alert-banner.show { display: block; animation: pulse 1s infinite; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.row {
  display: flex;
  gap: 10px;
  width: 100%;
  max-width: 480px;
}
.row > * { flex: 1; }

a.back {
  color: var(--muted);
  font-size: 13px;
  text-decoration: none;
}

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

.slider-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: 480px;
}
input[type="range"] { flex: 1; }
