@font-face {
  font-family: "Patrick Hand";
  src: url("assets/PatrickHand-Regular.ttf") format("truetype");
  font-display: swap;
}

@font-face {
  font-family: "Medieval Sharp";
  src: url("assets/MedievalSharp-Regular.ttf") format("truetype");
  font-display: swap;
}

:root {
  color-scheme: dark;
  font-family: "Patrick Hand", system-ui, sans-serif;
  background: #17221d;
}

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

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  touch-action: none;
  user-select: none;
}

button { font: inherit; }

#ad {
  position: fixed;
  inset: 0;
  min-width: 280px;
  min-height: 210px;
  overflow: hidden;
  background: #17221d;
}

#game {
  display: block;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

#mini-cta {
  position: absolute;
  z-index: 4;
  top: max(10px, env(safe-area-inset-top));
  right: max(10px, env(safe-area-inset-right));
  min-width: 72px;
  height: 32px;
  padding: 0 13px;
  border: 2px solid #f4ca73;
  border-radius: 6px;
  color: #fff4c9;
  background: #4a2b1d;
  box-shadow: 0 3px 0 #24150f, 0 0 12px rgba(244, 202, 115, 0.28);
  font-size: 17px;
  line-height: 1;
}

#mini-cta.hidden { display: none; }

#mini-cta:active,
#install-cta:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #24150f;
}

#loading {
  position: absolute;
  z-index: 6;
  inset: 0;
  display: grid;
  place-items: center;
  color: #ffe6a3;
  background: #17221d;
  font-size: 26px;
  transition: opacity 180ms ease;
}

#loading.ready {
  display: none;
}

#end-card {
  position: absolute;
  z-index: 5;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 12px;
  background: rgba(10, 16, 13, 0.76);
  backdrop-filter: blur(2px);
  animation: reveal 320ms ease-out both;
}

#end-card.hidden { display: none; }

.end-card__panel {
  width: min(92%, 680px);
  padding: 16px 22px 18px;
  border: 3px solid #d5a957;
  border-radius: 8px;
  text-align: center;
  color: #fff0ba;
  background: #536170;
  box-shadow: 0 0 0 5px #37281f, 0 12px 30px rgba(0, 0, 0, 0.45);
  display: grid;
  grid-template-columns: minmax(170px, 0.9fr) minmax(210px, 1.1fr);
  grid-template-areas:
    "eyebrow copy"
    "title copy"
    "title cta";
  column-gap: 22px;
  align-items: center;
}

.end-card__eyebrow {
  grid-area: eyebrow;
  margin: 0 0 3px;
  color: #d9c690;
  font-size: 18px;
}

h1 {
  grid-area: title;
  margin: 0;
  font-family: "Medieval Sharp", serif;
  font-size: clamp(36px, 7vw, 54px);
  line-height: 0.92;
  letter-spacing: 0;
  color: #f6d27e;
  text-shadow: 0 3px 0 #5c2e21, 0 0 14px rgba(246, 210, 126, 0.28);
}

#end-copy {
  grid-area: copy;
  margin: 0 auto 12px;
  max-width: 300px;
  font-size: 22px;
  line-height: 1.08;
}

#install-cta {
  grid-area: cta;
  width: 100%;
  min-height: 48px;
  padding: 8px 16px;
  border: 3px solid #ffe39b;
  border-radius: 7px;
  color: #2c1b13;
  background: #e9ad3e;
  box-shadow: 0 4px 0 #7a4a20;
  font-size: 24px;
}

@keyframes reveal {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

@media (max-height: 285px) {
  .end-card__panel { padding-block: 10px 12px; }
  .end-card__eyebrow { font-size: 16px; }
  h1 { font-size: 34px; }
  #end-copy { margin-bottom: 8px; font-size: 19px; }
  #install-cta { min-height: 42px; font-size: 21px; }
}
