:root{
  --bg: #050505;
  --overlay: rgba(0,0,0,.72);
  --panel: rgba(12,12,12,.70);
  --line: rgba(255,255,255,.14);
  --text: #fff;
  --muted: rgba(255,255,255,.70);
  --radius: 18px;
  --shadow: 0 25px 80px rgba(0,0,0,.65);
  --maxW: 1100px;
}

/* Reset / base */
*{ box-sizing: border-box; }
html, body{ height:100%; }
body{
  margin:0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

/* FULLSCREEN WRAPPER (centers the card) */
.modal{
  position: fixed;
  inset: 0;
  z-index: 1;

  display: grid;
  place-items: center;

  padding:
    max(14px, env(safe-area-inset-top))
    max(14px, env(safe-area-inset-right))
    max(14px, env(safe-area-inset-bottom))
    max(14px, env(safe-area-inset-left));
}

/* Dark overlay background */
.modalOverlay{
  position: absolute;
  inset: 0;
  background:
    radial-gradient(closest-side, rgba(255,99,0,.14), rgba(0,0,0,0) 55%),
    var(--overlay);
}

/*
  IMPORTANT:
  In your HTML you have: <div class="modalPanel videoModalPanel">
  So .modalPanel MUST be the CARD, not fullscreen.
*/
.modalPanel{
  position: relative;
  width: min(var(--maxW), 96vw);
  max-height: calc(100vh - 28px - env(safe-area-inset-top) - env(safe-area-inset-bottom));

  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
  overflow: hidden;
}

/* Optional: keep this class for future tweaks (not required) */
.videoModalPanel{
  /* no fullscreen rules here */
}

/* Close button (now anchored to the CARD, close to the video) */
.iconBtn{
  appearance: none;
  border: 1px solid rgba(255,255,255,.16);
  background: rgba(0,0,0,.35);
  color: #fff;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  cursor: pointer;

  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 3;

  transition: transform .15s ease, background .2s ease, border-color .2s ease;
}
.iconBtn:hover{
  transform: translateY(-1px);
  background: rgba(0,0,0,.48);
  border-color: rgba(255,99,0,.55);
}
.iconBtn:active{ transform: translateY(0); }
.iconBtn:focus-visible{
  outline: none;
  box-shadow: 0 0 0 6px rgba(255,99,0,.22);
}

/* Video sizing: responsive, no cropping */
#videoPlayer{
  display: block;
  width: 100%;
  height: auto;

  /* keep it inside the viewport on mobile */
  max-height: calc(100vh - 56px - 28px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  object-fit: contain;
  background: #000;
}

/* If you ever use poster images */
#videoPlayer[poster]{
  object-fit: contain;
}

/* Small screens: full width card, still centered via .modal padding */
@media (max-width: 640px){
  .modalPanel{
    width: 100%;
    border-radius: 16px;
  }
  .iconBtn{
    width: 40px;
    height: 40px;
    top: 8px;
    right: 8px;
  }
  #videoPlayer{
    max-height: calc(100vh - 52px - 28px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  }
}

/* Very short screens (landscape phones) */
@media (max-height: 520px){
  .iconBtn{
    width: 38px;
    height: 38px;
    top: 8px;
    right: 8px;
  }
  #videoPlayer{
    max-height: calc(100vh - 46px - 28px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  }
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce){
  .iconBtn{ transition: none; }
}
