/* Outer Wilds Portfolio — Clean Normalized Design System */

:root {
  /* Neutral Dark Obsidian / Charcoal (Zero blue/cyan tint) */
  --bg-space: #000000;
  --bg-surface: #121212;
  --bg-surface-elevated: #1c1c1c;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-active: rgba(255, 255, 255, 0.22);
  --control-bg: rgba(20, 20, 20, 0.75);
  --control-hover: rgba(35, 35, 35, 0.9);
  --control-border: rgba(255, 255, 255, 0.12);
  --control-text: #e2e8f0;
  --nomai-cyan: #ffffff;
  --drawer-width: 380px;
  --drawer-offset-x: 0px;
  --sheet-height: 0px;
  --system-scale: 1;
}

.drawer-open {
  --drawer-offset-x: 394px;
  --sheet-height: 48dvh;
}

[data-theme="light"] {
  --bg-space: #000000;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #f8fafc;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --border-subtle: rgba(0, 0, 0, 0.08);
  --border-active: rgba(0, 0, 0, 0.22);
  --control-bg: rgba(255, 255, 255, 0.85);
  --control-hover: rgba(245, 245, 245, 0.95);
  --control-border: rgba(0, 0, 0, 0.12);
  --control-text: #1e293b;
}

/* Global Resets */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

*:focus, *:focus-visible {
  outline: none;
}

html, body {
  width: 100vw;
  height: 100vh;
  margin: 0;
  padding: 0;
  overflow: hidden;
  position: fixed;
  inset: 0;
  background-color: var(--bg-space);
  color: var(--text-primary);
  font-family: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button {
  font-family: inherit;
  border: none;
  background: none;
  cursor: pointer;
}

/* App Container: Flex layout holding Solar View and Physical Drawer */
.app-container {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg-space);
}

/* Solar Pane: Expands & contracts smoothly with physical flexbox */
.solar-pane {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.vector-mode .solar-pane {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Solar Stage: Isolated stacking plane for deep space, stars, and orbits */
.solar-stage {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

.solar-container {
  position: absolute;
  top: calc(50% - 18px);
  left: 50%;
  width: 0;
  height: 0;
  overflow: visible;
  transform-origin: 0 0;
  z-index: 2;
}

/* Deep Space Starfield (Twinkling with pure opacity, zero movement) */
.solar-stage::before,
.solar-stage::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: -1;
  transition: opacity 0.5s ease-out;
}

.solar-stage::before {
  width: 2px;
  height: 2px;
  border-radius: 50%;
  box-shadow: 456px 51px 0 1px rgba(225, 235, 255, 0.78), 914px 285px 0 1px rgba(225, 235, 255, 0.78), 2418px 864px 0 1px rgba(225, 235, 255, 0.32), 895px 476px 0 1px rgba(225, 235, 255, 0.63), 2298px 407px 0 2px rgba(225, 235, 255, 0.77), 902px 919px 0 1px rgba(225, 235, 255, 0.68), 653px 1429px 0 1px rgba(225, 235, 255, 0.57), 636px 440px 0 1px rgba(225, 235, 255, 0.92), 418px 189px 0 1px rgba(225, 235, 255, 0.55), 1408px 1236px 0 1px rgba(225, 235, 255, 0.47), 1881px 1098px 0 2px rgba(225, 235, 255, 0.38), 322px 1130px 0 1px rgba(225, 235, 255, 0.49), 2364px 393px 0 1px rgba(225, 235, 255, 0.76), 933px 1583px 0 1px rgba(225, 235, 255, 0.49), 953px 206px 0 2px rgba(225, 235, 255, 0.55), 1494px 333px 0 1px rgba(225, 235, 255, 0.54), 1093px 1437px 0 1px rgba(225, 235, 255, 0.91), 2495px 1300px 0 1px rgba(225, 235, 255, 0.41), 669px 946px 0 1px rgba(225, 235, 255, 0.55), 1328px 1573px 0 1px rgba(225, 235, 255, 0.8), 131px 646px 0 1px rgba(225, 235, 255, 0.56), 864px 1161px 0 1px rgba(225, 235, 255, 0.87), 870px 1342px 0 2px rgba(225, 235, 255, 0.62), 585px 542px 0 1px rgba(225, 235, 255, 0.39), 2394px 877px 0 2px rgba(225, 235, 255, 0.88), 1482px 449px 0 1px rgba(225, 235, 255, 0.95), 2087px 1010px 0 1px rgba(225, 235, 255, 0.36), 449px 313px 0 2px rgba(225, 235, 255, 0.71), 2442px 130px 0 2px rgba(225, 235, 255, 0.55), 2167px 514px 0 1px rgba(225, 235, 255, 0.93), 469px 1396px 0 1px rgba(225, 235, 255, 0.88), 1393px 228px 0 1px rgba(225, 235, 255, 0.49), 1858px 6px 0 1px rgba(225, 235, 255, 0.92), 2050px 1560px 0 1px rgba(225, 235, 255, 0.42), 1222px 1308px 0 1px rgba(225, 235, 255, 0.63), 626px 765px 0 1px rgba(225, 235, 255, 0.8), 2453px 663px 0 1px rgba(225, 235, 255, 0.62), 1486px 629px 0 1px rgba(225, 235, 255, 0.46), 2323px 161px 0 2px rgba(225, 235, 255, 0.36), 283px 1557px 0 1px rgba(225, 235, 255, 0.65), 525px 1351px 0 1px rgba(225, 235, 255, 0.61), 1085px 1080px 0 2px rgba(225, 235, 255, 0.87), 867px 1104px 0 1px rgba(225, 235, 255, 0.79), 1276px 817px 0 1px rgba(225, 235, 255, 0.95), 1794px 1059px 0 1px rgba(225, 235, 255, 0.59), 920px 131px 0 1px rgba(225, 235, 255, 0.52), 2410px 451px 0 1px rgba(225, 235, 255, 0.3), 937px 138px 0 1px rgba(225, 235, 255, 0.89), 290px 1052px 0 2px rgba(225, 235, 255, 0.45), 877px 1104px 0 2px rgba(225, 235, 255, 0.39), 995px 968px 0 1px rgba(225, 235, 255, 0.82), 386px 198px 0 1px rgba(225, 235, 255, 0.73), 1734px 841px 0 1px rgba(225, 235, 255, 0.6), 403px 124px 0 1px rgba(225, 235, 255, 0.56), 447px 509px 0 2px rgba(225, 235, 255, 0.42), 574px 864px 0 2px rgba(225, 235, 255, 0.42), 1023px 154px 0 1px rgba(225, 235, 255, 0.59), 207px 1335px 0 1px rgba(225, 235, 255, 0.95), 382px 1543px 0 1px rgba(225, 235, 255, 0.85), 1664px 994px 0 2px rgba(225, 235, 255, 0.61), 240px 337px 0 2px rgba(225, 235, 255, 0.55), 1086px 931px 0 2px rgba(225, 235, 255, 0.49), 634px 388px 0 1px rgba(225, 235, 255, 0.49), 2372px 1506px 0 1px rgba(225, 235, 255, 0.65), 234px 102px 0 1px rgba(225, 235, 255, 0.68), 232px 1040px 0 1px rgba(225, 235, 255, 0.35), 280px 1218px 0 1px rgba(225, 235, 255, 0.34), 1653px 245px 0 1px rgba(225, 235, 255, 0.91), 2371px 1217px 0 1px rgba(225, 235, 255, 0.33), 1717px 1346px 0 1px rgba(225, 235, 255, 0.68), 1068px 418px 0 1px rgba(225, 235, 255, 0.74), 977px 543px 0 1px rgba(225, 235, 255, 0.56), 1872px 647px 0 1px rgba(225, 235, 255, 0.9), 38px 938px 0 1px rgba(225, 235, 255, 0.7), 300px 1101px 0 1px rgba(225, 235, 255, 0.44), 542px 714px 0 1px rgba(225, 235, 255, 0.87), 1513px 583px 0 1px rgba(225, 235, 255, 0.4), 2505px 1339px 0 1px rgba(225, 235, 255, 0.64), 424px 275px 0 1px rgba(225, 235, 255, 0.47), 2266px 318px 0 1px rgba(225, 235, 255, 0.48), 1404px 416px 0 1px rgba(225, 235, 255, 0.75), 2070px 1000px 0 1px rgba(225, 235, 255, 0.46), 378px 1299px 0 1px rgba(225, 235, 255, 0.58), 180px 7px 0 1px rgba(225, 235, 255, 0.52), 1072px 330px 0 2px rgba(225, 235, 255, 0.78), 2297px 19px 0 1px rgba(225, 235, 255, 0.37), 2234px 73px 0 1px rgba(225, 235, 255, 0.84), 1760px 261px 0 1px rgba(225, 235, 255, 0.33), 163px 732px 0 1px rgba(225, 235, 255, 0.44), 421px 724px 0 2px rgba(225, 235, 255, 0.81), 2542px 1534px 0 1px rgba(225, 235, 255, 0.4), 665px 362px 0 1px rgba(225, 235, 255, 0.87), 734px 1508px 0 2px rgba(225, 235, 255, 0.9), 1016px 546px 0 1px rgba(225, 235, 255, 0.4), 1566px 79px 0 1px rgba(225, 235, 255, 0.86), 817px 942px 0 1px rgba(225, 235, 255, 0.53), 913px 48px 0 2px rgba(225, 235, 255, 0.73), 1344px 570px 0 1px rgba(225, 235, 255, 0.86), 1438px 1313px 0 1px rgba(225, 235, 255, 0.63), 113px 236px 0 1px rgba(225, 235, 255, 0.87), 731px 1189px 0 1px rgba(225, 235, 255, 0.93), 156px 222px 0 1px rgba(225, 235, 255, 0.69), 1284px 893px 0 1px rgba(225, 235, 255, 0.69), 1577px 1180px 0 1px rgba(225, 235, 255, 0.42), 1786px 3px 0 1px rgba(225, 235, 255, 0.64), 1491px 883px 0 1px rgba(225, 235, 255, 0.35), 2552px 642px 0 1px rgba(225, 235, 255, 0.73), 1230px 1038px 0 2px rgba(225, 235, 255, 0.5), 1336px 824px 0 1px rgba(225, 235, 255, 0.75), 785px 861px 0 2px rgba(225, 235, 255, 0.73), 712px 1260px 0 2px rgba(225, 235, 255, 0.67), 2244px 0px 0 1px rgba(225, 235, 255, 0.5), 1760px 1187px 0 1px rgba(225, 235, 255, 0.69), 1904px 904px 0 1px rgba(225, 235, 255, 0.59), 2093px 969px 0 1px rgba(225, 235, 255, 0.82), 347px 581px 0 1px rgba(225, 235, 255, 0.64), 382px 1538px 0 1px rgba(225, 235, 255, 0.45), 920px 407px 0 1px rgba(225, 235, 255, 0.4), 1002px 973px 0 1px rgba(225, 235, 255, 0.7), 1865px 848px 0 1px rgba(225, 235, 255, 0.88), 1572px 1012px 0 1px rgba(225, 235, 255, 0.56), 22px 1537px 0 1px rgba(225, 235, 255, 0.86), 1741px 448px 0 2px rgba(225, 235, 255, 0.41), 205px 1141px 0 1px rgba(225, 235, 255, 0.46), 1869px 273px 0 1px rgba(225, 235, 255, 0.82), 1812px 1254px 0 2px rgba(225, 235, 255, 0.83), 2244px 913px 0 2px rgba(225, 235, 255, 0.88), 1843px 530px 0 1px rgba(225, 235, 255, 0.79), 2135px 992px 0 1px rgba(225, 235, 255, 0.71), 1801px 158px 0 1px rgba(225, 235, 255, 0.76), 1112px 687px 0 1px rgba(225, 235, 255, 0.51), 566px 308px 0 1px rgba(225, 235, 255, 0.45), 876px 131px 0 1px rgba(225, 235, 255, 0.57), 2222px 954px 0 1px rgba(225, 235, 255, 0.57), 1720px 797px 0 1px rgba(225, 235, 255, 0.89), 2358px 779px 0 1px rgba(225, 235, 255, 0.61), 1223px 1543px 0 2px rgba(225, 235, 255, 0.55), 2204px 1530px 0 1px rgba(225, 235, 255, 0.78), 1999px 449px 0 2px rgba(225, 235, 255, 0.48), 118px 796px 0 2px rgba(225, 235, 255, 0.52), 676px 957px 0 1px rgba(225, 235, 255, 0.9), 1613px 1212px 0 1px rgba(225, 235, 255, 0.67), 343px 1316px 0 2px rgba(225, 235, 255, 0.58), 744px 102px 0 1px rgba(225, 235, 255, 0.47), 866px 931px 0 2px rgba(225, 235, 255, 0.51), 1139px 1540px 0 2px rgba(225, 235, 255, 0.92), 1033px 167px 0 1px rgba(225, 235, 255, 0.61), 1433px 459px 0 1px rgba(225, 235, 255, 0.72), 127px 506px 0 1px rgba(225, 235, 255, 0.43), 2544px 312px 0 2px rgba(225, 235, 255, 0.46), 468px 1155px 0 2px rgba(225, 235, 255, 0.92), 1049px 1570px 0 1px rgba(225, 235, 255, 0.54), 670px 637px 0 1px rgba(225, 235, 255, 0.37), 1277px 1179px 0 2px rgba(225, 235, 255, 0.74), 1624px 1464px 0 1px rgba(225, 235, 255, 0.43), 417px 1427px 0 1px rgba(225, 235, 255, 0.8), 2318px 84px 0 2px rgba(225, 235, 255, 0.53), 1517px 141px 0 1px rgba(225, 235, 255, 0.63), 51px 860px 0 1px rgba(225, 235, 255, 0.83), 1775px 741px 0 2px rgba(225, 235, 255, 0.71), 626px 891px 0 1px rgba(225, 235, 255, 0.41), 2522px 1102px 0 2px rgba(225, 235, 255, 0.8), 1784px 1497px 0 1px rgba(225, 235, 255, 0.69), 1005px 177px 0 2px rgba(225, 235, 255, 0.48), 998px 1536px 0 2px rgba(225, 235, 255, 0.6), 1377px 58px 0 1px rgba(225, 235, 255, 0.62), 744px 998px 0 1px rgba(225, 235, 255, 0.44), 1394px 572px 0 1px rgba(225, 235, 255, 0.87), 2276px 20px 0 1px rgba(225, 235, 255, 0.64), 350px 494px 0 2px rgba(225, 235, 255, 0.77), 2274px 1552px 0 2px rgba(225, 235, 255, 0.46), 2010px 917px 0 1px rgba(225, 235, 255, 0.82), 1205px 453px 0 1px rgba(225, 235, 255, 0.56), 1254px 1359px 0 2px rgba(225, 235, 255, 0.68), 2267px 1087px 0 1px rgba(225, 235, 255, 0.52), 1441px 1439px 0 1px rgba(225, 235, 255, 0.59), 1029px 472px 0 1px rgba(225, 235, 255, 0.38), 1292px 244px 0 1px rgba(225, 235, 255, 0.78), 784px 443px 0 1px rgba(225, 235, 255, 0.78), 2414px 1556px 0 1px rgba(225, 235, 255, 0.64);
  opacity: 0.85;
  animation: starTwinkleSlow 7s ease-in-out infinite alternate;
}

.solar-stage::after {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  box-shadow: 411px 397px 0 1px rgba(225, 235, 255, 0.49), 734px 619px 0 1px rgba(225, 235, 255, 0.31), 1123px 93px 0 1px rgba(225, 235, 255, 0.93), 517px 1306px 0 2px rgba(225, 235, 255, 0.86), 420px 25px 0 2px rgba(225, 235, 255, 0.67), 1960px 902px 0 1px rgba(225, 235, 255, 0.52), 1034px 978px 0 1px rgba(225, 235, 255, 0.37), 1641px 1007px 0 1px rgba(225, 235, 255, 0.35), 621px 305px 0 1px rgba(225, 235, 255, 0.83), 348px 508px 0 2px rgba(225, 235, 255, 0.38), 2483px 1220px 0 1px rgba(225, 235, 255, 0.81), 2140px 779px 0 2px rgba(225, 235, 255, 0.59), 1217px 1205px 0 1px rgba(225, 235, 255, 0.94), 2329px 1271px 0 1px rgba(225, 235, 255, 0.34), 851px 1281px 0 1px rgba(225, 235, 255, 0.44), 643px 491px 0 1px rgba(225, 235, 255, 0.41), 641px 5px 0 2px rgba(225, 235, 255, 0.57), 1192px 66px 0 1px rgba(225, 235, 255, 0.45), 1859px 145px 0 1px rgba(225, 235, 255, 0.75), 2560px 1207px 0 1px rgba(225, 235, 255, 0.73), 1741px 235px 0 1px rgba(225, 235, 255, 0.65), 1088px 291px 0 1px rgba(225, 235, 255, 0.35), 1259px 1218px 0 1px rgba(225, 235, 255, 0.79), 1798px 254px 0 1px rgba(225, 235, 255, 0.6), 1648px 557px 0 2px rgba(225, 235, 255, 0.63), 1793px 164px 0 2px rgba(225, 235, 255, 0.69), 1320px 1236px 0 1px rgba(225, 235, 255, 0.46), 937px 1380px 0 1px rgba(225, 235, 255, 0.84), 1103px 1180px 0 1px rgba(225, 235, 255, 0.33), 1927px 1062px 0 1px rgba(225, 235, 255, 0.72), 743px 1198px 0 2px rgba(225, 235, 255, 0.58), 373px 962px 0 1px rgba(225, 235, 255, 0.53), 1315px 1372px 0 1px rgba(225, 235, 255, 0.37), 1350px 843px 0 1px rgba(225, 235, 255, 0.75), 1640px 1557px 0 2px rgba(225, 235, 255, 0.66), 360px 644px 0 1px rgba(225, 235, 255, 0.46), 1655px 1053px 0 1px rgba(225, 235, 255, 0.84), 2222px 946px 0 1px rgba(225, 235, 255, 0.57), 2123px 740px 0 2px rgba(225, 235, 255, 0.7), 1810px 1556px 0 1px rgba(225, 235, 255, 0.33), 2249px 268px 0 2px rgba(225, 235, 255, 0.9), 1985px 248px 0 1px rgba(225, 235, 255, 0.32), 648px 636px 0 2px rgba(225, 235, 255, 0.66), 381px 460px 0 1px rgba(225, 235, 255, 0.94), 1890px 240px 0 1px rgba(225, 235, 255, 0.72), 2041px 1467px 0 1px rgba(225, 235, 255, 0.49), 1701px 988px 0 1px rgba(225, 235, 255, 0.94), 1870px 1128px 0 1px rgba(225, 235, 255, 0.39), 2455px 1040px 0 1px rgba(225, 235, 255, 0.79), 285px 565px 0 2px rgba(225, 235, 255, 0.8), 1392px 1039px 0 1px rgba(225, 235, 255, 0.47), 1158px 1486px 0 2px rgba(225, 235, 255, 0.49), 608px 914px 0 1px rgba(225, 235, 255, 0.65), 1361px 1130px 0 2px rgba(225, 235, 255, 0.8), 1865px 659px 0 1px rgba(225, 235, 255, 0.87), 2342px 784px 0 2px rgba(225, 235, 255, 0.45), 178px 651px 0 2px rgba(225, 235, 255, 0.78), 1581px 1359px 0 1px rgba(225, 235, 255, 0.82), 2028px 75px 0 1px rgba(225, 235, 255, 0.38), 411px 901px 0 2px rgba(225, 235, 255, 0.36);
  opacity: 0.9;
  animation: starTwinkleFast 4.5s ease-in-out infinite alternate;
}

.vector-mode .solar-stage::before,
.vector-mode .solar-stage::after {
  display: none;
}

@keyframes starTwinkleSlow {
  0% { opacity: 0.55; }
  50% { opacity: 0.9; }
  100% { opacity: 0.65; }
}

@keyframes starTwinkleFast {
  0% { opacity: 0.65; }
  50% { opacity: 1.0; }
  100% { opacity: 0.65; }
}

/* Solar Container: Centered coordinate root scaled at 144Hz via JS transform */
.solar-container {
  position: absolute;
  top: calc(50% - 18px);
  left: 50%;
  width: 0;
  height: 0;
  overflow: visible;
  transform-origin: 0 0;
  z-index: 2;
}

/* SVG Keplerian Orbit Paths (Pure geometry, zero fill) */
.solar-orbits-svg {
  position: absolute;
  margin: 0;
  pointer-events: none;
  overflow: visible;
  z-index: 5;
}

.solar-orbits-svg * {
  fill: none;
}

.orbit-path {
  stroke: rgba(0, 245, 212, 0.22);
  stroke-width: 1.2px;
  stroke-dasharray: 4 6;
  transition: stroke 0.3s ease, stroke-width 0.3s ease, filter 0.3s ease;
}

.orbit-path.hovered,
.orbit-path.highlighted {
  stroke: var(--nomai-cyan);
  stroke-width: 2px;
  stroke-dasharray: none;
  filter: drop-shadow(0 0 8px rgba(0, 245, 212, 0.8));
}

.orbit-path.orbit-interloper {
  stroke: rgba(0, 210, 255, 0.32);
  stroke-dasharray: 6 8;
  stroke-width: 1.4px;
}

.orbit-path.orbit-interloper.hovered,
.orbit-path.orbit-interloper.highlighted {
  stroke: #00f0ff;
  stroke-width: 2.2px;
  stroke-dasharray: none;
  filter: drop-shadow(0 0 12px rgba(0, 240, 255, 0.9));
}

.quantum-orbit-ring {
  stroke: rgba(0, 245, 212, 0.4);
  stroke-width: 1px;
  stroke-dasharray: 2 4;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

/* Celestial Bodies (Planets, Moon, Sun) */
.planet-node {
  position: absolute;
  top: 0;
  left: 0;
  width: var(--planet-size, 40px);
  height: var(--planet-size, 40px);
  margin-left: calc(-0.5 * var(--planet-size, 40px));
  margin-top: calc(-0.5 * var(--planet-size, 40px));
  cursor: pointer;
  z-index: 10;
  will-change: transform;
  transform: translateZ(0);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.planet-node.sun-node {
  z-index: 20;
}

.planet-node.selected {
  z-index: 35;
}

.planet-node:hover .planet-sprite-wrap {
  transform: scale(1.28);
  filter: drop-shadow(0 0 20px var(--glow-color, rgba(255, 255, 255, 0.85)));
}

.planet-node.selected .planet-sprite-wrap {
  transform: scale(1.35);
  filter: drop-shadow(0 0 25px var(--glow-color, rgba(255, 255, 255, 0.85))) drop-shadow(0 0 10px rgba(255, 255, 255, 0.7));
}

.planet-sprite-wrap {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  transform-origin: center center;
  transition: transform 0.18s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform, opacity;
}

.mode-switching .planet-sprite-wrap {
  transform: scale(0);
  opacity: 0;
}

.planet-texture {
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  transform-origin: center center;
  will-change: transform;
  transform: translateZ(0);
  image-rendering: -webkit-optimize-contrast;
}

/* Starlight Planet Labels */
.planet-tag {
  position: absolute;
  top: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: none;
  border: none;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  padding: 0;
  color: #f1f5f9;
  font-family: inherit;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.5px;
  white-space: nowrap;
  pointer-events: none;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.95), 0 0 8px rgba(0, 0, 0, 0.8), 0 0 6px var(--glow-color, rgba(255, 255, 255, 0.4));
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.planet-node:hover .planet-tag,
.planet-node.selected .planet-tag {
  background: none;
  border: none;
  box-shadow: none;
  color: #ffffff;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.95), 0 0 10px var(--glow-color, rgba(255, 255, 255, 0.85));
}

/* Eye of the Universe (Spatial Anchor & Cosmic Aura) */
.eye-universe-anchor {
  position: absolute;
  left: -380px;
  top: -230px;
  width: 160px;
  height: 125px;
  margin-left: -80px;
  margin-top: -62px;
  z-index: 4;
  pointer-events: auto;
  cursor: default;
  filter: drop-shadow(0 0 18px rgba(168, 85, 247, 0.85)) drop-shadow(0 0 40px rgba(147, 51, 234, 0.6)) drop-shadow(0 0 65px rgba(126, 34, 206, 0.35));
  animation: eyePulse 6s ease-in-out infinite alternate;
  transition: filter 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.eye-universe-anchor:hover {
  filter: drop-shadow(0 0 25px rgba(192, 132, 252, 0.95)) drop-shadow(0 0 55px rgba(147, 51, 234, 0.8));
}

.eye-universe-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.mode-switching .eye-universe-anchor {
  transform: scale(0);
  opacity: 0;
  pointer-events: none;
}

.eye-universe-anchor::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 950px;
  height: 950px;
  margin-top: -475px;
  margin-left: -475px;
  border-radius: 50%;
  background: radial-gradient(
    circle at 50% 50%,
    rgba(168, 85, 247, 0.42) 0%,
    rgba(147, 51, 234, 0.22) 30%,
    rgba(107, 33, 168, 0.10) 55%,
    rgba(88, 28, 135, 0.04) 75%,
    transparent 100%
  );
  pointer-events: none;
  z-index: -1;
  filter: blur(25px);
  animation: eyeAuraPulse 7s ease-in-out infinite alternate;
}

@keyframes eyePulse {
  0% {
    filter: drop-shadow(0 0 14px rgba(168, 85, 247, 0.7)) drop-shadow(0 0 32px rgba(147, 51, 234, 0.45));
    opacity: 0.85;
    transform: scale(1);
  }
  50% {
    filter: drop-shadow(0 0 24px rgba(192, 132, 252, 0.95)) drop-shadow(0 0 52px rgba(147, 51, 234, 0.7));
    opacity: 1;
    transform: scale(1.03);
  }
  100% {
    filter: drop-shadow(0 0 14px rgba(168, 85, 247, 0.7)) drop-shadow(0 0 32px rgba(147, 51, 234, 0.45));
    opacity: 0.85;
    transform: scale(1);
  }
}

@keyframes eyeAuraPulse {
  0% { transform: scale(0.92); opacity: 0.75; }
  50% { transform: scale(1.06); opacity: 1; }
  100% { transform: scale(0.92); opacity: 0.75; }
}

/* Top Controls: Mode Switcher, Theme Switcher, Navigation Arrows */
.mode-switch-btn,
.theme-switch-btn {
  position: absolute;
  top: 18px;
  z-index: 60;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 34px;
  line-height: 1;
  gap: 6px;
  padding: 0 14px;
  border-radius: 20px;
  background: var(--control-bg);
  border: 1px solid var(--control-border);
  color: var(--control-text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
  transition: width 0.25s cubic-bezier(0.16, 1, 0.3, 1),
              min-width 0.25s cubic-bezier(0.16, 1, 0.3, 1),
              background 0.2s ease,
              border-color 0.2s ease,
              transform 0.15s ease;
  user-select: none;
  white-space: nowrap;
  box-sizing: border-box;
}

.mode-switch-btn {
  right: 128px;
}

.theme-switch-btn {
  right: calc(var(--drawer-offset-x, 0px) + 24px);
  padding: 0 12px;
  justify-content: flex-start;
  gap: 7px;
  overflow: hidden;
  transition: right 0.32s cubic-bezier(0.16, 1, 0.3, 1),
              width 0.24s cubic-bezier(0.16, 1, 0.3, 1),
              background 0.2s ease,
              border-color 0.2s ease,
              transform 0.15s ease;
}

.theme-switch-btn.theme-mode-system {
  width: 86px;
}

.theme-switch-btn.theme-mode-dark {
  width: 102px;
}

.theme-switch-btn.theme-mode-light {
  width: 108px;
}

.theme-icon-slot {
  width: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 14px;
  transform-origin: center center;
  transition: transform 0.14s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.14s ease;
}

.theme-text-slot {
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.02em;
  transform-origin: left center;
  transition: transform 0.14s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.14s ease;
}

/* Zoom Transition on Theme Toggle */
.theme-switch-btn.theme-switching .theme-icon-slot {
  transform: scale(0);
  opacity: 0;
}

.theme-switch-btn.theme-switching .theme-text-slot {
  transform: scale(0);
  opacity: 0;
}

.mode-switch-btn:hover,
.theme-switch-btn:hover {
  background: var(--control-hover);
  border-color: var(--border-active);
  transform: scale(1.04);
}

/* Navigation Arrows */
.nav-arrow {
  position: absolute;
  top: calc(50% - 18px);
  transform: translateY(-50%);
  z-index: 40;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--control-bg);
  border: 1px solid var(--control-border);
  color: var(--control-text);
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.nav-prev { left: 24px; }
.nav-next {
  right: calc(var(--drawer-offset-x, 0px) + 24px);
  transition: right 0.32s cubic-bezier(0.16, 1, 0.3, 1),
              background 0.2s ease,
              border-color 0.2s ease,
              transform 0.2s ease;
}

.nav-arrow:hover {
  background: var(--control-hover);
  border-color: var(--border-active);
  transform: translateY(-50%) scale(1.1);
}

/* Zero-flash for controls and planetary stage */
.solar-stage,
.solar-container,
.planet-node,
.nav-arrow,
.mode-switch-btn,
.eye-universe-anchor,
.theme-switch-btn {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease-out;
}

body.app-ready .solar-stage,
body.app-ready .solar-container,
body.app-ready .planet-node,
body.app-ready .nav-arrow,
body.app-ready .mode-switch-btn,
body.app-ready .eye-universe-anchor,
body.app-ready .theme-switch-btn {
  opacity: 1;
  pointer-events: auto;
}

/* Touch Dragging & Interactive Sheet Transitions */
.is-dragging,
.is-dragging .planet-drawer,
.is-dragging .nav-arrow {
  transition: none !important;
}

/* Drag handle bar hidden on desktop */
.drawer-drag-handle-bar {
  display: none;
}

/* Floating Frosted Hardware-Accelerated Drawer (Overlay: zero canvas shrinking) */
.planet-drawer {
  position: absolute;
  top: 14px;
  right: 14px;
  width: var(--drawer-width);
  max-width: var(--drawer-width);
  height: calc(100vh - 28px);
  height: calc(100dvh - 28px);
  max-height: calc(100dvh - 28px);
  margin: 0;
  background: rgba(18, 18, 18, 0.82);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-subtle);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
  pointer-events: none;
  visibility: hidden;
  opacity: 0;
  transform: translateX(calc(100% + 24px));
  transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1),
              opacity 0.25s ease,
              border-color 0.25s ease,
              box-shadow 0.25s ease,
              visibility 0.32s;
  will-change: transform, opacity;
  z-index: 70;
}

[data-theme="light"] .planet-drawer {
  background: rgba(255, 255, 255, 0.88);
}

.planet-drawer.open {
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
}

.drawer-inner {
  width: var(--drawer-width);
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 24px;
  overflow: hidden;
}

.drawer-card-enter {
  animation: drawerCardSwap 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes drawerCardSwap {
  from {
    opacity: 0.15;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.drawer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 20px;
}

.drawer-title-group {
  display: flex;
  align-items: center;
  gap: 14px;
}

.drawer-planet-icon {
  width: 38px;
  height: 38px;
  object-fit: contain;
  flex-shrink: 0;
  transition: filter 0.2s ease;
}

[data-theme="light"] .drawer-planet-icon[src$=".svg"],
[data-theme="light"] .vector-mode .drawer-planet-icon {
  filter: brightness(0);
}

.drawer-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.2;
}

.drawer-role {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1.3;
  margin-top: 3px;
}

/* Flat Circular Close Button */
.drawer-close {
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  background: var(--control-bg);
  border: 1px solid var(--control-border);
  color: var(--control-text);
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.drawer-close:hover {
  background: var(--control-hover);
  color: var(--text-primary);
  border-color: var(--border-active);
}

.drawer-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding-right: 4px;
}

.drawer-body::-webkit-scrollbar {
  width: 4px;
}

.drawer-body::-webkit-scrollbar-thumb {
  background: var(--border-subtle);
  border-radius: 2px;
}

.drawer-empty {
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.6;
}

/* Consolidated Responsive Layout (Mobile portrait & tablets) */
@media (max-width: 768px), (orientation: portrait) {
  /* Drag Handle for Mobile Bottom Sheet */
  .drawer-drag-handle-bar {
    width: 100%;
    padding: 8px 0 10px 0;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: grab;
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
  }

  .drawer-drag-pill {
    width: 42px;
    height: 4.5px;
    border-radius: 3px;
    background: var(--border-active);
    opacity: 0.65;
    transition: opacity 0.2s ease, transform 0.2s ease;
  }

  .drawer-drag-handle-bar:active .drawer-drag-pill {
    opacity: 0.95;
    transform: scaleX(1.1);
  }

  /* Nav Arrows on mobile: reactive SSOT to --sheet-height */
  .nav-arrow {
    display: flex !important;
    position: absolute !important;
    top: calc((100dvh - var(--sheet-height, 0px)) / 2) !important;
    transform: translateY(-50%) !important;
    z-index: 45 !important;
    width: 38px !important;
    height: 38px !important;
    font-size: 22px !important;
    transition: top 0.32s cubic-bezier(0.16, 1, 0.3, 1),
                opacity 0.25s ease,
                transform 0.2s ease,
                background 0.2s ease;
  }

  .sheet-expanded .nav-arrow,
  .sheet-expanded .theme-switch-btn,
  .sheet-expanded .mode-switch-btn {
    opacity: 0 !important;
    pointer-events: none !important;
  }

  .nav-prev {
    left: 10px !important;
  }

  .nav-next {
    right: 10px !important;
  }

  .mode-switch-btn {
    top: 12px;
    right: 106px;
    padding: 6px 10px;
    font-size: 12px;
  }

  .theme-switch-btn {
    top: 12px;
    right: 12px;
    height: 30px;
    padding: 0 9px;
    font-size: 11.5px;
    gap: 5px;
  }

  .theme-switch-btn.theme-mode-system {
    width: 76px;
  }

  .theme-switch-btn.theme-mode-dark {
    width: 90px;
  }

  .theme-switch-btn.theme-mode-light {
    width: 96px;
  }

  /* Native Mobile Bottom Sheet (Zero horizontal/bottom margins, pinned to screen base) */
  .planet-drawer {
    position: absolute;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100vw;
    max-width: 100vw;
    height: var(--sheet-height, 48dvh);
    max-height: 100dvh;
    margin: 0;
    border-radius: 20px 20px 0 0;
    border: 1px solid var(--border-subtle);
    border-bottom: none;
    border-left: none;
    border-right: none;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.6);
    transform: translateY(100%);
    opacity: 0;
    transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1),
                height 0.32s cubic-bezier(0.16, 1, 0.3, 1),
                opacity 0.2s ease,
                visibility 0.32s;
    will-change: transform, height;
    z-index: 70;
  }

  .planet-drawer.open {
    height: var(--sheet-height, 48dvh);
    max-height: 100dvh;
    width: 100vw;
    margin: 0;
    padding-bottom: 0;
    border-top: 1px solid var(--border-active);
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
    visibility: visible;
  }

  .drawer-inner {
    width: 100%;
    padding: 16px 20px 0 20px;
    box-sizing: border-box;
  }

  .drawer-body {
    padding-bottom: max(48px, env(safe-area-inset-bottom, 36px));
    -webkit-overflow-scrolling: touch;
  }
}

/* Ship Log / Outer Wilds Clean Content System */
.planet-content-flow {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.content-card {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color 0.18s ease, background 0.18s ease;
}

.content-card:hover {
  border-color: var(--border-active);
  background: rgba(255, 255, 255, 0.02);
}

[data-theme="light"] .content-card:hover {
  background: rgba(0, 0, 0, 0.02);
}

.content-card-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.content-card-title {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.content-card-subtitle {
  font-size: 0.8rem;
  line-height: 1.4;
  color: var(--text-muted);
}

.content-card-desc {
  font-size: 0.83rem;
  line-height: 1.5;
  color: var(--text-secondary);
}

.content-badge {
  font-size: 0.68rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.03);
  white-space: nowrap;
}

.content-card-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 2px;
}

.content-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-primary);
  text-decoration: none;
  background: none;
  border: none;
  padding: 0;
  transition: opacity 0.15s ease;
}

.content-link-btn::after {
  content: '↗';
  font-size: 0.85em;
  opacity: 0.7;
}

.content-link-btn:hover {
  opacity: 0.8;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.section-divider-title {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 10px;
  margin-bottom: 2px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border-subtle);
}

/* Vessel Mural (Secret Expedition Artifact) */
.vessel-mural-card {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1000 / 333;
  margin: 4px 0 14px 0;
  border-radius: 6px;
  overflow: hidden;
  border: none;
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
  contain: layout paint;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.vessel-mural-card:hover {
  opacity: 0.95;
  transform: scale(1.01);
}

.vessel-mural-img {
  width: 100%;
  height: 100%;
  aspect-ratio: 1000 / 333;
  display: block;
  object-fit: cover;
  opacity: 0.82;
  border-radius: 6px;
  transition: opacity 0.2s ease, filter 0.2s ease;
}

.vessel-mural-card:hover .vessel-mural-img {
  opacity: 1;
  filter: brightness(1.06);
}

.interactive-drill-card {
  cursor: pointer;
}

.interactive-drill-card:hover {
  border-color: var(--border-active);
  transform: none;
}

.subroute-nav {
  margin-bottom: 8px;
}

.subroute-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  font-size: 0.78rem;
  color: var(--text-secondary);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.subroute-back-btn:hover { color: #c084fc; border-color: rgba(168, 85, 247, 0.4); }

/* 2D Mode Celestial Rationale Card (Eye of the Universe Cosmic Violet) */
.vector-rationale-card {
  background: rgba(147, 51, 234, 0.06);
  border: 1px solid rgba(168, 85, 247, 0.28);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  animation: rationaleFade 0.25s ease-out;
}

[data-theme="light"] .vector-rationale-card {
  background: rgba(147, 51, 234, 0.04);
  border-color: rgba(147, 51, 234, 0.22);
}

@keyframes rationaleFade {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.vector-rationale-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.vector-rationale-tag {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #c084fc;
}

[data-theme="light"] .vector-rationale-tag {
  color: #7e22ce;
}

.vector-rationale-icon {
  font-size: 0.85rem;
  color: #c084fc;
  opacity: 0.8;
}

[data-theme="light"] .vector-rationale-icon {
  color: #7e22ce;
}

.vector-rationale-text {
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--text-secondary);
}

@keyframes rationaleFade {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.vector-rationale-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.vector-rationale-tag {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.85);
}

.vector-rationale-icon {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.85);
  opacity: 0.7;
}

.vector-rationale-text {
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--text-primary);
  opacity: 0.92;
}
