:root {
  --brand-navy:   #16325c;
  --brand-blue:   #1e88d0;
  --brand-orange: #f7941d;
  --node-pink:    #e0559a;
  --node-purple:  #8f6fd8;
  --node-green:   #6cbf47;

  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-2: #e2e8f0;
  --text: var(--brand-navy);
  --text-muted: #5b7089;
  --primary: var(--brand-blue);
  --primary-hover: #1470b0;
  --danger: #dc2626;
  --radius: 16px;
  --radius-sm: 10px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--surface-2);
  position: sticky;
  top: 0;
  z-index: 10;
}
.header-logo { display: flex; align-items: center; gap: 10px; }
.logo-img { width: 34px; height: 34px; object-fit: contain; }
.logo-text {
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--brand-navy);
  letter-spacing: 0.2px;
}
.header-lang {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--brand-blue);
  background: #eaf4fc;
  padding: 4px 12px;
  border-radius: 999px;
  text-transform: uppercase;
}

.screen { min-height: calc(100vh - 59px); padding: 24px 20px; }
.screen[hidden] { display: none !important; }
.screen-inner { max-width: 420px; margin: 0 auto; }
.screen-center {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center;
}

h1 { font-size: 1.5rem; margin-bottom: 8px; color: var(--brand-navy); }
h2 { font-size: 1.25rem; margin-bottom: 8px; color: var(--brand-navy); }
.muted { color: var(--text-muted); font-size: 0.95rem; margin-bottom: 24px; }

.boot-logo {
  width: 100%;
  max-width: 300px;
  height: auto;
  margin: 0 auto 20px auto;
  display: block;
}

.form { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
label { font-size: 0.85rem; color: var(--text-muted); font-weight: 600; }
input[type="text"] {
  background: var(--surface);
  border: 1px solid var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 14px;
  color: var(--text);
  font-size: 1rem;
  outline: none;
}
input[type="text"]:focus { border-color: var(--primary); }

.btn {
  border: none; border-radius: var(--radius-sm);
  padding: 14px 18px; font-size: 1rem; font-weight: 600;
  cursor: pointer; transition: background 0.15s, transform 0.1s;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--primary); color: #ffffff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-large { width: 100%; padding: 18px; margin-top: 12px; }
.btn-secondary {
  background: var(--surface);
  color: var(--brand-navy);
  border: 1px solid var(--surface-2);
}

.link-btn {
  background: none; border: none; color: var(--text-muted);
  font-size: 0.85rem; cursor: pointer; margin-top: 20px;
  text-decoration: underline;
}
.link-btn:hover { color: var(--brand-blue); }

.lang-list {
  display: flex; flex-direction: column; gap: 10px;
  width: 100%; max-width: 320px;
}
.lang-btn {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 18px; font-size: 1.05rem;
  background: var(--surface); color: var(--text);
  border: 2px solid var(--surface-2); border-radius: var(--radius-sm);
  cursor: pointer; text-align: left;
  transition: border-color 0.15s, transform 0.1s;
}
.lang-btn:hover { border-color: var(--primary); }
.lang-btn:active { transform: scale(0.98); }
.lang-flag { font-size: 1.4rem; }

.role-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
  width: 100%; text-align: left;
  background: var(--surface); border: 2px solid var(--surface-2);
  border-radius: var(--radius); padding: 20px;
  margin-bottom: 14px; cursor: pointer; color: var(--text);
  transition: border-color 0.15s, transform 0.1s;
}
.role-card:hover { border-color: var(--primary); }
.role-card:active { transform: scale(0.98); }
.role-icon { font-size: 1.6rem; }
.role-label { font-size: 1.05rem; font-weight: 600; color: var(--brand-navy); }
.role-hint { font-size: 0.85rem; color: var(--text-muted); }
.identity-greeting { margin-top: 24px; margin-bottom: 0; }

.qr-box {
  background: #ffffff; color: #0f172a;
  border: 1px solid var(--surface-2);
  border-radius: var(--radius); padding: 20px;
  width: 100%; max-width: 300px; min-height: 220px;
  display: flex; align-items: center; justify-content: center;
  margin: 20px 0;
}
#guest-qr-canvas {
  display: flex; align-items: center; justify-content: center;
}
#guest-qr-canvas canvas,
#guest-qr-canvas img {
  max-width: 100%;
  height: auto;
}
.qr-payload {
  font-size: 0.75rem; text-align: left;
  word-break: break-all; white-space: pre-wrap;
  font-family: ui-monospace, monospace;
}

/* Codigo del huesped visible (asociacion manual) */
.code-display {
  font-family: ui-monospace, monospace;
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--brand-navy);
  background: var(--surface);
  border: 1px dashed var(--brand-blue);
  border-radius: var(--radius-sm);
  padding: 10px 18px;
  margin-bottom: 12px;
}
.code-entry {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: 320px;
  margin-top: 12px;
}

.guest-status {
  display: flex; align-items: center; gap: 8px;
  color: var(--text-muted); font-size: 0.9rem;
  margin-top: 12px;
}
.status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--brand-blue);
  animation: pulse 1.6s infinite;
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }

.scanner-frame {
  width: 100%; max-width: 320px; aspect-ratio: 1;
  border: 2px dashed var(--brand-blue); border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  margin: 20px 0; background: #eaf4fc;
  overflow: hidden;
}
#scan-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}

.participant-list { display: flex; flex-direction: column; gap: 8px; margin: 16px 0; }
.participant-card {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--surface-2);
  border-radius: var(--radius-sm); padding: 12px 16px;
}
.participant-flag { font-size: 1.3rem; }
.participant-name { font-weight: 600; flex: 1; text-align: left; }
.participant-status { color: var(--node-green); font-size: 0.8rem; }
.participant-msg { color: var(--text-muted); font-size: 0.9rem; text-align: left; }