:root {
  --green-screen: #01f202;
  --corner-gap: 8px;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--green-screen);
}

body {
  font-family: Arial, Helvetica, sans-serif;
  overscroll-behavior: none;
}

.experience {
  position: fixed;
  inset: 0;
  overflow: hidden;
  isolation: isolate;
  background: var(--green-screen);
}

.sahur-video {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: 50%;
  width: auto;
  height: 138vh;
  max-width: none;
  transform: translate(-50%, -50%);
  object-fit: contain;
  background: var(--green-screen);
  pointer-events: none;
  user-select: none;
}



/* =========================================================
   PRESTIGE TITLE + INTERACTIVE STICKY NOTE
   ========================================================= */

.site-title-wrap {
  position: fixed;
  z-index: 58;
  top: 12px;
  left: 50%;
  width: min(52vw, 880px);
  transform: translateX(-50%);
  text-align: center;
  pointer-events: none;
}

.site-title {
  display: inline-block;
  margin: 0;
  padding: 0.08em 0.28em 0.14em;
  color: #ffffff;
  font-size: clamp(2.25rem, 4.65vw, 5.6rem);
  line-height: 0.92;
  font-weight: 1000;
  letter-spacing: 0.018em;
  text-transform: uppercase;
  cursor: pointer;
  pointer-events: auto;
  user-select: none;
  -webkit-text-stroke: clamp(1px, 0.12vw, 3px) #101010;
  text-shadow:
    0 4px 0 #101010,
    0 8px 18px rgba(0, 0, 0, 0.62),
    0 0 18px rgba(255, 214, 10, 0.55);
  transform-origin: center;
  animation: titleBreathe 2.8s ease-in-out infinite;
  transition:
    filter 180ms ease,
    text-shadow 180ms ease;
}

.site-title:hover,
.site-title:focus-visible {
  animation: titleHover 620ms cubic-bezier(.2,.9,.2,1) both;
  filter: brightness(1.12);
  text-shadow:
    0 4px 0 #101010,
    0 10px 24px rgba(0, 0, 0, 0.72),
    0 0 30px rgba(255, 226, 74, 0.95);
  outline: none;
}

.site-title.is-hit {
  animation: titleImpact 560ms cubic-bezier(.2,.9,.25,1.15) both;
}

.sticky-note {
  position: fixed;
  z-index: 57;
  top: clamp(132px, 17vh, 190px);
  left: clamp(340px, 22vw, 470px);
  width: clamp(238px, 18vw, 310px);
  min-height: clamp(132px, 13vw, 168px);
  padding: 34px 24px 24px;
  border: 0;
  border-radius: 3px;
  background:
    linear-gradient(145deg, rgba(255,255,255,.18), transparent 35%),
    #ffe04a;
  color: #181400;
  font: inherit;
  cursor: pointer;
  box-shadow:
    0 16px 28px rgba(0, 0, 0, 0.38),
    inset 0 -2px 0 rgba(160, 110, 0, 0.22);
  transform: rotate(-3.2deg);
  transform-origin: 50% 8%;
  animation: noteIdle 3.2s ease-in-out infinite;
  transition:
    box-shadow 180ms ease,
    filter 180ms ease;
  overflow: visible;
}

.sticky-note:hover,
.sticky-note:focus-visible {
  animation: noteHover 720ms cubic-bezier(.2,.85,.2,1) both;
  box-shadow:
    0 24px 38px rgba(0, 0, 0, 0.48),
    inset 0 -2px 0 rgba(160, 110, 0, 0.22);
  filter: saturate(1.08) brightness(1.03);
  outline: none;
}

.sticky-note.is-pressed {
  animation: notePress 620ms cubic-bezier(.22,.9,.24,1.18) both;
}

.sticky-note.is-spinning {
  animation: noteUnpinSpinRepin 980ms cubic-bezier(.22,.82,.24,1.08) both;
}

.sticky-text {
  position: relative;
  z-index: 2;
  display: block;
  font-size: clamp(1.35rem, 1.7vw, 2rem);
  line-height: 1.04;
  font-weight: 800;
  letter-spacing: -0.02em;
  text-align: center;
  text-transform: none;
}

.sticky-text strong {
  font-weight: 1000;
  font-size: 1.1em;
}

.sticky-pin {
  position: absolute;
  z-index: 3;
  top: -13px;
  left: 50%;
  width: 30px;
  height: 30px;
  transform: translateX(-50%);
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 30%, #ff8b8b 0 15%, #e51c23 20% 64%, #8c0004 68% 100%);
  box-shadow:
    0 5px 8px rgba(0, 0, 0, 0.35),
    inset -3px -5px 7px rgba(90, 0, 0, 0.32);
}

.sticky-pin::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -13px;
  width: 4px;
  height: 16px;
  transform: translateX(-50%);
  border-radius: 2px;
  background: #808080;
  box-shadow: 1px 0 0 rgba(255,255,255,.35);
}

.sticky-fold {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 34px;
  height: 34px;
  clip-path: polygon(100% 0, 100% 100%, 0 100%);
  background: #e1be21;
  filter: drop-shadow(-2px -2px 2px rgba(80, 55, 0, 0.18));
}

@keyframes titleBreathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.025); }
}

@keyframes titleHover {
  0%   { transform: scale(1) rotate(0); }
  22%  { transform: scale(1.065) rotate(-1deg); }
  44%  { transform: scale(1.045) rotate(1deg); }
  66%  { transform: scale(1.07) rotate(-0.45deg); }
  100% { transform: scale(1.055) rotate(0); }
}

@keyframes titleImpact {
  0%   { transform: scale(1); }
  18%  { transform: scaleX(1.12) scaleY(.78); }
  38%  { transform: scaleX(.92) scaleY(1.18) rotate(-1.4deg); }
  56%  { transform: translateX(-7px) rotate(1deg) scale(1.06); }
  70%  { transform: translateX(7px) rotate(-1deg) scale(1.04); }
  84%  { transform: translateX(-3px) scale(1.02); }
  100% { transform: translateX(0) scale(1); }
}

@keyframes noteIdle {
  0%, 100% { transform: translateY(0) rotate(-3.2deg); }
  50% { transform: translateY(-7px) rotate(-1.4deg); }
}

@keyframes noteHover {
  0%   { transform: translateY(0) rotate(-3.2deg) scale(1); }
  38%  { transform: translateY(-14px) rotate(.8deg) scale(1.075); }
  60%  { transform: translateY(-11px) rotate(-.7deg) scale(1.055); }
  100% { transform: translateY(-12px) rotate(0) scale(1.06); }
}

@keyframes notePress {
  0%   { transform: rotate(-3.2deg) scale(1); }
  20%  { transform: rotate(-1deg) scale(.86, .76); }
  44%  { transform: rotate(3deg) scale(1.16, 1.08); }
  62%  { transform: rotate(-5deg) scale(1.04); }
  78%  { transform: rotate(3deg) scale(1.03); }
  100% { transform: rotate(-1deg) scale(1); }
}

@keyframes noteUnpinSpinRepin {
  0% {
    transform: translateY(0) rotate(-3.2deg) scale(1);
  }
  12% {
    transform: translateY(10px) rotate(-4deg) scale(.95);
  }
  24% {
    transform: translateY(-18px) rotate(35deg) scale(1.06);
  }
  52% {
    transform: translateY(-24px) rotate(390deg) scale(1.12);
  }
  72% {
    transform: translateY(-10px) rotate(720deg) scale(1.04);
  }
  88% {
    transform: translateY(6px) rotate(716deg) scale(.98);
  }
  100% {
    transform: translateY(0) rotate(716.8deg) scale(1);
  }
}

.sticky-note.is-spinning .sticky-pin {
  animation: pinPop 980ms cubic-bezier(.22,.82,.24,1.08) both;
}

@keyframes pinPop {
  0%, 8% {
    transform: translateX(-50%) translateY(0) scale(1);
  }
  22% {
    transform: translateX(-50%) translateY(-34px) scale(.82);
  }
  54% {
    transform: translateX(-50%) translateY(-42px) rotate(360deg) scale(.9);
  }
  78% {
    transform: translateX(-50%) translateY(-12px) rotate(720deg) scale(1.08);
  }
  100% {
    transform: translateX(-50%) translateY(0) rotate(720deg) scale(1);
  }
}

/* Phone layout: title becomes dominant below the two top ad slots. */
@media (max-width: 780px) {
  .site-title-wrap {
    top: calc(env(safe-area-inset-top, 0px) + 72px);
    width: calc(100vw - 24px);
  }

  .site-title {
    max-width: 100%;
    padding: 0.08em 0.18em 0.12em;
    font-size: clamp(1.35rem, 7.2vw, 2.15rem);
    line-height: 0.95;
    letter-spacing: 0.012em;
    -webkit-text-stroke: 1px #101010;
    text-shadow:
      0 3px 0 #101010,
      0 6px 12px rgba(0,0,0,.68),
      0 0 14px rgba(255,226,74,.72);
  }

  .sticky-note {
    top: calc(env(safe-area-inset-top, 0px) + 150px);
    left: 14px;
    width: clamp(154px, 46vw, 190px);
    min-height: clamp(102px, 28vw, 126px);
    padding: 28px 14px 17px;
    transform: rotate(-4deg);
  }

  .sticky-text {
    font-size: clamp(0.98rem, 4.3vw, 1.3rem);
    line-height: 1.02;
  }

  .sticky-pin {
    width: 24px;
    height: 24px;
    top: -10px;
  }

  .sticky-fold {
    width: 26px;
    height: 26px;
  }
}

/* Very short phones: keep both elements visible without touching the video ads. */
@media (max-width: 780px) and (max-height: 700px) {
  .site-title-wrap {
    top: calc(env(safe-area-inset-top, 0px) + 65px);
  }

  .site-title {
    font-size: clamp(1.12rem, 6.4vw, 1.65rem);
  }

  .sticky-note {
    top: calc(env(safe-area-inset-top, 0px) + 124px);
    width: clamp(142px, 43vw, 172px);
    min-height: 92px;
    padding-top: 24px;
  }

  .sticky-text {
    font-size: clamp(.86rem, 3.9vw, 1.05rem);
  }
}

/* Foldables/tablets using the reference side rails. */
@media (min-width: 781px) and (max-width: 1100px) {
  .site-title-wrap {
    top: 18px;
    width: min(72vw, 720px);
  }

  .site-title {
    font-size: clamp(2.1rem, 5.4vw, 4.3rem);
  }

  .sticky-note {
    top: clamp(132px, 15vh, 180px);
    left: clamp(92px, 12vw, 150px);
    width: clamp(220px, 27vw, 290px);
  }
}

/* Desktop ad system */
.desktop-ad-field {
  position: fixed;
  inset: 0;
  z-index: 60;
  pointer-events: none;
}

.ad-slot {
  pointer-events: auto;
  overflow: hidden;
}

.desktop-ad-slot {
  position: absolute;
  width: 300px;
  height: 250px;
  padding: 0;
  display: grid;
  place-items: center;
}

.desktop-ad-slot.ad-1 { top: var(--corner-gap); left: var(--corner-gap); }
.desktop-ad-slot.ad-2 { top: var(--corner-gap); right: var(--corner-gap); }
.desktop-ad-slot.ad-3 {
  bottom: var(--corner-gap);
  left: 50%;
  transform: translateX(-50%);
}
.desktop-ad-slot.ad-4 { bottom: var(--corner-gap); left: var(--corner-gap); }
.desktop-ad-slot.ad-5 { bottom: var(--corner-gap); right: var(--corner-gap); }

.desktop-ad-content,
.desktop-ad-content iframe {
  width: 300px !important;
  height: 250px !important;
  border: 0 !important;
  display: grid !important;
  place-items: center !important;
}

/* Exact mobile base structure copied from TIC-TAC-TOE-WITH-AI-V5. */
.mobile-ad-rail {
  display: none;
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  z-index: 60;
  flex-direction: column;
  gap: 12px;
}

.mobile-ad-rail-left { left: 5px; }
.mobile-ad-rail-right { right: 5px; }

.mobile-ad-slot {
  width: clamp(58px, 15vw, 86px);
  height: clamp(116px, 24vh, 150px);
  padding: 10px 7px;
  text-align: center;
  align-items: center;
}

/* Placeholder styling only; position and dimensions come from the real slots. */
.ad-placeholder,
.mobile-placeholder {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  background: rgba(0, 40, 0, 0.88);
  border: 2px dashed rgba(255, 255, 255, 0.95);
  color: #fff;
  text-align: center;
  font-weight: 900;
  line-height: 1.35;
}

@media (max-width: 1100px) {
  .desktop-ad-field {
    display: none;
  }

  .mobile-ad-rail {
    display: flex;
  }
}

/*
  Exact final mobile placement rules from TIC-TAC-TOE-WITH-AI-V5.
  No extra iframe scaling, rotation or 320px inner canvas is applied.
*/
@media (max-width: 780px) {
  .sahur-video {
    width: 100%;
    height: 100%;
    transform: translate(-50%, calc(-50% + 34px));
    object-fit: cover;
  }

  .mobile-ad-rail {
    display: block !important;
    position: static !important;
    transform: none !important;
    z-index: 60 !important;
  }

  .mobile-ad-slot {
    position: fixed !important;
    width: calc((100vw - 34px) / 3) !important;
    height: 54px !important;
    padding: 6px 7px !important;
    border-radius: 15px !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: flex-start !important;
    text-align: left !important;
    z-index: 60 !important;
  }

  .mobile-ad-slot.ad-1 {
    top: calc(env(safe-area-inset-top, 0px) + 8px) !important;
    left: 8px !important;
  }

  .mobile-ad-slot.ad-2 {
    top: calc(env(safe-area-inset-top, 0px) + 8px) !important;
    right: 8px !important;
  }

  .mobile-ad-slot.ad-4 {
    bottom: calc(env(safe-area-inset-bottom, 0px) + 8px) !important;
    left: 8px !important;
  }

  .mobile-ad-slot.ad-3 {
    bottom: calc(env(safe-area-inset-bottom, 0px) + 8px) !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
  }

  .mobile-ad-slot.ad-5 {
    bottom: calc(env(safe-area-inset-bottom, 0px) + 8px) !important;
    right: 8px !important;
  }

  /*
    The message uses only the empty middle third between AD 1 and AD 2.
    Its top and width match that opening so it cannot touch either slot.
  */
  .tung-message {
    top: calc(env(safe-area-inset-top, 0px) + 9px);
    width: calc((100vw - 58px) / 3);
    min-width: 0;
  }

  .tung-message h1 {
    font-size: clamp(0.43rem, 2.05vw, 0.72rem);
    line-height: 1.05;
    letter-spacing: -0.025em;
    overflow-wrap: anywhere;
  }

  .tung-message p {
    margin-top: 4px;
    font-size: clamp(0.42rem, 1.95vw, 0.68rem);
    line-height: 1.02;
  }
}

@media (max-width: 420px) {
  .mobile-ad-slot {
    height: 50px !important;
    width: calc((100vw - 30px) / 3) !important;
  }

  .tung-message {
    top: calc(env(safe-area-inset-top, 0px) + 8px);
    width: calc((100vw - 52px) / 3);
  }

  .tung-message h1 {
    font-size: clamp(0.39rem, 2vw, 0.58rem);
  }

  .tung-message p {
    font-size: clamp(0.38rem, 1.85vw, 0.55rem);
  }
}

/*
  Compact tablets/foldables retain the exact reference side rails.
  The title remains safely centred at the top between those rails.
*/
@media (min-width: 781px) and (max-width: 1100px) {
  .tung-message {
    top: 14px;
    width: min(62vw, 600px);
  }

  .tung-message h1 {
    font-size: clamp(1rem, 3vw, 1.8rem);
  }

  .tung-message p {
    font-size: clamp(0.8rem, 2vw, 1.2rem);
  }
}


/* V8 mobile video clearance: character sits below the sticky note. */
@media (max-width: 780px) and (max-height: 700px) {
  .sahur-video {
    transform: translate(-50%, calc(-50% + 24px)) !important;
  }
}

/* Respect users who request reduced motion while retaining layout and playback. */
@media (prefers-reduced-motion: reduce) {
  .site-title,
  .sticky-note {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
  }
}
