* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: #14121f;
  font-family: 'Nunito', sans-serif;
  color: #fdf6ec;
  -webkit-tap-highlight-color: transparent;
}

#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }

/* ── Overlay'ler ─────────────────────────────── */
.overlay {
  position: fixed; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center;
  z-index: 10;
  padding: 24px;
  transition: opacity .8s ease;
}
.overlay.hidden { opacity: 0; pointer-events: none; }

#loading { background: #14121f; z-index: 30; }
#title-screen { background: linear-gradient(180deg, rgba(20,18,31,.45) 0%, rgba(20,18,31,.1) 45%, rgba(20,18,31,.55) 100%); }
#card-overlay { background: rgba(15, 13, 26, .55); backdrop-filter: blur(4px); z-index: 20; }
#finish-screen { background: rgba(15, 13, 26, .72); backdrop-filter: blur(6px); z-index: 25; }

/* ── Yükleme ─────────────────────────────────── */
.loader-figure { position: relative; width: 90px; height: 110px; }
.loader-coin {
  width: 64px; height: 64px; margin: 0 auto;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffe9a3, #f5c542 55%, #b8860b);
  box-shadow: 0 0 32px rgba(245, 197, 66, .55);
  animation: coin-bounce 1.2s ease-in-out infinite;
}
.loader-shadow {
  width: 56px; height: 12px; margin: 14px auto 0;
  border-radius: 50%;
  background: rgba(0,0,0,.5);
  animation: shadow-pulse 1.2s ease-in-out infinite;
}
@keyframes coin-bounce { 0%,100% { transform: translateY(0) scaleX(1); } 50% { transform: translateY(-22px) scaleX(.92); } }
@keyframes shadow-pulse { 0%,100% { transform: scaleX(1); opacity: .5; } 50% { transform: scaleX(.6); opacity: .25; } }

.loading-label { margin-top: 26px; letter-spacing: .45em; font-weight: 700; font-size: 15px; }
.loading-tip {
  position: absolute; bottom: 42px; left: 50%; transform: translateX(-50%);
  width: min(680px, 88vw);
  font-size: 15.5px; color: #d8d2c4;
}

/* ── Başlık / yazılar ────────────────────────── */
.game-title {
  font-family: 'Playfair Display', serif;
  font-size: clamp(44px, 7vw, 82px);
  font-weight: 700;
  letter-spacing: .01em;
}
.game-title.small { font-size: clamp(30px, 5vw, 52px); }
.game-subtitle {
  margin-top: 10px;
  font-size: clamp(15px, 2vw, 18px);
  line-height: 1.5;
}

.pill-btn {
  margin-top: 32px;
  padding: 14px 34px;
  font-family: 'Nunito', sans-serif;
  font-size: 18px; font-weight: 600;
  color: #fdf6ec;
  background: rgba(255,255,255,.06);
  border: 1.5px solid rgba(253,246,236,.85);
  border-radius: 999px;
  cursor: pointer;
  transition: background .25s, transform .25s;
}
.pill-btn:hover { background: rgba(255,255,255,.18); transform: translateY(-1px); }
.key-hint {
  display: inline-block; margin-left: 10px;
  border: 1px solid rgba(253,246,236,.6);
  border-radius: 6px; padding: 1px 7px;
  font-size: 13px; opacity: .85;
}
.controls-hint { margin-top: 22px; font-size: 13.5px; font-style: italic; color: #d8d2c4; text-shadow: 0 1px 8px rgba(0,0,0,.6); }

/* ── Açılış ekranı — parşömen karşılama kartı ─── */
.title-card {
  width: min(520px, 90vw);
  padding: 46px 42px 38px;
  background: linear-gradient(165deg, #fbf3e2 0%, #f0e2c4 100%);
  border-radius: 26px;
  box-shadow: 0 30px 90px rgba(0,0,0,.55), inset 0 0 0 1px rgba(255,255,255,.4);
  color: #3a3226;
  animation: card-in .5s cubic-bezier(.2, .9, .3, 1.2);
}
.welcome-label {
  font-size: 13px; font-weight: 700; letter-spacing: .38em;
  color: #a9803f; margin-bottom: 10px;
}
.title-card .game-title {
  font-family: 'Cinzel', 'Playfair Display', serif;
  font-weight: 700;
  color: #2e2013;
  font-size: clamp(36px, 6vw, 56px);
  text-transform: uppercase;
  letter-spacing: .02em;
}
.title-card .game-subtitle { color: #5a4f3d; }
.title-card .pill-btn { color: #3a3226; border-color: #3a3226; background: rgba(58,50,38,.05); }
.title-card .pill-btn:hover { background: rgba(58,50,38,.14); }
.title-card .key-hint { border-color: rgba(58,50,38,.5); }
.title-card .controls-hint { color: #7a6f5c; text-shadow: none; }

/* ── HUD ─────────────────────────────────────── */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 5; transition: opacity .6s; }
#hud.hidden { opacity: 0; }
#coin-counter {
  position: absolute; top: 18px; right: 20px;
  display: flex; align-items: center; gap: 9px;
  padding: 9px 18px;
  background: rgba(15, 13, 26, .45);
  border: 1px solid rgba(253,246,236,.25);
  border-radius: 999px;
  font-size: 17px; font-weight: 700;
  backdrop-filter: blur(3px);
}
.coin-icon, .finish-coin {
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffe9a3, #f5c542 55%, #b8860b);
  box-shadow: 0 0 14px rgba(245, 197, 66, .65);
}
.coin-icon { width: 20px; height: 20px; }
#walk-hint {
  position: absolute; bottom: 34px; left: 50%; transform: translateX(-50%);
  font-size: 15px; color: #f3ecdf;
  text-shadow: 0 1px 10px rgba(0,0,0,.7);
  transition: opacity 1s;
}

/* ── Bilgi kartı — defter sayfası ──────────────
   Kraft kağıt + spiral cilt + el yazısı, "Travel Notes"
   referansındaki gezi defteri sayfasını taklit eder. */
.notebook-page {
  width: min(600px, 92vw);
  max-height: 88vh;
  position: relative;
  padding: 8px 8px 8px 62px;
  border-radius: 10px;
  background:
    repeating-linear-gradient(128deg, rgba(0,0,0,.05) 0px, transparent 1.5px, transparent 30px),
    repeating-linear-gradient(35deg, rgba(255,255,255,.06) 0px, transparent 1px, transparent 24px),
    linear-gradient(160deg, #cda06c 0%, #b9895a 45%, #a5764a 100%);
  box-shadow: 0 30px 90px rgba(0,0,0,.55);
  clip-path: polygon(0 0, calc(100% - 30px) 0, 100% 30px, 100% 100%, 0 100%);
  animation: card-in .45s cubic-bezier(.2, .9, .3, 1.2);
}
@keyframes card-in { from { transform: translateY(36px) scale(.94); opacity: 0; } to { transform: none; opacity: 1; } }

/* Sayfanın kıvrılan üst-sağ köşesi */
.notebook-page::after {
  content: '';
  position: absolute; top: 0; right: 0;
  width: 30px; height: 30px;
  background: linear-gradient(135deg, rgba(0,0,0,0) 45%, rgba(0,0,0,.28) 100%),
              #8f6a42;
  clip-path: polygon(100% 0, 0 0, 100% 100%);
}

/* Spiral cilt halkaları — sol kenar boyunca tekrar eden SVG */
.spiral-rings {
  position: absolute; left: 12px; top: 14px; bottom: 14px;
  width: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='56'%3E%3Cellipse cx='20' cy='28' rx='11' ry='14' fill='none' stroke='%232b2620' stroke-width='5.5'/%3E%3C/svg%3E");
  background-repeat: repeat-y;
  background-size: 40px 56px;
  opacity: .8;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,.3));
}

.page-content {
  background: linear-gradient(170deg, #fbf3e0 0%, #f2e5c9 100%);
  border-radius: 4px;
  padding: 44px 40px 34px 40px;
  min-height: 300px;
  max-height: calc(88vh - 16px);
  overflow-y: auto;
  text-align: left;
  color: #362c1c;
  position: relative;
}
.page-label {
  font-family: 'Patrick Hand', cursive;
  font-size: 15px; letter-spacing: .12em;
  color: #a9803f; margin-bottom: 6px;
  text-transform: uppercase;
}
.page-content h2 {
  font-family: 'Permanent Marker', cursive;
  font-weight: 400;
  font-size: clamp(24px, 4vw, 34px);
  color: #241c10;
  display: inline-block;
  border-bottom: 3px solid #241c10;
  padding-bottom: 6px;
  margin-bottom: 18px;
  line-height: 1.25;
}
.page-content p {
  font-family: 'Patrick Hand', cursive;
  font-size: clamp(17px, 2.4vw, 20px);
  line-height: 1.7;
  color: #4a3d27;
}

.notebook-next {
  display: flex; align-items: center; justify-content: flex-end; gap: 10px;
  margin: 26px 0 0 auto;
  background: none; border: none; cursor: pointer;
  font-family: 'Patrick Hand', cursive;
  font-size: 19px; font-weight: 400;
  color: #241c10;
  padding: 6px 2px;
  transition: transform .2s, opacity .2s;
}
.notebook-next:hover { transform: translateX(3px); opacity: .8; }
.arrow-circle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px;
  border: 2px solid #241c10;
  border-radius: 50%;
  font-size: 15px;
}

/* ── Bitiş ekranı — defter kapanış sayfası ────── */
#finish-screen .notebook-page { width: min(640px, 92vw); }
#finish-screen .page-content { text-align: center; }
#finish-screen .page-content h2,
#finish-screen .game-title.small {
  font-family: 'Cinzel', 'Playfair Display', serif;
  font-weight: 700; color: #241c10; border: none;
  display: block; text-transform: uppercase;
}
#finish-screen .game-subtitle { color: #5a4f3d; margin-top: 8px; }
.finish-coin { width: 68px; height: 68px; margin: 0 auto 18px; animation: coin-bounce 1.6s ease-in-out infinite; }
#finish-list {
  margin: 24px auto 0; text-align: left; list-style: none;
  display: grid; gap: 8px; max-width: 460px;
}
#finish-list li {
  padding: 10px 16px;
  background: rgba(58,50,38,.06);
  border: 1px solid rgba(58,50,38,.14);
  border-radius: 12px;
  font-family: 'Patrick Hand', cursive;
  font-size: 16.5px;
  color: #3a3226;
}
#finish-list li b { color: #a9803f; }
#finish-screen .pill-btn { margin-top: 28px; color: #3a3226; border-color: #3a3226; background: rgba(58,50,38,.05); }
#finish-screen .pill-btn:hover { background: rgba(58,50,38,.14); }

/* ── Joystick ────────────────────────────────── */
#joystick {
  position: fixed; bottom: 34px; left: 34px;
  width: 120px; height: 120px;
  border-radius: 50%;
  background: rgba(253,246,236,.08);
  border: 1.5px solid rgba(253,246,236,.35);
  z-index: 6; touch-action: none;
}
#joystick.hidden { display: none; }
#joystick-knob {
  position: absolute; left: 50%; top: 50%;
  width: 52px; height: 52px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: rgba(253,246,236,.55);
}

/* ── Müzik aç/kapat ─────────────────────────────── */
#music-toggle {
  position: fixed; right: 22px; bottom: 22px;
  width: 50px; height: 50px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: rgba(15, 13, 26, .45);
  border: 1.5px solid rgba(253,246,236,.35);
  color: #fdf6ec;
  cursor: pointer;
  z-index: 40;
  backdrop-filter: blur(3px);
  transition: background .25s, transform .2s;
}
#music-toggle:hover { background: rgba(255,255,255,.18); transform: translateY(-1px); }
#music-toggle svg { width: 24px; height: 24px; }
#music-toggle .hidden { display: none; }
