/* B-Call pages: mobile first, one column. */
:root {
  --bg: #f4f5f7;
  --fg: #16181d;
  --muted: #5d6470;
  --card: #ffffff;
  --line: #d9dde3;
  --accent: #1f6feb;
  --danger: #c93c37;
  --ok: #1f8f4e;
  --warn: #b8860b;
  --call-bg: #0f1115;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--fg);
  background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
main { max-width: 640px; margin: 0 auto; padding: 24px 16px 48px; }
h1 { font-size: 1.5rem; margin: 0 0 16px; }
h2 { font-size: 1.1rem; margin: 24px 0 8px; }
p { line-height: 1.5; }
.muted { color: var(--muted); font-size: 0.9rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-bottom: 12px; }
label { display: block; font-weight: 600; margin: 12px 0 4px; }
input, select { width: 100%; font-size: 1rem; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
button { font-size: 1rem; padding: 10px 16px; border-radius: 8px; border: 1px solid var(--line); background: #fff; cursor: pointer; }
button.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
button.danger { background: var(--danger); color: #fff; border-color: var(--danger); }
button:disabled { opacity: 0.5; cursor: default; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 12px; }
.error { color: var(--danger); min-height: 1.2em; }
.invite { font-family: ui-monospace, Menlo, monospace; font-size: 0.85rem; word-break: break-all; background: var(--bg); padding: 8px; border-radius: 6px; }
.badge { display: inline-block; font-size: 0.8rem; padding: 2px 8px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); }
[hidden] { display: none !important; }

/* Call view */
.call { position: fixed; inset: 0; background: var(--call-bg); color: #fff; display: flex; flex-direction: column; }
.stage { position: relative; flex: 1; overflow: hidden; }
.tile { position: absolute; background: #1b1e25; overflow: hidden; }
.tile video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.tile.remote { inset: 0; }
.tile.local { width: 28%; max-width: 220px; aspect-ratio: 3 / 4; right: 12px; bottom: 12px; border-radius: 10px; border: 2px solid rgba(255, 255, 255, 0.4); }
.tile.local video { object-fit: cover; transform: scaleX(-1); }
.tile .label { position: absolute; left: 8px; bottom: 8px; background: rgba(0, 0, 0, 0.6); padding: 4px 8px; border-radius: 6px; font-size: 0.85rem; display: flex; gap: 6px; align-items: center; }
.tile .placeholder { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #aab; font-size: 1.1rem; text-align: center; padding: 16px; }
.quality { font-size: 0.75rem; padding: 1px 6px; border-radius: 4px; background: rgba(255, 255, 255, 0.15); }
.quality.excellent, .quality.good { color: #7ee2a8; }
.quality.poor { color: #ffd166; }
.quality.lost { color: #ff7b72; }
.banner { position: absolute; left: 50%; top: 12px; transform: translateX(-50%); background: rgba(0, 0, 0, 0.75); padding: 8px 14px; border-radius: 8px; z-index: 2; text-align: center; }
.controls { display: flex; justify-content: center; gap: 12px; padding: 12px 12px calc(12px + env(safe-area-inset-bottom)); background: #15181e; }
.controls button { min-width: 64px; background: #2a2f3a; color: #fff; border-color: #3a404d; }
.controls button.off { background: var(--danger); border-color: var(--danger); }
.controls button.danger { background: var(--danger); border-color: var(--danger); }
.controls button.icon { width: 56px; height: 56px; min-width: 0; padding: 0; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; }
.controls button.icon svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.controls button.icon svg.filled { fill: currentColor; stroke-width: 1; }
.controls button.icon.hearts svg { fill: #ff4d6d; stroke: none; }

/* Hearts sent during the call (seen in the recording too) */
.effects { position: absolute; inset: 0; z-index: 3; pointer-events: none; overflow: hidden; }
.heart { position: absolute; bottom: -10%; animation: heart_rise 2.6s ease-out forwards; }
.heart svg { width: 100%; height: 100%; fill: #ff4d6d; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5)); }
@keyframes heart_rise {
  0% { transform: translateY(0) scale(0.5); opacity: 0; }
  12% { opacity: 1; }
  100% { transform: translateY(-95vh) scale(1.1) rotate(10deg); opacity: 0; }
}

/* Calls page and link page */
label.check { display: flex; gap: 8px; align-items: center; font-weight: 600; }
label.check input { width: auto; }
.link { margin-top: 12px; }
.link h3 { font-size: 1rem; margin: 12px 0 4px; }
.notice { white-space: pre-line; line-height: 1.5; background: var(--bg); border-left: 4px solid var(--warn); padding: 12px; border-radius: 6px; margin-bottom: 8px; }
.record_notice { position: absolute; left: 12px; top: 12px; z-index: 2; background: rgba(201, 60, 55, 0.85); padding: 6px 10px; border-radius: 6px; font-size: 0.8rem; max-width: 60%; }

/* Whiteboard */
textarea { width: 100%; font-size: 1rem; font-family: ui-monospace, Menlo, monospace; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; resize: vertical; }
.invite a { color: var(--accent); word-break: break-all; }
.record_notice.active { background: rgba(201, 60, 55, 1); font-weight: 600; }

/* Call counter */
.call_timer { position: absolute; right: 12px; top: 12px; z-index: 2; background: rgba(0, 0, 0, 0.6); padding: 6px 10px; border-radius: 6px; font-size: 1rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.call_timer.waiting { opacity: 0.6; font-weight: 400; }
.call_timer.ending { background: var(--danger); }
