/* Sahne, Katmanlı Kâğıt Arka Plan, Sahnede Bilge, İnce Üst Şerit ve Tek Odaklı Yerleşim */

.app-shell {
  position: relative;
  min-height: 100dvh;
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  isolation: isolate;
}

/* --- Katmanlı Kâğıt Kesme (Paper-Cut Diorama) Arka Planı --- */
.diorama-backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  background: var(--night-950);
}

.paper-layer {
  position: absolute;
  inset: -24px;
  will-change: transform;
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}

.layer-sky {
  z-index: 1;
  transform: translate3d(calc(var(--px) * -6px), calc(var(--py) * -4px), 0);
}

.layer-hills {
  z-index: 2;
  transform: translate3d(calc(var(--px) * -14px), calc(var(--py) * -8px), 0);
}

.layer-harbour {
  z-index: 3;
  transform: translate3d(calc(var(--px) * -22px), calc(var(--py) * -11px), 0);
}

.layer-ships {
  z-index: 4;
  transform: translate3d(calc(var(--px) * -26px), calc(var(--py) * -12px), 0);
}

.layer-waves-back {
  z-index: 5;
  transform: translate3d(calc(var(--px) * -32px), calc(var(--py) * -14px), 0);
}

.layer-waves-front {
  z-index: 6;
  transform: translate3d(calc(var(--px) * -40px), calc(var(--py) * -16px), 0);
}

.paper-fallback-svg,
.paper-asset-img,
.harbour-windows-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center bottom;
}

.layer-sky .paper-asset-img {
  object-position: center top;
  filter: none;
}

.paper-asset-img {
  filter: drop-shadow(0 -6px 12px rgba(2, 7, 16, 0.58));
}

/* Fenerin yanında limanı gözleyen kâğıt kesme Bilge */
.scene-bilge {
  position: absolute;
  left: clamp(22px, 11.5vw, 178px);
  bottom: clamp(14%, 19vh, 24%);
  width: clamp(72px, 7.8vw, 110px);
  height: clamp(72px, 7.8vw, 110px);
  pointer-events: none;
  z-index: 5;
  filter: drop-shadow(0 8px 12px rgba(2, 8, 18, 0.72));
  transform-origin: center bottom;
}

.scene-bilge img,
.scene-bilge svg {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Kâğıt dokusu ve hafif kutu tiyatrosu çerçevesi */
.paper-grain-overlay {
  position: absolute;
  inset: 0;
  z-index: 7;
  pointer-events: none;
  opacity: 0.06;
  background-image: radial-gradient(rgba(255, 246, 224, 0.55) 0.65px, transparent 0.65px),
    radial-gradient(rgba(12, 26, 46, 0.45) 0.65px, transparent 0.65px);
  background-size: 16px 16px;
  background-position: 0 0, 8px 8px;
}

.theater-frame {
  position: absolute;
  inset: 0;
  z-index: 8;
  pointer-events: none;
  box-shadow: inset 0 0 65px rgba(3, 9, 19, 0.56);
}

/* Liman pencereleri (9 pencere: sönük -> sıcak sarı) */
.harbour-window {
  fill: #0b1829;
  stroke: rgba(246, 232, 204, 0.18);
  stroke-width: 1.2;
  transition: fill 0.55s ease, filter 0.55s ease;
}

.harbour-window.is-lit {
  fill: var(--lantern-400);
  filter: drop-shadow(0 0 10px rgba(255, 207, 86, 0.95));
}

.backdrop-beam {
  opacity: 0.25;
  transform-origin: 165px 420px;
  transition: opacity 0.8s ease;
}

.app-shell.is-finale .backdrop-beam {
  opacity: 0.92;
}

.app-shell.is-finale .workspace-grid {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
}

.diorama-ships {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.fx-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 15;
  pointer-events: none;
}

/* --- İnce Üst Şerit --- */
.hud-bar {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 1220px;
  margin: 0 auto;
  padding: 8px 16px 2px;
}

/* --- Ana Çalışma Alanı (geniş sahne + sade Bilge) --- */
.workspace-grid {
  position: relative;
  z-index: 10;
  flex: 1;
  width: 100%;
  max-width: 1220px;
  margin: 0 auto;
  padding: 4px 16px 12px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 268px;
  gap: 16px;
  align-items: center;
}

.stage-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.mascot-dock {
  min-width: 0;
  align-self: start;
  padding-top: 10px;
}

/* --- Tablet & Mobil Dikey (375x812 dahil) --- */
@media (max-width: 959px) {
  .hud-bar {
    padding: 6px 10px 2px;
  }

  .workspace-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 6px 10px 14px;
    align-items: stretch;
  }

  .mascot-dock {
    order: -1;
    align-self: stretch;
    padding-top: 0;
  }

  .stage-main {
    flex: 1;
    justify-content: space-evenly;
    gap: 12px;
  }

  .scene-bilge {
    left: 10px;
    bottom: 11%;
    width: 60px;
    height: 60px;
  }
}

@media (max-width: 640px) {
  .hud-bar {
    padding: 5px 6px 2px;
  }

  .workspace-grid {
    padding: 4px 4px 10px;
    gap: 6px;
  }

  .scene-bilge {
    width: 64px;
    height: 64px;
    bottom: 9%;
  }
}
