/* =====================================================
   INTERPRETED ROOMS — prototype styles
   ===================================================== */

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

:root {
  --bg:       #f4f5f7;
  --surface:  #ffffff;
  --surface2: #eef0f4;
  --border:   #d9dde5;
  --text:     #1b1f27;
  --muted:    #626a7a;
  --accent:   #2456d6;
  --live:     #d92c2c;
  --ok:       #1f9d55;
  --radius:   10px;
  --font:     system-ui, -apple-system, 'Segoe UI', 'Hiragino Sans', 'Noto Sans JP', sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:       #0f1117;
    --surface:  #1a1d27;
    --surface2: #232738;
    --border:   #2e3347;
    --text:     #e8eaf0;
    --muted:    #8a93a8;
    --accent:   #5b8cff;
  }
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
}

[hidden] { display: none !important; }

h1 { font-size: 1.4rem; }
h2 { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 10px; }
.muted { color: var(--muted); }
.small { font-size: .8rem; }

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

label { display: block; font-size: .85rem; font-weight: 600; }
input:not([type=radio]):not([type=range]), select {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface2);
  color: var(--text);
  font: inherit;
  font-weight: 400;
}
input[type=range] { width: 100%; margin-top: 10px; }

.btn {
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn--primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn--danger  { background: var(--live); border-color: var(--live); color: #fff; }

/* ---- JOIN ---- */
.join {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}
.join__card { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 14px; }

.roles { border: none; display: flex; flex-direction: column; gap: 8px; }
.roles legend { font-size: .85rem; font-weight: 600; margin-bottom: 6px; }
.role {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; font-weight: 400;
}
.role:has(input:checked) { border-color: var(--accent); background: var(--surface2); }
.role span { display: flex; flex-direction: column; }
.role small, .channel small { color: var(--muted); font-size: .78rem; }

.hint { font-size: .8rem; color: var(--live); }
.error { color: var(--live); font-size: .85rem; min-height: 1.2em; }

/* ---- ROOM ---- */
.room { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 16px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.topbar__title { display: flex; align-items: center; gap: 10px; }
.topbar__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.badge {
  font-size: .75rem; padding: 2px 10px; border-radius: 20px;
  background: var(--surface2); border: 1px solid var(--border); color: var(--muted);
}

.room__body {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 16px;
  padding: 16px;
}

.stage { position: relative; min-height: 300px; }
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}
.empty { padding: 40px 0; text-align: center; }

.tile {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
}
.tile video { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile--novideo video { visibility: hidden; }
.tile--novideo::after {
  content: 'Camera off';
  position: absolute; inset: 0; display: grid; place-items: center; color: #aaa; font-size: .85rem;
}
.tile__name {
  position: absolute; left: 8px; bottom: 8px; z-index: 1;
  background: rgba(0,0,0,.6); color: #fff; font-size: .78rem; padding: 2px 8px; border-radius: 6px;
}

.panel { display: flex; flex-direction: column; gap: 12px; }

/* Language channels */
.channels { display: flex; flex-direction: column; gap: 6px; }
.channel {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; font-weight: 400;
}
.channel input { position: absolute; opacity: 0; pointer-events: none; }
.channel span:last-child { display: flex; flex-direction: column; }
.channel--active { border-color: var(--accent); background: var(--surface2); }
.channel__dot { width: 10px; height: 10px; border-radius: 50%; background: var(--border); flex-shrink: 0; }
.channel__dot--live { background: var(--ok); }
.channel:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Interpreter booth */
.booth { display: flex; flex-direction: column; gap: 12px; }
.onair {
  padding: 18px; border-radius: var(--radius); border: 2px solid var(--border);
  background: var(--surface2); color: var(--muted);
  font: inherit; font-size: 1.1rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
  cursor: pointer;
}
.onair--live { background: var(--live); border-color: var(--live); color: #fff; }

.people { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.people li { display: flex; justify-content: space-between; gap: 8px; font-size: .85rem; }
.people small { color: var(--muted); text-transform: capitalize; }

.audio-unlock { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); }

.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 8px; font-size: .85rem;
  opacity: 0; transition: opacity .2s, transform .2s; pointer-events: none; max-width: calc(100% - 32px);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 800px) {
  .room__body { grid-template-columns: 1fr; }
}
