/* =========================================================
   STOEFFEL-MEDIA PLAY: website popup
   Include on the website next to sm-play.js. All classes start with "smp-"
   so nothing clashes with css/style.css.
   ========================================================= */

/* page behind the popup: no scrolling, and hide the custom cursor while it is over the game */
html.smp-open, html.smp-open body { overflow: hidden; }
html.smp-over-frame .cursor { opacity: 0 !important; }

.smp-root {
  position: fixed; inset: 0; z-index: 99990; /* below the custom cursor (99999) so it stays visible on the popup buttons */
  display: flex; align-items: center; justify-content: center;
  padding: max(24px, env(safe-area-inset-top, 0px)) max(24px, env(safe-area-inset-right, 0px)) max(24px, env(safe-area-inset-bottom, 0px)) max(24px, env(safe-area-inset-left, 0px));
  font-family: 'Outfit', system-ui, sans-serif;
}
.smp-root[hidden] { display: none; }
.smp-backdrop { position: absolute; inset: 0; background: rgba(12, 12, 12, .5); -webkit-backdrop-filter: blur(16px) saturate(1.1); backdrop-filter: blur(16px) saturate(1.1); opacity: 0; transition: opacity .25s ease; }

/* the window: popup size by default, full size with .is-full */
.smp-win {
  position: relative; display: flex; flex-direction: column;
  width: min(1000px, 100%); height: min(700px, 100%);
  background: #181818; border: 1px solid rgba(255, 255, 255, .08); border-radius: 18px; overflow: hidden;
  box-shadow: 0 30px 90px rgba(0, 0, 0, .55), 0 0 0 1px rgba(240, 137, 50, .06);
  opacity: 0; transform: translateY(14px) scale(.98);
  transition: opacity .25s ease, transform .3s cubic-bezier(.25, 1, .5, 1), width .3s cubic-bezier(.25, 1, .5, 1), height .3s cubic-bezier(.25, 1, .5, 1), border-radius .3s ease;
}
.smp-root.is-open .smp-backdrop { opacity: 1; }
.smp-root.is-open .smp-win { opacity: 1; transform: none; }
.smp-root.is-full { padding: 0; }
.smp-root.is-full .smp-win { width: 100%; height: 100%; border-radius: 0; border: 0; }

/* phones: the popup is almost full screen anyway, full size removes the last margin */
@media (max-width: 640px) {
  .smp-root { padding: max(10px, env(safe-area-inset-top, 0px)) max(10px, env(safe-area-inset-right, 0px)) max(10px, env(safe-area-inset-bottom, 0px)) max(10px, env(safe-area-inset-left, 0px)); }
  .smp-win { height: 100%; border-radius: 16px; }
}

/* header: one quiet line + the two icon buttons */
.smp-head { display: flex; align-items: center; gap: 4px; height: 46px; padding: 0 6px 0 16px; border-bottom: 1px solid rgba(255, 255, 255, .08); flex: none; }
.smp-root.is-full .smp-head { padding-top: env(safe-area-inset-top, 0px); height: calc(46px + env(safe-area-inset-top, 0px)); }
.smp-dot { width: 8px; height: 8px; border-radius: 50%; background: #f08932; margin-right: 8px; flex: none; }
.smp-title { flex: 1; min-width: 0; font-size: 13px; font-weight: 600; letter-spacing: .02em; color: #8e8e8e; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.smp-btn { width: 36px; height: 36px; display: grid; place-items: center; border: 0; border-radius: 10px; background: none; color: #fff; padding: 0; transition: background .2s ease, color .2s ease; }
.smp-btn:hover { background: rgba(255, 255, 255, .07); color: #f08932; }
.smp-btn:focus-visible { outline: 2px solid #f08932; outline-offset: -2px; }
.smp-btn svg { width: 18px; height: 18px; }
.smp-body { position: relative; flex: 1; min-height: 0; display: flex; }
.smp-frame { flex: 1; width: 100%; border: 0; display: block; background: #181818; }

/* optional floating launcher (script tag with data-launcher="true") */
.smp-launch {
  position: fixed; z-index: 9000;
  left: max(20px, env(safe-area-inset-left, 0px)); bottom: max(20px, env(safe-area-inset-bottom, 0px));
  display: inline-flex; align-items: center; gap: 9px; padding: 10px 16px 10px 12px;
  font: 600 14px 'Outfit', system-ui, sans-serif; color: #fff; background: rgba(24, 24, 24, .9);
  border: 1px solid rgba(255, 255, 255, .1); border-radius: 99px;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .35); transition: border-color .2s ease, transform .2s ease;
}
.smp-launch:hover { border-color: #f08932; transform: translateY(-2px); color: #fff; }
.smp-launch .smp-play { width: 26px; height: 26px; border-radius: 50%; background: #f08932; display: grid; place-items: center; }
.smp-launch .smp-play svg { width: 11px; height: 11px; margin-left: 2px; }
html.smp-open .smp-launch { opacity: 0; pointer-events: none; }

/* phones/tablets: softer blur. The website pauses its animations while the popup is open (smplay:open), so the blur stays cheap.
   In full size nothing of the page is visible, so the blur is switched off there. */
@media (max-width: 640px), (pointer: coarse) {
  .smp-backdrop { -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); background: rgba(12, 12, 12, .62); }
}
.smp-root.is-full .smp-backdrop { -webkit-backdrop-filter: none; backdrop-filter: none; }

@media (prefers-reduced-motion: reduce) {
  .smp-backdrop, .smp-win, .smp-launch { transition: none; }
}

/* LOADING SCREEN: always shown for at least one second, longer on a slow connection (see sm-play.js) */
.smp-loading {
  position: absolute; inset: 0; z-index: 2;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  padding: 24px; text-align: center; background: #181818;
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity .3s ease, visibility 0s linear .3s;
}
.smp-root.is-loading .smp-loading { opacity: 1; visibility: visible; pointer-events: auto; transition: opacity .12s ease, visibility 0s; }

/* a tiny loop of the game idea: the orange dot dodges falling squares */
.smp-ld-scene {
  position: relative; width: 132px; height: 70px; overflow: hidden; border-radius: 12px;
  background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .08);
}
.smp-ld-p {
  position: absolute; bottom: 8px; left: 10px; width: 14px; height: 14px; border-radius: 50%;
  background: #f08932; box-shadow: 0 0 14px rgba(240, 137, 50, .5);
  animation: smpLdDodge 2.8s ease-in-out infinite;
}
.smp-ld-b { position: absolute; top: -12px; width: 10px; height: 10px; border-radius: 2px; background: #8e8e8e; animation: smpLdFall 1.5s linear infinite; }
.smp-ld-b1 { left: 14px;  animation-delay: 0s; }
.smp-ld-b2 { left: 42px;  animation-delay: .5s; }
.smp-ld-b3 { left: 72px;  animation-delay: 1s; }
.smp-ld-b4 { left: 100px; animation-delay: .25s; }
@keyframes smpLdFall  { to { transform: translateY(96px); } }
@keyframes smpLdDodge { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(34px); } 50% { transform: translateX(70px); } 75% { transform: translateX(34px); } }

.smp-ld-bar { width: min(220px, 60%); height: 6px; border-radius: 99px; background: rgba(255, 255, 255, .08); overflow: hidden; }
.smp-ld-bar i { display: block; height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, #f08932, #ffb066); }
.smp-ld-text { margin: 0; font-size: 13px; letter-spacing: .06em; color: #8e8e8e; }
.smp-ld-slow { display: none; margin: 0; max-width: 300px; font-size: 13px; line-height: 1.5; color: #8e8e8e; }
.smp-ld-slow a { color: #f08932; text-decoration: none; }
.smp-root.is-slow .smp-ld-slow { display: block; }

@media (prefers-reduced-motion: reduce) {
  .smp-ld-p, .smp-ld-b { animation: none; }
  .smp-loading { transition: none; }
}
