:root {
  --ink: #181726;
  --paper: #f4e6c5;
  --sun: #ffcf72;
  --sans: "DM Mono", monospace;
  --read: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --pixel: "Pixelify Sans", sans-serif;
  --p: 0;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  background: var(--ink);
  color: var(--paper);
  font: 400 13px/1.45 var(--sans);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Top navigation bar */
.topbar {
  height: 54px;
  position: fixed;
  z-index: 20;
  inset: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  color: #fff3d8;
  background: linear-gradient(180deg, rgba(20, 18, 34, 0.78) 0%, rgba(20, 18, 34, 0) 100%);
  pointer-events: none;
}

.topbar > * {
  pointer-events: auto;
}

.chapters {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  letter-spacing: 0.1em;
  flex-wrap: nowrap;
}

.chapters .brand {
  font-family: var(--pixel);
  font-size: 19px;
  letter-spacing: 0.03em;
  color: #fff5dc;
}

.chapters .dot {
  display: inline-block;
  width: 4px;
  height: 4px;
  background: #ffc96b;
  margin: 0 4px 1px;
}

.chap-btn {
  position: relative;
  overflow: hidden;
  border: 1px solid transparent;
  background: rgba(24, 23, 38, 0.5);
  color: rgba(244, 230, 197, 0.62);
  font: 500 10px/1 var(--sans);
  letter-spacing: 0.1em;
  padding: 6px 9px 8px;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
  white-space: nowrap;
}

.chap-btn::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: linear-gradient(90deg, #e8b354, #ffcf72, #fff2be);
  transform-origin: left center;
  transform: scaleX(var(--chap-p, 0));
  will-change: transform;
}

.chap-btn:hover {
  color: #fff3d8;
  border-color: rgba(255, 230, 173, 0.35);
}

.chap-btn.is-active {
  color: #ffdb8d;
  border-color: rgba(255, 219, 141, 0.6);
  background: rgba(32, 29, 53, 0.88);
}

.back {
  border: 0;
  background: rgba(24, 23, 38, 0.48);
  border: 1px solid rgba(255, 230, 173, 0.22);
  color: inherit;
  font: 18px/1 var(--pixel);
  text-decoration: none;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  transition: border-color 0.2s, background 0.2s;
}

.sound-ctrl-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  position: relative;
}

#sound {
  border: 1px solid rgba(255, 230, 173, 0.34);
  background: rgba(24, 23, 38, 0.72);
  color: #f4e6c5;
  font: 500 10px/1 var(--sans);
  letter-spacing: 0.08em;
  height: 30px;
  padding: 0 11px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  transition: border-color 0.2s, background 0.2s, color 0.2s, box-shadow 0.2s;
}

#sound[aria-pressed="true"] {
  color: #ffdb8d;
  border-color: rgba(255, 207, 114, 0.75);
  background: rgba(36, 31, 58, 0.92);
  box-shadow: 0 0 10px rgba(255, 207, 114, 0.22);
}

.sound-cue {
  position: absolute;
  z-index: 25;
  left: 50%;
  top: calc(62px + env(safe-area-inset-top));
  transform: translateX(-50%);
  padding: 8px 14px 7px;
  border: 1px solid rgba(255, 207, 114, 0.7);
  background: rgba(18, 16, 28, 0.94);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5), 0 0 12px rgba(255, 207, 114, 0.25);
  color: #ffdb8d;
  font: 600 11px/1 var(--sans);
  letter-spacing: 0.08em;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: opacity 0.35s ease, transform 0.35s ease, background 0.2s;
  pointer-events: auto;
}

.sound-cue:hover,
.sound-cue:focus-visible {
  background: rgba(36, 31, 58, 0.96);
  border-color: #fff3d8;
  color: #fff3d8;
}

.sound-cue.is-hidden {
  opacity: 0;
  transform: translate(-50%, -10px);
  pointer-events: none;
}

.sound-sub-ctrls {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.sound-sub-ctrls[hidden] {
  display: none !important;
}

.sub-ctrl-btn {
  border: 1px solid rgba(255, 230, 173, 0.24);
  background: rgba(24, 23, 38, 0.65);
  color: rgba(244, 230, 197, 0.72);
  font: 500 9px/1 var(--sans);
  letter-spacing: 0.06em;
  height: 28px;
  padding: 0 7px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  transition: border-color 0.2s, background 0.2s, color 0.2s;
}

.sub-ctrl-btn:hover {
  color: #fff3d8;
  border-color: rgba(255, 230, 173, 0.55);
}

.sub-ctrl-btn.is-active {
  color: #ffdb8d;
  border-color: rgba(255, 207, 114, 0.7);
  background: rgba(36, 31, 58, 0.88);
}

.sub-ctrl-btn:not(.is-active) {
  opacity: 0.5;
  text-decoration: line-through;
}

@media (max-width: 640px) {
  .sound-sub-ctrls {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    background: rgba(18, 16, 28, 0.95);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 230, 173, 0.24);
    padding: 4px 6px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.65);
  }
}

.back:hover,
#sound:hover {
  border-color: rgba(255, 230, 173, 0.65);
  background: rgba(36, 31, 58, 0.88);
}

.back:focus-visible,
#sound:focus-visible,
.chap-btn:focus-visible,
.trace-btn:focus-visible,
.scene-dot:focus-visible,
.more-btn:focus-visible,
.restart-btn:focus-visible,
.trace-step:focus-visible,
.more-close:focus-visible {
  outline: 2px solid #fff3d8;
  outline-offset: 3px;
}

/* Scroll track & pinned viewport (weighted 18 scenes = 4900vh, slower finale) */
.journey {
  height: 4900vh;
  position: relative;
}

.pin {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: #181726;
  user-select: none;
  transform: translateZ(0);
  backface-visibility: hidden;
  contain: layout paint style;
}

#world {
  position: absolute;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  display: block;
  transform: translateZ(0);
  backface-visibility: hidden;
}

/* Bottom-left optional Historical Trace ("İz") pill button */
.trace-btn {
  position: absolute;
  z-index: 11;
  left: 14px;
  bottom: 48px;
  font: 500 10px/1.2 var(--sans);
  letter-spacing: 0.08em;
  color: #ffdf96;
  background: rgba(18, 16, 30, 0.92);
  border: 1px solid rgba(255, 222, 148, 0.45);
  padding: 6px 11px;
  cursor: pointer;
  box-shadow: 3px 3px 0 rgba(10, 9, 18, 0.55);
  transition: transform 0.15s, border-color 0.2s, background 0.2s, color 0.2s;
}

.trace-btn:hover {
  color: #fff6dc;
  border-color: #ffdb8d;
  background: rgba(38, 34, 62, 0.96);
  transform: translateY(-1px);
}

/* Subtle bottom-right scene interaction status */
.scene-hint {
  position: absolute;
  z-index: 9;
  right: 14px;
  bottom: 48px;
  font-size: 10px;
  letter-spacing: 0.1em;
  color: rgba(255, 242, 214, 0.88);
  background: rgba(18, 16, 30, 0.92);
  border: 1px solid rgba(255, 230, 173, 0.34);
  padding: 6px 11px;
  pointer-events: none;
  transition: opacity 0.25s;
}

/* 18-stop Chronological Timeline Rail along bottom */
.scene-dots {
  position: absolute;
  z-index: 10;
  left: 12px;
  right: 12px;
  bottom: 6px;
  display: grid;
  grid-template-columns: repeat(18, minmax(0, 1fr));
  gap: 3px;
  padding: 4px 5px;
  background: rgba(14, 13, 24, 0.92);
  border: 1px solid rgba(255, 230, 173, 0.28);
}

.scene-dot {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  padding: 3px 2px 6px;
  border: 1px solid rgba(255, 230, 173, 0.18);
  background: rgba(30, 27, 46, 0.55);
  color: rgba(244, 230, 197, 0.58);
  cursor: pointer;
  overflow: hidden;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.scene-dot .tl-fill {
  position: absolute;
  inset: 0;
  background: rgba(255, 207, 114, 0.22);
  transform-origin: left center;
  transform: scaleX(0);
  pointer-events: none;
  will-change: transform;
}

.scene-dot .tl-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: linear-gradient(90deg, #e8b354, #ffcf72, #fff4c4);
  transform-origin: left center;
  transform: scaleX(0);
  pointer-events: none;
  will-change: transform;
}

.scene-dot .tl-year {
  position: relative;
  z-index: 1;
  font: 600 9px/1 var(--sans);
  letter-spacing: 0.02em;
  color: inherit;
  white-space: nowrap;
}

.scene-dot .tl-place {
  position: relative;
  z-index: 1;
  font: 600 8.5px/1.1 var(--read);
  color: inherit;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.scene-dot:hover {
  background: rgba(54, 48, 82, 0.88);
  border-color: rgba(255, 220, 140, 0.65);
  color: #fff6dc;
}

.scene-dot.is-visited {
  background: rgba(44, 39, 66, 0.72);
  border-color: rgba(255, 219, 141, 0.36);
  color: rgba(255, 236, 194, 0.85);
}

.scene-dot.is-active {
  background: rgba(42, 36, 62, 0.95);
  border-color: #ffcf72;
  color: #fff8e6;
  box-shadow: 0 0 10px rgba(255, 207, 114, 0.35);
}

.scene-dot.is-active .tl-year {
  color: #ffcf72;
  font-weight: 700;
}

.scene-dot.is-active .tl-place {
  color: #fffaf0;
  font-weight: 700;
}

/* Scroll cue at start */
.scroll-cue {
  position: absolute;
  z-index: 9;
  left: 50%;
  bottom: 50px;
  transform: translateX(-50%);
  display: grid;
  justify-items: center;
  gap: 5px;
  font-size: 10px;
  letter-spacing: 0.18em;
  color: #fff2c3;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
  transition: opacity 0.25s;
  pointer-events: none;
}

.scroll-cue i {
  height: 18px;
  width: 2px;
  background: #fff2c3;
  animation: pulse 1.4s ease-in-out infinite;
}

/* End of journey optional actions */
.end-bar {
  position: absolute;
  z-index: 12;
  left: 50%;
  bottom: 50px;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  align-items: center;
}

.end-bar[hidden] {
  display: none;
}

.more-btn,
.restart-btn {
  border: 1px solid rgba(255, 230, 173, 0.58);
  background: rgba(26, 24, 42, 0.88);
  color: #fff2d6;
  font: 500 11px/1 var(--sans);
  letter-spacing: 0.1em;
  padding: 10px 14px;
  cursor: pointer;
  box-shadow: 4px 4px 0 rgba(16, 14, 28, 0.55);
  backdrop-filter: blur(4px);
  transition: transform 0.15s, border-color 0.2s, background 0.2s;
}

.more-btn {
  text-decoration: none;
}

.more-btn:hover,
.restart-btn:hover {
  border-color: #ffdb8d;
  background: rgba(38, 34, 60, 0.94);
  transform: translateY(-1px);
}

.journey-about {
  position: relative;
  z-index: 30;
  width: min(760px, calc(100% - 40px));
  margin: 0 auto;
  padding: clamp(42px, 8vw, 82px) 0;
  color: #241b30;
  font-family: var(--read);
}

.journey-about::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0 calc((100vw - 100%) / -2);
  background: #f4e6c5;
}

.journey-about-kicker {
  margin: 0 0 12px;
  color: #765029;
  font: 500 11px/1.2 var(--sans);
  letter-spacing: 0.12em;
}

.journey-about h1 {
  max-width: 24ch;
  margin: 0 0 18px;
  font: 600 clamp(28px, 5vw, 46px)/1.05 var(--pixel);
}

.journey-about p {
  max-width: 68ch;
  margin: 0 0 14px;
  font-size: clamp(15px, 1.8vw, 17px);
  line-height: 1.65;
}

.journey-about-link {
  display: inline-block;
  margin-top: 8px;
  color: #3d274d;
  font: 700 14px/1.3 var(--read);
  text-underline-offset: 4px;
}

/* Optional "İz" & "Daha fazlası ve kaynaklar" drawers */
.more-sheet {
  position: fixed;
  z-index: 40;
  inset: 0;
  background: rgba(14, 13, 24, 0.78);
  backdrop-filter: blur(6px);
  display: grid;
  place-items: center;
  padding: 20px;
}

.more-sheet[hidden] {
  display: none;
}

.more-card {
  width: min(760px, 94vw);
  max-height: 86vh;
  overflow-y: auto;
  background: #1e1c30;
  border: 1px solid rgba(255, 230, 173, 0.48);
  box-shadow: 10px 10px 0 rgba(10, 9, 18, 0.65);
  padding: clamp(20px, 4vw, 34px);
  color: #f4e6c5;
}

.trace-card {
  width: min(580px, 94vw);
}

.more-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.more-eyebrow {
  margin: 0;
  font-size: 10px;
  letter-spacing: 0.18em;
  color: #ffdb8d;
}

.more-close {
  border: 1px solid rgba(255, 230, 173, 0.35);
  background: none;
  color: #fff3d8;
  font: 18px/1 var(--sans);
  width: 28px;
  height: 28px;
  cursor: pointer;
}

.more-card h2 {
  font: 600 clamp(22px, 3.4vw, 30px)/1.15 var(--pixel);
  margin: 6px 0 12px;
  color: #fff5dc;
}

.more-lead {
  margin: 0 0 16px;
  color: #e6d7b8;
  font-size: 13px;
  line-height: 1.58;
}

.trace-quote {
  margin: 0 0 14px;
  padding: 12px 16px;
  background: rgba(14, 13, 24, 0.58);
  border-left: 3px solid #ffcf72;
  color: #fff4d4;
  font-size: 12.5px;
  line-height: 1.55;
}

.trace-source {
  margin: 0 0 18px;
  font-size: 11px;
  color: rgba(244, 230, 197, 0.72);
}

.trace-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: space-between;
  border-top: 1px solid rgba(255, 230, 173, 0.2);
  padding-top: 14px;
}

.trace-step {
  border: 1px solid rgba(255, 230, 173, 0.35);
  background: rgba(16, 15, 28, 0.65);
  color: #f4e6c5;
  font: 500 10px/1 var(--sans);
  letter-spacing: 0.08em;
  padding: 8px 11px;
  cursor: pointer;
}

.trace-step:hover {
  border-color: #ffdb8d;
  color: #fff6dc;
}

.more-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.more-grid > div {
  background: rgba(16, 15, 28, 0.55);
  border: 1px solid rgba(255, 230, 173, 0.2);
  padding: 12px 14px;
}

.more-card h3 {
  font: 600 15px/1.2 var(--pixel);
  color: #ffdb8d;
  margin: 0 0 6px;
}

.more-grid p,
.more-guide {
  margin: 0;
  font-size: 12px;
  color: #dfd0b2;
  line-height: 1.5;
}

.more-sources {
  border-top: 1px solid rgba(255, 230, 173, 0.2);
  padding-top: 14px;
  margin-top: 14px;
}

.more-sources ul {
  margin: 6px 0 0;
  padding-left: 18px;
  font-size: 12px;
  color: #dfd0b2;
}

.more-sources li + li {
  margin-top: 4px;
}

.grain {
  display: none;
}

@keyframes pulse {
  50% {
    transform: translateY(7px);
    opacity: 0.35;
  }
}

@media (max-width: 780px) {
  .topbar {
    height: 48px;
    padding-inline: 10px;
    align-items: center;
    background: rgba(20, 18, 34, 0.94);
  }
  .chapters {
    min-width: 0;
    max-width: calc(100vw - 112px);
    overflow: hidden;
  }
  .chapters .brand {
    display: inline-block;
    font-size: 14px;
    flex: 0 0 auto;
  }
  .chapters .dot,
  .chap-btn:not(.is-active) {
    display: none;
  }
  .chap-btn {
    min-width: 0;
    white-space: normal;
    line-height: 1.25;
    text-align: left;
    font-size: 8px;
    padding: 6px 7px;
    letter-spacing: 0.05em;
  }
  .back { width: 28px; height: 28px; font-size: 16px; }
  #sound {
    width: auto;
    min-width: 52px;
    overflow: visible;
    font-size: 8.5px;
    padding: 0 7px;
    height: 28px;
    letter-spacing: 0.04em;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    white-space: nowrap;
  }
  .trace-btn {
    left: 8px;
    bottom: 42px;
    font-size: 8.5px;
    padding: 5px 7px;
  }
  .scene-hint {
    display: none;
    bottom: 42px;
    font-size: 8px;
    padding: 5px 7px;
  }
  .scene-dots {
    left: 6px;
    right: 6px;
    display: flex;
    overflow-x: auto;
    scrollbar-width: none;
    gap: 2px;
    padding: 3px;
  }
  .scene-dots::-webkit-scrollbar { display: none; }
  .scene-dot {
    flex: 0 0 auto;
    padding-inline: 5px;
  }
  .scene-dot .tl-year {
    font-size: 7.5px;
  }
  .scene-dot .tl-place {
    display: none;
  }
  .end-bar {
    bottom: 72px;
    width: max-content;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
}
