:root { --ink: #fff1c1; --red: #e4572e; --gold: #ffcf5a; --night: #1a1233; }
* { box-sizing: border-box; }

/* Tam ekran sahne: dvh destekleyen tarayıcılarda adres çubuğu açılıp kapanınca sayfa boyu oynamaz */
html, body { height: 100%; height: 100dvh; margin: 0; overflow: hidden; overscroll-behavior: none;
  -webkit-text-size-adjust: 100%; text-size-adjust: 100%;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent; -webkit-touch-callout: none;
  -webkit-user-select: none; user-select: none; background: #120c26; color: var(--ink);
  font-family: 'Pixelify Sans', 'Courier New', monospace; }
canvas { position: fixed; left: 0; top: 0; display: block; image-rendering: pixelated; cursor: none; touch-action: none; }

/* Dokunma hedefleri: her düğme en az 44x44 CSS piksel, parmakla rahat basılır */
.pxbtn { font: inherit; font-size: 18px; line-height: 1; font-weight: 600; letter-spacing: 1px; color: var(--ink); background: var(--red); border: 0;
  padding: 14px 18px; min-width: 44px; min-height: 44px; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: -4px 0 0 #000, 4px 0 0 #000, 0 -4px 0 #000, 0 4px 0 #000,
    inset -4px -4px 0 #a8321a, inset 4px 4px 0 #ff8f5e; }
/* Üzerine gelme (hover) efektleri yalnızca imleçli cihazlarda; dokunmatikte basıştan sonra takılı kalmaz */
@media (hover: hover) {
  .pxbtn:hover { background: var(--gold); color: #2a1306;
    box-shadow: -4px 0 0 #000, 4px 0 0 #000, 0 -4px 0 #000, 0 4px 0 #000,
      inset -4px -4px 0 #c9972a, inset 4px 4px 0 #fff0a0; }
  .pxbtn.small:hover { background: var(--gold); }
}
.pxbtn:active { transform: translateY(4px); }
.pxbtn:focus-visible { outline: 4px dashed var(--gold); outline-offset: 8px; }
.pxbtn.small { font-size: 14px; padding: 10px 12px; background: #3a2c60;
  box-shadow: -3px 0 0 #000, 3px 0 0 #000, 0 -3px 0 #000, 0 3px 0 #000,
    inset -3px -3px 0 #231a40, inset 3px 3px 0 #5a4a90; }

/* İkon düğme: normalde yalnız simge durur, imleç üzerine gelince adı yanına
   açılır. Genişlik steps() ile açılır; yumuşak kayma yerine piksel kademeleri. */
.pxbtn.ico { padding: 10px; }
/* Simge kutusu 9'un tam katı: 27 = 9x3, 18 = 9x2. Böylece pixel art SVG tam sayı
   ölçekle büyür, kareler yarım piksele düşüp bulanıklaşmaz. */
.pxbtn.ico .gl { display: block; width: 27px; height: 27px; }
.pxbtn.small.ico .gl { width: 18px; height: 18px; }
.pxbtn.ico .gl svg { display: block; width: 100%; height: 100%; fill: currentColor; shape-rendering: crispEdges; }
.pxbtn.ico .lb { max-width: 0; margin-left: 0; overflow: hidden; white-space: nowrap; opacity: 0;
  transition: max-width .2s steps(5), margin-left .2s steps(5), opacity .2s steps(3); }
.pxbtn.ico:hover .lb, .pxbtn.ico:focus-visible .lb, .pxbtn.ico[aria-expanded="true"] .lb {
  max-width: 12em; margin-left: 8px; opacity: 1; }
#topbar { position: fixed; top: calc(30px + env(safe-area-inset-top, 0px)); right: calc(34px + env(safe-area-inset-right, 0px)); z-index: 5; display: flex; align-items: stretch; }
#zoomBtn { position: fixed; bottom: calc(26px + env(safe-area-inset-bottom, 0px)); left: calc(30px + env(safe-area-inset-left, 0px)); z-index: 5; }
#zoomBtn[hidden] { display: none; }
/* > düğmesi iletişim kartında, "Fikriniz mi var?" satırının sağında; altın gövde ve nabız gibi atan ışık halkası */
#contact { padding-right: 96px; }
#sideBtn { position: absolute; top: 18px; right: 22px; padding: 8px; background: var(--gold); color: #2a1306; animation: nudge 1.1s steps(2) infinite;
  box-shadow: -4px 0 0 #000, 4px 0 0 #000, 0 -4px 0 #000, 0 4px 0 #000, inset -4px -4px 0 #c9972a, inset 4px 4px 0 #fff0a0, 0 0 0 8px rgba(255,207,90,.28); }
#sideBtn { display: flex; align-items: center; justify-content: center; line-height: 0; }
#sideBtn .gl { display: block; width: 27px; height: 27px; animation: nudgeG 1.1s steps(2) infinite; }
#sideBtn .gl svg { display: block; width: 100%; height: 100%; fill: currentColor; shape-rendering: crispEdges; }
@keyframes nudge { 50% { box-shadow: -4px 0 0 #000, 4px 0 0 #000, 0 -4px 0 #000, 0 4px 0 #000, inset -4px -4px 0 #c9972a, inset 4px 4px 0 #fff0a0, 0 0 0 12px rgba(255,207,90,.12); } }
@keyframes nudgeG { 50% { transform: translateX(3px); } }
#side { top: 96px; right: 34px; display: none; flex-direction: column; gap: 14px; text-align: center; }
#side.open { display: flex; }
#side h2 { margin: 0; font-size: 26px; letter-spacing: 4px; color: var(--gold); font-weight: normal; text-shadow: 3px 3px 0 #000; }
#side .sub { margin: 0; font-size: 14px; opacity: .7; }
#side .pxbtn { width: 100%; }
#walls { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
#walls .pxbtn { flex-direction: column; gap: 6px; font-size: 15px; padding: 12px 8px; }
#walls small { font-size: 11px; letter-spacing: 1px; opacity: .75; }
#side .pxbtn.gold { background: var(--gold); color: #2a1306; box-shadow: -4px 0 0 #000, 4px 0 0 #000, 0 -4px 0 #000, 0 4px 0 #000, inset -4px -4px 0 #c9972a, inset 4px 4px 0 #fff0a0; }
#aboutBox { display: none; background: #120c26; padding: 18px; font-size: 15px; line-height: 1.7; box-shadow: -4px 0 0 var(--ink), 4px 0 0 var(--ink), 0 -4px 0 var(--ink), 0 4px 0 var(--ink); }
#aboutBox.open { display: block; }
#aboutBox p { margin: 0 0 16px; }

/* Müzik düğmesi ve pan okları: taban kuralları medya sorgularından ÖNCE gelir; böylece telefon, tablet ve yatay
   kurallar bunları geçersiz kılabilir (önceden sonra geldikleri için tablet boyutu ve telefon konumu uygulanmıyordu) */
#musicBtn { position: fixed; bottom: calc(26px + env(safe-area-inset-bottom, 0px)); right: calc(30px + env(safe-area-inset-right, 0px)); z-index: 5; }
.pan { position: fixed; top: 50%; z-index: 5; min-width: 44px; min-height: 44px; font-size: 16px; opacity: .55; touch-action: none; }
@media (hover: hover) { .pan:hover { opacity: 1; } }

/* Diyaloglar: taşan içerik kaydırılır; metin seçilebilir (e-posta kopyalanabilsin) */
.dlg { position: fixed; z-index: 6; display: none; background: var(--night); padding: 22px 24px;
  width: min(440px, calc(100vw - 48px)); max-height: calc(100vh - 150px); max-height: calc(100dvh - 150px);
  overflow: auto; overscroll-behavior: contain; font-size: 16px; line-height: 2;
  -webkit-user-select: text; user-select: text;
  box-shadow: -4px 0 0 var(--ink), 4px 0 0 var(--ink), 0 -4px 0 var(--ink), 0 4px 0 var(--ink), 10px 10px 0 4px rgba(0,0,0,.45); }
.dlg.open { display: block; animation: pop .18s steps(3); }
@keyframes pop { from { opacity: 0; margin-top: 12px; } }
#contact { top: 96px; right: 34px; }
.dlg h2 { margin: 0 0 8px; font-size: 16px; color: var(--gold); font-weight: normal; }
.dlg p { margin: 0 0 18px; font-size: 15px; line-height: 1.7; }
#typed { white-space: pre-line; min-height: 4em; }
#mail { color: var(--gold); word-break: break-all; }
.blink { display: inline-block; width: 8px; height: 8px; margin-left: 8px; background: var(--gold); animation: bl 1s steps(2) infinite; }
@keyframes bl { 50% { opacity: 0; } }

/* Sol üst sayaç: normalde kısık, imleç köşeye yaklaşınca canlanır (main.js
   mesafeye göre .hot ekler; pointer-events: none kalsın ki sahneye tıklanabilsin) */
#hud { opacity: .4; transition: opacity .3s steps(4);
  position: fixed; top: calc(26px + env(safe-area-inset-top, 0px)); left: calc(28px + env(safe-area-inset-left, 0px)); z-index: 4; font-size: 15px; line-height: 1.9; pointer-events: none;
  text-shadow: 2px 2px 0 #000; white-space: pre; background: rgba(18,12,38,.72); padding: 10px 14px;
  box-shadow: -3px 0 0 #000, 3px 0 0 #000, 0 -3px 0 #000, 0 3px 0 #000, inset 0 0 0 2px #3a2c60; }
#hud.hot { opacity: 1; }
#hud b { color: var(--gold); font-weight: 600; }
#hint { position: fixed; top: calc(120px + env(safe-area-inset-top, 0px)); left: calc(28px + env(safe-area-inset-left, 0px)); z-index: 4; font-size: 13px; line-height: 2; color: #cbb8f0;
  max-width: min(300px, calc(100vw - 56px));
  text-shadow: 2px 2px 0 #000; pointer-events: none; transition: opacity 1.5s; }
#hint.off { opacity: 0; }
#toast { position: fixed; top: calc(24px + env(safe-area-inset-top, 0px)); left: 50%; transform: translateX(-50%); z-index: 7; background: var(--gold); color: #2a1306;
  font-size: 15px; padding: 12px 14px; display: none; pointer-events: none;
  width: max-content; max-width: calc(100vw - 32px); text-align: center;
  box-shadow: -3px 0 0 #000, 3px 0 0 #000, 0 -3px 0 #000, 0 3px 0 #000; }
#toast.show { display: block; }
#bubble { position: fixed; z-index: 5; display: none; background: #fff; color: #000; font-size: 13px; padding: 6px 8px;
  pointer-events: none; box-shadow: -2px 0 0 #000, 2px 0 0 #000, 0 -2px 0 #000, 0 2px 0 #000; }
#bubble.show { display: block; }

/* Telefon (640 px ve altı, dikey ağırlıklı) */
@media (max-width: 640px) {
  #topbar { top: calc(20px + env(safe-area-inset-top, 0px)); right: calc(22px + env(safe-area-inset-right, 0px)); }
  #contactBtn { font-size: 15px; padding: 12px 14px; }
  #side { right: calc(24px + env(safe-area-inset-right, 0px)); top: calc(80px + env(safe-area-inset-top, 0px)); width: min(440px, calc(100vw - 48px)); }
  #contact { right: calc(24px + env(safe-area-inset-right, 0px)); top: calc(80px + env(safe-area-inset-top, 0px)); width: min(440px, calc(100vw - 48px)); }
  #hud { top: calc(16px + env(safe-area-inset-top, 0px)); left: calc(18px + env(safe-area-inset-left, 0px)); font-size: 13px; padding: 6px 10px; }
  #hint { display: none; }
  #toast { top: calc(76px + env(safe-area-inset-top, 0px)); font-size: 14px; }
  #musicBtn { right: calc(16px + env(safe-area-inset-right, 0px)); bottom: calc(20px + env(safe-area-inset-bottom, 0px)); }
  .dlg { padding: 18px; font-size: 15px; }
}
/* Tablet (641–900 px): daha büyük yazı ve dokunma hedefleri */
@media (min-width: 641px) and (max-width: 900px) {
  .pxbtn { font-size: 19px; }
  .pxbtn.small { font-size: 15px; padding: 12px 16px; }
  .dlg { width: min(460px, calc(100vw - 64px)); font-size: 17px; }
  .dlg p { font-size: 16px; }
  #hud { font-size: 16px; }
  #hint { font-size: 14px; }
  .pan { font-size: 20px; min-width: 52px; min-height: 52px; }
}
/* Yatay telefon (kısa yükseklik): üst ve alt şeritler sıkışır, pencereler ekrana sığar */
@media (orientation: landscape) and (max-height: 500px) {
  #hud { top: calc(10px + env(safe-area-inset-top, 0px)); font-size: 12px; line-height: 1.6; padding: 4px 8px; }
  #hint { display: none; }
  #topbar { top: calc(10px + env(safe-area-inset-top, 0px)); }
  #contactBtn { font-size: 14px; padding: 9px 12px; }
  #contact, #side { top: calc(60px + env(safe-area-inset-top, 0px)); }
  #musicBtn { bottom: calc(10px + env(safe-area-inset-bottom, 0px)); }
  .dlg { max-height: calc(100vh - 120px); max-height: calc(100dvh - 120px); padding: 14px 18px; line-height: 1.7; }
  #toast { top: calc(10px + env(safe-area-inset-top, 0px)); font-size: 13px; }
}
@media (hover: none) { canvas { cursor: default; } }
#musicBtn[aria-pressed="true"] { background: #2f7a5a; box-shadow: -3px 0 0 #000, 3px 0 0 #000, 0 -3px 0 #000, 0 3px 0 #000,
  inset -3px -3px 0 #1d5a40, inset 3px 3px 0 #5ec49a; }

#vignette { position: fixed; inset: 0; z-index: 3; pointer-events: none;
  background: linear-gradient(to bottom, rgba(4,2,14,.62) 0%, rgba(6,3,18,.30) 18%, transparent 42%),
    radial-gradient(ellipse at 50% 55%, transparent 52%, rgba(8,4,20,.6) 100%); }
/* Önizleme karesi (?shot): yalnız sahne; düğme, yazı, ipucu yok */
body.shot #hud, body.shot #hint, body.shot .pan, body.shot #topbar, body.shot #zoomBtn, body.shot #musicBtn,
body.shot .dlg, body.shot #side, body.shot #toast, body.shot #bubble, body.shot #veil { display: none !important; }
#veil { position: fixed; inset: 0; z-index: 20; background: #120c26; pointer-events: none; animation: veil 1.4s steps(7) forwards; }
@keyframes veil { to { opacity: 0; visibility: hidden; } }
@media (prefers-reduced-motion: reduce) {
  .dlg.open, #veil, .blink { animation: none; } #veil { display: none; }
  #hud, .pxbtn.ico .lb { transition: none; }
  #sideBtn, #sideBtn .gl, #side.open { animation: none; }
}

#panL { left: calc(14px + env(safe-area-inset-left, 0px)); }
#panR { right: calc(14px + env(safe-area-inset-right, 0px)); }

/* Oyun sözleşmesi: body.game eklenince HUD, düğmeler, ipucu ve vinyet gizlenir; oyun ekranın tamamını kullanır */
body.game #hud, body.game #hint, body.game .pan, body.game #topbar, body.game #zoomBtn, body.game #musicBtn, body.game #vignette, body.game .dlg { display: none !important; }
