/* Kumpas — tarayıcıda tek bölüm (dikey). Sahne 390 px mantıksal genişlikte kurulur, JS ölçekler. */
:root {
  --kagit: #f4e7c9;
  --murekkep: #2a1c13;
  --kiremit: #a3322a;
  --kiremit-koyu: #7e2620;
  --turkuaz-koyu: #1b3b35;
  --hardal: #d9a53a;
  --serif: "Superclarendon", "Rockwell", "Clarendon", "Georgia", "Times New Roman", serif;
  --govde: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #10241f; }
body { position: fixed; left: 0; top: 0; right: 0; bottom: 0; }
body {
  font: 15px/1.4 var(--govde); color: var(--murekkep);
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; touch-action: manipulation;
  background: radial-gradient(80% 60% at 50% 30%, #24493f, #10241f);
}
img { display: block; -webkit-user-drag: none; pointer-events: none; }
button { font: inherit; color: inherit; border: 0; background: none; padding: 0; cursor: pointer; }
button:focus-visible, a:focus-visible { outline: 3px solid var(--hardal); outline-offset: 2px; }

#sahne {
  position: absolute; left: 0; top: 0; width: 390px; overflow: hidden; overflow: clip; transform-origin: 0 0;
  background: var(--turkuaz-koyu);
}
.cerceveli #sahne { border-radius: 30px; box-shadow: 0 0 0 10px #0b1714, 0 24px 60px rgba(0, 0, 0, .55); }

/* sahnedeki parçalar: konumları JS verir (kaynak tuval 2400x1500 koordinatı) */
.p { position: absolute; }
.p img { width: 100%; height: 100%; }
#oda { z-index: 0; }
#cita { position: absolute; left: 0; width: 390px; height: 6px; z-index: 1;
  background: linear-gradient(#8a5a2b, #5b3416); box-shadow: 0 2px 4px rgba(0, 0, 0, .45); }
#askilik, #saat { z-index: 1; }
#masa { z-index: 2; }
#telefon, #lamba { z-index: 3; }
#sapka { z-index: 4; transition: left .7s cubic-bezier(.3, .1, .3, 1), top .7s cubic-bezier(.3, -.6, .5, 1), transform .7s ease; }
#sapka.masada { transform: rotate(45deg) scale(1.5); }
.ibre { position: absolute; z-index: 2; transform-origin: 50% 100%; transition: transform 1s cubic-bezier(.4, 0, .2, 1); }
.parla { animation: parla 1.2s ease-in-out infinite alternate; }
@keyframes parla { from { filter: drop-shadow(0 0 2px rgba(255, 214, 110, .5)); } to { filter: drop-shadow(0 0 10px rgba(255, 214, 110, 1)) drop-shadow(0 0 3px #fff3c4); } }
.zipla { animation: zipla .45s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes zipla { 0% { transform: scale(1); } 40% { transform: scale(1.12); } 100% { transform: scale(1); } }

/* dokunma alanları (≥ 56 px) */
.hedef { position: absolute; z-index: 6; border-radius: 50%; }

/* dedektif */
#dedektif { position: absolute; z-index: 5; width: 0; height: 0; }
#dedektif img { position: absolute; bottom: 0; left: 0; transform: translateX(-50%); visibility: hidden; }
#dedektif img.gor { visibility: visible; }
#dedektif.sola img { transform: translateX(-50%) scaleX(-1); }

/* üst: şüpheli kartları */
#kartlar { position: absolute; z-index: 8; left: 0; right: 0; top: 10px; display: flex; justify-content: center; gap: 12px; }
.kart { position: relative; width: 66px; text-align: center; }
.kart .foto { width: 66px; height: 91px; border-radius: 6px; box-shadow: 0 3px 8px rgba(0, 0, 0, .45); }
.kart .ad { margin-top: 4px; font-size: 11.5px; font-weight: 700; color: var(--kagit); text-shadow: 0 1px 2px rgba(0, 0, 0, .7); white-space: nowrap; }
.kart .etiket {
  position: absolute; top: -6px; left: 50%; transform: translateX(-50%) rotate(-4deg); white-space: nowrap;
  background: var(--kiremit); color: var(--kagit); font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 3px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .4);
}
.kart .puan {
  position: absolute; top: -8px; right: -10px; min-width: 26px; height: 26px; border-radius: 13px; padding: 0 6px;
  display: grid; place-items: center; background: var(--hardal); color: var(--murekkep); font-weight: 800; font-size: 14px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, .4); transform: scale(0); transition: transform .35s cubic-bezier(.3, 1.6, .5, 1);
}
.kart .puan.var { transform: scale(1); }
.kart.suclandi .foto { box-shadow: 0 0 0 3px var(--kiremit), 0 0 18px rgba(163, 50, 42, .9); }
.kart.suclandi { animation: salla .5s ease; }
@keyframes salla { 25% { transform: rotate(-6deg); } 50% { transform: rotate(5deg); } 75% { transform: rotate(-3deg); } }

/* anlatıcı */
#anlatici {
  position: absolute; z-index: 8; left: 10px; right: 10px; top: 129px; display: flex; gap: 8px; align-items: flex-start;
  transition: opacity .35s ease, transform .35s ease;
}
#anlatici.gizli { opacity: 0; transform: translateY(-8px); pointer-events: none; }
#anlatici .portre { flex: none; width: 54px; height: 67px; border-radius: 6px; box-shadow: 0 2px 6px rgba(0, 0, 0, .45); }
#anlatici .metin {
  position: relative; flex: 1; min-height: 80px; background: #fffaf0; border: 2px solid var(--murekkep); border-radius: 12px;
  padding: 8px 12px; font-size: 15px; line-height: 1.35; box-shadow: 0 3px 0 rgba(0, 0, 0, .25); min-height: 52px;
}
#anlatici .metin::before {
  content: ""; position: absolute; top: 16px; left: -9px; width: 14px; height: 14px; background: #fffaf0;
  border-left: 2px solid var(--murekkep); border-bottom: 2px solid var(--murekkep); transform: rotate(45deg);
}
[dir="rtl"] #anlatici .metin::before { left: auto; right: -9px; transform: rotate(-135deg); }
#anlatici .giris { margin: 0 0 4px; }
#anlatici .komut { margin: 0; font-weight: 800; color: var(--kiremit-koyu); }
#anlatici .metin.yeni { animation: zipla .4s ease; }

/* el işareti */
#el { position: absolute; z-index: 7; pointer-events: none; width: 76px; height: 93px; transition: left .45s ease, top .45s ease, opacity .3s;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .45)); }
#el img { width: 100%; height: 100%; transform-origin: 8% 6%; animation: dokun 1.1s ease-in-out infinite; }
/* "dokun" hareketi: hedeften biraz geri çekil, ileri gel, bas (küçül), bırak */
@keyframes dokun { 0% { transform: translate(14px, 16px); } 45% { transform: translate(0, 0) scale(1); } 55% { transform: translate(0, 0) scale(.88); } 70% { transform: translate(0, 0) scale(1); } 100% { transform: translate(14px, 16px); } }
#halka { position: absolute; z-index: 6; pointer-events: none; border-radius: 50%; border: 3px solid #ffd56e; opacity: 0; }
#halka.acik { animation: nabiz 1.1s ease-out infinite; }
@keyframes nabiz { 0% { transform: scale(.7); opacity: .95; } 100% { transform: scale(1.35); opacity: 0; } }
#el.gizli { opacity: 0; }

/* zil */
#zil {
  position: absolute; z-index: 8; right: 14px; bottom: 16px; width: 84px; height: 84px; border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #fff6df, #e9d6ab); box-shadow: 0 0 0 3px var(--hardal), 0 6px 14px rgba(0, 0, 0, .5);
  display: grid; place-items: center; transition: opacity .35s, transform .35s cubic-bezier(.3, 1.5, .5, 1);
  bottom: calc(16px + env(safe-area-inset-bottom, 0px)); transform: scale(.82);
}
#zil img { width: 60px; height: 57px; }
#zil.hazir { transform: scale(1.08); }
#zil.gitti { opacity: 0; transform: scale(.6); pointer-events: none; }
#zil.parla { animation: zilparla 1s ease-in-out infinite alternate; }
@keyframes zilparla { from { box-shadow: 0 0 0 3px var(--hardal), 0 6px 14px rgba(0, 0, 0, .5); } to { box-shadow: 0 0 0 4px #ffd56e, 0 0 26px 6px rgba(255, 213, 110, .85); } }
#zil.hazir:active { transform: scale(.96); }

/* ses düğmesi */
#ses { position: absolute; z-index: 9; top: 6px; right: 6px; width: 48px; height: 48px; display: grid; place-items: center; }
#ses img { width: 30px; height: 32px; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .6)); }
[dir="rtl"] #ses { right: auto; left: 6px; }

/* dedektif balonu */
#balon {
  position: absolute; z-index: 9; max-width: 240px; padding: 9px 13px; background: #fffaf0; border: 2px solid var(--murekkep);
  border-radius: 14px; font-size: 15px; line-height: 1.35; box-shadow: 0 3px 0 rgba(0, 0, 0, .25);
  opacity: 0; transform: translateY(6px) scale(.96); transition: opacity .25s ease, transform .25s ease; pointer-events: none;
}
#balon.acik { opacity: 1; transform: none; }
#balon::after {
  content: ""; position: absolute; bottom: -9px; left: var(--kuyruk, 50%); width: 14px; height: 14px; margin-left: -7px;
  background: #fffaf0; border-right: 2px solid var(--murekkep); border-bottom: 2px solid var(--murekkep); transform: rotate(45deg);
}

/* sonuç */
#sonuc {
  position: absolute; inset: 0; z-index: 20; display: grid; place-items: center; padding: 14px;
  background: rgba(10, 20, 17, .7); opacity: 0; pointer-events: none; transition: opacity .45s ease;
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
}
#dedektif { transition: opacity .5s ease; }
#dedektif.sol { opacity: 0; }
#sonuc.acik { opacity: 1; pointer-events: auto; }
.kutu {
  position: relative; width: 100%; max-width: 352px; text-align: center; padding: 20px 18px 16px;
  background: var(--kagit); border-radius: 10px; box-shadow: 0 0 0 4px var(--kiremit), 0 0 0 7px var(--hardal), 0 20px 40px rgba(0, 0, 0, .5);
  transform: scale(.85); transition: transform .45s cubic-bezier(.3, 1.5, .5, 1);
}
#sonuc.acik .kutu { transform: scale(1); }
.yildizlar { display: flex; justify-content: center; gap: 8px; height: 66px; margin-bottom: 6px; }
.yildiz { position: relative; width: 68px; height: 66px; }
.yildiz img { position: absolute; inset: 0; width: 100%; height: 100%; }
.yildiz .dolu { opacity: 0; transform: translateY(-140px) rotate(-40deg) scale(1.4); }
.yildiz.dustu .dolu { opacity: 1; transform: none; transition: transform .5s cubic-bezier(.3, 1.4, .5, 1), opacity .15s; }
.yildiz:nth-child(2) { margin-top: -10px; }
.kutu h2 { margin: 0 0 6px; font: 700 26px/1.15 var(--serif); color: var(--kiremit-koyu); }
.kutu .aciklama { margin: 0; font-size: 14.5px; color: #5a4330; }
.cagri { overflow: hidden; max-height: 0; opacity: 0; transition: max-height .6s ease, opacity .5s ease .1s; }
.cagri.acik { max-height: 260px; opacity: 1; }
.cagri p { margin: 14px 0 4px; font: 700 17px/1.3 var(--serif); color: var(--murekkep); }
.rozet-alan { padding: 14px; display: flex; justify-content: center; }
.rozet { display: block; line-height: 0; }
.rozet img { height: 56px; width: auto; }
.tekrar { min-height: 44px; padding: 10px 16px; font-size: 15px; font-weight: 700; color: var(--kiremit-koyu); text-decoration: underline; text-underline-offset: 3px; }

/* konfeti */
.konfeti { position: absolute; z-index: 21; top: -40px; width: 22px; height: auto; pointer-events: none; animation: dus linear forwards; }
@keyframes dus { to { transform: translate(var(--dx), 900px) rotate(var(--r)); } }

/* yükleme perdesi */
#perde {
  position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; text-align: center;
  background: #f4e7c9 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .35 0 0 0 0 .25 0 0 0 0 .12 0 0 0 .1 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
  transition: transform .8s cubic-bezier(.7, 0, .3, 1);
}
#perde::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -15px; height: 16px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='16' preserveAspectRatio='none'%3E%3Cpath d='M0 0V9l9-3 7 6 11-5 8 4 12-6 6 5 10-3 9 6 13-7 7 3 10-4 8 6 12-5 9 2 6-4 11 7 9-6 8 3 10-4 12 6 7-5 9 3 11-4 7 5 19 0V0z' fill='%23f4e7c9'/%3E%3C/svg%3E") 0 0 / 240px 16px repeat-x;
}
#perde.kalk { transform: translateY(calc(-100% - 20px)); pointer-events: none; }
#perde h1 { margin: 0 0 8px; font: 700 40px/1 var(--serif); color: var(--kiremit); letter-spacing: .04em; }
#perde p { margin: 0; color: #5a4330; font-size: 15px; }
.yukleme { width: 140px; height: 4px; margin: 16px auto 0; border-radius: 2px; background: #e2cc9c; overflow: hidden; }
.yukleme i { display: block; height: 100%; width: 0; background: var(--kiremit); transition: width .2s; }

@media (prefers-reduced-motion: reduce) {
  .parla, #el img, #zil.parla, .zipla, .kart.suclandi { animation: none !important; }
  .parla { filter: drop-shadow(0 0 8px rgba(255, 214, 110, .95)); }
}
