:root {
  --dusk: #1A1D33;
  --dusk-2: #262a47;
  --paper: #F2E6DA;
  --paper-dim: #c9bcb1;
  --dust: #C08A6A;
  --rock: #4A2A26;
  --haze: #8DB6E6;
  --signal: #F3D34A;
  --ok: #8fd6a8;
  --err: #ff9b8a;
  --glass: rgba(26, 29, 51, .58);
  --glass-line: rgba(242, 230, 218, .14);
  --display: 'Unbounded', system-ui, sans-serif;
  --body: 'Instrument Sans', system-ui, sans-serif;
  color-scheme: dark;
}
@view-transition { navigation: auto; }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body {
  background: var(--dusk);
  color: var(--paper);
  font: 400 16px/1.55 var(--body);
  -webkit-font-smoothing: antialiased;
  touch-action: none;
  user-select: none;
}
#scene, #scene canvas { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }

a { color: var(--signal); }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--signal); outline-offset: 3px; }
kbd {
  display: inline-grid; place-items: center;
  min-width: 1.7em; height: 1.7em; padding: 0 .35em;
  border: 1px solid currentColor; border-bottom-width: 3px; border-radius: 5px;
  font: 600 .72rem/1 var(--body);
}
[hidden] { display: none !important; }

/* ---------- Açılış ---------- */
#loader {
  position: fixed; inset: 0; z-index: 30;
  display: grid; align-items: end;
  padding: clamp(20px, 5vw, 64px);
  background:
    radial-gradient(120% 70% at 78% 112%, rgba(141,182,230,.55), transparent 60%),
    linear-gradient(180deg, rgba(26,29,51,.25) 0%, rgba(26,29,51,.92) 72%);
  transition: opacity .9s ease, visibility .9s;
}
#loader.gone { opacity: 0; visibility: hidden; }
.loader-inner { max-width: 1100px; }
.loader-domain { margin: 0 0 .6rem; color: var(--haze); font-weight: 600; letter-spacing: .02em; }
.brand {
  margin: 0;
  font: 800 clamp(2.6rem, 10.4vw, 10rem)/.86 var(--display);
  letter-spacing: -.045em;
  color: var(--paper);
}
.brand span { color: var(--dust); }
.loader-tag { max-width: 34ch; margin: 1.4rem 0 2rem; font-size: clamp(1.05rem, 2vw, 1.35rem); color: var(--paper-dim); }
.loader-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 1.6rem; }
#start {
  position: relative; overflow: hidden;
  min-width: 15rem; min-height: 52px; padding: 1rem 1.6rem;
  border: 0; border-radius: 999px;
  background: var(--signal); color: var(--dusk);
  font: 700 1rem/1 var(--display); letter-spacing: -.01em;
  transition: transform .15s ease, box-shadow .2s ease;
}
#start:disabled { background: var(--dusk-2); color: var(--paper-dim); cursor: progress; }
#start:not(:disabled):hover { transform: translateY(-2px); box-shadow: 0 10px 30px rgba(243,211,74,.35); }
.start-bar { position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; }
#progress { display: block; height: 100%; width: 0; background: var(--haze); transition: width .2s; }
#start:not(:disabled) .start-bar { display: none; }
.classic-link { color: var(--paper); text-underline-offset: 4px; }
.keys { display: flex; flex-wrap: wrap; gap: .7rem 1.6rem; margin: 2.4rem 0 0; color: var(--paper-dim); font-size: .9rem; }
.keys div { display: flex; align-items: center; gap: .5rem; }
.keys dt { display: flex; gap: 3px; }
.keys dd { margin: 0; }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; z-index: 10; pointer-events: none; }
#hud > * { pointer-events: auto; }
.hud-brand {
  position: absolute; top: 18px; left: 20px;
  font: 800 1.15rem/1 var(--display); letter-spacing: -.03em;
  color: var(--paper); text-decoration: none;
  text-shadow: 0 1px 12px rgba(26,29,51,.6);
}
.hud-brand span { color: var(--dust); }

#hud > .hud-top { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); display: grid; justify-items: center; gap: 8px; pointer-events: none; }
#compass {
  position: relative; width: min(380px, 44vw); height: 40px; overflow: hidden;
  border-radius: 999px; background: var(--glass); border: 1px solid var(--glass-line);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 18%, #000 82%, transparent);
          mask-image: linear-gradient(90deg, transparent, #000 18%, #000 82%, transparent);
}
#compass-track { position: absolute; inset: 0; }
.cmark {
  position: absolute; top: 50%; left: 0;
  font: 600 .72rem/1 var(--body); white-space: nowrap; color: var(--paper-dim);
  will-change: transform;
}
.cmark.card { font-family: var(--display); font-weight: 700; color: var(--paper); }
.cmark { top: 34%; }
.cmark.st { top: 72%; color: var(--signal); font-size: .68rem; }
.cmark.st::before { content: ''; display: inline-block; width: 6px; height: 6px; margin-right: 5px; border-radius: 50%; background: currentColor; vertical-align: 1px; }
.cmark.st.seen { color: var(--haze); }
.compass-tick { position: absolute; left: 50%; top: 0; width: 2px; height: 6px; margin-left: -1px; background: var(--signal); border-radius: 2px; }
.hud-chips { display: flex; gap: 8px; }
.chip {
  display: flex; align-items: center; gap: .5rem;
  padding: .38rem .85rem; border-radius: 999px;
  background: var(--glass); border: 1px solid var(--glass-line);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  font-size: .85rem; white-space: nowrap; font-variant-numeric: tabular-nums;
}
.hud-cores svg { width: 14px; height: 14px; fill: var(--haze); }
.hud-cores b { color: var(--haze); font-family: var(--display); }
.hud-cores.bump { animation: bump .45s ease; }
#timer { font-family: var(--display); font-weight: 600; color: var(--signal); }
@keyframes bump { 40% { transform: scale(1.12); } }

.hud-tools { position: absolute; top: 12px; right: 14px; display: flex; gap: 6px; }
.ibtn {
  position: relative; display: grid; place-items: center;
  width: 44px; height: 44px; padding: 0; border-radius: 12px;
  border: 1px solid var(--glass-line); background: var(--glass);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  transition: border-color .15s, background .15s, transform .1s;
}
.ibtn:hover { border-color: rgba(242,230,218,.45); }
.ibtn:active { transform: scale(.94); }
.ibtn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
#btn-night[aria-pressed="true"] { background: rgba(141,182,230,.28); border-color: var(--haze); }
#btn-sound .snd-off { display: none; }
#btn-sound[aria-pressed="false"] .snd-on { display: none; }
#btn-sound[aria-pressed="false"] .snd-off { display: inline; }
.badge {
  position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px; background: var(--signal); color: var(--dusk);
  font: 700 .66rem/18px var(--body); text-align: center;
}

.hud-dash {
  position: absolute; left: 20px; bottom: 20px;
  display: flex; align-items: end; gap: 18px;
  padding: 12px 16px; border-radius: 16px;
  background: var(--glass); border: 1px solid var(--glass-line);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.speed { display: grid; line-height: 1; }
.speed b { font: 800 2.2rem/1 var(--display); letter-spacing: -.04em; font-variant-numeric: tabular-nums; min-width: 2.6ch; }
.speed span { margin-top: 4px; font-size: .75rem; color: var(--paper-dim); }
.energy { display: grid; gap: 6px; font-size: .75rem; color: var(--paper-dim); }
.energy .bar { width: 120px; height: 8px; border-radius: 999px; background: rgba(242,230,218,.14); overflow: hidden; }
.energy i { display: block; height: 100%; width: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--haze), var(--signal)); transform-origin: left; }
.energy.low i { background: var(--err); }

#minimap {
  position: absolute; right: 18px; bottom: 18px;
  width: 150px; height: 150px; border-radius: 50%;
  background: var(--glass); border: 1px solid var(--glass-line);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
#prompt {
  position: absolute; left: 50%; bottom: 42px; transform: translateX(-50%);
  display: flex; align-items: center; gap: .65rem; min-height: 48px;
  padding: .8rem 1.3rem .8rem .9rem; border: 0; border-radius: 999px;
  background: var(--signal); color: var(--dusk);
  font: 700 .98rem/1 var(--display); letter-spacing: -.01em;
  box-shadow: 0 8px 30px rgba(243,211,74,.3);
  animation: rise .3s ease;
}
@keyframes rise { from { opacity: 0; transform: translate(-50%, 10px); } }
#toast {
  position: absolute; left: 50%; top: 96px; transform: translateX(-50%);
  max-width: min(92vw, 30rem); text-align: center;
  padding: .55rem 1rem; border-radius: 12px;
  background: rgba(141,182,230,.94); color: var(--dusk); font-weight: 600;
  opacity: 0; transition: opacity .3s; pointer-events: none;
}
#toast.show { opacity: 1; }

#hud > #achv-stack { position: absolute; right: 14px; top: 70px; display: grid; gap: 8px; width: 280px; pointer-events: none; }
.achv-toast {
  display: grid; grid-template-columns: 40px 1fr; gap: 10px; align-items: center;
  padding: 10px 12px; border-radius: 14px;
  background: rgba(26,29,51,.86); border: 1px solid rgba(243,211,74,.5);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  animation: achvIn .45s cubic-bezier(.2,.9,.3,1.2), achvOut .4s ease 4.2s forwards;
}
.achv-toast .ic { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: var(--signal); color: var(--dusk); }
.achv-toast .ic svg, .achv-list .ic svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.achv-toast small { display: block; color: var(--signal); font-weight: 600; font-size: .72rem; }
.achv-toast b { display: block; font-family: var(--display); font-size: .92rem; letter-spacing: -.01em; }
@keyframes achvIn { from { transform: translateX(30px); opacity: 0; } }
@keyframes achvOut { to { transform: translateX(30px); opacity: 0; } }

#joystick {
  display: none;
  position: absolute; left: 22px; bottom: 26px;
  width: 132px; height: 132px; border-radius: 50%;
  border: 1px solid rgba(242,230,218,.35); background: rgba(26,29,51,.35);
  touch-action: none;
}
#stick {
  position: absolute; left: 50%; top: 50%; width: 56px; height: 56px; margin: -28px 0 0 -28px;
  border-radius: 50%; background: rgba(242,230,218,.85);
}
#btn-boost {
  display: none;
  position: absolute; right: 22px; bottom: 140px;
  width: 76px; height: 76px; border-radius: 50%;
  border: 2px solid var(--signal); background: rgba(26,29,51,.5); color: var(--signal);
  font: 700 .8rem/1 var(--display); touch-action: none;
}
#btn-boost.on { background: var(--signal); color: var(--dusk); }
.touch #joystick, .touch #btn-boost { display: block; }
.touch .hud-dash { left: 50%; transform: translateX(-50%); bottom: 18px; padding: 8px 12px; gap: 12px; }
.touch .speed b { font-size: 1.4rem; }
.touch .energy .bar { width: 64px; }
.touch #minimap { width: 104px; height: 104px; right: 14px; bottom: 26px; }
.touch #prompt { bottom: auto; top: 50%; left: auto; right: 18px; transform: none; animation: none; }
.touch #prompt kbd { display: none; }

/* ---------- Fotoğraf modu ---------- */
#photo-bar {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 15;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center;
  padding: 10px 12px 10px 18px; border-radius: 999px;
  background: var(--glass); border: 1px solid var(--glass-line);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
#photo-bar p { margin: 0 6px 0 0; font-size: .88rem; color: var(--paper-dim); }
#photo-bar button { min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--glass-line); background: transparent; display: flex; align-items: center; gap: 8px; }
#photo-bar #photo-shot { background: var(--signal); color: var(--dusk); border: 0; font-weight: 700; }
#fade { position: fixed; inset: 0; z-index: 25; background: var(--dusk); opacity: 0; pointer-events: none; transition: opacity .35s ease; }
#fade.on { opacity: 1; }
#fade.flash { background: #fff; }

/* ---------- Panel ---------- */
#panel {
  position: fixed; inset: 0; z-index: 20;
  display: flex; justify-content: flex-end;
  background: linear-gradient(90deg, transparent 30%, rgba(26,29,51,.55));
}
.panel-sheet {
  position: relative;
  width: min(100%, 620px); height: 100%; overflow-y: auto;
  padding: clamp(28px, 5vw, 56px) clamp(22px, 4vw, 48px) 48px;
  background: rgba(26,29,51,.93); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  border-left: 1px solid var(--glass-line);
  animation: slide .38s cubic-bezier(.2,.8,.2,1);
  user-select: text; overscroll-behavior: contain; touch-action: pan-y;
}
@keyframes slide { from { transform: translateX(40px); opacity: 0; } }
#panel-close {
  position: absolute; top: 18px; right: 18px;
  display: flex; align-items: center; gap: .5rem; min-height: 40px;
  padding: .4rem .5rem .4rem .8rem; border-radius: 999px;
  border: 1px solid rgba(242,230,218,.28); background: transparent; font-size: .85rem;
}
.panel-kicker { margin: 0 0 .4rem; color: var(--haze); font-weight: 600; }
#panel-title { margin: 0 0 1.4rem; font: 700 clamp(2rem, 5vw, 3rem)/1 var(--display); letter-spacing: -.04em; }
#panel-body p { max-width: 62ch; color: var(--paper-dim); }
#panel-body h3 { margin: 0; font: 600 1.15rem/1.2 var(--display); letter-spacing: -.02em; color: var(--paper); }

.facts { margin: 1.8rem 0 0; display: grid; gap: .9rem; }
.facts div { display: grid; grid-template-columns: 8.5rem 1fr; gap: 1rem; padding-top: .9rem; border-top: 1px solid var(--glass-line); }
.facts dt { color: var(--dust); font-weight: 600; }
.facts dd { margin: 0; }
.stats { display: flex; flex-wrap: wrap; gap: 1.6rem; margin: 1.6rem 0 0; }
.stats div { display: grid; }
.stats b { font: 700 1.5rem/1.1 var(--display); letter-spacing: -.03em; color: var(--signal); }
.stats span { font-size: .82rem; color: var(--paper-dim); }

.projects { list-style: none; margin: 1.6rem 0 0; padding: 0; display: grid; gap: 1.4rem; }
.proj { border-top: 1px solid var(--glass-line); padding-top: 1.2rem; }
.proj figure { margin: 0 0 .9rem; border-radius: 12px; overflow: hidden; aspect-ratio: 16 / 10; background: var(--dusk-2); border: 1px solid var(--glass-line); }
.proj img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: top; transition: transform .5s ease; }
.proj:hover img { transform: scale(1.03); }
.proj .head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.proj .status { flex: none; padding: .15rem .6rem; border-radius: 999px; font-size: .78rem; font-weight: 600; color: var(--dusk); background: var(--dust); }
.proj .status.live { background: var(--ok); }
.proj p { margin: .5rem 0 .7rem; }
#panel-body .proj .note { font-size: .85rem; color: var(--haze); }
.tags { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0; padding: 0; list-style: none; }
.tags li { padding: .18rem .6rem; border-radius: 999px; background: rgba(141,182,230,.14); color: var(--haze); font-size: .8rem; }
.project-link {
  display: inline-flex; align-items: center; min-height: 44px; margin-top: .8rem; padding: 0 1.1rem;
  border-radius: 999px; background: var(--signal); color: var(--dusk); text-decoration: none;
  font: 700 .9rem/1 var(--display); letter-spacing: -.01em;
}
.project-link:hover { filter: brightness(1.08); }

.services { margin: 1.4rem 0 0; }
.services div { padding: 1.1rem 0; border-top: 1px solid var(--glass-line); }
.services dt { font: 600 1.1rem/1.2 var(--display); letter-spacing: -.02em; }
.services dd { margin: .45rem 0 0; color: var(--paper-dim); max-width: 60ch; }

.contact-mail {
  display: inline-block; margin: 1rem 0;
  font: 700 clamp(1.25rem, 3.4vw, 1.8rem)/1.1 var(--display); letter-spacing: -.03em;
  color: var(--signal); text-underline-offset: 6px; word-break: break-all;
}
.contact-links { display: flex; gap: 1.2rem; flex-wrap: wrap; margin-bottom: 1.6rem; }
.contact-links a { color: var(--paper); }

/* iletişim formu (js/contact.js) */
.contact-form { position: relative; display: grid; gap: 1rem; padding-top: 1.4rem; border-top: 1px solid var(--glass-line); }
.cf-row { display: grid; gap: .35rem; }
.cf-row label { font-weight: 600; font-size: .9rem; }
.cf-opt { font-weight: 400; color: var(--paper-dim); }
.contact-form input, .contact-form select, .contact-form textarea {
  width: 100%; min-height: 46px; padding: .7rem .85rem; border-radius: 10px;
  border: 1px solid rgba(242,230,218,.22); background: rgba(242,230,218,.06); color: var(--paper);
  font: inherit; user-select: text;
}
.contact-form textarea { resize: vertical; min-height: 120px; }
.contact-form select { color-scheme: dark; }
.contact-form select option { background: var(--dusk); color: var(--paper); }
.contact-form [aria-invalid="true"] { border-color: var(--err); }
.cf-trap { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.cf-send {
  justify-self: start; min-height: 48px; padding: 0 1.4rem; border: 0; border-radius: 999px;
  background: var(--signal); color: var(--dusk); font: 700 .95rem/1 var(--display);
}
.cf-send:disabled { opacity: .6; cursor: progress; }
.cf-status { margin: 0; min-height: 1.4em; font-weight: 600; }
#panel-body .cf-status.is-ok { color: var(--ok); }
#panel-body .cf-status.is-error { color: var(--err); }
#panel-body .cf-alt { margin: 0; font-size: .85rem; }
.cf-alt a { color: var(--paper); }

/* harita / başarımlar / yardım */
.travel { list-style: none; margin: 1rem 0 0; padding: 0; display: grid; gap: .6rem; }
.travel button {
  width: 100%; display: grid; grid-template-columns: 1fr auto; gap: .2rem 1rem; align-items: center; text-align: left;
  min-height: 60px; padding: .8rem 1rem; border-radius: 14px;
  border: 1px solid var(--glass-line); background: rgba(242,230,218,.04);
}
.travel button:hover { border-color: var(--signal); background: rgba(243,211,74,.08); }
.travel b { font: 600 1.05rem/1.2 var(--display); }
.travel small { grid-column: 1; color: var(--paper-dim); }
.travel em { grid-row: 1 / span 2; grid-column: 2; font-style: normal; color: var(--haze); font-size: .85rem; }
.achv-list { list-style: none; margin: 1.2rem 0 0; padding: 0; display: grid; gap: .6rem; }
.achv-list li { display: grid; grid-template-columns: 44px 1fr; gap: 12px; align-items: center; padding: .7rem; border-radius: 14px; border: 1px solid var(--glass-line); }
.achv-list .ic { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: rgba(242,230,218,.08); color: var(--paper-dim); }
.achv-list li.on .ic { background: var(--signal); color: var(--dusk); }
.achv-list li:not(.on) { opacity: .62; }
.achv-list b { display: block; font-family: var(--display); font-size: .95rem; }
.achv-list span { font-size: .85rem; color: var(--paper-dim); }
.best { margin-top: 1.4rem; padding: 1rem; border-radius: 14px; background: rgba(141,182,230,.1); }
.keys-table { width: 100%; border-collapse: collapse; margin-top: 1rem; }
.keys-table td { padding: .55rem 0; border-top: 1px solid var(--glass-line); }
.keys-table td:first-child { width: 9rem; }
.keys-table kbd { margin-right: 3px; }
.panel-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.6rem; }
.panel-actions button, .panel-actions a {
  min-height: 44px; padding: 0 1rem; border-radius: 999px; border: 1px solid var(--glass-line);
  background: transparent; color: var(--paper); text-decoration: none; display: inline-flex; align-items: center;
}

.noscript { position: fixed; inset: auto 0 0 0; padding: 1rem; background: var(--dusk); text-align: center; }

@media (max-width: 760px) {
  .hud-brand { font-size: .95rem; top: 16px; left: 14px; }
  #hud > .hud-top { top: 62px; }
  #compass { width: 72vw; }
  #toast { top: 150px; width: calc(100vw - 28px); font-size: .9rem; }
  .hud-tools { top: 8px; right: 8px; gap: 4px; }
  .ibtn { width: 40px; height: 40px; border-radius: 10px; }
  #btn-paint, #btn-help { display: none; }
  #hud > #achv-stack { top: 196px; right: 50%; transform: translateX(50%); width: min(300px, 92vw); }
  .facts div { grid-template-columns: 1fr; gap: .2rem; }
  .keys { display: none; }
  #panel { background: none; }
  #photo-bar p { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
