:root {
  color-scheme: dark;
  font-family: system-ui, sans-serif;
  color: #f2f6fc;
  background: #101b2b;
  --muted: #a9bad0;
  --line: #324960;
  --surface: #192a3d;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body { margin: 0; }
main {
  width: min(100%, 660px);
  margin-inline: auto;
  padding: max(20px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}

.header { display: flex; align-items: center; gap: 12px; }
.header img { border-radius: 12px; }
.header h1 { margin: 0; font-size: 1.45rem; }
.header p, #access-help { color: var(--muted); }
.header p { margin: 3px 0 0; font-size: .87rem; }

.status { display: flex; align-items: center; gap: 9px; margin: 16px 0 12px; line-height: 1.4; }
.status::before { content: ''; width: 9px; height: 9px; flex: none; border-radius: 50%; background: var(--muted); }
.status[data-phase="connecting"]::before { background: #ffcd78; }
.status[data-phase="connected"]::before { background: #66e3cd; }
.status[data-phase="error"]::before { background: #ff9999; }

.card, .text-form { padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: 15px; }
form { display: grid; gap: 8px; }
form label { font-size: .95rem; font-weight: 600; }
form label:not(:first-child) { margin-top: 7px; }
form p { margin: 0 0 7px; font-size: .85rem; }

input, textarea, button { border: 1px solid var(--line); border-radius: 9px; font: inherit; }
input, textarea { width: 100%; background: #101b2b; color: inherit; padding: 11px 12px; font-size: 1rem; }
button { min-height: 44px; padding: 7px; cursor: pointer; background: var(--surface); color: inherit; font-weight: 600; }
button:disabled { opacity: .52; cursor: default; }
:focus-visible { outline: 2px solid #74e5d4; outline-offset: 3px; }
.primary { background: #76dece; color: #0b2426; border-color: transparent; }
.stop { color: #ffd2d2; }

.screen {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #080e18;
}

video {
  display: block;
  width: 100%;
  height: min(66vh, 680px);
  height: min(66dvh, 680px);
  object-fit: contain;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

video[data-interactive="true"] { touch-action: none; cursor: crosshair; }
.play { position: absolute; inset: 50% auto auto 50%; padding-inline: 14px; transform: translate(-50%, -50%); white-space: nowrap; }
.controls { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; margin-block: 10px; }
.controls button { font-size: .86rem; }

@media (orientation: landscape) and (max-height: 560px) {
  video { height: min(57vh, 400px); height: min(57dvh, 400px); }
}
