:root {
  /* Color Palette */
  --bg-color: #05050A;
  --panel-bg: rgba(10, 12, 20, 0.75);
  --panel-border: rgba(255, 255, 255, 0.1);
  --text-main: #E2E8F0;
  --text-muted: #94A3B8;
  --accent: #38BDF8;
  --accent-glow: rgba(56, 189, 248, 0.4);
  --orbit-color: rgba(255, 255, 255, 0.15);
  --orbit-active: rgba(56, 189, 248, 0.5);

  /* Planet Colors */
  --sun-color: #FACC15;
  --mercury-color: #94A3B8;
  --venus-color: #FDBA74;
  --earth-color: #3B82F6;
  --mars-color: #EF4444;
  --jupiter-color: #F8B46C;
  --saturn-color: #FDE047;
  --uranus-color: #2DD4BF;
  --neptune-color: #2563EB;

  /* Typography */
  --font-en-title: 'Orbitron', sans-serif;
  --font-en-ui: 'Exo 2', sans-serif;
  --font-ta: 'Noto Sans Tamil', sans-serif;

  /* FIX 14: Default font so body doesn't fall back to browser default on first load */
  --font-main: 'Exo 2', sans-serif;
}

[data-lang="ta"] {
  --font-main: var(--font-ta);
}
[data-lang="en"] {
  --font-main: var(--font-en-ui);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-color);
  font-family: var(--font-main);
  color: var(--text-main);
  font-size: 14px;
}

/* Background Effects */
#starfield {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 0;
}

#nebula {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: radial-gradient(circle at 50% 50%, rgba(30, 20, 60, 0.3) 0%, transparent 60%),
              radial-gradient(circle at 80% 20%, rgba(20, 50, 80, 0.2) 0%, transparent 40%);
  z-index: 1;
  pointer-events: none;
}

/* Base Layout Container */
#universe {
  z-index: 2;
  position: absolute;
  overflow: hidden;
  width: 100%;
  height: 100%;
  background-position: center 40%;
  background-repeat: no-repeat;
  background-size: cover;
  /* POLISH: Prevent accidental text selection during drag on desktop */
  user-select: none;
  -webkit-user-select: none;
  /* POLISH: Smooth touch scrolling/panning on mobile */
  touch-action: none;
}

#galaxy {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
}

#solar-system {
  position: absolute;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
}

/* Animations */
@keyframes orbit {
  0% { transform: rotateZ(0deg); }
  100% { transform: rotateZ(-360deg); }
}

@keyframes invert {
  0% { transform: rotateX(-90deg) rotateY(360deg) rotateZ(0deg); }
  100% { transform: rotateX(-90deg) rotateY(0deg) rotateZ(0deg); }
}

@keyframes suborbit {
  0% { transform: rotateX(90deg) rotateZ(0deg); }
  100% { transform: rotateX(90deg) rotateZ(-360deg); }
}

@keyframes pulseGlow {
  0% { box-shadow: 0 0 40px var(--sun-color), 0 0 80px rgba(250, 204, 21, 0.4); }
  50% { box-shadow: 0 0 60px var(--sun-color), 0 0 120px rgba(250, 204, 21, 0.6); }
  100% { box-shadow: 0 0 40px var(--sun-color), 0 0 80px rgba(250, 204, 21, 0.4); }
}

.animations-paused .orbit,
.animations-paused .pos,
.animations-paused .planet,
.animations-paused .moon,
.animations-paused .sun-glow {
  animation-play-state: paused !important;
}

/* Orbits and Positions */
.orbit {
  position: absolute;
  top: 50%; left: 50%;
  border: 1px solid var(--orbit-color);
  border-radius: 50%;
  transform-style: preserve-3d;
  animation: orbit infinite linear;
  transition: border-color 0.3s ease;
}

/* FIX 16: Only show hover glow in 2D view — in 3D it's jarring and hard to target */
.view-2D .orbit:hover {
  border-color: var(--orbit-active);
}

.pos {
  position: absolute;
  top: 50%;
  width: 2em; height: 2em;
  margin-top: -1em; margin-left: -1em;
  transform-style: preserve-3d;
  animation: invert infinite linear;
}

/* Sun and Planets Base */
#sun, .planet, #earth .moon {
  position: absolute;
  top: 50%; left: 50%;
  width: 1em; height: 1em;
  margin-top: -0.5em; margin-left: -0.5em;
  border-radius: 50%;
  transform-style: preserve-3d;
}

/* Sun Styling */
#sun {
  background: radial-gradient(circle at 30% 30%, #FFFDE7, #FACC15, #EAB308, #CA8A04);
  box-shadow: 0 0 40px var(--sun-color), 0 0 80px rgba(250, 204, 21, 0.4);
  animation: pulseGlow 4s infinite alternate;
}

.sun-glow {
  position: absolute;
  top: -50%; left: -50%;
  width: 200%; height: 200%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(250, 204, 21, 0.3) 0%, transparent 70%);
  pointer-events: none;
}

/* Planets Textures & Shadows */
.planet {
  background-color: #202020;
  background-size: cover;
  box-shadow: inset -4px 0 8px rgba(0,0,0,0.8), inset 2px 0 4px rgba(255,255,255,0.2);
}

/* Enhanced CSS Textures for Planets */
#mercury .planet { background: radial-gradient(circle at 30% 30%, #CBD5E1, #94A3B8, #475569); }
#venus .planet { background: radial-gradient(circle at 30% 30%, #FED7AA, #FDBA74, #C2410C); }
#earth .planet { background: radial-gradient(circle at 30% 30%, #93C5FD, #3B82F6, #1E3A8A); }
#mars .planet { background: radial-gradient(circle at 30% 30%, #FCA5A5, #EF4444, #7F1D1D); }
#jupiter .planet { 
  background: repeating-linear-gradient(
    0deg,
    #D97706 0%,
    #FBBF24 10%,
    #FDE68A 20%,
    #D97706 30%
  );
  border-radius: 50%;
}
#saturn .planet { background: radial-gradient(circle at 30% 30%, #FEF08A, #FDE047, #A16207); }
#uranus .planet { background: radial-gradient(circle at 30% 30%, #99F6E4, #2DD4BF, #0F766E); }
#neptune .planet { background: radial-gradient(circle at 30% 30%, #60A5FA, #2563EB, #1E3A8A); }

#earth .moon { background: radial-gradient(circle at 30% 30%, #E2E8F0, #94A3B8, #475569); }

/* Rings */
.ring {
  position: absolute;
  top: 50%; left: 50%;
  border-radius: 50%;
}

#saturn .ring {
  width: 2.5em; height: 2.5em;
  margin-top: -1.25em; margin-left: -1.25em;
  border: 0.2em solid rgba(253, 224, 71, 0.4);
  box-shadow: 0 0 10px rgba(253, 224, 71, 0.2), inset 0 0 10px rgba(253, 224, 71, 0.2);
  transform: rotateX(75deg);
}
#saturn .ring:after {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  width: 3em; height: 3em;
  margin-top: -1.5em; margin-left: -1.5em;
  border: 0.1em solid rgba(253, 224, 71, 0.2);
  border-radius: 50%;
  box-sizing: border-box;
}

/* Z-Index Stacking */
#mercury { z-index: 10; }
#venus { z-index: 9; }
#earth { z-index: 8; }
#mars { z-index: 7; }
#jupiter { z-index: 6; }
#saturn { z-index: 5; }
#uranus { z-index: 4; }
#neptune { z-index: 3; }
#sun { z-index: 1; }

/* Views - 2D & 3D Transitions */
.view-2D.zoom-large #sun, .view-2D.zoom-large .orbit { transform-style: initial; }
.view-2D #sun, .view-2D .ring { transform: rotateX(0deg); }
.view-2D .planet, .view-2D .moon { transform: rotateX(90deg); }

.view-3D.zoom-large #sun, .view-3D.zoom-large .orbit { transform-style: preserve-3d; }
.view-3D #solar-system { transform: rotateX(65deg); }
.view-3D #sun { transform: rotateX(-90deg); }
.view-3D .ring { transform: rotateX(90deg); }
.view-3D .planet, .view-3D .moon { transform: rotateX(0deg); }

/* Zoom Settings */
.zoom-large #solar-system { width: 100%; }
.zoom-large.view-2D .scale-stretched #solar-system { font-size: 26%; }
.zoom-large.view-3D .scale-stretched #solar-system { font-size: 62%; }
.zoom-large.view-2D .scale-d #solar-system { font-size: 22%; }
.zoom-large.view-3D .scale-d #solar-system { font-size: 48%; }
.zoom-large.view-2D .scale-s #solar-system { font-size: 7%; }
.zoom-large.view-3D .scale-s #solar-system { font-size: 14%; }

.zoom-close #solar-system { width: 200%; font-size: 100%; }
.zoom-close .scale-stretched #solar-system { margin-left: -100%; }
.zoom-close .scale-d #solar-system { margin-left: -106%; }
.zoom-close.view-2D .scale-d #solar-system { font-size: 84%; }
.zoom-close.view-3D .scale-d #solar-system { font-size: 84%; }
.zoom-close .scale-s #solar-system { margin-left: -145%; }
.zoom-close.view-2D .scale-s #solar-system { font-size: 40%; }
.zoom-close.view-3D .scale-s #solar-system { font-size: 40%; }
.zoom-close .pos { left: 100%!important; top: 50%!important; }

/* POLISH: Stop orbit animations when zoomed close (focused planet view) */
.zoom-close .orbit,
.zoom-close .pos {
  animation-play-state: paused !important;
  animation-duration: 0s !important;
  animation: none !important;
}

/* Scale: Stretched Orbits */
.scale-stretched #mercury.orbit { width: 32em;  height: 32em;  margin-top: -16em;  margin-left: -16em; }
.scale-stretched #venus.orbit   { width: 40em;  height: 40em;  margin-top: -20em;  margin-left: -20em; }
.scale-stretched #earth.orbit   { width: 56em;  height: 56em;  margin-top: -28em;  margin-left: -28em; }
.scale-stretched #earth .orbit  { width: 6em;   height: 6em;   margin-top: -3em;   margin-left: -3em; }
.scale-stretched #mars.orbit    { width: 72em;  height: 72em;  margin-top: -36em;  margin-left: -36em; }
.scale-stretched #jupiter.orbit { width: 100em; height: 100em; margin-top: -50em;  margin-left: -50em; }
.scale-stretched #saturn.orbit  { width: 150em; height: 150em; margin-top: -75em;  margin-left: -75em; }
.scale-stretched #uranus.orbit  { width: 186em; height: 186em; margin-top: -93em;  margin-left: -93em; }
.scale-stretched #neptune.orbit { width: 210em; height: 210em; margin-top: -105em; margin-left: -105em; }

/* FIX 11: Scale-d (distance-proportional) Orbits */
.scale-d #sun { font-size: 41.73em; }
.scale-d #mercury.orbit { width: 44.74em;  height: 44.74em;  margin-top: -22.37em;  margin-left: -22.37em; }
.scale-d #venus.orbit   { width: 47.35em;  height: 47.35em;  margin-top: -23.68em;  margin-left: -23.68em; }
.scale-d #earth.orbit   { width: 49.51em;  height: 49.51em;  margin-top: -24.75em;  margin-left: -24.75em; }
.scale-d #earth .orbit  { width: 1em;      height: 1em;      margin-top: -0.5em;    margin-left: -0.5em; }
.scale-d #mars.orbit    { width: 53.58em;  height: 53.58em;  margin-top: -26.79em;  margin-left: -26.79em; }
.scale-d #jupiter.orbit { width: 82.20em;  height: 82.20em;  margin-top: -41.10em;  margin-left: -41.10em; }
.scale-d #saturn.orbit  { width: 115.91em; height: 115.91em; margin-top: -57.96em;  margin-left: -57.96em; }
.scale-d #uranus.orbit  { width: 191.00em; height: 191.00em; margin-top: -95.50em;  margin-left: -95.50em; }
.scale-d #neptune.orbit { width: 275.64em; height: 275.64em; margin-top: -137.82em; margin-left: -137.82em; }
.scale-d #mercury .planet { font-size: 0.146em; }
.scale-d #venus   .planet { font-size: 0.363em; }
.scale-d #earth   .planet { font-size: 0.382em; }
.scale-d #earth   .moon   { font-size: 0.082em; }
.scale-d #mars    .planet { font-size: 0.203em; }
.scale-d #jupiter .planet { font-size: 4.194em; }
.scale-d #saturn  .planet { font-size: 3.493em; }
.scale-d #uranus  .planet { font-size: 1.521em; }
.scale-d #neptune .planet { font-size: 1.477em; }

/* FIX 11: Scale-s (size-proportional) Orbits */
.scale-s #sun { font-size: 417.30em; }
.scale-s #mercury.orbit { width: 441.30em; height: 441.30em; margin-top: -220.65em; margin-left: -220.65em; }
.scale-s #venus.orbit   { width: 457.30em; height: 457.30em; margin-top: -228.65em; margin-left: -228.65em; }
.scale-s #earth.orbit   { width: 473.30em; height: 473.30em; margin-top: -236.65em; margin-left: -236.65em; }
.scale-s #earth .orbit  { width: 1em;      height: 1em;      margin-top: -0.5em;    margin-left: -0.5em; }
.scale-s #mars.orbit    { width: 489.30em; height: 489.30em; margin-top: -244.65em; margin-left: -244.65em; }
.scale-s #jupiter.orbit { width: 561.30em; height: 561.30em; margin-top: -280.65em; margin-left: -280.65em; }
.scale-s #saturn.orbit  { width: 705.30em; height: 705.30em; margin-top: -352.65em; margin-left: -352.65em; }
.scale-s #uranus.orbit  { width: 817.30em; height: 817.30em; margin-top: -408.65em; margin-left: -408.65em; }
.scale-s #neptune.orbit { width: 881.30em; height: 881.30em; margin-top: -440.65em; margin-left: -440.65em; }
.scale-s #mercury .planet { font-size: 1.463em; }
.scale-s #venus   .planet { font-size: 3.630em; }
.scale-s #earth   .planet { font-size: 3.822em; }
.scale-s #earth   .moon   { font-size: 0.822em; }
.scale-s #mars    .planet { font-size: 2.033em; }
.scale-s #jupiter .planet { font-size: 41.94em; }
.scale-s #saturn  .planet { font-size: 34.93em; }
.scale-s #uranus  .planet { font-size: 15.21em; }
.scale-s #neptune .planet { font-size: 14.77em; }

/* Moon sub-orbit animation */
#earth .orbit {
  animation-name: suborbit;
}

/* Planet Speeds (orbit + pos) */
#mercury .pos, #mercury.orbit { animation-duration: 4s; }
#venus .pos,   #venus.orbit   { animation-duration: 10s; }
#earth .pos,   #earth.orbit   { animation-duration: 16s; }
#earth .orbit .pos, #earth .orbit { animation-duration: 1.2s; }
#mars .pos,    #mars.orbit    { animation-duration: 30s; }
#jupiter .pos, #jupiter.orbit { animation-duration: 60s; }
#saturn .pos,  #saturn.orbit, #saturn .ring { animation-duration: 120s; }
#uranus .pos,  #uranus.orbit  { animation-duration: 180s; }
#neptune .pos, #neptune.orbit { animation-duration: 240s; }

/* Scale: Stretched Sizes */
.scale-stretched #sun { font-size: 24em; }
.scale-stretched #mercury .planet { font-size: 1.2em; }
.scale-stretched #venus .planet { font-size: 2.2em; }
.scale-stretched #earth .planet { font-size: 2.4em; }
.scale-stretched #earth .moon { font-size: 0.8em; }
.scale-stretched #mars .planet { font-size: 1.6em; }
.scale-stretched #jupiter .planet { font-size: 6em; }
.scale-stretched #saturn .planet { font-size: 5em; }
.scale-stretched #uranus .planet { font-size: 3em; }
.scale-stretched #neptune .planet { font-size: 2.8em; }

/* Starting Positions */
#mercury .pos { left: 50%; top: -1%; }
#venus .pos { left: 0; top: 50%; }
#earth .pos { left: 100%; top: 50%; }
#earth .orbit .pos { left: 100%; top: 50%; }
#mars .pos { left: 50%; top: 100%; }
#jupiter .pos { left: 100%; top: 50%; }
#saturn .pos { left: 0%; top: 50%; }
#uranus .pos { left: 0; top: 50%; }
#neptune .pos { left: 50%; top: 0; }

/* Transitions */
.pos { transition-property: top, left; }
#solar-system, .orbit, .planet, .ring { transition-property: width, height, top, left, margin-left, margin-top, transform; }
#sun { transition-property: width, height, transform; }
#solar-system, #sun, .orbit, .pos, .planet, .ring, .infos { transition-duration: 1.2s; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); }
.pos { transition-delay: 0.2s; }

/* Opening state */
.opening #solar-system, .opening #sun, .opening .orbit, .opening .pos, .opening .planet, .opening .ring, .opening .infos { transition-duration: 0s; transition-delay: 0s; }

/* Info Tooltips */
dl.infos {
  position: absolute;
  display: block;
  opacity: 0;
  width: 200px;
  height: auto;
  background: rgba(10, 12, 20, 0.88);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 12px;
  left: 2em; top: -1em;
  transform-style: preserve-3d;
  transform: rotateX(90deg);
  transition: opacity 0.5s ease, transform 0.5s ease;
  pointer-events: none;
  backdrop-filter: blur(6px);
  z-index: 50;
}

/* Hidden state per view */
.view-3D dl.infos { transform: rotateX(-90deg); opacity: 0; }
.view-2D dl.infos { transform: rotateX(0deg);   opacity: 0; }

dl.infos dt {
  color: var(--accent);
  font-family: var(--font-en-title);
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

dl.infos dd { color: #FFF; font-size: 1rem; }
dl.infos dd span { color: var(--text-muted); font-size: 0.8rem; display: block; margin-top: 4px; }

/* Fix: class is on #solar-system, not body */
#solar-system.sun    #sun     dl.infos,
#solar-system.mercury #mercury dl.infos,
#solar-system.venus  #venus   dl.infos,
#solar-system.earth  #earth   dl.infos,
#solar-system.mars   #mars    dl.infos,
#solar-system.jupiter #jupiter dl.infos,
#solar-system.saturn #saturn  dl.infos,
#solar-system.uranus #uranus  dl.infos,
#solar-system.neptune #neptune dl.infos {
  opacity: 1;
  transform: rotateX(0deg);
}

/* Info Data Text — Speed (orbit velocity) */
.set-speed dl.infos dd span:after { content: 'Orbit Velocity'; }
[data-lang="ta"] .set-speed dl.infos dd span:after { content: 'சுற்றுப்பாதை வேகம்'; }
.set-speed #sun     dl.infos dd:after { content: '0 km/h'; }
.set-speed #mercury dl.infos dd:after { content: '170,503 km/h'; }
.set-speed #venus   dl.infos dd:after { content: '126,074 km/h'; }
.set-speed #earth   dl.infos dd:after { content: '107,218 km/h'; }
.set-speed #mars    dl.infos dd:after { content: '86,677 km/h'; }
.set-speed #jupiter dl.infos dd:after { content: '47,002 km/h'; }
.set-speed #saturn  dl.infos dd:after { content: '34,701 km/h'; }
.set-speed #uranus  dl.infos dd:after { content: '24,477 km/h'; }
.set-speed #neptune dl.infos dd:after { content: '19,566 km/h'; }

/* Info Data Text — Size (equatorial circumference) */
.set-size dl.infos dd span:after { content: 'Equatorial Circumference'; }
[data-lang="ta"] .set-size dl.infos dd span:after { content: 'நிலநடு சுற்றளவு'; }
.set-size #sun     dl.infos dd:after { content: '4,370,005 km'; }
.set-size #mercury dl.infos dd:after { content: '15,329 km'; }
.set-size #venus   dl.infos dd:after { content: '38,024 km'; }
.set-size #earth   dl.infos dd:after { content: '40,030 km'; }
.set-size #mars    dl.infos dd:after { content: '21,296 km'; }
.set-size #jupiter dl.infos dd:after { content: '439,263 km'; }
.set-size #saturn  dl.infos dd:after { content: '365,882 km'; }
.set-size #uranus  dl.infos dd:after { content: '159,354 km'; }
.set-size #neptune dl.infos dd:after { content: '154,704 km'; }

/* Info Data Text — Distance (from Sun) */
.set-distance dl.infos dd span:after { content: 'Distance from Sun'; }
[data-lang="ta"] .set-distance dl.infos dd span:after { content: 'சூரியனிலிருந்து தூரம்'; }
.set-distance #sun     dl.infos dd span:after { content: 'Distance from Earth'; }
[data-lang="ta"] .set-distance #sun dl.infos dd span:after { content: 'பூமியிலிருந்து தூரம்'; }
.set-distance #sun     dl.infos dd:after { content: '149,598,262 km'; }
.set-distance #mercury dl.infos dd:after { content: '57,909,227 km'; }
.set-distance #venus   dl.infos dd:after { content: '108,209,475 km'; }
.set-distance #earth   dl.infos dd:after { content: '149,598,262 km'; }
.set-distance #mars    dl.infos dd:after { content: '227,943,824 km'; }
.set-distance #jupiter dl.infos dd:after { content: '778,340,821 km'; }
.set-distance #saturn  dl.infos dd:after { content: '1,426,666,422 km'; }
.set-distance #uranus  dl.infos dd:after { content: '2,870,658,186 km'; }
.set-distance #neptune dl.infos dd:after { content: '4,498,396,441 km'; }

/* UI Overlay */
#navbar {
  z-index: 100;
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 60px;
  background: var(--panel-bg);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--panel-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
}

.title-wrap {
  text-align: center;
}

h1 {
  font-family: var(--font-en-title);
  font-weight: 700;
  font-size: 20px;
  color: #FFF;
  text-transform: uppercase;
  letter-spacing: 2px;
  background: linear-gradient(90deg, #FFF, var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.subtitle {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 2px;
}

#navbar a {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-main);
  text-decoration: none;
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1px;
  transition: color 0.2s ease;
}

#navbar a:hover {
  color: var(--accent);
}

#navbar svg {
  width: 20px; height: 20px;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

#lang-toggle {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  padding: 4px 12px;
  color: #FFF;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  gap: 6px;
  transition: all 0.2s ease;
}

#lang-toggle:hover {
  background: rgba(255, 255, 255, 0.2);
}

.lang-sep { color: var(--text-muted); }

/* Panels */
#data, #controls {
  z-index: 90;
  position: absolute;
  top: 80px;
  width: 260px;
  background: var(--panel-bg);
  backdrop-filter: blur(10px);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 20px;
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.4s ease;
}

.panel-header {
  border-bottom: 1px solid var(--panel-border);
  padding-bottom: 12px;
  margin-bottom: 16px;
}

.panel-header h2 {
  font-family: var(--font-en-title);
  font-size: 16px;
  color: #FFF;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Data Panel */
#data { left: 20px; }
.data-close #data { transform: translateX(-300px); opacity: 0; }
.data-open #data { transform: translateX(0); opacity: 1; }

.planet-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.planet-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 8px;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

.planet-nav a:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
}

.planet-nav a.active {
  background: rgba(56, 189, 248, 0.1);
  color: var(--accent);
  border-color: var(--accent-glow);
}

/* FIX 13: explicit box-shadow colors instead of unreliable currentColor on spans */
.planet-icon {
  width: 12px; height: 12px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.sun-icon     { background: var(--sun-color);     box-shadow: 0 0 8px var(--sun-color); }
.mercury-icon { background: var(--mercury-color); box-shadow: 0 0 8px var(--mercury-color); }
.venus-icon   { background: var(--venus-color);   box-shadow: 0 0 8px var(--venus-color); }
.earth-icon   { background: var(--earth-color);   box-shadow: 0 0 8px var(--earth-color); }
.mars-icon    { background: var(--mars-color);    box-shadow: 0 0 8px var(--mars-color); }
.jupiter-icon { background: var(--jupiter-color); box-shadow: 0 0 8px var(--jupiter-color); }
.saturn-icon  { background: var(--saturn-color);  box-shadow: 0 0 8px var(--saturn-color); }
.uranus-icon  { background: var(--uranus-color);  box-shadow: 0 0 8px var(--uranus-color); }
.neptune-icon { background: var(--neptune-color); box-shadow: 0 0 8px var(--neptune-color); }

/* Controls Panel */
#controls { right: 20px; }
.controls-close #controls { transform: translateX(300px); opacity: 0; }
.controls-open #controls { transform: translateX(0); opacity: 1; }

.control-group {
  margin-bottom: 20px;
}

.control-label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 10px;
  font-weight: 600;
}

/* Custom Toggle Switch */
.toggle-switch {
  position: relative;
  display: block;
  width: 100%;
  height: 36px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--panel-border);
  border-radius: 18px;
  cursor: pointer;
  overflow: hidden;
}

.toggle-switch input { display: none; }

.slider {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  display: flex;
}

.slider span {
  flex: 1;
  text-align: center;
  line-height: 34px;
  font-size: 12px;
  font-weight: 700;
  z-index: 2;
  transition: color 0.3s ease;
}

.toggle-switch::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: calc(50% - 2px); height: 30px;
  background: var(--accent);
  border-radius: 15px;
  z-index: 1;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.toggle-switch input:checked ~ .slider span:first-child { color: var(--text-muted); }
.toggle-switch input:checked ~ .slider span:last-child { color: #000; }
.toggle-switch input:not(:checked) ~ .slider span:first-child { color: #000; }
.toggle-switch input:not(:checked) ~ .slider span:last-child { color: var(--text-muted); }

/* Toggle pill positions — pill width is calc(50% - 2px), gap is 2px each side */
/* LEFT position = translateX(0), RIGHT position = translateX(calc(100% + 4px)) */
.view-2D .set-view::after  { transform: translateX(0); }
.view-3D .set-view::after  { transform: translateX(calc(100% + 4px)); }

.zoom-large .set-zoom::after { transform: translateX(0); }
.zoom-close .set-zoom::after { transform: translateX(calc(100% + 4px)); }

/* Custom Radio Buttons */
.scale-group .radio-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.radio-btn {
  display: flex;
  align-items: center;
  cursor: pointer;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid transparent;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.radio-btn input { display: none; }

.radio-btn span {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

.radio-btn input:checked + span { color: var(--accent); }
.radio-btn:has(input:checked) {
  background: rgba(56, 189, 248, 0.1);
  border-color: var(--accent-glow);
}

/* Action Button */
.action-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--panel-border);
  color: #FFF;
  padding: 10px 16px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.action-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.action-btn svg {
  width: 16px; height: 16px;
}

/* Hide UI — FIX 12: pointer-events disabled so hidden panels can't intercept clicks */
.hide-UI h1, .hide-UI #data, .hide-UI #controls {
  opacity: 0 !important;
  pointer-events: none !important;
}
.data-close #data {
  pointer-events: none;
}
.controls-close #controls {
  pointer-events: none;
}
.data-open #data,
.controls-open #controls {
  pointer-events: all;
}

/* Mobile Optimizations */
#mobile-bar {
  display: none;
  position: fixed;
  bottom: 0; left: 0; width: 100%;
  height: 60px;
  background: var(--panel-bg);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--panel-border);
  z-index: 100;
}

@media screen and (max-width: 768px) {
  #navbar .nav-label { display: none; }
  #navbar #toggle-data, #navbar #toggle-controls { display: none; }
  #lang-toggle { display: none; }
  
  .title-wrap { text-align: left; margin-left: 10px; }
  h1 { font-size: 16px; }
  .subtitle { font-size: 10px; }
  
  #mobile-bar {
    display: flex;
    justify-content: space-around;
    align-items: center;
  }
  
  .mob-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    font-family: inherit;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    /* POLISH: explicit cursor and tap highlight */
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    padding: 8px 16px;
    transition: color 0.2s ease;
  }
  
  .mob-btn:active, .data-open #mob-data-btn, .controls-open #mob-ctrl-btn {
    color: var(--accent);
  }
  
  #data, #controls {
    top: auto;
    bottom: 70px;
    height: auto;
    max-height: 60vh;
    overflow-y: auto;
    padding: 15px;
    width: calc(100% - 30px);
  }
  
  #data { left: 15px; }
  #controls { right: 15px; }
  
  .data-close #data { transform: translateY(100vh); opacity: 0; }
  .data-open #data { transform: translateY(0); opacity: 1; }
  
  .controls-close #controls { transform: translateY(100vh); opacity: 0; }
  .controls-open #controls { transform: translateY(0); opacity: 1; }
  
  dl.infos {
    left: 50%;
    transform: translateX(-50%) rotateX(90deg);
    top: auto; bottom: 2em;
    width: 160px;
    opacity: 0;
  }
  /* POLISH: base hidden state per view on mobile */
  .view-3D dl.infos { transform: translateX(-50%) rotateX(-90deg); opacity: 0; }
  .view-2D dl.infos { transform: translateX(-50%) rotateX(0deg);   opacity: 0; }

  /* POLISH: active planet info visible on mobile */
  #solar-system.sun    #sun     dl.infos,
  #solar-system.mercury #mercury dl.infos,
  #solar-system.venus  #venus   dl.infos,
  #solar-system.earth  #earth   dl.infos,
  #solar-system.mars   #mars    dl.infos,
  #solar-system.jupiter #jupiter dl.infos,
  #solar-system.saturn #saturn  dl.infos,
  #solar-system.uranus #uranus  dl.infos,
  #solar-system.neptune #neptune dl.infos {
    opacity: 1;
    transform: translateX(-50%) rotateX(0deg);
  }
}
