:root {
  color-scheme: dark;
  --bg: #141414;
  --card: #232323;
  --text: #fff8e8;
  --muted: #d8d0c2;
  --green: #1b8f3a;
  --red: #c62828;
  --blue: #1565c0;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", sans-serif;
}

body {
  min-height: 100dvh;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

button, input, select {
  font: inherit;
  color: inherit;
}

button {
  border: 0;
  border-radius: 18px;
  cursor: pointer;
}

main {
  max-width: 880px;
  margin: 0 auto;
  padding: 16px;
}

h1 {
  font-size: 2rem;
  line-height: 1.15;
  margin: 0 0 8px;
}

.muted { color: var(--muted); }

.status {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.2rem;
  margin: 8px 0 18px;
}

.dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #c62828;
}

.dot.on { background: #43a047; }

.giant {
  width: 100%;
  min-height: 32dvh;
  font-size: 2.4rem;
  font-weight: 800;
  background: var(--green);
  color: white;
}

.giant:disabled {
  background: #555;
}

.notify {
  width: 100%;
  min-height: 64px;
  margin-top: 12px;
  font-size: 1.35rem;
  font-weight: 700;
  background: var(--blue);
  color: white;
}

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  min-height: 42dvh;
}

.split button {
  font-size: 2.2rem;
  font-weight: 800;
  color: white;
}

.yes { background: var(--green); }
.no { background: var(--red); }

.banner {
  background: #5d4037;
  border-radius: 16px;
  padding: 14px 16px;
  margin-bottom: 14px;
  font-size: 1.15rem;
}

#stage {
  position: fixed;
  inset: 0;
  background: black;
  display: flex;
  flex-direction: column;
}

#stage[hidden] { display: none; }

#remote {
  width: 100%;
  flex: 1;
  min-height: 0;
  object-fit: cover;
  background: #000;
}

#self {
  position: absolute;
  z-index: 3;
  top: 12px;
  right: 12px;
  width: 112px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#self[hidden] { display: none; }

#local {
  width: 112px;
  height: 150px;
  flex: none;
  object-fit: cover;
  border-radius: 14px;
  border: 2px solid #fff;
  background: #222;
}

#flip {
  min-height: 44px;
  border-radius: 12px;
  background: #1565c0;
  color: #fff;
  font-weight: 700;
}

#caption {
  position: absolute;
  left: 16px;
  right: 16px;
  top: 16px;
  text-align: center;
  font-size: 2rem;
  font-weight: 800;
  text-shadow: 0 2px 8px #000;
}

#caption.plate {
  padding: 22px 24px;
  background: #fff8e1;
  color: #111;
  border: 4px solid #111;
  border-radius: 20px;
  font-size: 3.4rem;
  line-height: 1.15;
  text-shadow: none;
}

#caption.plate:empty { display: none; }

.live-bar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  background: #111;
}

.phrases {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.phrases button, .live-bar input {
  background: #333;
  min-height: 56px;
  padding: 8px 12px;
  border-radius: 12px;
}

.live-bar input { flex: 1; }

.row { display: flex; gap: 8px; }

.hang {
  background: var(--red);
  color: white;
  font-size: 1.6rem;
  font-weight: 800;
  min-height: 72px;
}

.card {
  background: var(--card);
  border-radius: 16px;
  padding: 16px;
  margin: 12px 0;
}

label {
  display: block;
  margin: 10px 0;
}

input[type="text"], input[type="password"], input[type="number"], input[type="email"] {
  width: 100%;
  margin-top: 4px;
  min-height: 48px;
  border-radius: 10px;
  border: 0;
  padding: 8px 12px;
  background: #111;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.actions button, .save {
  background: var(--blue);
  color: white;
  min-height: 56px;
  padding: 8px 16px;
  font-weight: 700;
}

.link {
  word-break: break-all;
  font-size: 0.95rem;
}

img.shot {
  width: 100%;
  border-radius: 12px;
  background: #000;
}

.sleep-button {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 5;
  width: 132px;
  height: 76px;
  background: #333;
  color: white;
  font-size: 1.6rem;
  font-weight: 800;
}

.sleeper {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: #000;
  cursor: pointer;
}

@media (max-width: 700px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  h1 { font-size: 1.7rem; }
}
