/* jharaka: home, manage and send pages (the OBS page has its own, transparent stylesheet) */
:root {
  color-scheme: dark;
  --bg: #0d0f13;
  --surface: #161920;
  --surface-2: #1e222b;
  --border: #2b303c;
  --text: #e8eaef;
  --muted: #9aa2b3;
  --accent: #7091ff;
  --accent-hover: #87a2ff;
  --on-accent: #0b0d12;
  --live: #ff4d5e;
  --ok: #34d399;
  --warn: #f5b041;
  --radius: 12px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 var(--font);
}
[hidden] { display: none !important; }

.wrap { max-width: 680px; margin: 0 auto; padding: 20px 16px 48px; }

header.top { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.brand { font-weight: 700; font-size: 20px; letter-spacing: -0.01em; color: var(--text); text-decoration: none; }
.brand span { color: var(--accent); }
.crumb { color: var(--muted); font-size: 15px; overflow-wrap: anywhere; }

h1 { font-size: 24px; line-height: 1.25; margin: 0 0 6px; }
h2 { font-size: 17px; margin: 0 0 12px; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }

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

label { display: block; font-size: 14px; color: var(--muted); margin: 0 0 6px; }
.field { margin-bottom: 14px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 520px) { .grid2 { grid-template-columns: 1fr; } }

input[type="text"], input[type="password"], select {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 9px;
  font: inherit;
}
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
input[readonly] { font: 13px var(--mono); color: var(--muted); }

.check { display: flex; gap: 10px; align-items: flex-start; color: var(--text); font-size: 15px; cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 3px 0 0; accent-color: var(--accent); flex: none; }
.check small { display: block; color: var(--muted); font-size: 13px; }

button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 18px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  touch-action: manipulation;
}
button:hover { border-color: #3a4152; }
button:disabled { opacity: 0.5; cursor: default; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
button.primary:hover { background: var(--accent-hover); }
button.live, .button.live { background: var(--live); border-color: var(--live); color: #fff; }
button.small { min-height: 34px; padding: 6px 12px; font-size: 14px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.actions .grow { flex: 1 1 auto; }

.msg {
  padding: 12px 14px;
  border-radius: 9px;
  margin: 12px 0;
  font-size: 15px;
  background: #3a1d22;
  border: 1px solid #6b2a33;
  color: #ffd6da;
}
.msg.info { background: #1b2540; border-color: #2f3f6e; color: #d7e0ff; }

/* status pill: a dot and a short text */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 11px;
  border-radius: 999px;
  background: rgba(13, 15, 19, 0.78);
  border: 1px solid var(--border);
  font-size: 14px;
  font-weight: 600;
}
.pill::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--muted); }
.pill.live::before { background: var(--live); box-shadow: 0 0 0 3px rgba(255, 77, 94, 0.25); }
.pill.ok::before { background: var(--ok); }
.pill.warn::before { background: var(--warn); }

/* send page preview */
.stage {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 16px;
  border: 1px solid var(--border);
}
.stage video { width: 100%; height: 100%; object-fit: contain; display: block; }
.stage video.mirror { transform: scaleX(-1); }
.stage .pill { position: absolute; top: 12px; left: 12px; }
.stage .empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 15px;
  text-align: center;
  padding: 16px;
}

/* manage page */
.slot { border-top: 1px solid var(--border); padding-top: 16px; margin-top: 16px; }
.slot:first-of-type { border-top: 0; padding-top: 0; margin-top: 0; }
.slot-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.slot-head h2 { margin: 0; }
.linkrow { display: flex; gap: 8px; margin-bottom: 10px; }
.linkrow input { flex: 1; min-width: 0; }
.linkrow button { flex: none; }
ol.steps { margin: 0; padding-left: 22px; }
ol.steps li { margin-bottom: 6px; }
code { font: 14px var(--mono); background: var(--surface-2); padding: 1px 6px; border-radius: 5px; }

/* room codes */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.joinrow { display: flex; gap: 8px; flex-wrap: wrap; }
.joinrow input { flex: 1 1 160px; min-width: 0; }
.joinrow button { flex: none; }
input.codeinput {
  font: 700 20px var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
input.codeinput::placeholder { letter-spacing: 0.06em; font-weight: 600; }
.bigcode {
  font: 700 44px/1.1 var(--mono);
  letter-spacing: 0.16em;
  color: var(--accent);
  margin: 4px 0 10px;
  overflow-wrap: anywhere;
}
.hint { margin: 6px 0 0; }
.remember { margin-top: 10px; }
.mono { font-family: var(--mono); letter-spacing: 0.08em; }
button.link {
  min-height: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font-weight: 600;
  text-decoration: underline;
}
button.danger { color: #ffd6da; border-color: #6b2a33; background: #3a1d22; }
button.danger:hover { border-color: var(--live); }
details { margin: 4px 0 10px; }
summary { cursor: pointer; margin-bottom: 8px; }
.addcam { align-items: center; margin: 16px 0; }

/* manage page: cams in a grid that follows how many there are, each with a live preview */
.wrap.wide { max-width: 1120px; }
.wrap.wide .card { max-width: 820px; }
.camsbar { display: flex; align-items: baseline; gap: 6px 14px; flex-wrap: wrap; margin: 24px 0 12px; }
.camsbar h2 { margin: 0; font-size: 20px; }
.cams { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
.cams.n1 { max-width: 820px; }
.cams.n2, .cams.n3, .cams.n4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 860px) { .cams.n2, .cams.n3, .cams.n4 { grid-template-columns: minmax(0, 1fr); } }
.cam { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; min-width: 0; }
.cam.mine { border-color: #34467a; }
.cam .slot-head { margin-bottom: 10px; }
.cam .slot-head h2 { font-size: 16px; }
.preview { position: relative; aspect-ratio: 16 / 9; background: #000; border-radius: 9px; overflow: hidden; margin-bottom: 12px; }
.preview iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.preview .off {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 12px;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
  pointer-events: none;
}
.preview .pill { position: absolute; top: 10px; left: 10px; }
.preview .previewtoggle {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(13, 15, 19, 0.78);
  border-radius: 999px;
}
.preview .previewtoggle[aria-pressed="false"] { color: var(--muted); }
.cam .mycam { margin: 0 0 12px; }

/* home page room list */
ul.rooms { list-style: none; margin: 0; padding: 0; }
ul.rooms li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-top: 1px solid var(--border); }
ul.rooms li:first-child { border-top: 0; }
ul.rooms a { color: var(--text); font-weight: 600; overflow-wrap: anywhere; }

/* the host's own cam on the manage page */
.slot.mine h2 { color: var(--accent); }
.mycam { margin-bottom: 4px; }
.mirroropt { margin: 2px 0 12px; }
