/* ===========================================================
   Umay Bebek Oyunu — stil
   =========================================================== */
:root {
  --pink: #ff8fb3;
  --pink-dark: #ff5f95;
  --purple: #b39ddb;
  --cream: #fff7fb;
  --card: #ffffff;
  --ink: #5a3d52;
  --shadow: 0 6px 18px rgba(255, 120, 170, .25);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font-family: 'Baloo 2', 'Comic Sans MS', 'Trebuchet MS', system-ui, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 10%, #ffe3f1 0, transparent 40%),
    radial-gradient(circle at 85% 20%, #e7e0ff 0, transparent 40%),
    linear-gradient(160deg, #fff0f7, #f3ecff);
  overflow: hidden;
}

#app {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 14px;
  height: 100vh;
  padding: 12px;
}

/* ---------------- Sahne ---------------- */
.stage-wrap { display: flex; flex-direction: column; min-height: 0; }
.title-bar { text-align: center; margin-bottom: 6px; }
.title-bar h1 {
  margin: 0; font-size: clamp(20px, 3vw, 34px);
  color: var(--pink-dark);
  text-shadow: 2px 2px 0 #fff, 3px 3px 0 #ffd1e3;
  letter-spacing: .5px;
}
.wiggle { display: inline-block; animation: wiggle 1.6s ease-in-out infinite; }
@keyframes wiggle { 0%,100%{transform:rotate(-8deg)} 50%{transform:rotate(8deg)} }

.stage {
  position: relative; flex: 1; min-height: 0;
  border-radius: 26px;
  background: #fff;
  box-shadow: var(--shadow), inset 0 0 0 6px #ffe1ee;
  overflow: hidden;
}
#doll-svg { position: absolute; inset: 0; width: 100%; height: 100%; }
#fx-canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }

.nameplate {
  position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%);
  background: var(--pink); color: #fff; font-weight: 800;
  padding: 5px 22px; border-radius: 999px; font-size: clamp(15px, 2.4vw, 22px);
  box-shadow: var(--shadow); border: 3px solid #fff; white-space: nowrap;
}
.extras-layer { position: absolute; inset: 0; pointer-events: none; }
.flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
.flash.go { animation: flash .4s ease-out; }
@keyframes flash { 0%{opacity:.9} 100%{opacity:0} }

/* araç çubuğu */
.stage-tools {
  display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 8px;
}
.tool {
  border: none; cursor: pointer; font: inherit; font-weight: 700; font-size: 13px;
  background: #fff; color: var(--ink);
  padding: 8px 12px; border-radius: 14px; box-shadow: var(--shadow);
  transition: transform .12s;
}
.tool:hover { transform: translateY(-2px); }
.tool:active { transform: scale(.94); }

/* ---------------- Panel ---------------- */
.panel {
  display: flex; flex-direction: column; min-height: 0;
  background: var(--card); border-radius: 24px;
  box-shadow: var(--shadow); padding: 10px; overflow: hidden;
}
.tabs {
  display: flex; gap: 6px; overflow-x: auto; padding-bottom: 8px;
  scrollbar-width: thin; flex-wrap: nowrap;
}
.tabs::-webkit-scrollbar { height: 6px; }
.tabs::-webkit-scrollbar-thumb { background: #ffd1e3; border-radius: 9px; }
.tab {
  flex: 0 0 auto; border: none; cursor: pointer; font: inherit;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: #fff0f6; color: var(--ink);
  padding: 7px 11px; border-radius: 16px; min-width: 62px;
  transition: transform .1s; font-weight: 700;
}
.tab .ti { font-size: 22px; }
.tab .tl { font-size: 11px; }
.tab.active { background: var(--pink); color: #fff; box-shadow: var(--shadow); transform: translateY(-2px); }

.items {
  flex: 1; min-height: 0; overflow-y: auto; margin-top: 8px;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(86px, 1fr));
  gap: 9px; align-content: start; padding: 4px;
}
.items::-webkit-scrollbar { width: 8px; }
.items::-webkit-scrollbar-thumb { background: #ffd1e3; border-radius: 9px; }

.item {
  border: 3px solid transparent; cursor: pointer; font: inherit;
  background: #fff6fb; border-radius: 16px; padding: 8px 4px;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  transition: transform .1s; box-shadow: 0 2px 6px rgba(255,140,180,.18);
}
.item:hover { transform: translateY(-3px) scale(1.03); }
.item:active { transform: scale(.93); }
.item.on { border-color: var(--pink-dark); background: #ffe5f0; }
.item .ie { font-size: 30px; line-height: 1; }
.item .il { font-size: 11px; font-weight: 700; text-align: center; line-height: 1.05; }

.item.swatch {
  width: 100%; aspect-ratio: 1 / 1; min-height: 48px; padding: 0;
  border-radius: 50%;
}
.item.swatch.on { border-color: var(--pink-dark); box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--pink-dark); }

.sec-title {
  grid-column: 1 / -1; font-weight: 800; color: var(--pink-dark);
  font-size: 14px; padding: 6px 4px 2px; border-bottom: 2px dashed #ffd1e3;
}

/* ---------------- Modal ---------------- */
.modal {
  position: fixed; inset: 0; background: rgba(90,40,70,.45);
  display: flex; align-items: center; justify-content: center; z-index: 50; padding: 16px;
}
.modal[hidden] { display: none; }
.modal-box {
  background: #fff; border-radius: 24px; padding: 18px; width: min(680px, 100%);
  max-height: 86vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.modal-box.small { width: min(380px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.modal-head h2 { margin: 0; color: var(--pink-dark); font-size: 20px; }
.close {
  border: none; background: #ffe5f0; color: var(--pink-dark); font-weight: 800;
  width: 36px; height: 36px; border-radius: 50%; cursor: pointer; font-size: 16px;
}
#name-input {
  width: 100%; font: inherit; font-size: 20px; padding: 12px 16px;
  border: 3px solid #ffd1e3; border-radius: 16px; text-align: center; margin-bottom: 12px;
}
#name-input:focus { outline: none; border-color: var(--pink); }
.big-btn {
  width: 100%; border: none; cursor: pointer; font: inherit; font-weight: 800; font-size: 18px;
  background: var(--pink); color: #fff; padding: 12px; border-radius: 16px; box-shadow: var(--shadow);
}

.album-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.album-card {
  background: #fff6fb; border-radius: 16px; padding: 8px; box-shadow: 0 3px 10px rgba(255,140,180,.2);
  border: 3px solid #ffe1ee;
}
.album-card img { width: 100%; border-radius: 10px; display: block; background: #fff; }
.ac-name { text-align: center; font-weight: 800; color: var(--pink-dark); margin-top: 4px; }
.ac-tools { display: flex; justify-content: center; gap: 6px; margin-top: 6px; }
.ac-tools button {
  border: none; background: #ffe5f0; cursor: pointer; border-radius: 10px;
  padding: 5px 9px; font-size: 15px;
}
.empty-note { text-align: center; color: #b08aa0; padding: 24px; }

/* toast */
#toast {
  position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%) translateY(20px);
  background: var(--pink-dark); color: #fff; font-weight: 800;
  padding: 12px 24px; border-radius: 999px; box-shadow: var(--shadow);
  opacity: 0; pointer-events: none; transition: all .3s; z-index: 80;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------------- Sürükle-bırak ---------------- */
.items { touch-action: pan-y; }
.item.draggable { cursor: grab; touch-action: pan-y; position: relative; }
.item.draggable:active { cursor: grabbing; }

/* askılı dolap görünümü */
.item.hang { margin-top: 12px; }
.item.hang::before {
  content: ''; position: absolute; top: -11px; left: 50%; transform: translateX(-50%);
  width: 16px; height: 16px; border: 3px solid #e7a9c6; border-bottom: none;
  border-radius: 50% 50% 0 0;
}

/* sürüklenen hayalet */
#drag-ghost {
  position: fixed; z-index: 300; pointer-events: none; left: 0; top: 0;
  transform: translate(-50%, -50%) scale(1.15);
  filter: drop-shadow(0 7px 7px rgba(0,0,0,.32));
}
#drag-ghost.back { transition: all .18s ease; opacity: 0; transform: translate(-50%, -50%) scale(.35); }
.g-emoji { font-size: 48px; line-height: 1; }
.g-disc { display: block; width: 48px; height: 48px; border-radius: 50%; box-shadow: 0 0 0 4px #fff; }

/* sahne vurgusu */
.stage.drag-on { box-shadow: var(--shadow), inset 0 0 0 6px #ffe1ee, 0 0 0 4px rgba(255,214,10,.4); }
.stage.drag-hover { box-shadow: var(--shadow), inset 0 0 0 6px #ffd60a, 0 0 28px 8px rgba(255,214,10,.55); }

/* giydirince bebek "pop" yapsın */
#doll-group.doll-pop { animation: dollpop .45s ease; transform-box: fill-box; transform-origin: center bottom; }
@keyframes dollpop { 0% { transform: scale(1); } 35% { transform: scale(1.05); } 70% { transform: scale(.985); } 100% { transform: scale(1); } }

/* bırakma ışıltısı */
.drop-spark { position: fixed; z-index: 310; transform: translate(-50%, -50%); font-size: 34px; pointer-events: none; animation: spark .65s ease-out forwards; }
@keyframes spark {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.4); }
  30% { opacity: 1; transform: translate(-50%, -50%) scale(1.3); }
  100% { opacity: 0; transform: translate(-50%, -95%) scale(.8); }
}

/* ipucu çubuğu */
.hint-bar {
  text-align: center; font-size: 12.5px; font-weight: 800; color: #c4548a;
  background: #fff3f9; border: 2px dashed #ffd1e3; border-radius: 12px;
  padding: 5px 8px; margin-top: 6px; flex: 0 0 auto;
}

/* ---------------- Mobil ---------------- */
@media (max-width: 820px) {
  body { overflow: auto; }
  #app { grid-template-columns: 1fr; height: auto; min-height: 100vh; }
  .stage { height: 56vh; min-height: 360px; }
  .panel { max-height: none; }
  .items { max-height: 38vh; }
}
@media (max-width: 820px) and (orientation: landscape) {
  #app { grid-template-columns: 1.1fr 1fr; }
  .stage { height: auto; }
}
