/* TRAC Live — simple, solid colours, no gradients, no oval buttons. */
:root {
  --magenta: rgb(145, 6, 63);
  --magenta-dark: rgb(115, 4, 49);
  --magenta-light: #f6e6ed;
  --gold: #D4A017;
  --plum: #2A0B1F;
  --plum-2: #3a1630;
  --plum-3: #4b2140;
  --page: #eeeef0;
  --card: #ffffff;
  --text: #1c1c1e;
  --muted: #55555c;
  --line: #d6d6db;
  --ok: #1d6b3a;
  --danger: #a3141c;
  --radius: 4px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { background: var(--page); color: var(--text); font: 16px/1.45 "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
a { color: var(--magenta); }
h1 { font-size: 1.5rem; margin: 0 0 16px; }
h2 { font-size: 1.15rem; margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.hidden { display: none !important; }

/* ---------- top bar ---------- */
.topbar { background: var(--card); border-bottom: 3px solid var(--magenta); }
.topbar .in { max-width: 1100px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.brand { font-weight: 700; font-size: 1.2rem; color: var(--magenta); text-decoration: none; letter-spacing: .02em; }
.brand span { color: var(--text); font-weight: 600; }
.brand i { display: inline-block; width: 10px; height: 10px; background: var(--gold); margin-right: 8px; vertical-align: 1px; }
.nav { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; flex: 1; }
.nav a { color: var(--text); text-decoration: none; font-weight: 600; font-size: .95rem; }
.nav a:hover { color: var(--magenta); }
.nav .right { margin-left: auto; display: flex; gap: 12px; align-items: center; }
.nav form { margin: 0; }

.page { max-width: 1100px; margin: 0 auto; padding: 24px 16px 48px; }
.narrow { max-width: 460px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; }

/* ---------- forms ---------- */
label { display: block; font-weight: 600; font-size: .9rem; margin: 12px 0 4px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=datetime-local], input[type=date], input[type=time], select, textarea {
  width: 100%; padding: 10px 12px; font: inherit; color: var(--text); background: #fff; border: 1px solid #b9b9c0; border-radius: var(--radius);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--magenta); outline-offset: 0; border-color: var(--magenta); }
.check { display: flex; gap: 8px; align-items: center; font-weight: 600; margin-top: 12px; }
.check input { width: 18px; height: 18px; accent-color: var(--magenta); }
.hint { font-size: .82rem; color: var(--muted); margin-top: 4px; }
.errors { background: #fbe9ea; color: var(--danger); border: 1px solid #efc2c5; padding: 10px 12px; border-radius: var(--radius); margin-bottom: 12px; }
.errors ul { margin: 0; padding-left: 18px; }
.notice { background: var(--magenta-light); border-left: 4px solid var(--magenta); padding: 10px 12px; border-radius: var(--radius); margin-bottom: 12px; }

/* ---------- buttons: solid, square corners ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 18px; font: inherit; font-weight: 600;
  border: 1px solid var(--magenta); border-radius: var(--radius); background: var(--magenta); color: #fff; cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--magenta-dark); border-color: var(--magenta-dark); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.secondary { background: #fff; color: var(--magenta); }
.btn.secondary:hover { background: var(--magenta-light); }
.btn.danger { background: var(--danger); border-color: var(--danger); }
.btn.small { padding: 6px 10px; font-size: .85rem; }
.btn.block { width: 100%; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row.end { justify-content: flex-end; }
.mt { margin-top: 16px; }

/* ---------- lists / tables ---------- */
table.list { width: 100%; border-collapse: collapse; background: #fff; }
table.list th, table.list td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.list th { font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.tag { display: inline-block; font-size: .75rem; font-weight: 700; padding: 2px 6px; border-radius: 3px; background: #ececf0; color: var(--text); }
.tag.live { background: var(--magenta); color: #fff; }
.tag.gold { background: var(--gold); color: #1c1c1e; }
.copybox { display: flex; gap: 8px; }
.copybox input { font-family: ui-monospace, Consolas, monospace; font-size: .9rem; }

@media (max-width: 640px) {
  .topbar .in { gap: 6px 14px; padding: 8px 12px; }
  .nav { flex: 1 1 100%; flex-wrap: nowrap; overflow-x: auto; gap: 14px; padding-bottom: 2px; }
  .nav a { white-space: nowrap; font-size: .9rem; }
  .nav .right .small { display: none; }
  .page { padding: 16px 12px 40px; }
  .card { padding: 16px; }
  table.list.stack thead { display: none; }
  table.list.stack tr { display: block; border-bottom: 1px solid var(--line); padding: 8px 0; }
  table.list.stack td { display: block; border: none; padding: 3px 8px; }
  table.list.stack td[data-label]::before { content: attr(data-label) ": "; font-weight: 600; color: var(--muted); }
  .copybox { flex-direction: column; }
}

/* =================== ROOM =================== */
body.room-body { background: var(--plum); color: #fff; height: 100vh; height: 100dvh; overflow: hidden; }
.room { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
.room-top { display: flex; align-items: center; gap: 12px; padding: 8px 14px; background: var(--plum-2); border-bottom: 2px solid var(--magenta); min-height: 48px; }
.room-top .title { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.room-top .pill { font-size: .78rem; font-weight: 700; padding: 3px 8px; border-radius: 3px; background: var(--plum-3); color: #fff; white-space: nowrap; }
.room-top .pill.gold { background: var(--gold); color: #1c1c1e; }
.room-top .pill.rec { background: var(--danger); }
.room-main { flex: 1; display: flex; min-height: 0; }
.stage-wrap { flex: 1; display: flex; flex-direction: column; min-width: 0; padding: 10px; gap: 10px; }
.screen-area { flex: 1; min-height: 0; background: #000; border-radius: var(--radius); position: relative; display: flex; align-items: center; justify-content: center; }
.screen-area video { width: 100%; height: 100%; object-fit: contain; }
.screen-area .label { position: absolute; left: 8px; top: 8px; }
.grid { flex: 1; min-height: 0; display: grid; gap: 8px; align-content: center; justify-content: center; grid-auto-rows: 1fr; }
.grid.strip { flex: 0 0 120px; grid-auto-flow: column; grid-auto-columns: 180px; grid-auto-rows: 1fr; justify-content: start; overflow-x: auto; overflow-y: hidden; }
.tile { position: relative; background: var(--plum-2); border-radius: var(--radius); overflow: hidden; min-height: 0; aspect-ratio: 16/9; border: 2px solid transparent; }
.grid:not(.strip) .tile { width: 100%; max-height: 100%; align-self: center; justify-self: center; }
.tile.speaking { border-color: var(--gold); }
.tile video { width: 100%; height: 100%; object-fit: cover; display: block; background: #000; }
.tile video.mirror { transform: scaleX(-1); }
.tile .avatar { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.tile .avatar b { width: 64px; height: 64px; border-radius: 50%; background: var(--magenta); display: flex; align-items: center; justify-content: center; font-size: 1.6rem; font-weight: 700; }
.tile .label, .screen-area .label { position: absolute; left: 6px; bottom: 6px; background: rgba(20, 4, 14, .78); padding: 2px 8px; border-radius: 3px; font-size: .82rem; display: flex; gap: 6px; align-items: center; max-width: calc(100% - 12px); }
.tile .label span.n { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .hand { position: absolute; right: 6px; top: 6px; background: var(--gold); color: #1c1c1e; font-weight: 700; font-size: .78rem; padding: 2px 7px; border-radius: 3px; }
.ico { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.label .ico { width: 14px; height: 14px; }
.ico.off { color: #ff8a8a; }

.side { width: 340px; background: #fff; color: var(--text); display: flex; flex-direction: column; border-left: 1px solid #000; }
.side-head { display: flex; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--line); gap: 8px; }
.side-head h2 { margin: 0; flex: 1; font-size: 1rem; }
.side-body { flex: 1; overflow-y: auto; padding: 10px 12px; }
.side-foot { border-top: 1px solid var(--line); padding: 10px 12px; }
.xbtn { background: none; border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 10px; cursor: pointer; font-weight: 600; color: var(--text); }
.msg { margin-bottom: 10px; }
.msg .who { font-weight: 700; font-size: .85rem; }
.msg .who small { font-weight: 400; color: var(--muted); margin-left: 6px; }
.msg .txt { white-space: pre-wrap; word-wrap: break-word; }
.msg.me .who { color: var(--magenta); }
.chatform { display: flex; gap: 8px; }
.chatform input { flex: 1; }
.person { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid #eee; flex-wrap: wrap; }
.person .nm { flex: 1; font-weight: 600; min-width: 120px; }
.person .acts { display: flex; gap: 4px; flex-wrap: wrap; }
.section-title { font-size: .78rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin: 12px 0 4px; }

.controls { display: flex; justify-content: center; gap: 6px; padding: 8px; background: var(--plum-2); border-top: 1px solid #000; flex-wrap: nowrap; overflow-x: auto; }
.cbtn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-width: 72px; padding: 7px 8px; background: var(--plum-3); color: #fff;
  border: 1px solid transparent; border-radius: var(--radius); cursor: pointer; font: inherit; font-size: .74rem; font-weight: 600; position: relative; }
.cbtn:hover { background: #5c2a4f; }
.cbtn .ico { width: 22px; height: 22px; }
.cbtn.off { background: #5a1a22; }
.cbtn.on { background: var(--magenta); }
.cbtn.leave { background: var(--danger); }
.cbtn .lbl-s { display: none; }
.cbtn .badge { position: absolute; top: 3px; right: 6px; background: var(--gold); color: #1c1c1e; border-radius: 3px; font-size: .68rem; padding: 0 4px; }

.toast-area { position: fixed; left: 50%; top: 60px; transform: translateX(-50%); z-index: 50; display: flex; flex-direction: column; gap: 6px; align-items: center; width: min(92vw, 420px); }
.toast { background: #fff; color: var(--text); border-left: 4px solid var(--gold); padding: 10px 12px; border-radius: var(--radius); box-shadow: 0 2px 10px rgba(0,0,0,.35); width: 100%; display: flex; gap: 8px; align-items: center; }
.toast .t { flex: 1; }

/* lobby (before joining) */
.lobby { min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.lobby-card { background: #fff; color: var(--text); border-radius: var(--radius); width: min(100%, 860px); display: grid; grid-template-columns: 1.2fr 1fr; overflow: hidden; }
.lobby-card .preview { background: #000; position: relative; min-height: 260px; }
.lobby-card .preview video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); position: absolute; inset: 0; }
.lobby-card .preview .noprev { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #ccc; font-size: .95rem; padding: 12px; text-align: center; }
.lobby-card .preview .pbar { position: absolute; left: 0; right: 0; bottom: 10px; display: flex; justify-content: center; gap: 8px; }
.lobby-card .form { padding: 22px; }
.lobby-card .brand-line { font-size: .8rem; font-weight: 700; color: var(--magenta); letter-spacing: .05em; text-transform: uppercase; }
.lobby-card h1 { margin: 4px 0 6px; }
.waiting-box { text-align: center; padding: 24px 8px; }
.spinner { width: 34px; height: 34px; border: 4px solid var(--magenta-light); border-top-color: var(--magenta); border-radius: 50%; animation: spin 1s linear infinite; margin: 0 auto 14px; }
@keyframes spin { to { transform: rotate(360deg); } }
.ended { min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.ended .card { color: var(--text); max-width: 420px; width: 100%; text-align: center; }

@media (max-width: 760px) {
  .lobby-card { grid-template-columns: 1fr; }
  .lobby-card .preview { min-height: 220px; aspect-ratio: 4/3; }
  .side { position: fixed; inset: 0; width: auto; z-index: 40; }
  .controls { gap: 4px; padding: 6px 4px; }
  .cbtn { min-width: 0; flex: 1 1 0; padding: 6px 2px; font-size: .68rem; }
  .cbtn .ico { width: 20px; height: 20px; }
  .cbtn .lbl-l { display: none; }
  .cbtn .lbl-s { display: inline; }
  .grid.flow { align-content: safe center; grid-auto-rows: auto; overflow-y: auto; }
  .grid.flow .tile { aspect-ratio: 4/3; max-height: none; }
  .grid.flow.strip { grid-auto-rows: 1fr; overflow-y: hidden; }
  .grid.flow.strip .tile { aspect-ratio: 16/9; }
  .toast { font-size: .9rem; padding: 8px 10px; }
  .grid.strip { flex-basis: 90px; grid-auto-columns: 130px; }
  .room-top .pill.opt { display: none; }
  .stage-wrap { padding: 6px; gap: 6px; }
}

/* webinar */
.lobby-card.solo { grid-template-columns: 1fr; width: min(100%, 480px); }
.qa { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; margin-bottom: 10px; }
.qa .q { font-weight: 600; white-space: pre-wrap; word-wrap: break-word; }
.qa .meta { font-size: .78rem; color: var(--muted); margin-bottom: 4px; }
.qa .a { margin-top: 8px; padding: 8px; background: var(--magenta-light); border-left: 3px solid var(--magenta); white-space: pre-wrap; word-wrap: break-word; }
.qa .a b { display: block; font-size: .78rem; color: var(--magenta); }
.qa.open { border-left: 4px solid var(--gold); }
.qa form { display: flex; gap: 6px; margin-top: 8px; }
.qa form input { flex: 1; padding: 6px 8px; }
.invite-box { position: fixed; inset: 0; background: rgba(20,4,14,.7); display: flex; align-items: center; justify-content: center; z-index: 60; padding: 16px; }
.invite-box .card { color: var(--text); max-width: 420px; width: 100%; text-align: center; }

/* buttons inside the top menu keep their own text colour */
.nav a.btn { color: #fff; }
.nav a.btn:hover { color: #fff; }
.nav a.btn.secondary { color: var(--magenta); }
