/* Kaybolan Yollar — romantik labirent teması */

:root {
  --bg-deep: #0c0612;
  --bg-mid: #1a0f28;
  --neon-pink: #ff4d8d;
  --neon-purple: #b84dff;
  --neon-soft: rgba(255, 77, 141, 0.35);
  --text: #f8e8f2;
  --text-muted: rgba(248, 232, 242, 0.65);
  --glass: rgba(30, 18, 45, 0.72);
  --font-ui: "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-display: "Georgia", "Times New Roman", serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  font-family: var(--font-ui);
  background: radial-gradient(ellipse 120% 80% at 50% 0%, #2a1538 0%, var(--bg-deep) 55%, #050308 100%);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}

#app {
  position: fixed;
  inset: 0;
}

/* Ekran katmanları */
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(16px, 5vw, 40px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.65s ease;
  z-index: 2;
}

.screen--visible {
  opacity: 1;
  pointer-events: auto;
}

.screen__inner {
  max-width: 520px;
  text-align: center;
}

.intro-lines {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-bottom: 2rem;
  font-size: clamp(1rem, 3.8vw, 1.2rem);
  line-height: 1.55;
  color: var(--text-muted);
}

.intro-lines span {
  display: block;
  animation: fadeLine 0.9s ease backwards;
}

.intro-lines span:nth-child(1) { animation-delay: 0.1s; }
.intro-lines span:nth-child(2) { animation-delay: 0.45s; }
.intro-lines span:nth-child(3) { animation-delay: 0.8s; }
.intro-lines__cta {
  margin-top: 0.5rem;
  color: var(--text);
  font-weight: 500;
  animation-delay: 1.15s !important;
}

@keyframes fadeLine {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.btn {
  font: inherit;
  cursor: pointer;
  border: none;
  border-radius: 999px;
  padding: 0.85rem 2rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  transition: transform 0.2s ease, box-shadow 0.25s ease, background 0.2s ease;
}

.btn:active {
  transform: scale(0.97);
}

.btn--primary {
  background: linear-gradient(135deg, var(--neon-pink), var(--neon-purple));
  color: #fff;
  box-shadow: 0 0 28px var(--neon-soft), 0 4px 20px rgba(0, 0, 0, 0.35);
}

.btn--primary:hover {
  box-shadow: 0 0 40px rgba(255, 77, 141, 0.55), 0 6px 24px rgba(0, 0, 0, 0.4);
}

.btn--ghost {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.15);
  margin-top: 1.5rem;
}

.btn--ghost:hover {
  background: rgba(255, 255, 255, 0.12);
}

/* Oyun ekranı */
#screen-game {
  z-index: 1;
  flex-direction: column;
  padding: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.65s ease;
}

#screen-game.screen--visible {
  display: flex;
  opacity: 1;
  pointer-events: auto;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
}

/* Oyun sırasında hiçbir şey seçilemesin (mobil uzun basış / sürükleme) */
#screen-game,
#screen-game * {
  -webkit-user-select: none !important;
  user-select: none !important;
  -webkit-touch-callout: none !important;
}

#screen-game *::selection {
  background: transparent;
}

.hud {
  position: relative;
  z-index: 5;
  width: 100%;
  padding: 10px clamp(12px, 3vw, 24px);
  pointer-events: none;
}

.hud--top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: linear-gradient(180deg, rgba(12, 6, 18, 0.92) 0%, transparent 100%);
}

.hud__block {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
}

.hud__block--hidden {
  display: none !important;
}

.hud__keys {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 1.35rem;
  font-weight: 700;
  color: #ffd966;
  text-shadow: 0 0 12px rgba(255, 200, 100, 0.55);
  pointer-events: auto;
  cursor: default;
  user-select: none;
  -webkit-user-select: none;
}

.hud__key-icon {
  font-size: 1.1rem;
}

.hud__phase2-hint {
  margin: 0;
  flex: 1;
  text-align: right;
  font-size: clamp(0.72rem, 2.2vw, 0.88rem);
  color: var(--text-muted);
  font-style: italic;
  max-width: 52ch;
}

.hud__hearts {
  display: flex;
  align-items: baseline;
  gap: 4px;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--neon-pink);
  text-shadow: 0 0 12px rgba(255, 77, 141, 0.6);
  /* gizli kısayol: tıklanabilsin (üst hud pointer-events: none) */
  pointer-events: auto;
  cursor: default;
  user-select: none;
  -webkit-user-select: none;
}

.hud__heart-icon {
  font-size: 1.1rem;
  margin-right: 2px;
}

.hud__sep {
  opacity: 0.6;
  font-weight: 500;
}

.hud__quote {
  flex: 1;
  min-width: 200px;
  margin: 0;
  text-align: right;
  font-size: clamp(0.72rem, 2.2vw, 0.88rem);
  color: var(--text-muted);
  font-style: italic;
  line-height: 1.4;
  max-width: 62ch;
  transition: opacity 0.45s ease;
}

.hud__hint {
  position: absolute;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 6;
  margin: 0;
  padding: 8px 16px;
  font-size: 0.8rem;
  color: var(--neon-purple);
  background: var(--glass);
  border-radius: 999px;
  border: 1px solid rgba(184, 77, 255, 0.25);
  opacity: 0;
  transition: opacity 0.35s ease;
  pointer-events: none;
  max-width: 90vw;
  text-align: center;
}

.hud__hint--show {
  opacity: 1;
}

.canvas-wrap {
  position: relative;
  flex: 1 1 auto;
  width: 100%;
  min-height: min(62vh, 560px);
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
}

#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
  max-height: min(72vh, 100%);
  object-fit: contain;
  /* Yakın zoom + gul.png için yumuşak ölçekleme (daha net görünüm) */
  image-rendering: auto;
  border-radius: 12px;
  box-shadow: 0 0 0 1px rgba(255, 77, 141, 0.15), 0 20px 60px rgba(0, 0, 0, 0.5);
  touch-action: none;
}

/* Toast — 10 kalp */
.toast {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(8, 4, 14, 0.55);
  backdrop-filter: blur(6px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.45s ease, visibility 0.45s ease;
}

.toast--visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.toast__inner {
  max-width: 400px;
  padding: 28px 32px;
  background: linear-gradient(155deg, rgba(40, 22, 55, 0.95), rgba(20, 12, 32, 0.98));
  border: 1px solid rgba(255, 77, 141, 0.25);
  border-radius: 20px;
  box-shadow: 0 0 60px rgba(184, 77, 255, 0.2);
  text-align: center;
  line-height: 1.65;
  font-size: 1rem;
  /* "both" fill bazı tarayıcılarda kapanışı bozabiliyor; sadece giriş animasyonu */
  animation: toastPop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  pointer-events: auto;
}

.toast__title {
  font-weight: 600;
}

.toast__dismiss {
  margin-top: 1.1rem;
  width: 100%;
  max-width: 220px;
}

.toast__inner p {
  margin: 0 0 0.5rem;
}

.toast__emoji {
  margin-top: 0.75rem !important;
  font-size: 1.15rem;
}

@keyframes toastPop {
  from {
    opacity: 0;
    transform: scale(0.92) translateY(12px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* Final */
#screen-final {
  z-index: 15;
  background: radial-gradient(ellipse at 50% 30%, rgba(80, 40, 100, 0.35) 0%, rgba(12, 6, 18, 0.97) 55%);
}

#screen-final.screen--visible {
  opacity: 1;
  pointer-events: auto;
}

.screen__inner--final {
  max-width: 560px;
}

.final-lines {
  font-family: var(--font-display);
  font-size: clamp(1rem, 3.2vw, 1.15rem);
  line-height: 1.75;
  color: var(--text-muted);
}

.final-lines p {
  margin: 0 0 0.35rem;
  animation: fadeLine 0.8s ease backwards;
}

.final-lines p:nth-child(1) { animation-delay: 0.1s; }
.final-lines p:nth-child(2) { animation-delay: 0.25s; }
.final-lines p:nth-child(3) { animation-delay: 0.4s; }
.final-lines p:nth-child(4) { animation-delay: 0.55s; }
.final-lines__space { height: 0.75rem; animation: none !important; }
.final-lines p:nth-child(6) { animation-delay: 0.85s; color: var(--text); font-weight: 600; }
.final-lines p:nth-child(7) { animation-delay: 1s; }
.final-lines p:nth-child(8) { animation-delay: 1.15s; }

.final-signature {
  margin-top: 1.5rem;
  font-style: italic;
  color: var(--neon-pink);
  opacity: 0.9;
  animation: fadeLine 0.8s ease 1.3s backwards;
}

/* Kalp parçacıkları */
.particles {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.particle {
  position: absolute;
  bottom: -20px;
  font-size: 14px;
  color: rgba(255, 77, 141, 0.7);
  animation: floatUp linear forwards;
}

@keyframes floatUp {
  from {
    transform: translateY(0) rotate(0deg);
    opacity: 0.75;
  }
  to {
    transform: translateY(-110vh) rotate(22deg);
    opacity: 0;
  }
}

/* Mobil kontroller — iOS Safari seçim / tap highlight */
.touch-controls {
  display: none;
  position: relative;
  z-index: 8;
  padding: 12px 16px 24px;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  gap: 6px;
  pointer-events: auto;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

@media (max-width: 900px), (pointer: coarse) {
  .touch-controls {
    display: flex;
  }

  .hud__quote {
    text-align: center;
    width: 100%;
    max-width: none;
  }
}

.touch-pad__row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.touch-pad__btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  padding: 0;
  border-radius: 14px;
  border: 1px solid rgba(255, 77, 141, 0.35);
  background: rgba(30, 18, 45, 0.85);
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
  -webkit-appearance: none;
  appearance: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
  outline: none;
}

.touch-pad__btn:focus,
.touch-pad__btn:focus-visible {
  outline: none;
}

.touch-pad__icon {
  display: block;
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  pointer-events: none;
  -webkit-user-select: none;
  user-select: none;
}

.touch-pad__icon path {
  pointer-events: none;
  -webkit-user-select: none;
  user-select: none;
}

.touch-pad__btn:active {
  background: rgba(255, 77, 141, 0.25);
  transform: scale(0.96);
}

.touch-pad__btn--up {
  margin-bottom: 2px;
}

/* Kesit metni */
.cutscene-overlay {
  position: fixed;
  inset: 0;
  z-index: 25;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(8, 4, 14, 0.72);
  backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

.cutscene-overlay--visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.cutscene-overlay__text {
  margin: 0;
  max-width: 28ch;
  font-size: clamp(1.35rem, 5vw, 2rem);
  font-weight: 800;
  text-align: center;
  line-height: 1.35;
  color: #ffb3c9;
  text-shadow: 0 0 24px rgba(255, 77, 141, 0.85), 0 0 4px #000;
  animation: screamPulse 0.6s ease infinite alternate;
}

@keyframes screamPulse {
  from {
    transform: scale(1);
  }
  to {
    transform: scale(1.03);
  }
}

/* Faz 2 yeniden dene */
.phase2-retry {
  position: fixed;
  inset: 0;
  z-index: 28;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(6, 2, 12, 0.78);
  backdrop-filter: blur(5px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

.phase2-retry--visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.phase2-retry__inner {
  text-align: center;
  padding: 28px 32px;
  max-width: 360px;
  background: linear-gradient(155deg, rgba(45, 18, 40, 0.96), rgba(18, 8, 28, 0.98));
  border: 1px solid rgba(255, 77, 141, 0.35);
  border-radius: 20px;
  box-shadow: 0 0 48px rgba(255, 50, 100, 0.2);
}

.phase2-retry__title {
  margin: 0 0 1.25rem;
  font-size: 1.35rem;
  font-weight: 700;
  color: #ffb3c9;
  text-shadow: 0 0 20px rgba(255, 77, 141, 0.5);
}

.phase2-retry .btn {
  width: 100%;
  max-width: 260px;
}

/* Diyalog */
.screen-dialogue {
  z-index: 30;
  background: radial-gradient(ellipse at 50% 40%, rgba(60, 30, 80, 0.45) 0%, rgba(12, 6, 18, 0.98) 60%);
}

.screen__inner--wide {
  max-width: 720px;
  width: 100%;
}

.dialogue-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(16px, 4vw, 32px);
  align-items: start;
}

.dialogue-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.dialogue-col--ediz {
  text-align: center;
}

.dialogue-col--gul {
  text-align: center;
}

.dialogue-face {
  width: min(140px, 28vw);
  height: auto;
  border-radius: 16px;
  border: 2px solid rgba(255, 77, 141, 0.35);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
  object-fit: cover;
}

.dialogue-col--dim .dialogue-face {
  opacity: 0.38;
  filter: grayscale(0.35);
}

.chat-bubble {
  min-height: 2.5rem;
  padding: 14px 18px;
  border-radius: 18px;
  background: var(--glass);
  border: 1px solid rgba(255, 77, 141, 0.28);
  font-size: clamp(0.95rem, 2.8vw, 1.08rem);
  line-height: 1.5;
  color: var(--text);
  max-width: 100%;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
}

.chat-bubble--hidden {
  opacity: 0;
  visibility: hidden;
}

.chat-bubble--visible {
  opacity: 1;
  visibility: visible;
  animation: bubbleIn 0.45s ease backwards;
}

@keyframes bubbleIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.dialogue-hint {
  margin-top: 1.75rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  text-align: center;
}

/* Mektup */
.screen-letter {
  z-index: 32;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  background: radial-gradient(ellipse 100% 60% at 50% 0%, rgba(50, 28, 65, 0.5) 0%, rgba(12, 6, 18, 0.98) 50%);
}

.screen-letter.screen--visible {
  align-items: center;
  justify-content: center;
  padding: clamp(20px, 4vh, 40px);
}

.letter-scroll {
  max-width: 520px;
  width: 100%;
  max-height: min(72vh, 640px);
  overflow-y: auto;
  padding: 20px 24px 28px;
  margin: 0 auto;
  text-align: left;
  background: rgba(22, 12, 34, 0.55);
  border: 1px solid rgba(255, 77, 141, 0.2);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  font-family: var(--font-display);
  font-size: clamp(0.95rem, 2.8vw, 1.05rem);
  line-height: 1.75;
  color: var(--text-muted);
}

.letter-scroll p {
  margin: 0 0 1rem;
}

.letter-greeting {
  color: var(--text);
  font-weight: 600;
}

.letter-close {
  margin-top: 1.25rem !important;
  color: var(--neon-pink);
  font-weight: 600;
}

.letter-sign {
  text-align: right;
  font-style: italic;
  color: var(--text-muted);
  margin-bottom: 0 !important;
}

@media (max-width: 560px) {
  .dialogue-grid {
    grid-template-columns: 1fr;
  }
}
