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

body, html {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: #08080c;
  font-family: 'Space Grotesk', sans-serif;
  color: #1a1a1a;
}

#webgl-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

/* Fullscreen Macintosh UI Viewport */
#mac-os {
  position: absolute;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 20;
  opacity: 0;
  pointer-events: none;
  background: #eae4d5;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: opacity 0.8s ease-in-out;
}

#mac-os.active {
  opacity: 1;
  pointer-events: all;
}

#desktop-area {
  touch-action: none; /* 防止手機拖動按鈕時觸發頁面的預設滾動行為 */
  user-select: none;  /* 防止拖動時誤選中文字 */
}

/* Viewport Scanline Overlay */
.crt-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 100;
  background: 
    linear-gradient(
      to bottom,
      rgba(255, 250, 235, 0.05) 50%, 
      rgba(30, 25, 20, 0.04) 50%      
    ),
    radial-gradient(ellipse at center, transparent 75%, rgba(0, 0, 0, 0.08) 100%);
  
  background-size: 100% 3px, 100% 100%;
  
  animation: flicker 0.25s infinite alternate;
}

.crt-overlay::after {
  content: "";
  position: absolute;
  top: -10%; left: -10%; 
  width: 120%; height: 120%;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.06) 0%, rgba(255, 255, 255, 0.01) 35%, transparent 60%);
  pointer-events: none;
}

@keyframes flicker {
  0% { opacity: 0.97; }
  100% { opacity: 1; }
}

@keyframes mac-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(0, 0, 0, 0.4), 2px 2px 0px #000;
  }
  70% {
    box-shadow: 0 0 0 15px rgba(0, 0, 0, 0), 2px 2px 0px #000;
  }
  100% {
    box-shadow: 0 0 0 0 rgba(0, 0, 0, 0), 2px 2px 0px #000;
  }
}

/* System Menu Bar */
.menu-bar {
  height: 32px;
  background: #ffffff;
  border-bottom: 2px solid #000;
  display: flex;
  align-items: center;
  padding: 0 10px;
  font-family: 'VT323', monospace;
  font-size: 1.1rem;
  justify-content: space-between;
  z-index: 30;
}

.menu-left, .menu-right {
  display: flex;
  gap: 20px;
  align-items: center;
}

.menu-item:hover {
  background: #000;
  color: #fff;
  padding: 0 4px;
  cursor: pointer;
}

/* Main Desktop Workspace */
.desktop {
  flex: 1;
  position: relative;
  padding: 32px;
  display: flex;
  justify-content: center;
  align-items: center;
  background-image: radial-gradient(#9d978a 1px, transparent 1px);
  background-size: 16px 16px;
  z-index: 2;
  overflow: hidden;
}

.circle-btn.center-btn {
  width: 80px;          
  height: 80px;
  margin-left: -40px;    
  margin-top: -40px;    
  border-width: 3px;    
  z-index: 10;
  animation: mac-pulse 2s infinite ease-in-out;
}
.circle-btn.center-btn:hover {
  animation: none;
  background: #000000;
  color: #ffffff;
  box-shadow: 5px 5px 0px rgba(0, 0, 0, 0.35);
}
.circle-btn.center-btn .icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
}
.circle-btn .icon svg {
  fill: currentColor;
  width: 100%;
  height: 100%;
}

.circle-btn.label-bottom .label {
  top: 72px;
  left: 50%;
  right: auto;
  transform: translateX(-50%);
}

.floating-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 5;
}

/* Compact Lightweight Circular Button */
.circle-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  margin-left: -28px;
  margin-top: -28px;
  pointer-events: auto;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #ffffff;
  border: 2px solid #000;
  box-shadow: 2px 2px 0px #000;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease, z-index 0.15s ease;
  will-change: transform;
  z-index: 5;
}

.circle-btn:hover {
  background: #000;
  color: #fff;
  box-shadow: 4px 4px 0px rgba(0, 0, 0, 0.35);
  z-index: 25;
}

.circle-btn .icon {
  font-size: 1.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Adaptive Side Label with Hover Display */
.circle-btn .label {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  white-space: nowrap;
  font-size: 0.8rem;
  font-weight: 600;
  color: rgba(20, 20, 20, 0.85);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(4px);
  padding: 3px 8px;
  border-radius: 10px;
  border: 1px solid rgba(0, 0, 0, 0.15);
  pointer-events: none;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  opacity: 0;
  visibility: hidden;
}

.circle-btn.label-right .label {
  left: 62px;
  right: auto;
}

.circle-btn.label-left .label {
  right: 62px;
  left: auto;
}

.circle-btn:hover .label {
  color: #ffffff;
  background: #000000;
  border-color: #000000;
  opacity: 1;
  visibility: visible;
}

/* Desktop Window Modal */
.window-content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.95);
  width: 95%;
  max-width: 820px;
  max-height: 85vh;
  background: #ffffff;
  border: 3px solid #000;
  box-shadow: 8px 8px 0px #000;
  padding: 12px 10px 12px 10px;
  z-index: 30;
  
  display: none;        
  pointer-events: none; 
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
@media (max-width: 768px) {
  .window-container {
    height: auto;          /* Let content dictate height */
    min-height: unset;     /* Remove 100vh constraints */
    margin: 20px auto;     /* Center vertically with margin */
    width: 90%;            /* Give it room on small screens */
  }
}

.window-content.active {
  display: flex;         
  flex-direction: column;
  overflow: hidden;     
  pointer-events: auto;  
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.window-header {
  flex-shrink: 0;        
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid #000;
  padding-bottom: 10px;
  margin-bottom: 14px;
}

.window-close-btn {
  background: #000;
  color: #fff;
  border: none;
  padding: 4px 12px;
  font-family: 'VT323', monospace;
  font-size: 1.1rem;
  cursor: pointer;
}

.window-close-btn:hover {
  background: #d93838;
}

.page-title {
  font-size: 1.8rem;
  margin-bottom: 12px;
  border-bottom: 2px solid #000;
  padding-bottom: 6px;
}

.page-body {
  font-size: 1.05rem;
  line-height: 1.6;
  color: #222;
}

#pages-container {
  flex: 1;
  min-height: 0;         
  overflow-y: auto;      
  padding-right: 10px;   
}

.floating-container.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none; /* 徹底禁用滑鼠互動 */
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

/* Retro Select Dropdown Styling */
.retro-select {
  background: #ffffff;
  border: 2px solid #000000;
  color: #000000;
  font-family: 'VT323', monospace;
  font-size: 1.1rem;
  font-weight: bold;
  padding: 1px 6px;
  cursor: pointer;
  outline: none;
  border-radius: 0;
  box-shadow: 2px 2px 0px #000;
  transition: all 0.1s ease;
}

.retro-select:hover {
  background: #000000;
  color: #ffffff;
}

.retro-select option {
  background: #ffffff;
  color: #000000;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.9rem;
}