* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; height: 100%; background: #0b1620; color: #f5f5f5;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  overscroll-behavior: none; -webkit-user-select: none; user-select: none;
}
button {
  font: inherit; border: 0; border-radius: 12px; padding: 12px 16px;
  color: #fff; background: #333; cursor: pointer;
}
button:disabled { opacity: .35; }
.primary { background: #0b8fc4; font-weight: 600; }
.danger { background: #c62828; font-weight: 600; }
.ghost { background: rgba(255,255,255,.12); }
.ghost.on { background: #0b8fc4; }
.wide { width: 100%; }
.muted { color: #9fb0bc; }
.small { font-size: 14px; }
.hidden { display: none !important; }

.screen {
  display: none; position: fixed; inset: 0;
  padding: calc(env(safe-area-inset-top) + 12px) 16px calc(env(safe-area-inset-bottom) + 16px);
  flex-direction: column; gap: 12px;
}
.screen.active { display: flex; }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.bar h1 { font-size: 22px; margin: 0; }
.row { display: flex; gap: 10px; }
.row > button { flex: 1; }
.row.wrap { flex-wrap: wrap; }

.home-body { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 14px; font-size: 17px; line-height: 1.45; }
.home-body p { margin: 0; }
.home-body .primary { margin-top: 12px; padding: 16px; font-size: 18px; }

/* ---------- Studio ---------- */
#screen-studio { padding: 0; background: #000; }
#stage { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
#canvas { touch-action: none; background: #000; } /* taille calculée par fitCanvas() */
.source { position: fixed; left: 0; top: 0; width: 2px; height: 2px; opacity: 0; pointer-events: none; }

.hint {
  position: absolute; z-index: 2; left: 24px; right: 24px; top: 38%;
  display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center;
}
.hint .primary { padding: 16px 20px; font-size: 18px; }

#topbar {
  position: absolute; left: 0; right: 0; top: 0; z-index: 3;
  display: flex; justify-content: space-between; align-items: center;
  padding: calc(env(safe-area-inset-top) + 8px) 12px 0; pointer-events: none;
}
#topbar > * { pointer-events: auto; }
#timer {
  display: flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 99px;
  background: rgba(0,0,0,.5); font-variant-numeric: tabular-nums; font-size: 15px;
}
#timer .dot { width: 10px; height: 10px; border-radius: 50%; background: #777; }
#screen-studio.recording #timer .dot { background: #ff2d55; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .2; } }

.round {
  width: 56px; height: 56px; border-radius: 50%; padding: 0;
  background: rgba(0,0,0,.55); font-size: 22px;
}
.round.small { width: 44px; height: 44px; font-size: 15px; font-weight: 600; }

#controls {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 3;
  display: flex; flex-direction: column; gap: 10px;
  padding: 16px max(16px, env(safe-area-inset-right)) calc(env(safe-area-inset-bottom) + 14px) max(16px, env(safe-area-inset-left));
  background: linear-gradient(to top, rgba(0,0,0,.65), rgba(0,0,0,0));
}
#scrub-row { display: flex; align-items: center; gap: 10px; font-size: 13px; font-variant-numeric: tabular-nums; text-shadow: 0 1px 2px #000; }
#scrub { flex: 1; accent-color: #fff; }
#buttons { display: flex; align-items: center; justify-content: space-between; }

.rec-btn {
  width: 78px; height: 78px; border-radius: 50%; padding: 0;
  background: transparent; border: 5px solid #fff;
  display: flex; align-items: center; justify-content: center;
}
.rec-btn span { width: 58px; height: 58px; border-radius: 50%; background: #ff2d55; transition: all .2s; }
/* pendant l'enregistrement : icône stop */
#screen-studio.recording .rec-btn span { width: 30px; height: 30px; border-radius: 6px; }

.panel {
  position: absolute; z-index: 5; right: 12px; top: calc(env(safe-area-inset-top) + 60px);
  width: min(310px, calc(100% - 24px)); padding: 14px; border-radius: 14px;
  background: rgba(16,24,32,.94); display: flex; flex-direction: column; gap: 14px; font-size: 15px;
}
.panel label { display: flex; flex-direction: column; gap: 6px; }
.panel label.check { flex-direction: row; align-items: center; gap: 10px; }
.panel input[type=range] { width: 100%; accent-color: #0b8fc4; }
.panel input[type=checkbox] { width: 20px; height: 20px; accent-color: #0b8fc4; }
.seg { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.seg span { width: 100%; }
.seg button { flex: 1; padding: 10px 8px; }

#cam-error {
  position: absolute; z-index: 6; left: 16px; right: 16px; top: 40%;
  padding: 16px; border-radius: 14px; background: #2a1215; text-align: center; line-height: 1.4;
}

/* ---------- Revoir ---------- */
#review-video { flex: 1; min-height: 0; width: 100%; background: #000; border-radius: 14px; }

/* ---------- Mes réactions ---------- */
#takes-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
#takes-list li { display: flex; align-items: center; gap: 8px; padding: 10px; border-radius: 12px; background: #15232e; }
#takes-list .meta { flex: 1; font-size: 14px; line-height: 1.3; }
#takes-list button { padding: 10px 12px; }

/* ---------- Modale et toast ---------- */
.modal { position: fixed; inset: 0; z-index: 20; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; padding: 24px; }
.modal-box { background: #1b2833; border-radius: 16px; padding: 20px; width: 100%; max-width: 360px; }
.modal-box p { margin: 0 0 18px; font-size: 17px; line-height: 1.4; }
#toast {
  position: fixed; z-index: 30; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 150px);
  transform: translateX(-50%); background: rgba(30,40,48,.95); padding: 10px 16px; border-radius: 99px; font-size: 15px;
  max-width: 90%; text-align: center;
}
