/* CuteTopia — LOOK
   Pastel, cozy, rounded, mobile-first. Built to feel like a real little app
   (in-game modal cards instead of browser pop-ups). */

:root {
  --pink: #ffd4ec;
  --pink-deep: #ff7cc9;
  --lav: #ece1ff;
  --purple: #b57cff;
  --mint: #cdeede;
  --sky: #cfe9ff;
  --butter: #fff1b8;
  --cream: #fff7fb;
  --peach: #ffe0c7;
  --ink: #5b2b5f;
  --muted: #9a6f93;
  --card: #ffffff;
  --radius: 22px;
  --shadow: 0 14px 34px rgba(150, 70, 140, 0.18);
  --shadow-sm: 0 6px 16px rgba(150, 70, 140, 0.12);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: "Quicksand", "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 0%, var(--pink), transparent 42%),
    radial-gradient(circle at 85% 8%, var(--sky), transparent 40%),
    radial-gradient(circle at 50% 100%, var(--lav), transparent 55%),
    var(--cream);
  background-attachment: fixed;
  min-height: 100vh;
  -webkit-text-size-adjust: 100%;
}

/* App is phone-shaped and centered, even on a big screen. */
.app {
  width: 100%;
  max-width: 540px;
  margin: 0 auto;
  padding: 26px 20px 60px;
  min-height: 100vh;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  width: 100%;
  border: none;
  border-radius: 999px;
  padding: 16px 22px;
  font: inherit;
  font-weight: 700;
  font-size: 1.08rem;
  cursor: pointer;
  margin-top: 14px;
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: linear-gradient(135deg, var(--pink-deep), var(--purple));
  color: #fff;
  box-shadow: 0 12px 26px rgba(181, 124, 255, 0.4);
}
.btn-primary:hover { filter: brightness(1.05); transform: translateY(-2px); }
.btn-secondary { background: #fff; color: var(--purple); box-shadow: var(--shadow-sm); }
.btn-ghost { background: transparent; color: var(--muted); box-shadow: none; }

.row { display: flex; gap: 12px; }
.row .btn { margin-top: 14px; }
.center { text-align: center; }
.muted { color: var(--muted); margin: 6px 0 0; font-size: 0.96rem; line-height: 1.4; }
.note { color: var(--muted); font-size: 0.95rem; }

/* ---------- Screen transitions ---------- */
.screen { animation: fadeIn 0.42s ease both; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.fade-in { animation: fadeIn 0.45s ease both; }
@keyframes popIn { from { opacity: 0; transform: scale(0.86); } to { opacity: 1; transform: scale(1); } }
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }

.screen-head { text-align: center; margin-bottom: 18px; }
.screen-title { font-size: 1.8rem; margin: 6px 0; color: var(--ink); }
.screen-title.left { text-align: left; font-size: 1.5rem; }
.screen-sub { color: var(--muted); margin: 0 auto; max-width: 30em; line-height: 1.45; }

/* ---------- Splash ---------- */
.splash { text-align: center; padding-top: 10px; }
.splash-poster {
  width: 78%; max-width: 320px; border-radius: 26px;
  box-shadow: var(--shadow); display: block; margin: 8px auto 18px;
  animation: float 5s ease-in-out infinite;
}
.splash-logo { font-size: 2.1rem; font-weight: 800; }
.splash-tag { color: var(--muted); margin: 6px 0 22px; font-size: 1.1rem; }
.sparkle-field { font-size: 1.4rem; letter-spacing: 0.5em; opacity: 0.8; animation: float 6s ease-in-out infinite; }

/* ---------- Storybook ---------- */
.storybook { padding-top: 18px; }
.book-card {
  background: var(--card); border-radius: 28px; box-shadow: var(--shadow);
  min-height: 230px; display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 40px 26px; text-align: center;
  border: 3px solid #fff;
}
.storybook-text { font-size: 1.5rem; line-height: 1.5; font-weight: 600; }
.dots { display: flex; gap: 8px; margin-top: 22px; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--pink); transition: background 0.2s; }
.dot.on { background: var(--purple); }

/* ---------- Choice cards (stacked) ---------- */
.stack { display: flex; flex-direction: column; gap: 14px; }
.choice-card {
  display: flex; align-items: center; gap: 16px; text-align: left;
  width: 100%; background: var(--card); border: 3px solid var(--pink);
  border-radius: var(--radius); padding: 18px; cursor: pointer; font: inherit;
  color: var(--ink); box-shadow: var(--shadow-sm);
  transition: transform 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}
.choice-card:hover { transform: translateY(-2px); border-color: var(--purple); box-shadow: var(--shadow); }
.choice-card:active { transform: scale(0.99); }
.choice-card h3 { margin: 0 0 2px; font-size: 1.15rem; }
.choice-emoji { font-size: 2.4rem; flex: none; }
.life-royal { border-color: var(--lav); }

/* quiz answer rows */
.choice-row {
  width: 100%; text-align: left; background: var(--card); border: 2px solid var(--pink);
  border-radius: 16px; padding: 15px 18px; font: inherit; font-weight: 600; color: var(--ink);
  cursor: pointer; box-shadow: var(--shadow-sm); transition: transform 0.1s, border-color 0.1s;
}
.choice-row:hover { transform: translateX(3px); border-color: var(--purple); }

.quiz-step { color: var(--muted); font-weight: 700; text-align: center; }
.quiz-q { text-align: center; font-size: 1.3rem; margin: 6px 0 18px; }
.quiz-area { animation: fadeIn 0.3s ease; }

/* ---------- Character creator ---------- */
.avatar-preview {
  display: flex; justify-content: center; margin: 4px 0 18px; padding: 10px 0;
  background: radial-gradient(circle at 50% 42%, #ffffff 0%, rgba(255, 255, 255, 0) 68%);
  border-radius: 24px;
}

/* dressing-room scene: cozy wall + floor, with the avatar in a standing mirror */
.dressing-room {
  position: relative; border-radius: 24px; overflow: hidden; margin: 4px 0 16px;
  background: linear-gradient(#fdeede 0%, #ffe7f1 46%, #efe2ff 100%); box-shadow: var(--shadow-sm);
}
.dressing-room .room-floor { position: absolute; left: 0; right: 0; bottom: 0; height: 46px; background: linear-gradient(#f0d3b6, #e3bd95); }
.creator-mirror {
  position: relative; width: 270px; margin: 0 auto; padding: 16px 0 24px; z-index: 1;
  display: flex; justify-content: center; align-items: flex-end;
}
.creator-mirror::before {
  content: ""; position: absolute; left: 50%; transform: translateX(-50%); top: 10px; bottom: 18px;
  width: 232px; border-radius: 116px 116px 26px 26px;
  background: linear-gradient(#ffffff, #fbf0ff); box-shadow: inset 0 0 0 5px #fff, var(--shadow); z-index: -1;
}
.creator-mirror .avatar-stage { position: relative; }

/* walk-style chips */
.walk-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.walk-chip {
  display: flex; align-items: center; gap: 6px; background: #fff; border: 2px solid var(--pink);
  border-radius: 999px; padding: 8px 14px; font: inherit; font-weight: 700; font-size: 0.9rem;
  color: var(--ink); cursor: pointer; box-shadow: var(--shadow-sm);
}
.walk-chip .walk-emoji { font-size: 1.1rem; }
.walk-chip.is-selected { background: var(--lav); border-color: var(--purple); box-shadow: 0 0 0 3px rgba(181, 124, 255, 0.2); }
.walk-chip:active { transform: scale(0.96); }
.controls { display: flex; flex-direction: column; gap: 14px; }
.field label { display: block; font-weight: 700; margin-bottom: 7px; font-size: 0.95rem; }
.text-input {
  width: 100%; border: 2px solid var(--pink); border-radius: 14px; padding: 13px 15px;
  font: inherit; font-size: 1.05rem; color: var(--ink); background: #fff;
}
.text-input:focus { outline: none; border-color: var(--purple); }
.swatches { display: flex; flex-wrap: wrap; gap: 9px; }
.swatch { cursor: pointer; border: 3px solid transparent; font: inherit; transition: transform 0.1s; }
.swatch:active { transform: scale(0.92); }
.swatch-color { width: 38px; height: 38px; border-radius: 50%; box-shadow: var(--shadow-sm); }
.swatch-chip {
  background: #fff; color: var(--ink); border: 2px solid var(--pink);
  border-radius: 999px; padding: 9px 15px; font-weight: 600; font-size: 0.95rem;
}
.swatch.is-selected { border-color: var(--purple); box-shadow: 0 0 0 3px rgba(181, 124, 255, 0.25); }
.swatch-chip.is-selected { background: var(--lav); }

/* ---------- The character avatar (layered art) ---------- */
.avatar-stage { position: relative; margin: 0 auto; border-radius: 22px; overflow: hidden; }
.avatar-layer { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; pointer-events: none; user-select: none; transform-origin: center; }
.avatar-base { z-index: 10; }
.avatar-outfit { z-index: 20; }
.avatar-hair { z-index: 30; }

/* thumbnail pickers in the character creator */
.picker { margin-top: 4px; }
.picker > label { display: block; font-weight: 700; margin: 12px 0 8px; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: 10px; }
.thumb {
  position: relative; background: #fff; border: 3px solid var(--pink); border-radius: 16px;
  padding: 4px; cursor: pointer; aspect-ratio: 1 / 1; overflow: hidden; box-shadow: var(--shadow-sm);
  transition: transform 0.1s, border-color 0.1s;
}
.thumb img { width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.thumb .thumb-label {
  position: absolute; left: 0; right: 0; bottom: 0; font-size: 0.62rem; font-weight: 700;
  text-align: center; background: rgba(255, 255, 255, 0.85); padding: 2px 0;
}
.thumb.is-selected { border-color: var(--purple); box-shadow: 0 0 0 3px rgba(181, 124, 255, 0.25); }
.thumb:active { transform: scale(0.96); }

/* hidden alignment tool (?avatarDebug=1) */
.debug-panel { margin-top: 16px; padding: 12px 14px; border: 2px dashed var(--purple); border-radius: 14px; background: #fff; font-size: 0.85rem; }
.debug-tabs { display: flex; gap: 6px; margin: 8px 0; }
.debug-tab { flex: 1; border: 2px solid var(--pink); background: #fff; border-radius: 999px; padding: 6px 8px; font: inherit; font-weight: 700; font-size: 0.8rem; cursor: pointer; color: var(--ink); }
.debug-tab.is-active { background: var(--lav); border-color: var(--purple); }
.debug-panel .field { margin: 6px 0; }
.debug-panel input[type="range"] { width: 100%; }
.debug-readout { background: #f6eefe; border-radius: 8px; padding: 6px 8px; font-size: 0.78rem; overflow-x: auto; margin: 6px 0 0; }

/* ---------- Grids (guides, locations, friends) ---------- */
.grid { display: grid; gap: 12px; margin-top: 6px; }
.grid-guide { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.grid-loc { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
.grid-friends { grid-template-columns: repeat(auto-fill, minmax(135px, 1fr)); }

.guide-card, .loc-card, .friend-card {
  position: relative; background: var(--card); border-radius: 18px; padding: 16px 12px;
  text-align: center; box-shadow: var(--shadow-sm); border: 2px solid transparent;
}
.guide-card { cursor: pointer; font: inherit; color: var(--ink); transition: transform 0.12s, border-color 0.12s; }
.guide-card:hover { transform: translateY(-2px); }
.guide-card.is-selected { border-color: var(--purple); box-shadow: 0 0 0 3px rgba(181, 124, 255, 0.25); }
.guide-emoji, .loc-emoji { font-size: 2.2rem; }
.guide-name, .loc-name { font-weight: 700; margin-top: 6px; font-size: 0.95rem; }
.loc-blurb { color: var(--muted); font-size: 0.82rem; margin-top: 5px; line-height: 1.35; }
.loc-card.is-button { cursor: pointer; font: inherit; color: var(--ink); transition: transform 0.12s; }
.loc-card.is-button:hover { transform: translateY(-2px); border-color: var(--pink-deep); }

.badge {
  position: absolute; top: -10px; left: 50%; transform: translateX(-50%);
  background: var(--purple); color: #fff; font-size: 0.7rem; font-weight: 700;
  padding: 4px 10px; border-radius: 999px; white-space: nowrap; box-shadow: var(--shadow-sm);
}

/* welcome party */
.tag-row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 6px 0 14px; }
.tag-pill { background: #fff; border-radius: 999px; padding: 7px 13px; font-size: 0.85rem; font-weight: 600; box-shadow: var(--shadow-sm); }
.quote { text-align: center; font-style: italic; color: var(--muted); line-height: 1.5; margin: 14px auto 20px; max-width: 28em; }
.friend-card { color: var(--ink); }
.friend-card.is-best { box-shadow: 0 0 0 3px var(--purple), var(--shadow-sm); }
.friend-emoji { font-size: 2rem; }
.friend-av { display: flex; justify-content: center; }
.friend-av .avatar-stage { background: rgba(255, 255, 255, 0.5); border-radius: 50%; }
.reveal-av { display: flex; justify-content: center; margin-bottom: 8px; }
.reveal-av .avatar-stage { background: rgba(255, 255, 255, 0.55); border-radius: 50%; }
.friend-name { font-weight: 800; margin-top: 4px; }
.friend-arch { font-size: 0.8rem; color: var(--ink); opacity: 0.75; }

/* ---------- Living world map ---------- */
.world-screen { position: relative; }

.world-viewport {
  position: relative; width: 100%; height: 70vh; max-height: 640px;
  border-radius: 24px; overflow: hidden; box-shadow: var(--shadow);
  background: linear-gradient(#bfe6ff, #d4f0ff 38%, #e7f6dc 38%, #d3edc2);
  touch-action: none; user-select: none; -webkit-user-select: none; cursor: grab;
}
.world-viewport:active { cursor: grabbing; }
.world-canvas { position: absolute; top: 0; left: 0; transform-origin: 0 0; will-change: transform; }
.world-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }

/* painted placeholder town (used until DATA.world.bg art exists) */
.painted-town {
  position: absolute; inset: 0;
  background:
    radial-gradient(120% 55% at 50% 6%, #d6f1ff 0%, #c3e8ff 32%, transparent 56%),
    linear-gradient(#c3e8ff 0%, #d4f0ff 33%, #e2f4d4 33%, #cfe9bd 100%);
}
.town-patch { position: absolute; width: 210px; height: 140px; transform: translate(-50%, -50%); border-radius: 50%; filter: blur(3px); opacity: 0.55; }

/* clouds + butterflies (calm looping motion) */
.cloud {
  position: absolute; width: 120px; height: 44px; border-radius: 999px; background: #fff; opacity: 0.92;
  box-shadow: 32px 8px 0 -6px #fff, -32px 10px 0 -9px #fff;
  animation-name: drift; animation-timing-function: linear; animation-iteration-count: infinite;
}
@keyframes drift { from { transform: scale(var(--cloud-scale,1)) translateX(-220px); } to { transform: scale(var(--cloud-scale,1)) translateX(1700px); } }
.butterfly { position: absolute; font-size: 1.5rem; animation-name: flit; animation-timing-function: ease-in-out; animation-iteration-count: infinite; }
@keyframes flit { 0%,100% { transform: translate(0,0) rotate(-6deg); } 25% { transform: translate(46px,-28px) rotate(8deg); } 50% { transform: translate(96px,4px) rotate(-4deg); } 75% { transform: translate(44px,30px) rotate(6deg); } }

/* location tap targets — cute signs in placeholder mode */
.hotspot {
  position: absolute; transform: translate(-50%, -50%); display: flex; flex-direction: column;
  align-items: center; gap: 4px; border: none; background: none; cursor: pointer; font: inherit;
  color: var(--ink); -webkit-tap-highlight-color: transparent; z-index: 3;
}
.hotspot-pin {
  width: 60px; height: 60px; border-radius: 50%; background: #fff; border: 3px solid #fff;
  display: flex; align-items: center; justify-content: center; font-size: 1.9rem;
  box-shadow: var(--shadow-sm); transition: transform 0.12s ease;
}
.hotspot:hover .hotspot-pin { transform: translateY(-3px) scale(1.05); }
.hotspot:active .hotspot-pin { transform: scale(0.94); }
.hotspot-label { background: rgba(255,255,255,0.92); border-radius: 999px; padding: 3px 10px; font-size: 0.72rem; font-weight: 700; white-space: nowrap; box-shadow: var(--shadow-sm); }
.world-viewport.has-art .hotspot-pin { background: rgba(255,255,255,0.32); border-color: rgba(255,255,255,0.55); }

/* player + guide tokens */
.player-character { position: absolute; transform: translate(-50%, -88%); width: 140px; pointer-events: none; z-index: 6; }
.player-character.face-left { transform: translate(-50%, -88%) scaleX(-1); }
.player-character .avatar-stage { filter: drop-shadow(0 8px 6px rgba(80,40,80,0.22)); }

/* ---------- Walk styles (dressing room previews them; the map plays them while walking) ---------- */
@keyframes wsBounce  { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-9px); } }
@keyframes wsSkip    { 0% { transform: translateY(0) rotate(-2deg); } 45% { transform: translateY(-13px) rotate(2deg); } 100% { transform: translateY(0) rotate(-2deg); } }
@keyframes wsMarch   { 0%,100% { transform: translateY(0) rotate(-1.5deg); } 50% { transform: translateY(-4px) rotate(1.5deg); } }
@keyframes wsTiptoe  { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
@keyframes wsTwirl   { 0% { transform: scaleX(1) translateY(0); } 50% { transform: scaleX(-1) translateY(-6px); } 100% { transform: scaleX(1) translateY(0); } }
@keyframes wsShuffle { 0%,100% { transform: translateX(0) rotate(-1deg); } 50% { transform: translateX(3px) rotate(1deg); } }

.dressing-room .avatar-stage.walk-bounce  { animation: wsBounce 0.7s ease-in-out infinite; }
.dressing-room .avatar-stage.walk-skip    { animation: wsSkip 0.6s ease-in-out infinite; }
.dressing-room .avatar-stage.walk-march   { animation: wsMarch 0.5s ease-in-out infinite; }
.dressing-room .avatar-stage.walk-tiptoe  { animation: wsTiptoe 0.42s ease-in-out infinite; }
.dressing-room .avatar-stage.walk-twirl   { animation: wsTwirl 1.7s ease-in-out infinite; }
.dressing-room .avatar-stage.walk-shuffle { animation: wsShuffle 0.95s ease-in-out infinite; }

.player-character.is-walking .avatar-stage.walk-bounce  { animation: wsBounce 0.5s ease-in-out infinite; }
.player-character.is-walking .avatar-stage.walk-skip    { animation: wsSkip 0.45s ease-in-out infinite; }
.player-character.is-walking .avatar-stage.walk-march   { animation: wsMarch 0.4s ease-in-out infinite; }
.player-character.is-walking .avatar-stage.walk-tiptoe  { animation: wsTiptoe 0.32s ease-in-out infinite; }
.player-character.is-walking .avatar-stage.walk-twirl   { animation: wsTwirl 1.2s ease-in-out infinite; }
.player-character.is-walking .avatar-stage.walk-shuffle { animation: wsShuffle 0.7s ease-in-out infinite; }
.guide-animal { position: absolute; transform: translate(-50%, -50%); font-size: 2.4rem; pointer-events: none; z-index: 5; filter: drop-shadow(0 4px 3px rgba(80,40,80,0.25)); }
.guide-animal.is-hopping { animation: hop 0.42s ease-in-out infinite; }
@keyframes hop { 0%,100% { transform: translate(-50%,-50%); } 50% { transform: translate(-50%,-66%); } }

/* sticker overlay bubbles (kept small so the map stays the star) */
.world-overlay { position: absolute; inset: 0; pointer-events: none; }
.bubble { position: absolute; pointer-events: auto; background: rgba(255,255,255,0.92); border-radius: 18px; box-shadow: var(--shadow-sm); padding: 8px 12px; backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); animation: popIn 0.3s ease both; }
.bubble-sub { color: var(--muted); font-size: 0.76rem; }
.bubble-player { top: 12px; left: 12px; display: flex; align-items: center; gap: 8px; }
.bubble-portrait .avatar-stage { background: var(--lav); border-radius: 50%; }
.bubble-friend { top: 12px; right: 12px; display: flex; align-items: center; gap: 8px; max-width: 46%; }
.bubble-friend-emoji { font-size: 1.6rem; flex: none; }
.bubble-suggest { left: 12px; right: 66px; bottom: 12px; font-weight: 600; }
.bubble-suggest-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 2px; }
.mini-refresh { border: none; background: var(--lav); border-radius: 999px; width: 28px; height: 28px; cursor: pointer; font-size: 0.85rem; flex: none; }
.mini-refresh:active { transform: scale(0.9); }
.bubble-menu { right: 12px; bottom: 12px; width: 46px; height: 46px; border: none; cursor: pointer; font-size: 1.3rem; font-weight: 800; color: var(--purple); display: flex; align-items: center; justify-content: center; }

/* ---------- Modal (in-game pop-up) ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(70, 30, 70, 0.45);
  backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px);
  display: flex; align-items: center; justify-content: center; padding: 24px; z-index: 100;
  animation: fadeIn 0.2s ease both;
}
.modal-card {
  background: var(--card); border-radius: 26px; padding: 28px 24px; width: 100%; max-width: 380px;
  text-align: center; box-shadow: 0 26px 60px rgba(80, 30, 80, 0.4); animation: popIn 0.28s ease both;
}
.modal-emoji { font-size: 3rem; animation: float 4s ease-in-out infinite; }
.modal-title { font-size: 1.4rem; margin: 8px 0 6px; }
.modal-body { color: var(--muted); line-height: 1.5; white-space: pre-line; margin: 0; }
.modal-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }
.modal-actions .btn { margin-top: 0; }

@media (min-width: 560px) {
  .app { padding-top: 40px; }
}
