/* BlindSight — Design system */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=DM+Mono:wght@400;500&display=swap');

:root {
  --blue:       #1B4FD8;
  --blue-dark:  #1340B0;
  --blue-light: #EEF2FF;
  --red:        #DC2626;
  --red-light:  #FEF2F2;
  --green:      #16A34A;
  --green-light:#F0FDF4;
  --amber:      #D97706;
  --amber-light:#FFFBEB;
  --ink:        #0F172A;
  --ink-2:      #334155;
  --ink-3:      #64748B;
  --line:       #E2E8F0;
  --bg:         #F8FAFC;
  --white:      #FFFFFF;
  --radius:     12px;
  --radius-sm:  8px;
  --shadow:     0 1px 4px rgba(0,0,0,.08);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg); color: var(--ink);
  line-height: 1.6; -webkit-font-smoothing: antialiased;
}

/* ── Utilities ── */
.hidden  { display: none !important; }
.muted   { color: var(--ink-3); }
.mono    { font-family: 'DM Mono', monospace; }

/* ── Layout ── */
.wrap { max-width: 860px; margin: 0 auto; padding: 0 16px; }
.g2   { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ── Topbar ── */
.topbar {
  background: var(--blue); padding: 0 20px; height: 56px;
  display: flex; align-items: center; gap: 14px;
  position: sticky; top: 0; z-index: 200;
  box-shadow: 0 2px 8px rgba(27,79,216,.25);
}
.topbar .logo {
  font-size: 18px; font-weight: 700; color: #fff; letter-spacing: -.3px;
  display: flex; align-items: center; gap: 8px;
}

/* ── Cards ── */
.card {
  background: var(--white); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px;
  box-shadow: var(--shadow); margin-bottom: 14px;
}
.card-title {
  font-size: 15px; font-weight: 600; color: var(--ink);
  margin-bottom: 14px; display: flex; align-items: center; gap: 8px;
}

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px; padding: 11px 22px; border-radius: var(--radius-sm);
  border: none; cursor: pointer; font-family: inherit;
  font-size: 15px; font-weight: 500; text-decoration: none;
  transition: background .12s, transform .08s;
  white-space: nowrap; -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(.97); }
.btn:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }

.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-dark); }
.btn-danger  { background: var(--red); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-success { background: var(--green); color: #fff; }
.btn-success:hover { background: #15803d; }
.btn-ghost   { background: transparent; color: var(--ink); border: 1.5px solid var(--line); }
.btn-ghost:hover { background: var(--bg); }

.btn-sm   { padding: 7px 14px; font-size: 13px; border-radius: 7px; }
.btn-lg   { padding: 15px 28px; font-size: 17px; }
.btn-xl   { padding: 20px 32px; font-size: 20px; font-weight: 600; border-radius: var(--radius); }
.btn-full { width: 100%; }

/* ── Forms ── */
.field { margin-bottom: 14px; }
.field label {
  display: block; font-size: 13px; font-weight: 500;
  color: var(--ink-2); margin-bottom: 5px;
}
.field input,
.field select,
.field textarea {
  width: 100%; padding: 11px 13px;
  border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  font-family: inherit; font-size: 15px; color: var(--ink);
  background: var(--white); transition: border-color .12s; appearance: none;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(27,79,216,.12);
}
.field textarea { resize: vertical; min-height: 80px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-inline { display: flex; gap: 8px; }
.field-inline input { flex: 1; }

/* ── Badge ── */
.badge { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 12px; font-weight: 500; }
.badge-amber { background: var(--amber-light); color: var(--amber); }

/* ── Alert flash ── */
.alert-flash {
  padding: 11px 15px; border-radius: var(--radius-sm);
  font-size: 14px; margin-bottom: 14px;
  display: flex; align-items: center; gap: 8px;
}
.alert-flash.error   { background: var(--red-light);   color: #991B1B; border: 1px solid #FCA5A5; }
.alert-flash.success { background: var(--green-light);  color: #166534; border: 1px solid #86EFAC; }
.alert-flash.info    { background: var(--blue-light);   color: #1E40AF; border: 1px solid #93C5FD; }

/* ── Video ── */
.video-box {
  background: #0F172A; border-radius: var(--radius);
  overflow: hidden; position: relative; aspect-ratio: 4/3;
}
.video-box video { width: 100%; height: 100%; object-fit: cover; display: block; }
.video-label {
  position: absolute; bottom: 8px; left: 10px;
  background: rgba(0,0,0,.55); color: #fff; font-size: 11px;
  padding: 3px 8px; border-radius: 5px; pointer-events: none;
}
.video-err {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  color: rgba(255,255,255,.6); font-size: 14px; gap: 8px; padding: 16px;
}
.video-err .icon { font-size: 36px; }

/* ── Activity log ── */
.log-box {
  max-height: 220px; overflow-y: auto;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: #F8FAFC;
}
.log-item {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 9px 13px; border-bottom: 1px solid var(--line); font-size: 13px;
}
.log-item:last-child { border-bottom: none; }
.log-time { color: var(--ink-3); font-size: 11px; white-space: nowrap; padding-top: 2px; }

/* ── Connection banner ── */
.conn-banner {
  padding: 10px 16px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 500;
  display: flex; align-items: center; gap: 8px; margin-bottom: 14px;
}
.conn-banner.waiting { background: #FFFBEB; color: #92400E; border: 1px solid #FCD34D; }
.conn-banner.live    { background: var(--green-light); color: #166534; border: 1px solid #86EFAC; }
.conn-banner.ended   { background: var(--red-light); color: #991B1B; border: 1px solid #FCA5A5; }

/* ── SOS banner ── */
.sos-banner {
  background: var(--red); color: #fff;
  padding: 14px 18px; border-radius: var(--radius-sm);
  font-weight: 600; font-size: 15px;
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 14px; animation: pulse-border 1s infinite;
}
@keyframes pulse-border {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220,38,38,.5); }
  50%       { box-shadow: 0 0 0 8px rgba(220,38,38,0); }
}

/* ── Profile info tiles ── */
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.info-tile {
  background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 12px;
}
.info-tile .label { font-size: 11px; font-weight: 500; color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; }
.info-tile .value { font-size: 17px; font-weight: 600; margin-top: 2px; }

/* ── Quick phrase chips ── */
.phrase-strip { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.phrase-chip {
  padding: 8px 14px; background: var(--white);
  border: 1.5px solid var(--line); border-radius: 20px;
  cursor: pointer; font-family: inherit; font-size: 13px;
  font-weight: 500; color: var(--ink-2);
  transition: background .1s, border-color .1s;
}
.phrase-chip:hover { background: var(--blue-light); border-color: var(--blue); color: var(--blue); }

/* ── Room ID display ── */
.room-display {
  background: var(--ink); color: #fff; border-radius: var(--radius-sm);
  padding: 16px 20px; font-family: 'DM Mono', monospace;
  font-size: 28px; font-weight: 500; letter-spacing: 6px;
  text-align: center; margin: 10px 0;
}

/* ── Auth (index.html) ── */
.auth-shell {
  min-height: 100vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; padding: 24px 16px;
}
.auth-card {
  background: var(--white); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 32px 28px;
  width: 100%; max-width: 420px; box-shadow: var(--shadow);
}
.brand { text-align: center; margin-bottom: 24px; }
.brand-logo { font-size: 40px; margin-bottom: 8px; }
.brand .name { font-size: 22px; font-weight: 700; }
.brand .desc { font-size: 14px; color: var(--ink-3); margin-top: 2px; }

.tabs { display: flex; border-bottom: 2px solid var(--line); margin-bottom: 20px; }
.tab {
  flex: 1; padding: 10px; text-align: center; cursor: pointer;
  font-weight: 500; color: var(--ink-3); border: none; background: none;
  font-family: inherit; font-size: 15px;
  border-bottom: 2px solid transparent; margin-bottom: -2px;
}
.tab.active { color: var(--blue); border-bottom-color: var(--blue); }

.role-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.role-tile {
  border: 2px solid var(--line); border-radius: var(--radius-sm);
  padding: 14px 10px; text-align: center; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.role-tile.active { border-color: var(--blue); background: var(--blue-light); }
.role-tile .ico  { font-size: 28px; margin-bottom: 4px; }
.role-tile .name { font-size: 14px; font-weight: 600; }
.role-tile .desc { font-size: 12px; color: var(--ink-3); margin-top: 2px; }

@media (max-width: 600px) {
  .field-row { grid-template-columns: 1fr; }
  .g2 { grid-template-columns: 1fr; }
}
