:root {
  --pink-50: #fff3f8;
  --pink-100: #ffe0ee;
  --pink-200: #fcc4dc;
  --pink-300: #f7a8c8;
  --pink-400: #f07fae;
  --pink-500: #e65a95;
  --pink-700: #b2346c;
  --ink: #3a1f2e;
  --black: #26232b;
  --lcd: #fde9f1;
  --lcd-ink: #5a1d3a;
  --gold: #ffd34d;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-touch-callout: none;
  -webkit-text-size-adjust: 100%;
  background: #f9c9dc;
  color: var(--ink);
  font-family: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

/* #app boyutu JS'te ekran boyutuna göre ayarlanır */
#app {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  container-type: size;
  overflow: hidden;
  touch-action: none;
  background: radial-gradient(circle at 30% 20%, #ffe6f1 0%, #f9c4da 55%, #efa3c3 100%);
}

/* iPhone Safari: sayfa kaydırılabilir olmalı ki Safari adres çubuğunu gizlesin */
html.ios-scroll, html.ios-scroll body { overflow: visible; height: auto; touch-action: pan-y; }
html.ios-scroll body { min-height: 300vh; }
html.ios-scroll #app { touch-action: pan-y; }
#swipe {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(58, 31, 46, .55);
  touch-action: pan-y;
}
.swipe-box { text-align: center; color: #fff; font-weight: 700; font-size: clamp(16px, 4cqmin, 22px); }
.swipe-box p { margin: 6px 0 14px; text-shadow: 0 2px 0 rgba(0, 0, 0, .3); }
.swipe-icon { font-size: 48px; animation: swipeup 1.2s ease-in-out infinite; }
@keyframes swipeup { 0% { transform: translateY(24px); opacity: 0; } 30% { opacity: 1; } 100% { transform: translateY(-24px); opacity: 0; } }
.swipe-close { font-family: inherit; font-size: 13px; color: #fff; background: none; border: 1px solid rgba(255, 255, 255, .6); border-radius: 999px; padding: 4px 12px; }
#rotate {
  position: absolute;
  inset: 0;
  z-index: 50;
  background: #ffd6e8;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.rotate-box { text-align: center; color: var(--pink-700); font-weight: 700; font-size: 20px; max-width: 320px; }
.rotate-icon { font-size: 56px; margin-bottom: 8px; animation: bob 1.6s ease-in-out infinite; }
.rotate-note { font-size: 14px; font-weight: 500; opacity: .85; }
.screen, .pager-screen, #lightbox { touch-action: pan-x pan-y; }

#stage {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

#game {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  display: block;
}

.hidden { display: none !important; }

/* ---------- HUD ---------- */
#hud {
  position: absolute;
  top: max(8px, env(safe-area-inset-top));
  left: max(8px, env(safe-area-inset-left));
  right: max(8px, env(safe-area-inset-right));
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  pointer-events: none;
  z-index: 5;
}
.hud-left, .hud-right { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.hud-right { justify-content: flex-end; }
.pill {
  background: rgba(255, 255, 255, .82);
  border: 2px solid var(--pink-300);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: clamp(11px, 2.2cqmin, 15px);
  font-weight: 600;
  color: var(--pink-700);
  white-space: nowrap;
  box-shadow: 0 2px 0 rgba(178, 52, 108, .18);
}
.furyoku { display: flex; align-items: center; gap: 6px; }
.fur-label { font-size: .8em; opacity: .8; }
#fur-slots { display: flex; gap: 3px; }
.slot {
  width: clamp(9px, 1.9cqmin, 13px);
  height: clamp(9px, 1.9cqmin, 13px);
  border-radius: 50%;
  background: #f3dbe6;
  border: 1.5px solid #e3b5ca;
  transition: transform .2s, background .2s;
}
.slot.on {
  background: radial-gradient(circle at 40% 30%, #fff6e6 0 18%, #5a2f1c 19% 45%, #e3a35a 46%);
  border-color: #c47f3a;
  transform: scale(1.15);
}
.furyoku.full { box-shadow: 0 0 12px 3px rgba(240, 127, 174, .8); animation: pulse 0.7s ease-in-out infinite alternate; }

.icon-btn {
  pointer-events: auto;
  border: 2px solid var(--pink-300);
  background: rgba(255, 255, 255, .85);
  border-radius: 50%;
  width: clamp(28px, 5cqmin, 36px);
  height: clamp(28px, 5cqmin, 36px);
  font-size: clamp(13px, 2.6cqmin, 17px);
  cursor: pointer;
  padding: 0;
}

/* ---------- Touch controls ---------- */
#touch {
  position: absolute;
  left: max(10px, env(safe-area-inset-left));
  right: max(10px, env(safe-area-inset-right));
  bottom: max(10px, env(safe-area-inset-bottom));
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  pointer-events: none;
  z-index: 6;
}
.tgroup { display: flex; gap: 12px; align-items: flex-end; }
.tbtn {
  pointer-events: auto;
  touch-action: none;
  width: clamp(54px, 13cqmin, 76px);
  height: clamp(54px, 13cqmin, 76px);
  will-change: transform;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, .9);
  background: rgba(240, 127, 174, .45);
  color: #fff;
  font-size: clamp(20px, 5cqmin, 28px);
  font-family: inherit;
  font-weight: 700;
  box-shadow: 0 3px 0 rgba(178, 52, 108, .35);
}
.tbtn.active { background: rgba(230, 90, 149, .8); transform: scale(.94); }
.tgroup:first-child .tbtn { width: clamp(66px, 17cqmin, 94px); height: clamp(66px, 17cqmin, 94px); }
.tbtn.jump { width: clamp(64px, 15cqmin, 88px); height: clamp(64px, 15cqmin, 88px); }
.tbtn.over {
  font-size: clamp(10px, 2.4cqmin, 13px);
  line-height: 1.1;
  background: linear-gradient(135deg, #ff7eb6, #b06bff);
  box-shadow: 0 0 14px 4px rgba(255, 126, 182, .7);
  animation: pulse 0.7s ease-in-out infinite alternate;
}
/* sadece transform: ekran kartında ucuz, oyunu dondurmaz */
@keyframes pulse { to { transform: scale(1.08); } }
@keyframes pulse2 { from { transform: translateX(-50%); } to { transform: translateX(-50%) scale(1.08); } }

#btn-over {
  position: absolute;
  top: 54px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 6;
  font-family: inherit;
  font-weight: 700;
  font-size: 16px;
  color: #fff;
  border: 3px solid #fff;
  border-radius: 999px;
  padding: 8px 18px;
  background: linear-gradient(135deg, #ff7eb6, #b06bff);
  box-shadow: 0 0 14px 4px rgba(255, 126, 182, .7);
  cursor: pointer;
  will-change: transform;
  animation: pulse2 0.7s ease-in-out infinite alternate;
}
#btn-over small { opacity: .8; font-weight: 500; }

/* ---------- Toast ---------- */
#toast {
  position: absolute;
  top: 18%;
  left: 50%;
  transform: translate(-50%, -10px);
  background: rgba(255, 255, 255, .95);
  color: var(--pink-700);
  border: 3px solid var(--pink-300);
  border-radius: 16px;
  padding: 8px 16px;
  font-weight: 600;
  font-size: clamp(13px, 3cqmin, 18px);
  text-align: center;
  max-width: min(86cqw, 520px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s, transform .25s;
  z-index: 7;
  box-shadow: 0 6px 20px rgba(178, 52, 108, .25);
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Over Soul flash ---------- */
#flash {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  z-index: 8;
}
#flash { background: rgba(255, 140, 190, .4); will-change: opacity; }
#flash.go { animation: flash 1.4s ease-out forwards; }
@keyframes flash {
  0% { opacity: 0; }
  10% { opacity: 1; }
  60% { opacity: .8; }
  100% { opacity: 0; }
}
.os-title {
  font-weight: 700;
  font-size: clamp(36px, 11cqmin, 84px);
  color: #fff;
  letter-spacing: 2px;
  text-shadow: 0 0 2px var(--pink-700), 0 4px 0 var(--pink-700), 0 0 30px #ff7eb6;
  transform: rotate(-4deg);
}
.os-sub {
  font-weight: 600;
  font-size: clamp(16px, 4cqmin, 26px);
  color: #fff;
  text-shadow: 0 2px 0 var(--pink-700);
}

/* ---------- Screens ---------- */
.screen {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: max(12px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  overflow-y: auto;
}

.btn {
  font-family: inherit;
  font-weight: 600;
  font-size: clamp(15px, 3.2cqmin, 19px);
  padding: 10px 22px;
  border-radius: 999px;
  border: 3px solid var(--pink-400);
  background: #fff;
  color: var(--pink-700);
  cursor: pointer;
  box-shadow: 0 4px 0 var(--pink-400);
  transition: transform .1s;
}
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--pink-400); }
.btn.primary { background: var(--pink-500); border-color: var(--pink-700); color: #fff; box-shadow: 0 4px 0 var(--pink-700); }
.btn.ghost { background: rgba(255, 255, 255, .6); }

/* Title */
#screen-title { background: rgba(255, 230, 241, .15); }
.title-box { text-align: center; margin-top: -6cqh; }
.logo-small {
  font-weight: 600;
  font-size: clamp(14px, 3cqmin, 20px);
  color: #fff;
  letter-spacing: 1px;
  text-shadow: 0 2px 0 var(--pink-700);
}
.logo {
  margin: 0;
  font-weight: 900;
  line-height: .95;
  font-size: clamp(30px, 8.5cqmin, 64px);
  color: #fff;
  text-shadow: 0 3px 0 var(--pink-700);
  filter: drop-shadow(0 0 14px rgba(255, 126, 182, .55));
}
.logo span {
  display: inline-block;
  font-size: 1.6em;
  letter-spacing: 4px;
  line-height: 1.1;
  padding-top: .14em; /* İ'nin noktası kırpılmasın */
  background: linear-gradient(180deg, #fff 0 45%, #ffd1e6 60%, #ff8fc0 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 4px 0 var(--pink-700));
  text-shadow: none;
  animation: bob 2.4s ease-in-out infinite;
}
@keyframes bob { 50% { transform: translateY(-4px) rotate(-1deg); } }
.tagline {
  margin: 10px 0 14px;
  font-size: clamp(14px, 3cqmin, 19px);
  font-weight: 500;
  color: var(--pink-700);
  background: rgba(255, 255, 255, .75);
  display: inline-block;
  padding: 4px 14px;
  border-radius: 999px;
}
.title-buttons { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 4px; }

/* Pager */
.pager {
  background: linear-gradient(160deg, #ff9cc6, #f06ea6);
  border: 4px solid #fff;
  border-radius: 22px;
  padding: 12px;
  box-shadow: 0 10px 0 #c04a7f, 0 18px 40px rgba(120, 30, 70, .35);
  width: min(520px, 92cqw);
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 100%;
  animation: popin .45s cubic-bezier(.2, 1.4, .4, 1) both;
}
.pager.big { width: min(600px, 94cqw); }
@keyframes popin { from { transform: scale(.6) rotate(-3deg); opacity: 0; } }
.pager-head {
  display: flex;
  justify-content: space-between;
  font-family: 'VT323', monospace;
  font-size: clamp(15px, 3cqmin, 20px);
  color: #fff;
  letter-spacing: 1px;
}
.blink { animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: .3; } }
.pager-screen {
  background: var(--lcd);
  border-radius: 12px;
  box-shadow: inset 0 3px 0 rgba(90, 29, 58, .25), inset 0 0 0 2px #e8b9cd;
  padding: 12px 14px;
  min-height: 90px;
  overflow-y: auto;
  flex: 1 1 auto;
  cursor: pointer;
}
.pager-text {
  font-family: 'VT323', monospace;
  font-size: clamp(18px, 3.8cqmin, 24px);
  line-height: 1.22;
  color: var(--lcd-ink);
  white-space: pre-wrap;
}
.pager-text .cursor { animation: blink .7s steps(2) infinite; }
.controls-help {
  background: rgba(255, 255, 255, .9);
  border-radius: 12px;
  padding: 8px 12px;
  font-size: clamp(12px, 2.6cqmin, 15px);
  color: var(--pink-700);
  line-height: 1.45;
}
.controls-help b { color: var(--ink); }
.pager .btn { align-self: flex-end; }
.pager .more {
  align-self: center;
  font-family: 'VT323', monospace;
  font-size: clamp(16px, 3.2cqmin, 21px);
  color: #fff;
  background: none;
  border: none;
  cursor: pointer;
  animation: bob 1.2s ease-in-out infinite;
}

/* Level card */
#screen-card { background: rgba(255, 220, 236, .6); cursor: pointer; }
.card {
  text-align: center;
  background: #fff;
  border: 4px solid var(--pink-300);
  border-radius: 26px;
  padding: 18px 34px;
  box-shadow: 0 8px 0 var(--pink-300);
  animation: popin .45s cubic-bezier(.2, 1.4, .4, 1) both;
  max-width: 92cqw;
}
.card-num { font-family: 'VT323', monospace; font-size: clamp(18px, 3.6cqmin, 24px); color: var(--pink-500); letter-spacing: 2px; }
.card-name { font-weight: 700; font-size: clamp(28px, 7cqmin, 48px); color: var(--pink-700); }
.card-sub { font-size: clamp(13px, 2.8cqmin, 17px); color: var(--ink); opacity: .8; margin-top: 4px; }

/* Reward */
#screen-reward { background: rgba(255, 214, 232, .85); justify-content: center; gap: 10px; }
.reward-head {
  font-weight: 700;
  font-size: clamp(18px, 4cqmin, 28px);
  color: var(--pink-700);
  background: rgba(255, 255, 255, .85);
  padding: 4px 18px;
  border-radius: 999px;
  text-align: center;
}
.reward-wrap {
  display: flex;
  gap: clamp(14px, 3cqw, 34px);
  align-items: center;
  justify-content: center;
  max-height: calc(100% - 50px);
  width: 100%;
}
.polaroid {
  margin: 0;
  background: #fff;
  padding: 10px 10px 8px;
  border-radius: 4px;
  box-shadow: 0 10px 30px rgba(120, 30, 70, .3);
  transform: rotate(-3deg);
  animation: drop .7s cubic-bezier(.2, 1.3, .4, 1) both;
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
}
@keyframes drop { from { transform: translateY(-60px) rotate(8deg); opacity: 0; } }
.polaroid img {
  display: block;
  height: min(62cqh, 520px);
  max-width: 40cqw;
  object-fit: cover;
  border-radius: 2px;
}
.polaroid figcaption {
  font-family: 'VT323', monospace;
  font-size: clamp(16px, 3cqmin, 21px);
  color: var(--pink-700);
  text-align: center;
  padding-top: 6px;
  max-width: 40cqw;
}
#screen-reward .pager { max-height: min(80cqh, 560px); }

/* dar/dik pencere (masaüstünde dik pencere gibi) */
.tall .reward-wrap { flex-direction: column; max-height: none; }
.tall #screen-reward .polaroid img { height: auto; width: min(58cqw, 300px); max-width: none; max-height: 42cqh; }
.tall #screen-reward .polaroid figcaption { max-width: min(58cqw, 300px); }
.tall #screen-reward { justify-content: flex-start; }
.ios-hint {
  margin: 12px auto 0;
  max-width: 420px;
  font-size: clamp(12px, 2.6cqmin, 15px);
  color: var(--pink-700);
  background: rgba(255, 255, 255, .8);
  border-radius: 12px;
  padding: 6px 12px;
}

/* Gallery */
#screen-gallery { background: rgba(255, 224, 238, .92); justify-content: flex-start; }
.gallery-title { margin: 8px 0 12px; font-size: clamp(24px, 5cqmin, 38px); color: var(--pink-700); text-shadow: 0 2px 0 #fff; }
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(150px, 40cqw), 1fr));
  gap: 18px;
  width: min(980px, 100%);
}
.gallery .polaroid { animation-delay: var(--d, 0s); cursor: zoom-in; }
.gallery .polaroid:nth-child(even) { transform: rotate(2.5deg); }
.gallery .polaroid img { width: 100%; height: auto; aspect-ratio: 3 / 4; max-width: none; }
.gallery .polaroid figcaption { max-width: none; font-size: clamp(14px, 2.6cqmin, 18px); }
.gallery .locked {
  aspect-ratio: 3 / 4;
  display: flex;
  align-items: center;
  justify-content: center;
  background: repeating-linear-gradient(45deg, #fde3ee 0 10px, #fbd3e4 10px 20px);
  font-size: 34px;
  border-radius: 2px;
}
.gallery-foot {
  text-align: center;
  font-family: 'VT323', monospace;
  font-size: clamp(18px, 3.4cqmin, 24px);
  color: var(--pink-700);
  margin: 18px 0 10px;
}

#lightbox {
  position: absolute;
  inset: 0;
  z-index: 20;
  background: rgba(58, 31, 46, .85);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
}
#lightbox img { max-width: 94cqw; max-height: 94cqh; border: 8px solid #fff; border-radius: 4px; }
