:root {
  color-scheme: dark;
  --bg-gradient: linear-gradient(180deg, #07080d 0%, #0e1018 45%, #111321 100%);
  --panel-bg: linear-gradient(160deg, rgba(20, 24, 36, 0.96) 0%, rgba(14, 17, 28, 0.92) 100%);
  --glass-bg: rgba(18, 22, 33, 0.65);
  --card-bg: linear-gradient(165deg, rgba(17, 21, 32, 0.94) 0%, rgba(12, 14, 22, 0.92) 100%);
  --glass-border: rgba(255, 255, 255, 0.09);
  --inner-border: rgba(255, 255, 255, 0.04);
  --text-primary: #f5f6fb;
  --text-secondary: rgba(230, 233, 247, 0.6);
  --muted: rgba(196, 203, 224, 0.45);
  --accent: #ff4b4b;
  --accent-strong: #ff5757;
  --accent-soft: rgba(255, 75, 75, 0.2);
  --shadow-strong: rgba(0, 0, 0, 0.55);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
}

body {
  font-family: "Josefin Sans", "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  margin: 0;
  padding: 20px;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: #17161a;
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
}

#viewer {
  position: relative;
  width: 100%;
  height: 100%;
  margin: 0 auto;
  overflow: hidden;
  background: transparent;
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
}

.viewer-container {
  position: absolute;
  top: 20%;
  left: 20%;
  transform: translate(-50%, -50%);
  width: 80%;
  height: 80%;
  max-width: 1200px;
  max-height: 800px;
}

#viewer canvas {
  position: absolute;
  inset: 0;
  outline: none;
  border: none;
}

#loading-indicator {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1.15rem;
  color: var(--text-primary);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: linear-gradient(135deg, rgba(255, 75, 75, 0.28), rgba(42, 50, 72, 0.45));
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 24px;
  /* Performans optimizasyonu: Blur'u 18px'den 8px'e düşür */
  backdrop-filter: blur(8px);
  /* Performans optimizasyonu: Box-shadow'u hafiflet */
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.45);
  z-index: 1;
}

.loading-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.2rem;
  width: 100%;
  max-width: 400px;
  padding: 0 2rem;
}

.loading-text {
  font-size: 1.15rem;
  color: var(--text-primary);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: center;
}

.loading-hint {
  margin: -0.4rem 0 0;
  text-transform: none;
  letter-spacing: normal;
  font-size: 0.9rem;
  color: var(--text-secondary);
  text-align: center;
}

.loading-hint small {
  color: inherit;
}

.loading-bar-container {
  width: 100%;
  height: 6px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.loading-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent-strong) 0%, var(--accent) 50%, rgba(255, 140, 140, 0.9) 100%);
  border-radius: 999px;
  transition: width 0.3s ease;
  box-shadow: 0 0 12px rgba(255, 75, 75, 0.6);
  /* Performans optimizasyonu: Animasyonu kapat (düşük donanımlı makinelerde frame drop'ları azaltır) */
  /* animation: loading-pulse 2s ease-in-out infinite; */
}

@keyframes loading-pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.8;
  }
}

#hover-tooltip {
  position: fixed;
  pointer-events: none;
  display: none;
  top: 20px;
  right: 20px;
  padding: 0.45rem 0.7rem;
  border-radius: 10px;
  background: rgba(255, 55, 55, 0.85);
  color: #f8fafc;
  font-size: 0.9rem;
  box-shadow: 0 20px 32px rgba(15, 23, 42, 0.35);
  white-space: normal;
  z-index: 1000;
  max-width: 350px;
  word-wrap: break-word;
  overflow-wrap: break-word;
  line-height: 1.4;
}

#ui-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: flex-start;
  align-items: flex-start;
  padding: clamp(0.65rem, 1.5vw, 1.25rem);
  pointer-events: none;
  z-index: 2;
}

#panel-toggle {
  position: absolute;
  left: calc(clamp(280px, 24vw, 380px) + clamp(0.65rem, 1.5vw, 1.25rem) + 8px);
  top: clamp(0.65rem, 1.5vw, 1.25rem);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(15, 17, 24, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  pointer-events: auto;
  transition: all 300ms ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

#ui-overlay.collapsed #panel-toggle {
  left: clamp(0.65rem, 1.5vw, 1.25rem);
}

#panel-toggle:hover {
  background: var(--accent);
  border-color: rgba(255, 132, 132, 0.8);
  transform: scale(1.05);
}

#panel-toggle:focus-visible {
  outline: 2px solid rgba(255, 140, 140, 0.85);
  outline-offset: 2px;
}

.toggle-icon {
  width: 20px;
  height: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 200ms ease;
}

.hamburger-line {
  width: 100%;
  height: 2px;
  background-color: var(--text-primary);
  border-radius: 2px;
  transition: all 200ms ease;
}

/* Panel açıkken: X (çarpı) ikonu */
#ui-overlay:not(.collapsed) .hamburger-line:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

#ui-overlay:not(.collapsed) .hamburger-line:nth-child(2) {
  opacity: 0;
}

#ui-overlay:not(.collapsed) .hamburger-line:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* Panel kapalıyken: Hamburger (3 çizgi) ikonu */
#ui-overlay.collapsed .hamburger-line:nth-child(1) {
  transform: translateY(0) rotate(0deg);
}

#ui-overlay.collapsed .hamburger-line:nth-child(2) {
  opacity: 1;
}

#ui-overlay.collapsed .hamburger-line:nth-child(3) {
  transform: translateY(0) rotate(0deg);
}

#ui-overlay.collapsed #menu-bar {
  transform: translateX(-100%);
  opacity: 0;
  pointer-events: none;
}

#menu-bar {
  width: clamp(280px, 24vw, 380px);
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: clamp(0.85rem, 1.6vw, 1.2rem);
  padding-bottom: clamp(0.85rem, 1.6vw, 1.2rem);
  background: rgba(15, 17, 24, 0.94);
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow:
    0 26px 48px rgba(6, 8, 14, 0.55),
    inset 0 0 0 1px rgba(255, 255, 255, 0.03);
  pointer-events: auto;
  position: relative;
  max-height: calc(100vh - clamp(1.5rem, 3vw, 2.5rem));
  overflow: hidden;
  transition: transform 300ms ease, opacity 300ms ease;
  transform: translateX(0);
  opacity: 1;
  box-sizing: border-box;
}

/* Scroll edilebilir içerik wrapper'ı */
.menu-scrollable-content {
  flex: 1 1 auto;
  min-height: 0;
  max-height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: clamp(0.75rem, 1.6vw, 1.1rem);
  padding-right: 0.15rem;
  margin-bottom: 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.35) transparent;
}

.menu-scrollable-content::-webkit-scrollbar {
  width: 6px;
}

.menu-scrollable-content::-webkit-scrollbar-track {
  background: transparent;
}

.menu-scrollable-content::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.35);
  border-radius: 999px;
}

.menu-scrollable-content::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.5);
}


#menu-bar::before {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.02);
  pointer-events: none;
}

#menu-top {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

#overlay-header {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  backdrop-filter: none;
  box-shadow: none;
}

#overlay-header h3 {
  margin: 0;
  font-size: clamp(1.45rem, 2.2vw, 2rem);
  font-weight: 600;
  letter-spacing: 0.035em;
}

#overlay-header p {
  margin: 0;
  font-size: 0.88rem;
  color: var(--text-secondary);
  letter-spacing: 0.06em;
}

.menu-subtitle {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: rgba(255, 255, 255, 0.52);
}

#model-switcher {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 0.75rem;
  pointer-events: auto;
  max-height: 34vh;
  padding-right: 0.15rem;
  overflow-y: auto;
  scrollbar-width: thin;
}

.model-category {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.category-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0.3rem 0.5rem;
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(255, 75, 75, 0.2);
  cursor: pointer;
  transition: background 200ms ease, border-color 200ms ease;
}

.category-toggle:hover {
  background: rgba(255, 75, 75, 0.08);
  border-bottom-color: rgba(255, 75, 75, 0.3);
}

.category-title {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  pointer-events: none;
}

.category-arrow {
  font-size: 0.7rem;
  color: var(--accent);
  transition: transform 250ms ease;
  pointer-events: none;
}

.category-toggle[aria-expanded="true"] .category-arrow {
  transform: rotate(180deg);
}

.category-content {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 0.5rem 0.3rem 0.3rem 0.3rem;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 300ms ease, opacity 250ms ease, padding 250ms ease;
}

.category-content[aria-hidden="false"] {
  max-height: 500px;
  opacity: 1;
  padding: 0.5rem 0.3rem 0.3rem 0.3rem;
}

#model-switcher::-webkit-scrollbar {
  width: 6px;
}

#model-switcher::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.35);
  border-radius: 999px;
}

.model-button {
  padding: 0.48rem 0.96rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(21, 24, 34, 0.8);
  color: var(--text-primary);
  font-size: 0.76rem;
  line-height: 1.15;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  transition:
    transform 150ms ease,
    box-shadow 200ms ease,
    background 200ms ease,
    border-color 200ms ease,
    color 200ms ease;
  backdrop-filter: blur(18px);
  min-width: 0;
  text-align: left;
  flex: 0 0 auto;
}

.model-button:hover {
  transform: translateY(-2px);
  background: var(--accent);
  border-color: rgba(255, 132, 132, 0.8);
  box-shadow: 0 16px 24px rgba(255, 75, 75, 0.32);
  color: #0d0f16;
}

.model-button.active {
  background: var(--accent-strong);
  border-color: rgba(255, 214, 214, 0.8);
  box-shadow:
    0 20px 36px rgba(255, 55, 55, 0.4),
    inset 0 0 0 1px rgba(255, 255, 255, 0.18);
  color: #0c0c12;
}

.model-button:focus-visible {
  outline: 2px solid rgba(255, 140, 140, 0.85);
  outline-offset: 3px;
}

#info-panel {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 0.65rem;
  pointer-events: auto;
  padding-right: 0.15rem;
}

.info-card {
  border-radius: 18px;
  background: var(--card-bg);
  border: 1px solid var(--inner-border);
  backdrop-filter: blur(30px) saturate(180%);
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  box-shadow:
    0 24px 45px var(--shadow-strong),
    inset 0 0 0 1px rgba(255, 255, 255, 0.03);
  position: relative;
  min-height: 0;
}

.info-card::after {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.025);
  pointer-events: none;
}

.info-card h2 {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.info-card dl {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 1rem;
}

.info-card div {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 120px;
}

.info-card dt {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.info-card dd {
  margin: 0;
  font-size: 0.99rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.04em;
}

@media (max-width: 1024px) {
  #ui-overlay {
    padding: clamp(0.75rem, 3vw, 1.5rem);
  }

  #menu-bar {
    width: min(92vw, 420px);
    max-height: none;
  }

  #info-panel {
    max-height: none;
  }
}

@media (max-width: 768px) {
  #ui-overlay {
    width: 100%;
    justify-content: center;
  }

  #menu-bar {
    width: min(94vw, 500px);
    max-height: calc(100vh - 2.5rem);
    gap: 1rem;
    border-radius: 18px;
    padding: 1.1rem;
  }

  #model-switcher {
    flex-direction: row;
    flex-wrap: wrap;
    max-height: none;
  }

  .model-button {
    flex: 1 1 calc(50% - 0.5rem);
    transform: none !important;
  }

  #info-panel {
    max-height: none;
  }

}

#instructions-panel {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  pointer-events: auto;
  margin-top: auto;
  padding-top: 0.5rem;
}

.instructions-card {
  padding: 0.6rem 0.85rem;
}

.instructions-card h2 {
  font-size: 0.75rem;
  margin-bottom: 0.2rem;
}

.instructions-content {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.instruction-text {
  margin: 0;
  font-size: 0.72rem;
  color: var(--text-secondary);
  letter-spacing: 0.04em;
  text-align: center;
  padding: 0.25rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.mouse-controls {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.control-item {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.5rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  transition: background 200ms ease, border-color 200ms ease;
}

.control-item:hover {
  background: rgba(255, 75, 75, 0.1);
  border-color: rgba(255, 75, 75, 0.2);
}

.control-icon {
  font-size: 0.9rem;
  flex-shrink: 0;
  width: 18px;
  text-align: center;
}

.control-label {
  flex: 1;
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text-primary);
  letter-spacing: 0.03em;
}

.control-desc {
  font-size: 0.65rem;
  color: var(--text-secondary);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 400;
}

@media (max-width: 768px) {
  #instructions-panel {
    margin-top: 0.75rem;
    padding-top: 0.5rem;
  }

  .control-item {
    flex-wrap: wrap;
    gap: 0.4rem;
  }

  .control-label {
    flex-basis: 100%;
  }

  .control-desc {
    margin-left: 32px;
  }
}

/* Footer Stilleri */
footer {
  flex: 0 0 auto;
  margin-top: clamp(0.75rem, 1.6vw, 1.1rem);
  margin-left: calc(-1 * clamp(0.85rem, 1.6vw, 1.2rem));
  margin-right: calc(-1 * clamp(0.85rem, 1.6vw, 1.2rem));
  margin-bottom: calc(-1 * clamp(0.85rem, 1.6vw, 1.2rem));
  padding-top: 1.5rem;
  padding-bottom: clamp(0.85rem, 1.6vw, 1.2rem);
  padding-left: clamp(0.85rem, 1.6vw, 1.2rem);
  padding-right: clamp(0.85rem, 1.6vw, 1.2rem);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  pointer-events: auto;
  position: relative;
  z-index: 1;
}

.social-media-links {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.social-media-links a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 200ms ease;
  text-decoration: none;
  color: var(--text-primary);
}

.social-media-links a:hover {
  background: var(--accent);
  border-color: rgba(255, 132, 132, 0.8);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(255, 75, 75, 0.3);
  color: #0d0f16;
}

.social-media-links a:focus-visible {
  outline: 2px solid rgba(255, 140, 140, 0.85);
  outline-offset: 2px;
}

.social-media-links i {
  font-size: 1.2rem;
  line-height: 1;
  opacity: 0.9;
  transition: opacity 200ms ease, transform 200ms ease;
  display: inline-block;
}

.social-media-links a:hover i {
  opacity: 1;
  transform: scale(1.1);
}

footer p {
  margin: 0;
  margin-bottom: 0;
  text-align: center;
  font-size: 0.75rem;
  color: var(--muted);
  letter-spacing: 0.05em;
  padding-bottom: 0;
}

/* Mobil/Tablet Uyarı Mesajı */
.mobile-warning-container {
  position: fixed;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  background: linear-gradient(135deg, #07080d 0%, #0e1018 45%, #111321 100%);
  z-index: 9999;
  padding: 2rem;
}

.mobile-warning-content {
  text-align: center;
  max-width: 500px;
  padding: 3rem 2rem;
  background: var(--card-bg);
  border-radius: 24px;
  border: 1px solid var(--glass-border);
  box-shadow:
    0 26px 48px rgba(6, 8, 14, 0.55),
    inset 0 0 0 1px rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(30px) saturate(180%);
}

.mobile-warning-icon {
  font-size: 4rem;
  margin-bottom: 1.5rem;
  animation: pulse 2s ease-in-out infinite;
}

.mobile-warning-content h1 {
  margin: 0 0 1rem 0;
  font-size: 2rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.05em;
}

.mobile-warning-content p {
  margin: 0.75rem 0;
  font-size: 1rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.mobile-warning-hint {
  margin-top: 1.5rem !important;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.9rem !important;
  color: var(--muted) !important;
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.1);
    opacity: 0.8;
  }
}


