/* Genel arka plan ve tipografi */
html, body {
  height: 100%;
}
body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #222;
}

.is-hidden { display: none !important; }

/* Kapsayıcı */
.container {
  box-sizing: border-box;
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 20px;
}

.header {
  color: white;
  text-align: center;
  margin-bottom: 16px;
}
.header h1 {
  margin: 0 0 6px 0;
  font-size: 1.8rem;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}
.header p {
  margin: 0;
  opacity: 0.9;
}

/* Model alanı */
.stage {
  position: relative;
  width: 100%;
  height: calc(100vh - 160px);
  background: rgba(255,255,255,0.1);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

model-viewer#mv {
  width: 100%;
  height: 100%;
  background: transparent;
  --progress-bar-color: #667eea;
  --progress-bar-height: 4px;
}

/* Yükleme katmanı */
.loader {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 10px;
  background: rgba(0,0,0,0.35);
  color: #fff;
  z-index: 10;
}
.progress-bar {
  width: min(420px, 90%);
}
.progress-bar progress {
  width: 100%;
  height: 10px;
  border: none;
  background: transparent;
  border-radius: 8px;
  overflow: hidden;
  appearance: none;
  -webkit-appearance: none;
}
.progress-bar progress::-webkit-progress-bar {
  background: rgba(255,255,255,0.3);
  border-radius: 8px;
}
.progress-bar progress::-webkit-progress-value {
  background: #67eaca;
  border-radius: 8px;
}
.progress-bar progress::-moz-progress-bar {
  background: #67eaca;
  border-radius: 8px;
}

/* Kontrol çubuğu */
.controls {
  position: absolute;
  left: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  z-index: 5;
  max-width: calc(100% - 160px); /* AR butonu için sağda güvenli alan bırak */
}
.controls { pointer-events: none; }
.controls button, .controls a {
  background: rgba(255,255,255,0.9);
  color: #333;
  border: none;
  padding: 8px 12px;
  border-radius: 8px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.12);
  pointer-events: auto;
  touch-action: manipulation;
}
.controls button:hover, .controls a:hover {
  background: #fff;
}
.controls button[aria-pressed="true"] {
  background: #667eea;
  color: #fff;
}
.controls button[aria-pressed="true"]:hover { background: #764ba2; }
.controls button:focus-visible, .controls a:focus-visible, .ar-button:focus-visible {
  outline: 3px solid #ffd36a;
  outline-offset: 3px;
}

/* AR butonu slotu */
.ar-button {
  position: absolute;
  right: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  background: #667eea;
  color: #fff;
  border: none;
  padding: 10px 16px;
  border-radius: 10px;
  font-weight: 600;
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
  z-index: 20; /* Kontrollerin üstünde kalsın */
  touch-action: manipulation;
}
.ar-button:hover { background: #764ba2; }

.hint {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(255,255,255,0.95);
  color: #333;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12px;
  max-width: min(60ch, 90%);
  box-shadow: 0 2px 6px rgba(0,0,0,0.12);
}

.debug {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(0,0,0,0.7);
  color: #f8fafc;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 12px;
  line-height: 1.35;
  max-width: min(64ch, 92%);
  max-height: min(50vh, 520px);
  overflow: auto;
  box-shadow: 0 6px 18px rgba(0,0,0,0.25);
  white-space: pre-wrap;
}

@media (max-width: 768px) {
  .header h1 { font-size: 1.4rem; }
  .stage { height: calc(100vh - 140px); }
  .controls { max-width: calc(100% - 160px); }
}

@media (prefers-reduced-motion: reduce) {
  /* progress element animasyonu yok; mevcut davranış yeterli */
}
