@font-face {
  font-family: "Quicksand";
  src: url("assets/fonts/quicksand-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Ranchers";
  src: url("assets/fonts/ranchers-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: only light;
  font-family: "Quicksand", system-ui, sans-serif;
  background: #23182c;
  touch-action: none;
}

* { box-sizing: border-box; }

html, body {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 50% 30%, #54405f, #201724 72%);
}

.game-hidden { display: none !important; }

#setup-screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(22px, 5vw, 76px);
  background:
    linear-gradient(90deg, rgba(255,255,255,.04), rgba(255,244,220,.08)),
    url("assets/long-bg.png") center center / cover no-repeat;
  overflow: auto;
}

#setup-screen.hidden { display: none; }

.setup-panel {
  width: min(470px, 92vw);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  padding: clamp(20px, 2.6vw, 30px);
  color: #6c331e;
  text-align: center;
  border: 4px solid #ff9aaf;
  border-radius: 30px;
  background: linear-gradient(180deg, rgba(255,251,228,.97), rgba(255,232,194,.97));
  box-shadow: 0 10px 0 rgba(184,94,59,.2), 0 28px 70px rgba(82,45,35,.22);
}

.setup-panel .logo {
  white-space: nowrap;
  font-size: clamp(44px, 5vw, 70px);
  line-height: 1;
}

.setup-description {
  max-width: 360px;
  margin: -2px 0 2px;
  color: #74361f;
  font-size: 15px;
  line-height: 1.25;
}

.setup-character-panel {
  position: relative;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-height: 220px;
  padding: 26px 12px 10px;
  border: 3px solid #ff9aaf;
  border-radius: 22px;
  background: rgba(255,250,231,.74);
}

.setup-character-panel > small {
  position: absolute;
  top: 10px;
  left: 12px;
  padding: 4px 9px;
  border-radius: 999px;
  color: #a74245;
  background: #ffc2bd;
  font-size: 10px;
  letter-spacing: .04em;
}

.setup-character {
  width: min(72%, 285px);
  height: 165px;
  object-fit: contain;
}

.setup-character-panel strong {
  color: #74361f;
  font-size: 15px;
}

.setup-note {
  max-width: 100%;
  color: #a75d3b;
  font-size: 10px;
  line-height: 1.25;
}

#game-shell {
  position: relative;
  width: min(100vw, calc(100svh * 0.45));
  height: min(100svh, calc(100vw / 0.45));
  overflow: hidden;
  background: #65caff;
  box-shadow: 0 0 45px rgba(0,0,0,.45);
  user-select: none;
  -webkit-user-select: none;
}

#game {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

.game-overlay-button {
  position: absolute;
  z-index: 4;
  display: none;
  min-width: 11%;
  min-height: 5.5%;
  padding: 0 2%;
  border: clamp(3px,.45vw,7px) solid #fff5de;
  border-radius: 999px;
  color: #fff;
  background: #ef5682;
  box-shadow: 0 .45rem 0 #b72d59;
  font: 700 clamp(17px,4vw,40px)/1 "Quicksand",sans-serif;
  touch-action: manipulation;
}
#game-shell:not(.game-hidden) .game-overlay-button { display: block; }
#game-back-button { left: 2.2%; top: 9.2%; }
#skip-game-button {
  right: 3.2%;
  bottom: 13.2%;
  min-width: 0;
  min-height: 0;
  padding: .35em .15em;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: #fff;
  text-shadow: 0 2px 4px rgba(75,34,48,.8);
  font-size: clamp(11px,2.3vw,22px);
}
.game-overlay-button[hidden] { display: none !important; }

.card {
  position: absolute;
  left: 7%;
  right: 7%;
  top: 50%;
  transform: translateY(-45%) scale(.94);
  display: none;
  flex-direction: column;
  align-items: center;
  gap: clamp(10px, 2svh, 24px);
  padding: 8% 7%;
  text-align: center;
  color: #6c331e;
  border: clamp(3px, .7vw, 8px) solid #fff5de;
  border-radius: 8%;
  background: linear-gradient(180deg, rgba(255,251,228,.97), rgba(255,226,181,.97));
  box-shadow: none;
  z-index: 5;
}

.card.visible { display: flex; animation: pop .34s ease-out forwards; }
.card p { margin: 0; font-weight: 800; font-size: clamp(18px, 4.2vw, 46px); }
.card small { font-weight: 800; font-size: clamp(13px, 3vw, 31px); color: #a75d3b; }
.card h1 {
  margin: 0;
  color: #ef4f7d;
  font-family: "Ranchers", sans-serif;
  font-weight: 400;
  font-size: clamp(34px, 8vw, 80px);
  line-height: 1;
}

#start-card {
  inset: 0;
  transform: none;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

#start-card.visible { animation: none; }
#start-button, #start-card #start-button {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
#start-button img { display: block; width: 100%; height: 100%; object-fit: fill; pointer-events: none; }
#start-button:active { transform: none; box-shadow: none; }
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

#start-card .logo {
  white-space: nowrap;
  font-size: clamp(21px, 4.8vw, 48px);
  line-height: 1;
  letter-spacing: .035em;
}

#start-card p {
  max-width: 100%;
  font-size: clamp(12px, 2.2vw, 22px);
  line-height: 1.18;
}

#start-card p span {
  display: block;
  white-space: nowrap;
}

#start-card p span + span { margin-top: .28em; }

.demo-label {
  color: #ef5682 !important;
  letter-spacing: .16em;
}

.name-fields {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(5px, .6svh, 9px);
  width: 100%;
}

.name-fields label {
  color: #8d472e;
  font-size: 16px;
  font-weight: 700;
  text-align: left;
}

.name-fields input {
  display: block;
  width: 100%;
  margin-top: .25em;
  border: clamp(1px, .35vw, 3px) solid #e9a06d;
  border-radius: 999px;
  padding: .48em .7em;
  outline: none;
  color: #6c331e;
  background: rgba(255,255,255,.82);
  font: 700 17px/1.1 "Quicksand", sans-serif;
}

.language-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3%;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
}

.language-fields legend {
  grid-column: 1 / -1;
  margin-bottom: .25em;
  color: #8d472e;
  font-size: 16px;
  font-weight: 700;
  text-align: left;
}

.language-button {
  min-width: 0;
  padding: .55em .4em;
  border: clamp(1px, .3vw, 3px) solid #e9a06d;
  color: #7b3a25;
  background: rgba(255,255,255,.7);
  box-shadow: none;
  font-size: 15px;
}

.language-button.active {
  border-color: #ef5682;
  background: #ffe8ef;
}

#setup-button {
  width: 100%;
  min-width: 0;
  padding: .55em 1em;
  font-size: 20px;
}

#setup-buy-cta {
  display: block;
  width: 100%;
  min-width: 0;
  padding: .62em 1em;
  border-radius: 999px;
  color: white;
  background: linear-gradient(#f4578a, #dd3568);
  box-shadow: 0 .22em 0 #a92652;
  font: 700 19px/1 "Quicksand", system-ui, sans-serif;
  text-align: center;
  text-decoration: none;
}
#setup-buy-cta:active { transform: translateY(.16em); box-shadow: 0 .06em 0 #a92652; }
#setup-buy-cta[hidden] { display: none; }

.name-fields input:focus { border-color: #ef5682; }

.name-error {
  min-height: 1em;
  color: #c7355f;
  font-size: 14px;
  font-weight: 700;
}

#start-card button {
  min-width: 53%;
  padding: .48em .9em;
  font-size: clamp(15px, 3.1vw, 31px);
}

#start-card small {
  font-size: clamp(10px, 1.95vw, 20px);
}

#end-card {
  left: 50%;
  right: auto;
  top: 43%;
  width: 78%;
  aspect-ratio: 1 / 1;
  height: auto;
  overflow: hidden;
  justify-content: flex-start;
  padding: 3.2% 5% 3.8%;
  gap: clamp(4px, .55svh, 7px);
  transform: translate(-50%,-45%) scale(.94);
}

#end-card .end-present {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 20%;
  height: auto;
  transform: translateX(-50%);
  filter: drop-shadow(0 8px 0 rgba(172,62,74,.2));
}

#end-card .end-visual {
  position: relative;
  width: 29%;
  aspect-ratio: 2 / 3;
  flex: 0 0 auto;
}

#end-card .end-character {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
#end-card .end-photo-mask{position:absolute;z-index:1;inset:0;overflow:hidden;-webkit-mask:url("assets/arms-out-face-mask.png") 0 0/100% 100% no-repeat;mask:url("assets/arms-out-face-mask.png") 0 0/100% 100% no-repeat}
#end-card .end-photo-mask img{position:absolute;left:50%;top:34.34%;width:67.375%;height:39.375%;object-fit:cover;transform:translate(-50%,-50%)}
#end-card .end-character{z-index:2}
.end-cta{display:block;width:min(82%,280px);margin:3px auto 0;padding:7px 10px;border-radius:999px;color:#fff;text-decoration:none;font-family:Quicksand,sans-serif;font-size:clamp(13px,2.8vw,17px);font-weight:800;line-height:1.1;text-align:center}
.buy-game-cta{background:#ef5682;box-shadow:0 4px 0 #c72e61}
.store-cta{background:#62ad62;box-shadow:0 4px 0 #3d7d42}
.end-cta[hidden]{display:none}

#end-card h1 {
  max-width: 100%;
  font-size: clamp(18px, 4vw, 25px);
  line-height: 1.03;
  letter-spacing: .025em;
}

#end-card p {
  max-width: 100%;
  font-size: clamp(13px, 2.9vw, 18px);
  line-height: 1.18;
  white-space: normal;
}

#end-card .end-from {
  color: #a75d3b;
  font-size: clamp(11px, 2.35vw, 14px);
  max-width: 100%;
  white-space: normal;
}

#end-card button {
  min-width: 44%;
  padding: .46em .85em;
  font-size: clamp(13px, 2.7vw, 17px);
}

#end-card .preview-actions {
  width: 86%;
  display: grid;
  gap: 8px;
}

#end-card .preview-actions[hidden] { display: none; }

#end-card .preview-actions button {
  width: 100%;
  min-width: 0;
  margin: 0;
  font-size: clamp(12px, 2.5vw, 16px);
}

#end-card .preview-edit-button {
  color: #713821;
  background: #fff4df;
  box-shadow: 0 4px 0 #d9a777;
}

#end-card.visible { animation: end-pop .34s ease-out forwards; }

@keyframes end-pop {
  from { opacity: 0; transform: translate(-50%,-45%) scale(.75); }
  to { opacity: 1; transform: translate(-50%,-45%) scale(1); }
}

.logo {
  color: #ef4f7d;
  font-family: "Ranchers", sans-serif;
  font-weight: 400;
  font-size: clamp(52px, 13vw, 132px);
  line-height: .82;
  letter-spacing: .035em;
  -webkit-text-stroke: 0 transparent;
  text-shadow: -1px -2px 0 rgba(255,255,255,.42);
}

button {
  min-width: 68%;
  border: 0;
  border-radius: 999px;
  padding: .7em 1.25em;
  color: white;
  background: linear-gradient(#ff6f9b, #ed3f73);
  box-shadow: 0 .22em 0 #b52c5b;
  font: 700 clamp(20px, 5vw, 52px)/1 "Quicksand", system-ui, sans-serif;
  cursor: pointer;
}

button:active { transform: translateY(.16em); box-shadow: 0 .06em 0 #b52c5b; }
@keyframes pop {
  from { opacity: 0; transform: translateY(-45%) scale(.75); }
  to { opacity: 1; transform: translateY(-45%) scale(1); }
}

@media (max-width: 700px) and (pointer: coarse) {
  #game-shell {
    width: 100vw;
    height: 100svh;
  }

  #start-card {
    width: 100%;
    height: 100%;
    min-height: 0;
    max-height: none;
    overflow: hidden;
    padding: 0;
  }

  #start-card .logo {
    font-size: clamp(34px, 9.5vw, 41px);
    line-height: 1;
  }

  #start-card p {
    font-size: clamp(18px, 4.8vw, 21px);
    line-height: 1.2;
  }

  #start-card p span { white-space: normal; }
  #start-card p span + span { margin-top: .28em; }

  #start-card button {
    min-width: 0;
    padding: 0;
    font-size: 0;
  }

  #start-card small {
    max-width: 88%;
    font-size: clamp(17px, 4.4vw, 19px);
    line-height: 1.2;
  }

  #setup-screen {
    justify-content: center;
    padding: 18px;
    background-position: 42% center;
  }
  .setup-panel {
    width: min(430px, 94vw);
    gap: 6px;
    padding: 17px 19px 19px;
  }
  .setup-panel .logo { font-size: clamp(39px, 12vw, 58px); }
  .setup-description { font-size: 13px; }
  .setup-character-panel { min-height: 184px; padding-top: 22px; }
  .setup-character { height: 132px; }
  .setup-character-panel strong { font-size: 13px; }
  .name-fields { gap: 6px; }
  .name-fields label,
  .language-fields legend { font-size: 14px; }
  .name-fields input { font-size: 15px; }
  .language-button { font-size: 13px; }
  #setup-button { font-size: 18px; }
  #setup-buy-cta { font-size: 17px; }
}

@media (pointer: fine) {
  html,
  body,
  #game-shell {
    overflow: clip;
    scrollbar-width: none;
  }
}
.language-select{width:100%;padding:12px 14px;border:2px solid #ef4f7d;border-radius:14px;background:#fffaf0;color:#713821;font:inherit;font-weight:800}.language-select:focus{outline:3px solid rgba(239,79,125,.2)}

/* v14: Gift Grab-style compact setup template. */
#setup-screen { padding: max(16px, env(safe-area-inset-top)) 14px max(16px, env(safe-area-inset-bottom)); }
.setup-panel { width: min(92vw, 420px); gap: 7px; padding: 20px; border-width: 3px; }
.setup-panel .logo { font-size: clamp(37px, 10vw, 51px); }
.setup-description { margin: 0; font-size: 13px; }
.setup-character-panel { min-height: 0; padding: 0; border: 0; background: transparent; }
.setup-character { width: min(42%, 170px); height: 116px; }
.name-fields { gap: 7px; }
.name-fields label, .language-fields > span { color: #8d472e; font-size: 13px; font-weight: 700; text-align: left; }
.name-fields input { margin-top: 3px; padding: 9px 11px; border-radius: 12px; font-size: 14px; }
.language-fields { display: grid; grid-template-columns: 1fr; gap: 4px; }
.language-select { min-height: 39px; padding: 9px 11px; border-radius: 12px; }
#demo-photo-mount .kdp-photo-row { grid-template-columns: 1fr; margin: 0; }
#demo-photo-mount .kdp-photo-adjust { display: none !important; }
#demo-photo-mount .kdp-photo-button { min-height: 38px; border-radius: 12px; }
.name-error { display: none; }
#setup-button, #setup-buy-cta, #setup-home-cta { min-height: 41px; padding: 10px 14px; font-size: 14px; }
#setup-home-cta { display:block; width:100%; border-radius:999px; color:#fff; background:#985b32; box-shadow:0 5px 0 #69391f; font:700 14px/1.1 "Quicksand",sans-serif; text-align:center; text-decoration:none; }
.setup-note { display: none; }
@media (max-height: 700px) {
  .setup-panel { padding-block: 14px; }
  .setup-character { height: 88px; }
  .setup-description { display: none; }
}
