:root {
  --pink: #ff2d95;
  --pink-dark: #d81b7a;
  --pink-light: #ffd6ea;
  --pink-pale: #fff0f7;
  --text: #4a1033;
  --white: #fff;
  --shadow: 0 6px 20px rgba(216, 27, 122, .25);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--text);
  background: linear-gradient(180deg, #ffe4f0 0%, #fff3f8 60%, #fffafc 100%);
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}
#app { height: 100vh; height: 100dvh; display: flex; flex-direction: column; }
.screen {
  display: none;
  flex: 1;
  min-height: 0;
  padding: calc(12px + var(--safe-top)) 16px calc(16px + var(--safe-bottom));
  overflow-y: auto;
}
.screen.active { display: flex; flex-direction: column; }
.centered { align-items: center; justify-content: center; text-align: center; gap: 16px; }
.hidden { display: none !important; }
.subtle { opacity: .72; font-size: .95rem; margin: 4px 0; }
h1, h2, h3 { margin: 0; }
.title { font-size: 2rem; color: var(--pink-dark); }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.topbar h2 { font-size: 1.3rem; }
.btn {
  font: inherit; font-size: 1.05rem; padding: 12px 18px; border: none; border-radius: 999px;
  background: var(--white); color: var(--pink-dark); box-shadow: var(--shadow); cursor: pointer;
}
.btn:active { transform: scale(.97); }
.btn.big { font-size: 1.15rem; padding: 16px 20px; }
.btn.primary { background: var(--pink); color: var(--white); }
.btn.danger { background: #ffe0e0; color: #a00; }
.icon-btn { font-size: 1.6rem; background: none; border: none; cursor: pointer; padding: 6px; }
.field { display: flex; flex-direction: column; gap: 6px; font-weight: 600; width: 100%; max-width: 360px; }
input[type=text], textarea {
  font: inherit; padding: 12px; border: 2px solid var(--pink-light); border-radius: 14px;
  background: var(--white); color: var(--text); width: 100%;
}
textarea { resize: vertical; font-size: .85rem; }
.bubble {
  background: var(--white); border-radius: 18px; padding: 12px 16px; box-shadow: var(--shadow);
  position: relative; margin: 8px auto; max-width: 420px; text-align: center; min-height: 1.4em;
}
.bubble::after {
  content: ""; position: absolute; left: 50%; bottom: -10px; transform: translateX(-50%);
  border: 10px solid transparent; border-top-color: var(--white); border-bottom: 0;
}
.stage-area { flex: 1; display: flex; align-items: flex-end; justify-content: center; min-height: 240px; }
.barbie-holder {
  display: flex; align-items: flex-end; justify-content: center; height: 260px; cursor: pointer;
  background: radial-gradient(ellipse 60% 55% at 50% 62%, rgba(255, 255, 255, .85), rgba(255, 255, 255, 0) 100%);
}
.barbie-holder.small { height: 200px; }
.status { display: flex; align-items: center; gap: 10px; margin: 8px 0; }
.mood { font-size: 1.8rem; }
.bar { flex: 1; height: 16px; background: var(--white); border-radius: 999px; overflow: hidden; box-shadow: inset 0 2px 4px rgba(0, 0, 0, .1); }
.bar-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--pink), #ff8fc8); border-radius: 999px; transition: width .4s; }
.actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.house-nav { grid-template-columns: 1fr 2fr 1fr; }
.btn.arrow { font-size: 2rem; padding: 8px; }
.btn.arrow:disabled { opacity: .35; }
.actions .btn { padding: 10px 6px; font-size: 1rem; }
.icon-first { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.icon-first .ico { font-size: 2.2rem; line-height: 1; }
.icon-first span:last-child { font-size: .85rem; }
.cards { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.card {
  text-align: left; background: var(--white); border: none; border-radius: 22px; padding: 18px;
  box-shadow: var(--shadow); font: inherit; color: var(--text); cursor: pointer;
}
.card-emoji { font-size: 2.2rem; }
.card h3 { color: var(--pink-dark); margin: 6px 0; }
.card p { margin: 4px 0; }
.tabs { display: flex; gap: 8px; margin-bottom: 10px; }
.tab { flex: 1; font: inherit; padding: 10px; border: none; border-radius: 999px; background: var(--white); color: var(--pink-dark); cursor: pointer; }
.tab.active { background: var(--pink); color: var(--white); }
.bag-layout { display: flex; gap: 12px; flex: 1; min-height: 0; }
.bag-side { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.item-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 10px; overflow-y: auto; padding: 4px; }
.reward-grid { width: 100%; max-width: 480px; }
.item {
  background: var(--white); border: none; border-radius: 16px; padding: 10px 6px; display: flex; flex-direction: column;
  align-items: center; gap: 4px; box-shadow: var(--shadow); font: inherit; color: var(--text); cursor: pointer;
}
.item .emoji { font-size: 2rem; }
.item .name { font-size: .72rem; text-align: center; line-height: 1.1; }
.item .count { font-size: .75rem; background: var(--pink); color: var(--white); border-radius: 999px; padding: 1px 7px; }
.worn { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0; font-size: .85rem; }
.worn span { background: var(--pink-pale); border-radius: 999px; padding: 4px 10px; }
.album { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.album li { background: var(--white); border-radius: 16px; padding: 12px 16px; box-shadow: var(--shadow); display: flex; align-items: center; gap: 12px; }
.album .big { font-size: 2rem; }
.album .pending { opacity: .5; }
.settings { display: flex; flex-direction: column; gap: 10px; max-width: 520px; width: 100%; margin: 0 auto; }
.settings h3 { margin-top: 12px; color: var(--pink-dark); }
.save-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.save-actions .btn { flex: 1; min-height: 44px; }
.save-link { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.save-link a, .saved-games a { color: var(--pink-dark); overflow-wrap: anywhere; }
.save-link a { min-height: 44px; display: inline-flex; align-items: center; }
.saved-games { list-style: none; margin: 0; padding: 0; }
.saved-games li { padding: 18px 0; border-bottom: 1px solid var(--pink-light); }
.saved-games h3 { margin-top: 0; overflow-wrap: anywhere; }
.saved-games .save-actions { margin: 12px 0; }
.saved-games a { display: inline-block; padding: 10px 0; }
.overlay { position: fixed; top: 0; right: 0; bottom: 0; left: 0; background: rgba(74, 16, 51, .45); display: flex; align-items: center; justify-content: center; z-index: 20; }
.overlay-card { background: var(--white); border-radius: 24px; padding: 24px; text-align: center; box-shadow: var(--shadow); min-width: 260px; }
.gift-box { font-size: 5rem; cursor: pointer; animation: wiggle 1s infinite; }
.gift-box.opened { animation: none; }
.gift-item { font-size: 3rem; }
.gift-item .name { font-size: 1rem; display: block; }
@keyframes wiggle { 0%, 100% { transform: rotate(-6deg); } 50% { transform: rotate(6deg); } }
.notice { position: fixed; top: var(--safe-top); left: 0; right: 0; background: #fff3cd; color: #7a5a00; padding: 8px 16px; text-align: center; font-size: .85rem; z-index: 30; }
.toast {
  position: fixed; bottom: calc(24px + var(--safe-bottom)); left: 50%; transform: translateX(-50%);
  background: var(--text); color: var(--white); padding: 10px 18px; border-radius: 999px; z-index: 40;
}
.play-container { flex: 1; position: relative; min-height: 0; display: flex; flex-direction: column; touch-action: none; }
.game-top { display: flex; justify-content: space-between; align-items: center; padding: 4px 0 8px; font-weight: 600; }

.evolution { position: relative; overflow: hidden; }
#confetti { position: absolute; top: 0; right: 0; bottom: 0; left: 0; pointer-events: none; }
.confetti-piece { position: absolute; top: -16px; width: 10px; height: 14px; border-radius: 2px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }
.evo-pop { animation: pop .8s ease-out; }
@keyframes pop { 0% { transform: scale(.3); opacity: 0; } 60% { transform: scale(1.15); opacity: 1; } 100% { transform: scale(1); } }
.evo-fade { animation: fade .8s ease-in forwards; }
@keyframes fade { to { opacity: 0; transform: scale(.6); } }

.memory-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); grid-template-rows: repeat(3, minmax(0, 1fr)); gap: 10px;
  flex: 0 1 560px; min-height: 0; max-width: 520px; width: 100%; margin: auto;
}
.memory-card {
  min-height: 0; border: none; border-radius: 16px; background: var(--pink); font-size: clamp(1.3rem, 7vh, 2.2rem);
  box-shadow: var(--shadow); cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.memory-card .back { display: none; }
.memory-card.open .back, .memory-card.matched .back { display: block; }
.memory-card.open .front, .memory-card.matched .front { display: none; }
.memory-card.open, .memory-card.matched { background: var(--white); }
.memory-card.matched { opacity: .55; }

.rain-field { position: relative; flex: 1; overflow: hidden; background: linear-gradient(#ffe3f1, #ffb3d9); border-radius: 20px; }
.rain-divider { position: absolute; left: 50%; top: 0; bottom: 0; border-left: 2px dashed rgba(255, 255, 255, .8); }
.catcher { position: absolute; bottom: 0; left: 0; width: 90px; height: 150px; display: flex; align-items: flex-end; justify-content: center; will-change: transform; }
.catcher.caught .doll { filter: brightness(1.25); }

.doll { position: relative; width: 120px; height: 220px; transform: scale(var(--scale, 1)); transform-origin: bottom center; filter: drop-shadow(0 4px 4px rgba(0, 0, 0, .18)); }
.doll svg { display: block; width: 100%; height: 100%; overflow: visible; }
.costume { position: absolute; top: 2px; right: -18px; font-size: 32px; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .2)); }
.slot { position: absolute; font-size: 30px; line-height: 1; pointer-events: none; }
.slot-head { top: -12px; left: 50%; transform: translateX(-50%); }
.slot-body { top: 104px; left: 50%; transform: translateX(-50%); font-size: 34px; }
.slot-feet { bottom: -8px; left: 50%; transform: translateX(-50%); }
.slot-hand { top: 118px; right: -26px; }
.ken .costume { right: auto; left: 50%; transform: translateX(-50%); top: -16px; }

@media (max-width: 480px) {
  .actions .btn { font-size: .9rem; padding: 12px 4px; }
  .barbie-holder { height: 220px; }
  .bag-layout { flex-direction: column; }
  .barbie-holder.small { height: 160px; }
}

.bubble-field { position: relative; flex: 1; overflow: hidden; background: linear-gradient(#ffe3f1, #ffb3d9); border-radius: 20px; }
.balloon {
  position: absolute; top: 0; left: 0; width: 72px; height: 72px; border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #fff 0%, #ffd6ea 45%, #ff8fc8 100%);
  box-shadow: var(--shadow); display: flex; align-items: center; justify-content: center;
  font-size: 34px; will-change: transform; cursor: pointer; user-select: none;
}
.balloon.pop { animation: pop-bubble .25s ease-out forwards; pointer-events: none; }
@keyframes pop-bubble { to { opacity: 0; scale: 1.6; } }

.odd-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); grid-template-rows: repeat(4, minmax(0, 1fr)); gap: 10px;
  flex: 0 1 520px; min-height: 0; max-width: 520px; width: 100%; margin: auto;
}
.odd-tile {
  min-height: 0; border: none; border-radius: 16px; background: var(--white); box-shadow: var(--shadow);
  font-size: clamp(1.3rem, 7vh, 2.4rem); cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.odd-tile.right { background: #c6f5d4; }
.odd-tile.wrong, .simon-pad.wrong { animation: shake .3s; }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

.simon-grid {
  display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: repeat(2, minmax(0, 1fr)); gap: 12px;
  flex: 0 1 460px; min-height: 0; max-width: 460px; width: 100%; margin: auto;
}
.simon-pad {
  min-height: 0; border: none; border-radius: 24px; box-shadow: var(--shadow); cursor: pointer;
  font-size: clamp(2rem, 10vh, 3.5rem); opacity: .5; transition: opacity .1s, transform .1s;
}
.simon-pad.lit { opacity: 1; transform: scale(1.04); }
.simon-status { font-size: 1.6rem; }

/* Το σπίτι. Λωρίδα δωματίων που γλιστράει πίσω από τη Barbie. */
.house { position: relative; flex: 1; min-height: 240px; overflow: hidden; border-radius: 22px; box-shadow: var(--shadow); touch-action: pan-y; }
.rooms { display: flex; height: 100%; width: 400%; transition: transform .55s cubic-bezier(.4, 0, .2, 1); }
.room { position: relative; width: 25%; height: 100%; background: linear-gradient(var(--wall) 0%, var(--wall) 68%, var(--floor) 68%, var(--floor) 100%); overflow: hidden; }
.room::after { content: ""; position: absolute; left: 0; right: 0; top: 68%; height: 3px; background: rgba(0, 0, 0, .08); }
.furniture { position: absolute; line-height: 1; filter: drop-shadow(0 3px 3px rgba(0, 0, 0, .15)); user-select: none; }
.furniture.tappable { cursor: pointer; animation: wiggle 2.4s ease-in-out infinite; }
.house-barbie { position: absolute; left: 50%; bottom: 4%; transform: translateX(-50%); height: auto; background: none; cursor: pointer; }
.house-barbie .doll { filter: drop-shadow(0 6px 6px rgba(0, 0, 0, .2)); }
.house-barbie.walk .doll { animation: walk .55s ease-in-out; }
@keyframes walk {
  0%, 100% { transform: scale(var(--scale, 1)) translateY(0); }
  25% { transform: scale(var(--scale, 1)) translateY(-7px) rotate(-2deg); }
  50% { transform: scale(var(--scale, 1)) translateY(0); }
  75% { transform: scale(var(--scale, 1)) translateY(-7px) rotate(2deg); }
}
@media (max-width: 480px) {
  .furniture { font-size: 60% !important; }
}
