/* Screenbird Screen Mirror - sender page */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #0d1117;
  --surface: #161b22;
  --border: #2d333b;
  --text: #e6edf3;
  --text-muted: #9198a1;
  --accent: #2f81f7;
  --accent-hover: #1f6feb;
  --danger: #da3633;
  --ok: #3fb950;
}

html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: radial-gradient(1200px 800px at 50% -10%, #16202e 0%, var(--bg) 55%);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.wrap { width: 100%; max-width: 460px; }

.brand { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 28px; }
.brand-mark { width: 28px; height: 28px; border-radius: 8px; background: linear-gradient(135deg, var(--accent), #7ee787); }
.brand-name { font-size: 18px; font-weight: 700; letter-spacing: 0.2px; }

.card {
  display: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 36px 32px;
  text-align: center;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}
.card h1 { font-size: 22px; font-weight: 650; margin-bottom: 8px; }
.muted { color: var(--text-muted); font-size: 14.5px; line-height: 1.55; }
.hint { color: var(--text-muted); font-size: 12.5px; line-height: 1.5; margin-top: 10px; }

/* state machine: toon secties op basis van body[data-state] */
body[data-state="unsupported"] [data-show~="unsupported"],
body[data-state="enter-code"] [data-show~="enter-code"],
body[data-state="connecting"] [data-show~="connecting"],
body[data-state="ready"] [data-show~="ready"],
body[data-state="sharing"] [data-show~="sharing"],
body[data-state="ended"] [data-show~="ended"],
body[data-state="error"] [data-show~="error"] { display: block; }

#code-form { display: flex; flex-direction: column; gap: 14px; margin-top: 22px; }
.code-input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font-family: "SF Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 34px;
  font-weight: 700;
  letter-spacing: 0.42em;
  text-align: center;
  text-transform: uppercase;
  padding: 14px 8px 14px calc(8px + 0.42em);
  outline: none;
}
.code-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(47, 129, 247, 0.25); }
.code-input::placeholder { color: #3d444d; }

.btn {
  border: 0; border-radius: 12px; cursor: pointer;
  font-size: 15.5px; font-weight: 600; color: #fff;
  padding: 13px 22px; transition: background 0.15s ease, transform 0.05s ease;
}
.btn:active { transform: scale(0.985); }
.btn-primary { background: var(--accent); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled { background: #30363d; color: #768390; cursor: not-allowed; }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #b62324; }
.btn-lg { font-size: 17px; padding: 15px 26px; width: 100%; margin-top: 18px; }

.error-line { color: #ff7b72; font-size: 13.5px; margin-top: 12px; line-height: 1.5; }

.icon-big { font-size: 40px; margin-bottom: 12px; }
.icon-big.ok { color: var(--ok); }

.audio-row {
  display: flex; align-items: center; justify-content: center; gap: 9px;
  margin-top: 20px; font-size: 14.5px; color: var(--text); cursor: pointer; user-select: none;
}
.audio-row input { width: 17px; height: 17px; accent-color: var(--accent); cursor: pointer; }

.live-row { display: flex; align-items: center; justify-content: center; gap: 9px; font-size: 14.5px; font-weight: 600; margin-bottom: 16px; }
.live-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

#preview {
  width: 100%; aspect-ratio: 16 / 9; background: #000;
  border-radius: 10px; border: 1px solid var(--border); object-fit: contain; margin-bottom: 16px;
}

.spinner {
  width: 34px; height: 34px; margin: 6px auto 18px;
  border: 3px solid var(--border); border-top-color: var(--accent);
  border-radius: 50%; animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

#debug-overlay {
  position: fixed; left: 10px; bottom: 10px; z-index: 99;
  background: rgba(0, 0, 0, 0.78); border: 1px solid var(--border); border-radius: 8px;
  color: #7ee787; font: 11px/1.5 ui-monospace, Menlo, monospace;
  padding: 8px 10px; white-space: pre; pointer-events: none;
}
