/* KitUI — bright arcade styling. No grey placeholders, no dark full-screen scrims. */
:root {
  --ink: #123047;
  --paper: #ffffff;
  --pink: #ff5d73;
  --mint: #2ec4a6;
  --grape: #7a5cff;
  --sun: #ffd166;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: #ffd98a;
  overflow: hidden;
  font-family: "Trebuchet MS", Verdana, "Segoe UI", sans-serif;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

#game-wrap {
  position: relative;
  height: min(100vh, 1039px);
  aspect-ratio: 390 / 844;
  max-width: 100vw;
  margin: 0 auto;
  overflow: hidden;
  background: #ffd98a;
  box-shadow: 0 0 60px rgba(24, 48, 80, 0.28);
}

#game-wrap canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
  touch-action: none;
}

.kit-ui {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.kit-ui .screen {
  position: absolute;
  inset: 0;
  display: none;
  pointer-events: none;
}

.kit-ui .screen[data-visible="true"] {
  display: flex;
}

/* age rating badge: small, bottom-left, never covers play */
.age-badge {
  position: absolute;
  left: 12px;
  bottom: 12px;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  color: #20304f;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.4px;
  box-shadow: 0 2px 8px rgba(20, 40, 70, 0.18);
  z-index: 30;
}

.gear {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  color: #24405f;
  font-size: 22px;
  line-height: 44px;
  text-align: center;
  cursor: pointer;
  pointer-events: auto;
  box-shadow: 0 3px 10px rgba(20, 40, 70, 0.2);
  z-index: 40;
}

.reward-btn {
  position: absolute;
  right: 14px;
  bottom: 64px;
  min-width: 96px;
  height: 46px;
  padding: 0 16px;
  border: 0;
  border-radius: 23px;
  background: linear-gradient(180deg, #8f74ff, #6a49e8);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  pointer-events: auto;
  display: none;
  box-shadow: 0 6px 14px rgba(80, 50, 200, 0.35);
  z-index: 35;
}

.reward-btn[data-visible="true"] {
  display: block;
}

.title-screen {
  flex-direction: column;
  align-items: center;
  padding-top: 74px;
  text-align: center;
  z-index: 20;
}

.title-kicker {
  font-size: 12px;
  letter-spacing: 3px;
  font-weight: 700;
  color: #fff;
  background: var(--pink);
  padding: 6px 14px;
  border-radius: 999px;
  box-shadow: 0 4px 12px rgba(200, 50, 90, 0.3);
}

#game-title {
  margin: 14px 18px 4px;
  font-size: 40px;
  line-height: 1.05;
  color: #fff;
  text-shadow: 0 3px 0 #1b3a5c, 0 8px 20px rgba(20, 40, 70, 0.35);
  letter-spacing: 1px;
}

#game-tagline {
  margin: 6px 24px;
  font-size: 15px;
  color: #17324c;
  background: rgba(255, 255, 255, 0.82);
  padding: 6px 14px;
  border-radius: 12px;
}

.title-cta {
  position: absolute;
  left: 50%;
  bottom: 132px;
  transform: translateX(-50%);
  min-width: 220px;
  padding: 16px 22px;
  border-radius: 999px;
  background: linear-gradient(180deg, #ff7a8c, #ff4f6d);
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  box-shadow: 0 8px 0 #d63855, 0 12px 20px rgba(180, 40, 70, 0.3);
  animation: cta-pulse 1.6s ease-in-out infinite;
}

@keyframes cta-pulse {
  0%, 100% { transform: translateX(-50%) scale(1); }
  50% { transform: translateX(-50%) scale(1.045); }
}

.tutorial {
  position: absolute;
  left: 20px;
  right: 20px;
  bottom: 118px;
  display: none;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.95);
  color: #14294a;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.25;
  box-shadow: 0 6px 18px rgba(20, 40, 70, 0.22);
  z-index: 25;
}

.tutorial[data-visible="true"] {
  display: flex;
}

.tut-hand {
  font-size: 24px;
}

.tut-arrow {
  font-size: 26px;
  color: var(--pink);
  animation: tut-bob 0.9s ease-in-out infinite;
}

@keyframes tut-bob {
  0%, 100% { transform: translateY(2px); }
  50% { transform: translateY(-6px); }
}

#tutorial-text {
  font-size: 17px;
}

.result-screen {
  align-items: center;
  justify-content: center;
  background: transparent;
  z-index: 30;
}


.result-screen .panel,
.settings-screen .panel {
  box-shadow: 0 18px 50px rgba(16, 40, 70, 0.35);
  pointer-events: auto;
  width: min(310px, calc(100vw - 48px));
  background: linear-gradient(180deg, #fff8e4 0%, #ffe7f0 100%);
  border-radius: 26px;
  padding: 20px 18px 18px;
  text-align: center;
  box-shadow: 0 18px 40px rgba(16, 40, 70, 0.28);
}

.panel h2 {
  margin: 0 0 4px;
  font-size: 26px;
  color: #16324f;
}

.panel p {
  margin: 0 0 12px;
  font-size: 14px;
  color: #5a6a8a;
  min-height: 18px;
}

.score-row {
  display: flex;
  justify-content: space-between;
  font-size: 16px;
  color: #16324f;
  padding: 7px 4px;
  border-top: 1px solid #e8eef6;
}

.score-row b {
  color: #ff4f6d;
}

.btn {
  margin-top: 14px;
  width: 100%;
  height: 52px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(180deg, #35d3b2, #1fae91);
  color: #fff;
  font-family: inherit;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 0 #16866f;
}

.btn:active {
  transform: translateY(2px);
  box-shadow: 0 3px 0 #16866f;
}

.settings-screen {
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.9);
  pointer-events: auto;
  z-index: 50;
}

.settings-screen .panel {
  width: min(330px, calc(100vw - 40px));
  background: #ffffff;
}

.settings-screen .row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 4px;
  border-bottom: 1px solid #eef3f9;
  font-size: 17px;
  color: #16324f;
  font-weight: 600;
}

.settings-screen input[type="checkbox"] {
  width: 26px;
  height: 26px;
  accent-color: #2ec4a6;
}

.link {
  display: block;
  margin-top: 16px;
  font-size: 17px;
  color: #1d6fd8;
  font-weight: 700;
  text-decoration: underline;
  pointer-events: auto;
}

.support {
  margin: 10px 0 0;
  font-size: 13px;
  color: #6b7a95;
}

.toast {
  position: absolute;
  left: 50%;
  top: 92px;
  transform: translateX(-50%) translateY(-8px);
  background: rgba(20, 40, 70, 0.92);
  color: #fff;
  font-size: 14px;
  padding: 9px 16px;
  border-radius: 999px;
  opacity: 0;
  transition: opacity 0.16s ease, transform 0.16s ease;
  z-index: 60;
}

.toast[data-visible="true"] {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

#debug-overlay {
  position: absolute;
  left: 8px;
  top: 58px;
  max-width: 260px;
  font: 11px/1.35 monospace;
  color: #0b1b33;
  background: rgba(255, 255, 255, 0.8);
  padding: 6px 8px;
  border-radius: 8px;
  pointer-events: none;
  white-space: pre-wrap;
  z-index: 70;
}

#boot-splash {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #ffd98a, #ffb3c7);
  color: #16324f;
  font-size: 20px;
  font-weight: 700;
  z-index: 90;
  pointer-events: none;
  animation: splash-out 0.45s ease 0.9s forwards;
}

@keyframes splash-out {
  to { opacity: 0; visibility: hidden; }
}

/* ---------- retention layer: hud, celebration, campaign, unlocks ---------- */

#hud {
  position: absolute;
  left: 14px;
  right: 14px;
  top: 12px;
  display: none;
  align-items: center;
  gap: 10px;
  z-index: 18;
  pointer-events: none;
  color: #14294a;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.4px;
}
#hud[data-visible="true"] { display: flex; }

#hud-level, #hud-coins {
  background: rgba(255, 255, 255, 0.82);
  padding: 4px 10px;
  border-radius: 999px;
  box-shadow: 0 2px 0 rgba(20, 41, 74, 0.12);
}
#hud-coins { color: #b26a00; }

#hud-bar {
  flex: 1;
  height: 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.55);
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(20, 41, 74, 0.18);
}
#hud-bar-fill {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #ffd166, #ff8b5e);
  transition: width 0.25s ease-out;
}

#celebrate {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  pointer-events: none;
  z-index: 38;
  text-align: center;
}
#celebrate[data-visible="true"] { display: flex; animation: celeb-pop 0.32s ease-out; }

#celebrate-stars { font-size: 44px; letter-spacing: 6px; }
#celebrate-stars i { color: rgba(255, 255, 255, 0.55); font-style: normal; }
#celebrate-stars i.on { color: #ffc53d; text-shadow: 0 3px 0 #d98f00; }

#celebrate-title {
  font-size: 30px;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 3px 0 rgba(20, 41, 74, 0.35);
}
#celebrate-coins {
  font-size: 17px;
  font-weight: 800;
  color: #fff7d6;
  text-shadow: 0 2px 0 rgba(20, 41, 74, 0.3);
}

@keyframes celeb-pop {
  from { transform: scale(0.86); opacity: 0.2; }
  to { transform: scale(1); opacity: 1; }
}

#title-meta {
  margin-top: 14px;
  display: flex;
  gap: 14px;
  font-size: 13px;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 2px 0 rgba(20, 41, 74, 0.28);
}

#campaign {
  margin-top: 10px;
  width: 190px;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.45);
  overflow: hidden;
}
#campaign-fill {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #ffd166, #ff6ec7);
}

#unlock-row {
  margin-top: 16px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 330px;
}
.chip {
  border: 0;
  border-radius: 999px;
  padding: 8px 12px;
  min-height: 34px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 800;
  color: #14294a;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 3px 0 rgba(20, 41, 74, 0.14);
  cursor: pointer;
}
.chip[data-unlocked="false"] { opacity: 0.72; }
.chip.equipped { background: #ffd166; }

.result-hint {
  margin: 2px 0 6px;
  font-size: 15px;
  font-weight: 700;
  color: #d0453f;
  display: none;
}

.btn.ghost {
  margin-top: 10px;
  background: #ffffff;
  color: #14294a;
  box-shadow: 0 4px 0 rgba(20, 41, 74, 0.18);
}

#tutorial-visual {
  position: absolute;
  left: 50%;
  top: 60%;
  width: 0;
  height: 0;
  display: none;
}
#tutorial-visual[data-visible="true"] { display: block; }

#tutorial-visual .ring {
  position: absolute;
  left: -26px;
  top: -26px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 3px solid #ff6b6b;
  animation: tut-ring 1.2s ease-out infinite;
}
#tutorial-visual .finger {
  position: absolute;
  left: -11px;
  top: -11px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 3px #ff6b6b, 0 4px 10px rgba(20, 41, 74, 0.3);
  animation: tut-tap 1.2s ease-in-out infinite;
}
#tutorial-visual .chev {
  position: absolute;
  left: -9px;
  top: -62px;
  width: 18px;
  height: 18px;
  border-right: 4px solid #fff;
  border-bottom: 4px solid #fff;
  transform: rotate(45deg);
  animation: tut-chev 1.2s ease-in-out infinite;
}

@keyframes tut-ring {
  0% { transform: scale(0.6); opacity: 0.95; }
  80% { transform: scale(1.35); opacity: 0; }
  100% { transform: scale(1.35); opacity: 0; }
}
@keyframes tut-tap {
  0%, 100% { transform: translateY(0) scale(1); }
  45% { transform: translateY(4px) scale(0.9); }
}
@keyframes tut-chev {
  0%, 100% { transform: translateY(0) rotate(45deg); opacity: 0.9; }
  50% { transform: translateY(8px) rotate(45deg); opacity: 0.5; }
}
