:root {
  --kfc-red: #e4002b;
  --kfc-red-bright: #ee002d;
  --kfc-red-hover: #c40024;
  --kfc-red-dark: #8c0019;
  --kfc-bg: #360501;
  --kfc-page-bg: #140201;
  --kfc-white: #ffffff;
  --kfc-black: #111111;
  --font-display: "Arial Black", "Impact", "Helvetica Neue", Arial, sans-serif;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: var(--kfc-page-bg);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  display: flex;
  align-items: center;
  justify-content: center;
}

button {
  font: inherit;
  border: 0;
  background: none;
  cursor: pointer;
  color: inherit;
}

[hidden] {
  display: none !important;
}

/* ---------- Interstitial Ad Container ---------- */
/* Responsive: 100% full screen on mobile; neatly centered with max-width on desktop */

.ad {
  position: relative;
  width: 100%;
  max-width: 480px;
  height: 100vh;
  height: 100dvh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  background: radial-gradient(circle at 50% 35%, #5a0803 0%, #360501 100%);
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  box-shadow: 0 0 60px rgba(0, 0, 0, 0.85);
}

/* ---------- Loader ---------- */

.loader {
  position: absolute;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--kfc-bg);
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

.ad:not(.is-loading) .loader {
  opacity: 0;
  visibility: hidden;
}

.spinner {
  width: 44px;
  height: 44px;
  border: 4px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--kfc-red);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ---------- Close Button ---------- */

.close-btn {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  right: 12px;
  z-index: 50;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  border: 1.5px solid rgba(255, 255, 255, 0.75);
  color: #fff;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}

.close-btn:active {
  transform: scale(0.9);
  background: rgba(0, 0, 0, 0.85);
}

.close-btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: #fff;
  stroke-width: 2.6;
  stroke-linecap: round;
}

/* ---------- Main Creative Image (kfc.jpg) ---------- */

.creative-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: pointer;
}

.kfc-img {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: cover;
  object-position: center bottom;
  display: block;
}

/* ---------- Action Bar & Find Nearest KFC Store Button ---------- */

.action-bar {
  position: relative;
  z-index: 20;
  flex: none;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 12px 16px max(16px, env(safe-area-inset-bottom));
  background: linear-gradient(to top, rgba(20, 2, 1, 0.96) 0%, rgba(35, 3, 2, 0.75) 70%, transparent 100%);
}

.directions-btn {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  max-width: 420px;
  height: 54px;
  padding: 0 16px;
  background: linear-gradient(180deg, var(--kfc-red-bright) 0%, var(--kfc-red) 55%, var(--kfc-red-hover) 100%);
  color: var(--kfc-white);
  border: 2px solid #ffffff;
  border-radius: 50px;
  box-shadow: 0 6px 22px rgba(228, 0, 43, 0.6), 0 2px 8px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.4);
  cursor: pointer;
  transition: transform 0.18s ease, filter 0.18s ease, box-shadow 0.18s ease;
  animation: btnPulse 2.8s ease-in-out infinite;
}

.btn-shine {
  position: absolute;
  top: 0;
  left: -100%;
  width: 50%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.38), transparent);
  transform: skewX(-20deg);
  animation: shine 3.6s ease-in-out infinite;
  pointer-events: none;
}

@keyframes shine {
  0%, 65% { left: -100%; }
  100% { left: 160%; }
}

.btn-icon-wrap {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  flex-shrink: 0;
}

.btn-icon-wrap svg.nav-icon {
  width: 18px;
  height: 18px;
  fill: var(--kfc-red);
}

.btn-text {
  font-family: var(--font-display);
  font-size: clamp(12px, 3.4vw, 15px);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--kfc-white);
  white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

.directions-btn:hover {
  filter: brightness(1.06);
  box-shadow: 0 8px 28px rgba(228, 0, 43, 0.75), 0 3px 10px rgba(0, 0, 0, 0.5);
  transform: translateY(-1px);
}

.directions-btn:active {
  transform: translateY(1px) scale(0.98);
  filter: brightness(0.94);
  box-shadow: 0 3px 12px rgba(228, 0, 43, 0.5);
}

@keyframes btnPulse {
  0%, 100% {
    box-shadow: 0 6px 22px rgba(228, 0, 43, 0.6), 0 2px 8px rgba(0, 0, 0, 0.45);
  }
  50% {
    box-shadow: 0 6px 30px rgba(228, 0, 43, 0.9), 0 3px 12px rgba(0, 0, 0, 0.6);
  }
}

/* ---------- Closed Screen (MRAID / Ad Fallback) ---------- */

.closed-screen {
  position: absolute;
  inset: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: #150201;
  color: #eee;
  font-size: 14px;
}

.closed-screen button {
  padding: 10px 22px;
  border-radius: 6px;
  background: var(--kfc-red);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
}

/* Small screen adjustments */
@media (max-height: 520px) {
  .action-bar {
    padding: 8px 12px max(10px, env(safe-area-inset-bottom));
  }
  .directions-btn {
    height: 46px;
  }
  .btn-icon-wrap {
    width: 28px;
    height: 28px;
  }
  .btn-icon-wrap svg.nav-icon {
    width: 15px;
    height: 15px;
  }
}
