/* ---------- Yazı tipi (yerel, internetsiz çalışır) ---------- */
@font-face { font-family: 'Fredoka'; font-weight: 600; font-display: swap;
  src: url('../assets/fonts/fredoka-latin-ext-600-normal.woff2') format('woff2');
  unicode-range: U+0100-02AF, U+1E00-1E9F; }
@font-face { font-family: 'Fredoka'; font-weight: 600; font-display: swap;
  src: url('../assets/fonts/fredoka-latin-600-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+2000-206F; }
@font-face { font-family: 'Fredoka'; font-weight: 700; font-display: swap;
  src: url('../assets/fonts/fredoka-latin-ext-700-normal.woff2') format('woff2');
  unicode-range: U+0100-02AF, U+1E00-1E9F; }
@font-face { font-family: 'Fredoka'; font-weight: 700; font-display: swap;
  src: url('../assets/fonts/fredoka-latin-700-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+2000-206F; }

:root {
  --pink: #ff6fa3;
  --pink-dark: #e24f86;
  --pink-light: #ffd3e3;
  --purple: #7c5cd6;
  --purple-dark: #5a3fb0;
  --blue: #5bb8f0;
  --mint: #6fd6b4;
  --yellow: #ffd45c;
  --cream: #fff8f0;
  --ink: #4a2f5e;
  --letterbox: #2b1f3d;
  --shadow: 0 10px 0 rgba(0,0,0,.18), 0 18px 30px rgba(0,0,0,.18);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: var(--letterbox);
  font-family: 'Fredoka', 'Baloo 2', system-ui, sans-serif;
  font-weight: 600;
  color: var(--ink);
  user-select: none; -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: none; overscroll-behavior: none;
}
img { -webkit-user-drag: none; user-drag: none; pointer-events: none; }

/* ---------- Sabit 1920×1080 sahne, JS ile ölçeklenir ---------- */
#app { position: fixed; inset: 0; overflow: hidden; }
#stage {
  position: absolute; left: 0; top: 0;
  width: 1920px; height: 1080px;
  transform-origin: 0 0;
  overflow: hidden;
  background: #fff;
}
.layer { position: absolute; inset: 0; }
.scene { position: absolute; inset: 0; overflow: hidden; }

/* ---------- Görsel kompozisyonu: ortada görsel, kenarlarda bulanık dolgu ---------- */
.backdrop {
  position: absolute; inset: -60px;
  background-size: cover; background-position: center;
  filter: blur(28px) saturate(1.1) brightness(1.04);
}
.picture {
  position: absolute; left: 50%; top: 0; height: 100%;
  transform: translateX(-50%);
  box-shadow: 0 0 60px rgba(0,0,0,.18);
}
.picture > img { display: block; height: 100%; width: auto; }
.picture .hotspots { position: absolute; inset: 0; }

/* ---------- Düğmeler (yazısız, büyük, simgeli) ---------- */
.btn {
  position: absolute; display: grid; place-items: center;
  border: none; border-radius: 999px; cursor: pointer;
  color: #fff; background: var(--pink);
  box-shadow: inset 0 -10px 0 var(--pink-dark), var(--shadow);
  transition: transform .12s ease;
  touch-action: none;
}
.btn:active, .btn.pressed { transform: scale(.92) translateY(4px); }
.btn svg { width: 55%; height: 55%; fill: currentColor; pointer-events: none; }
.btn.round-sm { width: 120px; height: 120px; }
.btn.purple { background: var(--purple); box-shadow: inset 0 -8px 0 var(--purple-dark), var(--shadow); }
.btn.ghost { background: rgba(255,255,255,.85); color: var(--purple); box-shadow: inset 0 -6px 0 rgba(0,0,0,.08), 0 8px 20px rgba(0,0,0,.15); }

/* İleri oku */
#next {
  right: 50px; bottom: 50px; width: 190px; height: 190px;
  border: 10px solid #fff;
  opacity: 0; transform: scale(.3); pointer-events: none;
  transition: opacity .35s ease, transform .45s cubic-bezier(.3,1.6,.5,1);
  z-index: 50;
}
#next.show { opacity: 1; transform: scale(1); pointer-events: auto; animation: pulse 1.4s ease-in-out .5s infinite; }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.09); } }

/* Üst bar: ses ve "tekrar dinle" */
#hud { position: absolute; inset: 0; pointer-events: none; z-index: 40; }
#hud .btn { pointer-events: auto; }
#btn-sound { right: 36px; top: 30px; }
#btn-replay { right: 176px; top: 30px; }
#btn-sound.off { background: #b9b0c9; box-shadow: inset 0 -8px 0 #988da9, var(--shadow); }

/* Öğretmen menüsünün gizli köşesi */
#teacher-corner { position: absolute; left: 0; top: 0; width: 140px; height: 140px; pointer-events: auto; z-index: 60; }
#teacher-corner .ring {
  position: absolute; left: 30px; top: 30px; width: 80px; height: 80px; border-radius: 50%;
  border: 8px solid rgba(255,255,255,.9); opacity: 0;
  clip-path: inset(0 0 100% 0);
}
#teacher-corner.holding .ring { opacity: 1; animation: fillring 2s linear forwards; }
@keyframes fillring { to { clip-path: inset(0 0 0 0); } }

/* ---------- Geçiş perdesi (daire kapanır/açılır) ---------- */
#curtain {
  position: absolute; inset: 0; z-index: 90; pointer-events: none;
  background: radial-gradient(circle at 50% 50%, #ffb3cf, #a98bf0);
  clip-path: circle(0% at 50% 50%);
}
#curtain.close { pointer-events: auto; animation: curtainClose .5s ease-in forwards; }
#curtain.open { animation: curtainOpen .55s ease-out forwards; }
@keyframes curtainClose { from { clip-path: circle(0% at 50% 50%); } to { clip-path: circle(80% at 50% 50%); } }
@keyframes curtainOpen  { from { clip-path: circle(80% at 50% 50%); } to { clip-path: circle(0% at 50% 50%); } }

/* ---------- Konuşma balonu (ses yoksa / destek amaçlı) ---------- */
.bubble {
  position: absolute; max-width: 760px; padding: 26px 40px;
  background: #fff; border-radius: 48px; font-size: 46px; font-weight: 600; line-height: 1.2;
  box-shadow: 0 12px 30px rgba(0,0,0,.18);
  opacity: 0; transform: scale(.6); transform-origin: var(--tail-x, 20%) 110%;
  transition: opacity .25s, transform .35s cubic-bezier(.3,1.6,.5,1);
  z-index: 30; pointer-events: none;
}
.bubble.show { opacity: 1; transform: scale(1); }
.bubble::after {
  content: ''; position: absolute; left: var(--tail-x, 20%); bottom: -34px;
  border: 22px solid transparent; border-top: 30px solid #fff; border-bottom: 0;
}

/* ---------- Ortak animasyonlar ---------- */
.breathe { animation: breathe 3.2s ease-in-out infinite; transform-origin: 50% 100%; }
@keyframes breathe { 0%,100% { transform: scale(1, 1); } 50% { transform: scale(1.015, 1.03); } }
.bounce { animation: bounce .6s cubic-bezier(.3,1.8,.5,1); }
@keyframes bounce { 0% { transform: scale(1); } 30% { transform: scale(.94, 1.06) translateY(-30px); } 100% { transform: scale(1); } }
.wobble { animation: wobble 1.1s ease-in-out infinite; transform-origin: 50% 100%; }
@keyframes wobble { 0%,100% { transform: rotate(-2.5deg); } 50% { transform: rotate(2.5deg); } }
.float-up { animation: floatUp 3s ease-out forwards; }
@keyframes floatUp { from { opacity: 0; transform: translateY(0) scale(.6); } 15% { opacity: 1; } to { opacity: 0; transform: translateY(-260px) scale(1.2); } }

/* İpucu eli */
.hint-hand {
  position: absolute; width: 150px; height: 150px; z-index: 35; pointer-events: none;
  filter: drop-shadow(0 8px 10px rgba(0,0,0,.25));
  transition: left 1s ease-in-out, top 1s ease-in-out, opacity .3s;
}
.hint-hand.tap { animation: tap 1s ease-in-out infinite; }
@keyframes tap { 0%,100% { transform: scale(1); } 50% { transform: scale(.85); } }

/* Parçacıklar */
.particle { position: absolute; pointer-events: none; z-index: 33; will-change: transform, opacity; }

/* ---------- Yükleme ve başlangıç ekranı ---------- */
#boot {
  position: absolute; inset: 0; z-index: 100;
  background: radial-gradient(circle at 50% 40%, #fff3f8 0%, #ffd3e3 55%, #c9b6ff 100%);
  display: grid; place-items: center;
}
#boot .loader { width: 900px; height: 60px; border-radius: 30px; background: rgba(255,255,255,.7); overflow: hidden; box-shadow: inset 0 4px 10px rgba(0,0,0,.08); }
#boot .loader i { display: block; height: 100%; width: 0; border-radius: 30px; background: linear-gradient(90deg, var(--mint), var(--blue)); transition: width .2s; }
#boot .start { position: relative; width: 300px; height: 300px; left: auto; top: auto; animation: pulse 1.4s ease-in-out infinite; border: 14px solid #fff; }
#boot .hidden { display: none; }

/* ---------- Yatay çevir uyarısı ---------- */
#rotate {
  position: fixed; inset: 0; z-index: 200; display: none;
  background: var(--letterbox); color: #fff; place-items: center; text-align: center;
}
#rotate svg { width: 40vmin; height: 40vmin; animation: rot 2s ease-in-out infinite; }
@keyframes rot { 0%,30% { transform: rotate(0); } 60%,100% { transform: rotate(-90deg); } }
@media (orientation: portrait) and (max-width: 1100px) { #rotate { display: grid; } }

/* ---------- Öğretmen paneli ---------- */
#teacher {
  position: absolute; inset: 0; z-index: 95; display: none;
  background: rgba(30,20,50,.55); place-items: center;
}
#teacher.show { display: grid; }
#teacher .panel {
  width: 1300px; max-height: 960px; overflow: auto; background: var(--cream); border-radius: 40px;
  padding: 40px 50px; box-shadow: 0 30px 80px rgba(0,0,0,.35); font-size: 30px;
}
#teacher h2 { margin: 0 0 20px; font-size: 44px; color: var(--purple); }
#teacher h3 { margin: 26px 0 12px; font-size: 32px; }
#teacher .grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; }
#teacher .grid button, #teacher .row button {
  font: inherit; font-size: 26px; padding: 18px 10px; border-radius: 22px; border: 3px solid #e7dcf5;
  background: #fff; color: var(--ink); cursor: pointer; min-height: 90px;
}
#teacher .grid button.cur { border-color: var(--pink); background: var(--pink-light); }
#teacher .row { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
#teacher .row button.on { border-color: var(--mint); background: #dcf7ee; }
#teacher .close { float: right; font: inherit; font-size: 40px; width: 90px; height: 90px; border-radius: 50%; border: none; background: var(--pink); color: #fff; cursor: pointer; }

/* ---------- Geliştirici: yiyecek noktası düzenleyici (?debug=1) ---------- */
.hs-debug { position: absolute; border: 4px dashed #ff2d75; border-radius: 50%; background: rgba(255,45,117,.15); color: #ff2d75; font-size: 22px; display: grid; place-items: center; cursor: move; }
.dev-badge { position: absolute; left: 50%; top: 24px; transform: translateX(-50%); background: #ffe27a; color: #6b4e00; padding: 10px 26px; border-radius: 20px; font-size: 26px; z-index: 39; }
