:root {
  --brand: #0f766e;
  --bg: #f6f7f8;
  --fg: #0f172a;
  --muted: #64748b;
  --card: #ffffff;
  --danger: #b91c1c;
  --ok: #15803d;
  --border: #e2e8f0;
  --bar: #0f172a;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Ubuntu, Cantarell, 'Noto Sans', sans-serif;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.45;
}

a {
  color: var(--brand);
}

img {
  max-width: 100%;
  height: auto;
}

.wrap {
  max-width: 40rem;
  margin: 0 auto;
  padding: 1.25rem 1rem 4rem;
}

.site-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.site-header img.logo {
  width: 2.25rem;
  height: 2.25rem;
}

.site-header .brand {
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--brand);
}

.studio-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.studio-bar img {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.5rem;
  object-fit: cover;
  background: var(--border);
}

h1 {
  font-size: 1.6rem;
  line-height: 1.2;
  margin: 0 0 0.75rem;
}

.tagline {
  color: var(--muted);
  margin: 0 0 1.25rem;
}

.bullets {
  margin: 0 0 1.5rem;
  padding-left: 1.1rem;
}

.bullets li {
  margin: 0.4rem 0;
}

.msg {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 1.25rem;
  margin: 1rem 0;
}

.msg.error {
  border-color: #fecaca;
  color: var(--danger);
}

.msg.info {
  border-color: #a5f3fc;
}

.footer {
  margin-top: 2.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
}

button,
.btn {
  appearance: none;
  border: none;
  border-radius: 0.6rem;
  background: var(--brand);
  color: #fff;
  font: inherit;
  font-weight: 600;
  padding: 0.7rem 1.1rem;
  cursor: pointer;
}

button.secondary,
.btn.secondary {
  background: #e2e8f0;
  color: var(--fg);
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.toggle-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 1rem 0;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.45rem 0.85rem;
  cursor: pointer;
  user-select: none;
}

.toggle input {
  margin: 0;
}

.preview-wrap {
  position: relative;
  background: #0f172a;
  border-radius: 0.75rem;
  overflow: hidden;
  aspect-ratio: 16 / 10;
  margin: 1rem 0;
}

.preview-wrap video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
}

.help {
  font-size: 0.9rem;
  color: var(--muted);
  margin: 0.75rem 0;
}

.hidden {
  display: none !important;
}

/* Room layout */
#room {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: #020617;
  color: #f8fafc;
}

#room.hidden {
  display: none !important;
}

.banner {
  background: #b45309;
  color: #fff;
  text-align: center;
  padding: 0.4rem 0.75rem;
  font-size: 0.9rem;
}

.stage {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: minmax(40%, auto) 1fr;
  gap: 0.4rem;
  padding: 0.4rem;
  min-height: 0;
}

.stage .main-tile,
.stage .grid-tile {
  position: relative;
  background: #111827;
  border-radius: 0.5rem;
  overflow: hidden;
  min-height: 0;
}

.stage .main-tile video,
.stage .grid-tile video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.stage .label {
  position: absolute;
  left: 0.4rem;
  bottom: 0.4rem;
  background: rgba(0, 0, 0, 0.55);
  padding: 0.15rem 0.45rem;
  border-radius: 0.35rem;
  font-size: 0.8rem;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.4rem;
  min-height: 0;
  overflow: auto;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem;
  background: var(--bar);
}

.controls button {
  min-width: 3rem;
}

.controls button.active {
  outline: 2px solid #fbbf24;
}

.rec-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: #fecaca;
  font-weight: 700;
  font-size: 0.9rem;
}

.rec-badge.hidden {
  display: none !important;
}

.host-panel {
  background: #0f172a;
  color: #e2e8f0;
  border-top: 1px solid #1e293b;
  max-height: 40vh;
  overflow: auto;
  padding: 0.75rem 1rem 1rem;
}

.host-panel h2 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
}

.host-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.host-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid #1e293b;
}

.host-list .name {
  flex: 1;
  min-width: 8rem;
}

.host-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

/* Watch */
.player-wrap {
  background: #000;
  border-radius: 0.75rem;
  overflow: hidden;
  aspect-ratio: 16 / 9;
}

.player-wrap video {
  width: 100%;
  height: 100%;
  background: #000;
}

@media (min-width: 720px) {
  .stage {
    grid-template-columns: 2fr 1fr;
    grid-template-rows: 1fr;
  }
}

/* Admin */
.admin-wrap {
  max-width: 56rem;
}

.admin-section {
  margin: 2rem 0;
}

.admin-section h1 {
  font-size: 1.25rem;
  margin: 0 0 0.75rem;
}

.admin-section h2 {
  font-size: 1.05rem;
  margin: 1.25rem 0 0.5rem;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  background: var(--card);
  border: 1px solid var(--border);
}

.admin-table th,
.admin-table td {
  text-align: left;
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.admin-table th {
  background: #f1f5f9;
  font-weight: 600;
}

.admin-table .wrap-cell {
  word-break: break-all;
  max-width: 16rem;
}

.admin-form {
  display: grid;
  gap: 0.75rem;
  max-width: 28rem;
  background: var(--card);
  border: 1px solid var(--border);
  padding: 1rem;
}

.admin-form label {
  display: grid;
  gap: 0.25rem;
  font-size: 0.9rem;
}

.admin-form label.check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.admin-form input[type="text"],
.admin-form input[type="url"] {
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 0.35rem;
  font: inherit;
}

.btn {
  display: inline-block;
  padding: 0.45rem 0.85rem;
  border: none;
  border-radius: 0.35rem;
  background: var(--brand);
  color: #fff;
  font: inherit;
  cursor: pointer;
}

.btn.danger {
  background: var(--danger);
  font-size: 0.85rem;
}

form.inline {
  display: inline;
  margin: 0;
}

.flash {
  padding: 0.75rem 1rem;
  border-radius: 0.4rem;
  margin-bottom: 1rem;
  border: 1px solid var(--border);
  background: #fff;
}

.flash.ok {
  border-color: #86efac;
  background: #f0fdf4;
  color: var(--ok);
}

.flash.error {
  border-color: #fecaca;
  background: #fef2f2;
  color: var(--danger);
}

.flash .key-once {
  display: block;
  margin-top: 0.4rem;
  word-break: break-all;
  font-size: 0.95rem;
}

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

/* ------------------------------------------------------------------
   Toast (participant + host). Additive: nothing else on the page uses it.
   ------------------------------------------------------------------ */
.toast {
  position: fixed;
  top: 0.75rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  width: min(92vw, 30rem);
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  background: #0f172a;
  color: #f8fafc;
  border: 1px solid #334155;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  font-size: 0.95rem;
  line-height: 1.35;
  text-align: center;
}

/* Persistent error banner (camera / mic / connection). */
.toast.media-banner {
  top: 0.5rem;
  z-index: 80;
  background: #3b0d0d;
  border-color: #b91c1c;
  text-align: left;
}
.media-banner p { margin: 0 0 0.5rem; }
.media-banner-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.media-banner-actions button {
  min-height: 2.5rem;
  padding: 0.4rem 0.9rem;
  border-radius: 0.5rem;
  border: 1px solid #fca5a5;
  background: #b91c1c;
  color: #fff;
  font: inherit;
}
.media-banner-actions .media-banner-close { background: transparent; }

/* ------------------------------------------------------------------
   HOST room only (#room.host-room). The participant page never gets these rules.
   Tokens extend the :root set above.
   ------------------------------------------------------------------ */
.host-room {
  --room-surface: #0f172a;
  --room-surface-2: #1e293b;
  --room-line: #334155;
  --room-fg: #f8fafc;
  --room-muted: #94a3b8;
  --focus: #5eead4;
  --hand: #fbbf24;
  --tap: 44px;
  --r: 0.6rem;
}

.host-room button:focus-visible,
.host-room [data-identity]:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.host-room button,
.host-room [data-identity] {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* ---- stage ---- */
.host-room .stage {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 0.4rem;
  padding: 0.4rem;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}

.host-room .stage [data-identity] {
  width: 100%;
  height: 100%;
  cursor: pointer;
  background: #0b1220;
  border-radius: var(--r);
}

.host-room .stage video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

.host-room .stage .local video {
  transform: scaleX(-1); /* mirrored self-view */
}

.host-room #main-tile {
  min-width: 0;
  min-height: 0;
  background: transparent;
}

.host-room #grid {
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.host-room .stage .label {
  max-width: calc(100% - 0.8rem);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.host-room .stage .hand {
  outline: 3px solid var(--hand);
  outline-offset: -3px;
}

.host-room .stage .hand .label {
  background: var(--hand);
  color: #1c1917;
  font-weight: 700;
}

.host-room .stage .speaking:not(.hand) {
  outline: 2px solid var(--focus);
  outline-offset: -2px;
}

.host-room .stage-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  margin: 0;
  color: var(--room-muted);
  pointer-events: none;
  z-index: 2;
}

/* focus views (Eu / Vorbitor / pinned): big tile + strip */
.host-room .stage[data-view='focus'] #grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  grid-auto-rows: 66px;
  align-content: start;
  gap: 0.4rem;
  max-height: 30vh;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.host-room .stage[data-view='focus'] #grid video {
  object-fit: cover;
}

.host-room .stage.strip-hidden #grid,
.host-room .stage.no-strip #grid {
  display: none;
}

.host-room .stage.strip-hidden,
.host-room .stage.no-strip {
  grid-template-rows: minmax(0, 1fr);
}

/* gallery ("Toți"): equal tiles fill the stage; columns/rows are set from JS */
.host-room .stage[data-view='gallery'] {
  grid-template-rows: minmax(0, 1fr);
}

.host-room .stage[data-view='gallery'] #grid {
  display: grid;
  gap: 0.4rem;
  height: 100%;
}

.host-room .stage[data-view='gallery'] #main-tile {
  position: absolute;
  right: 0.9rem;
  bottom: 0.9rem;
  z-index: 3;
  width: clamp(84px, 22%, 168px);
  height: auto;
  aspect-ratio: 3 / 4;
  max-height: 38%;
  border-radius: var(--r);
  box-shadow: 0 0 0 2px rgba(248, 250, 252, 0.35), 0 6px 18px rgba(0, 0, 0, 0.5);
}

.host-room .stage[data-view='gallery'] #main-tile video {
  object-fit: cover;
}

@media (orientation: landscape) and (min-width: 600px) {
  .host-room .stage[data-view='focus'] {
    grid-template-columns: minmax(0, 1fr) clamp(150px, 24vw, 260px);
    grid-template-rows: minmax(0, 1fr);
  }

  .host-room .stage[data-view='focus'].strip-hidden,
  .host-room .stage[data-view='focus'].no-strip {
    grid-template-columns: minmax(0, 1fr);
  }

  .host-room .stage[data-view='focus'] #grid {
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    grid-auto-rows: 86px;
    max-height: none;
    height: 100%;
  }
}

/* unpin "x" on the pinned big tile */
.host-room .unpin {
  position: absolute;
  top: 0.4rem;
  right: 0.4rem;
  width: var(--tap);
  height: var(--tap);
  padding: 0;
  border-radius: 999px;
  background: rgba(2, 6, 23, 0.72);
  color: var(--room-fg);
  font-size: 1.1rem;
  line-height: 1;
  z-index: 4;
}

/* ---- control bar (bottom, like Meet/Zoom) ---- */
.host-room .hostbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.4rem 0.3rem;
  padding: 0.4rem max(0.3rem, env(safe-area-inset-left)) max(0.5rem, env(safe-area-inset-bottom));
  background: var(--room-surface);
  border-top: 1px solid var(--room-line);
}

.host-room .cb-group {
  display: flex;
  gap: 0.2rem;
}

.host-room .cb-end {
  margin-left: 0.2rem;
  padding-left: 0.3rem;
  border-left: 1px solid var(--room-line);
}

.host-room .cb {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: var(--tap);
  min-height: 52px;
  padding: 4px 0.15rem;
  border-radius: var(--r);
  background: var(--room-surface-2);
  color: var(--room-fg);
  font-size: 11px;
  line-height: 1.1;
  font-weight: 600;
  white-space: nowrap;
}

.host-room .cb .cb-text {
  display: block;
}

.host-room .cb-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: #475569;
  color: #fff;
  font-size: 10px;
  line-height: 16px;
  text-align: center;
}

.host-room .cb-badge.hand {
  background: var(--hand);
  color: #1c1917;
}

.host-room .panel-head .cb {
  min-height: var(--tap);
}

.host-room .cb:hover:not(:disabled) {
  background: #334155;
}

.host-room .cb .ic {
  flex: none;
}

.host-room .cb-danger {
  background: var(--danger);
  color: #fff;
}

.host-room .cb-danger:hover:not(:disabled) {
  background: #991b1b;
}

/* mic / cam: pressed = on; off = red with slashed icon */
.host-room .cb[aria-pressed] .ic-off,
.host-room .cb[aria-pressed='false'] .ic-on {
  display: none;
}

.host-room .cb[aria-pressed='false'] .ic-off {
  display: inline-flex;
}

.host-room .cb[aria-pressed='false'] {
  background: #7f1d1d;
}

.host-room .cb .ic-on,
.host-room .cb .ic-off {
  display: inline-flex;
}

.host-room .cb[aria-pressed='true'] .ic-off {
  display: none;
}

/* segmented control */
.host-room .seg {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  border-radius: calc(var(--r) + 3px);
  background: var(--room-surface-2);
  order: -1;
  flex: 1 0 100%;
}

.host-room .seg button {
  flex: 1;
  min-height: var(--tap);
  border-radius: var(--r);
  background: transparent;
  color: var(--room-muted);
  padding: 0 0.5rem;
}

.host-room .seg button[aria-checked='true'] {
  background: var(--brand);
  color: #fff;
}

.host-room .controls button.active {
  outline: none; /* generic "active" amber ring is for the participant bar */
}

.host-room .seg button {
  min-width: 0;
}

@media (min-width: 760px) {
  .host-room .seg {
    order: 0;
    flex: none;
  }
}

@media (min-width: 760px) {
  .host-room .seg {
    width: 280px;
  }
}

/* ---- participants drawer ---- */
.host-room .host-panel {
  display: none;
  position: fixed;
  z-index: 30;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(100%, 380px);
  max-height: none;
  padding: 0.75rem;
  background: var(--room-surface);
  border-left: 1px solid var(--room-line);
  box-shadow: -12px 0 32px rgba(0, 0, 0, 0.5);
  overflow-y: auto;
}

.host-room .host-panel.open {
  display: block;
}

.host-room .panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.host-room .panel-head h2 {
  margin: 0;
}

.host-room .switch {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  width: 100%;
  min-height: var(--tap);
  margin: 0 0 0.5rem;
  padding: 0.6rem 0.75rem;
  border-radius: var(--r);
  background: var(--room-surface-2);
  color: var(--room-fg);
  text-align: left;
  font-weight: 600;
}

.host-room .switch small {
  display: block;
  margin-top: 0.15rem;
  color: var(--room-muted);
  font-weight: 400;
  font-size: 0.8rem;
}

.host-room .switch .track {
  flex: none;
  width: 44px;
  height: 26px;
  margin-top: 1px;
  border-radius: 999px;
  background: #475569;
  position: relative;
  transition: background 0.15s;
}

.host-room .switch .knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.15s;
}

.host-room .switch[aria-checked='true'] .track {
  background: var(--brand);
}

.host-room .switch[aria-checked='true'] .knob {
  transform: translateX(18px);
}

.host-room .host-list li {
  min-height: var(--tap);
  flex-wrap: nowrap;
}

.host-room .host-list .name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.host-room .host-list button {
  min-height: var(--tap);
  padding: 0 0.7rem;
  font-size: 0.85rem;
  white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
  .host-room .switch .track,
  .host-room .switch .knob {
    transition: none;
  }
}

/* Phone: 6 labelled buttons fit one row; "Ascunde" moves into the Participanți panel. */
.host-room .panel-strip {
  display: none;
}

@media (max-width: 599px) {
  .host-room .cb-strip {
    display: none;
  }

  .host-room .panel-strip {
    display: flex;
    align-items: center;
  }

  .host-room .panel-strip.hidden {
    display: none !important;
  }
}

@media (min-width: 760px) {
  .host-room .hostbar {
    column-gap: 0.6rem;
  }
}

/* ------------------------------------------------------------------
   Host: live timer + recording indicator (top bar) and record button.
   Participant: "Se înregistrează" consent badge.
   ------------------------------------------------------------------ */
.host-room .hosttop {
  flex: none;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.6rem;
  min-height: 34px;
  padding: 0.3rem max(0.6rem, env(safe-area-inset-left)) 0.1rem;
  font-size: 0.85rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--room-fg);
}

.host-room .hosttop .hidden {
  display: none !important;
}

.host-room .live-pill,
.host-room .rec-ind {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  background: var(--room-surface-2);
  white-space: nowrap;
}

.host-room .rec-ind {
  color: #fecaca;
  background: #450a0a;
}

.host-room .rec-off {
  color: var(--room-muted);
  font-weight: 500;
  white-space: nowrap;
}

.live-dot,
.rec-dot {
  display: inline-block;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: #ef4444;
}

.live-dot {
  background: #22c55e;
}

.rec-ind .rec-dot,
.rec-note .rec-dot {
  animation: rec-pulse 1.6s ease-in-out infinite;
}

@keyframes rec-pulse {
  50% {
    opacity: 0.35;
  }
}

@media (prefers-reduced-motion: reduce) {
  .rec-ind .rec-dot,
  .rec-note .rec-dot {
    animation: none;
  }
}

.host-room .cb-rec .cb-text {
  max-width: 5.4rem;
  white-space: normal;
  text-align: center;
}

.host-room .cb-rec .ic {
  color: #f87171;
}

.host-room .cb-rec.rec-on {
  background: #7f1d1d;
}

.host-room .cb-rec:disabled {
  opacity: 0.6;
}

.rec-note {
  position: absolute;
  top: 0.5rem;
  left: 0.6rem;
  z-index: 5;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  background: rgba(69, 10, 10, 0.88);
  color: #fecaca;
  font-size: 0.85rem;
  font-weight: 700;
  pointer-events: none;
}

.rec-note.hidden {
  display: none !important;
}

/* In-page confirm dialog (host). */
.dlg-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(2, 6, 23, 0.72);
}

.dlg {
  width: min(100%, 26rem);
  padding: 1.1rem 1.1rem 0.9rem;
  border-radius: 0.8rem;
  background: #0f172a;
  color: #f8fafc;
  border: 1px solid #334155;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
}

.dlg p {
  margin: 0 0 1rem;
  font-size: 1rem;
  line-height: 1.45;
}

.dlg-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.5rem;
}

.dlg-actions button {
  min-height: 44px;
  padding: 0 1rem;
  border-radius: 0.6rem;
  font-weight: 600;
  font-size: 0.95rem;
}

.dlg-no {
  background: #1e293b;
  color: #f8fafc;
}

.dlg-yes {
  background: #b91c1c;
  color: #fff;
}

.dlg-actions button:focus-visible {
  outline: 2px solid #5eead4;
  outline-offset: 2px;
}

/* Watch page inside an iframe (?embed=1): player fills the frame, no outer chrome. */
body.embed {
  background: #000;
  color: #f8fafc;
}

body.embed .wrap {
  max-width: none;
  margin: 0;
  padding: 0;
}

body.embed .studio-bar,
body.embed .site-header,
body.embed h1,
body.embed .footer {
  display: none;
}

body.embed .player-wrap {
  position: fixed;
  inset: 0;
  aspect-ratio: auto;
  border-radius: 0;
}

body.embed .player-wrap video {
  object-fit: contain;
}

body.embed .help,
body.embed .msg {
  position: fixed;
  left: 0.75rem;
  right: 0.75rem;
  bottom: 3.5rem;
  margin: 0;
  padding: 0.6rem 0.8rem;
  border-radius: 0.6rem;
  background: rgba(15, 23, 42, 0.92);
  color: #f8fafc;
}

/* Teaser (preview_seconds): badge + end overlay. NexiBook shows the buy CTA around the iframe. */
.player-wrap {
  position: relative;
}

.preview-badge {
  position: absolute;
  top: 0.6rem;
  left: 0.6rem;
  z-index: 3;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.85);
  color: #f8fafc;
  font-size: 0.8rem;
  font-weight: 700;
  pointer-events: none;
}

.preview-end {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(2, 6, 23, 0.88);
  color: #f8fafc;
  font-size: 1.1rem;
  font-weight: 700;
  text-align: center;
}

.preview-end.hidden {
  display: none !important;
}
