:root {
  --ui-bg: #0b0d12;
  --ui-panel: #151922;
  --ui-line: #262c3a;
  --ui-text: #e8ecf4;
  --ui-mut: #8e98ad;
  --ui-accent: #f7b731;
  --ui-ok: #21c55d;
  --ui-rec: #ef4444;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: #06070a;
  color: var(--ui-text);
  font: 14px/1.4 "Segoe UI", system-ui, sans-serif;
  overflow: hidden;
}

#stage {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
}

#stage.recording { padding: 0; background: #000; }

canvas {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  border-radius: 10px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, .8);
  background: #000;
}

#stage.recording canvas { border-radius: 0; box-shadow: none; }

/* ---------- barra de controles ---------- */

#bar {
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: rgba(15, 18, 26, .92);
  border: 1px solid var(--ui-line);
  border-radius: 14px;
  backdrop-filter: blur(10px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, .6);
  z-index: 20;
  transition: opacity .25s, transform .25s;
  flex-wrap: wrap;
  justify-content: center;
  max-width: calc(100vw - 24px);
}

#bar.hidden { opacity: 0; pointer-events: none; transform: translate(-50%, 20px); }

button, .seg {
  font: 600 13px/1 "Segoe UI", system-ui, sans-serif;
  color: var(--ui-text);
  background: #1d2331;
  border: 1px solid var(--ui-line);
  border-radius: 9px;
  padding: 9px 12px;
  cursor: pointer;
  white-space: nowrap;
}

button:hover { background: #262e40; border-color: #3a4459; }
button:disabled { opacity: .45; cursor: not-allowed; }
button.primary { background: var(--ui-ok); border-color: transparent; color: #06210f; }
button.primary:hover { background: #2ada6c; }
button.rec { background: var(--ui-rec); border-color: transparent; color: #fff; }
button.rec:hover { background: #ff5b5b; }
button.icon { padding: 9px 11px; font-size: 15px; }

.seg { display: flex; gap: 0; padding: 0; overflow: hidden; }
.seg button { border: 0; border-radius: 0; background: transparent; }
.seg button.on { background: var(--ui-accent); color: #201700; }

.sep { width: 1px; align-self: stretch; background: var(--ui-line); margin: 0 2px; }

#time {
  font-variant-numeric: tabular-nums;
  color: var(--ui-mut);
  min-width: 108px;
  text-align: center;
}

#scrub {
  width: 220px;
  accent-color: var(--ui-accent);
  cursor: pointer;
}

/* ---------- overlays ---------- */

#hint {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--ui-mut);
  background: rgba(15, 18, 26, .85);
  border: 1px solid var(--ui-line);
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 12px;
  z-index: 20;
  transition: opacity .3s;
}

#hint.hidden { opacity: 0; }

#recBadge {
  position: fixed;
  top: 16px;
  right: 16px;
  display: none;
  align-items: center;
  gap: 10px;
  background: rgba(10, 12, 16, .9);
  border: 1px solid #3a1f24;
  border-radius: 12px;
  padding: 10px 14px;
  z-index: 30;
  font-weight: 700;
}

#recBadge.on { display: flex; }
#recBadge .dot {
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--ui-rec);
  animation: blink 1s infinite;
}
@keyframes blink { 50% { opacity: .2; } }
#recBadge small { display: block; font-weight: 500; color: var(--ui-mut); }

#msg {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(4, 6, 10, .92);
  z-index: 40;
  text-align: center;
  padding: 24px;
}
#msg.on { display: flex; }
#msg .box {
  max-width: 560px;
  background: var(--ui-panel);
  border: 1px solid var(--ui-line);
  border-radius: 16px;
  padding: 28px;
}
#msg h2 { margin: 0 0 10px; font-size: 20px; }
#msg p { color: var(--ui-mut); margin: 0 0 18px; line-height: 1.6; }
#msg a { color: var(--ui-accent); }
