:root {
  --bg: #111;
  --fg: #eee;
  --muted: #999;
  --card: #1e1e1e;
  --accent: #e50914;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--fg); font: 16px/1.4 system-ui, sans-serif; }
#home { max-width: 640px; margin: 0 auto; padding: 24px 16px; }
h1 { font-size: 1.4rem; margin: 0 0 4px; }
#status { color: var(--muted); margin: 0 0 20px; }
#status.warn { color: #f5a524; }
#cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.card {
  background: var(--card); color: var(--fg); border: 1px solid #333; border-radius: 12px;
  padding: 28px 12px; font-size: 1.1rem; font-weight: 600; cursor: pointer;
}
.card:hover:not(:disabled), .card:focus-visible { border-color: var(--accent); outline: none; }
.card:disabled { opacity: .5; cursor: default; }
/* iOS web apps can stop a fixed inset:0 box short of the bottom edge; size it to the large viewport instead */
#player { position: fixed; top: 0; left: 0; width: 100%; height: 100vh; height: 100lvh; background: #000; overflow: hidden; }
body:has(#player:not([hidden])) { background: #000; }
#player[hidden] { display: none; }
/* video uses the whole viewport (contain keeps aspect, no crop); controls float on top */
/* safe areas keep the video clear of the iPhone status bar, notch and Dynamic Island */
#screen {
  position: absolute; top: env(safe-area-inset-top); left: env(safe-area-inset-left);
  width: calc(100% - env(safe-area-inset-left) - env(safe-area-inset-right));
  height: calc(100% - env(safe-area-inset-top)); /* the home indicator may sit over the video */
  object-fit: contain; touch-action: none;
}
#bar {
  position: absolute; left: 50%; bottom: calc(12px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  display: flex; gap: 8px; padding: 6px; border-radius: 12px; background: rgba(0, 0, 0, .55);
  transition: opacity .3s;
}
#bar.faded { opacity: 0; pointer-events: none; }
#bar button { background: rgba(255, 255, 255, .12); color: var(--fg); border: 0; border-radius: 8px; padding: 10px 16px; font-size: 1rem; white-space: nowrap; }
#login { display: grid; gap: 12px; max-width: 320px; }
#login input { padding: 12px; font-size: 1rem; border-radius: 8px; border: 1px solid #333; background: var(--card); color: var(--fg); }
.warn { color: #f5a524; margin: 0; }
#home { padding-top: max(24px, env(safe-area-inset-top)); }
