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

html, body { 
  width: 100%; height: 100%; background: #050505; color: #fff;
  font-family: 'Outfit', -apple-system, sans-serif;
  overflow: hidden; 
}

#stage { 
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; 
}

#video { 
  transform: scaleX(-1); width: 100%; height: 100%; object-fit: cover; 
  opacity: 0.7; /* 稍微暗一點讓 UI 更跳出 */
  filter: contrast(1.1) saturate(1.2);
}

#canvas, #particles-canvas { 
  position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; 
}

/* Glassmorphism Classes */
.glass-panel {
  background: rgba(15, 15, 20, 0.65);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  border-radius: 40px;
}

.glass-overlay {
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.glass-btn {
  color: #fff;
  border-radius: 40px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* Start Screen */
#start-screen { 
  position: fixed; inset: 0; 
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  z-index: 30; 
}

.start-content {
  text-align: center;
  padding: 50px 70px;
  border-radius: 32px;
  background: rgba(20, 20, 25, 0.5);
  backdrop-filter: blur(30px);
  border: 1px solid rgba(255,255,255,0.1);
  box-shadow: 0 30px 60px rgba(0,0,0,0.5);
}

h1 { font-size: 64px; font-weight: 200; letter-spacing: 6px; margin-bottom: 24px;}
h1 span { font-weight: 600; background: linear-gradient(135deg, #4a9eff, #b87aff); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }

.desc { opacity: 0.8; max-width: 520px; line-height: 1.8; font-size: 18px; margin-bottom: 40px; font-weight: 300;}
.desc b { color: #4a9eff; font-weight: 500; }

/* Premium Start Button */
#start-btn { 
  padding: 18px 60px; font-size: 22px; font-family: 'Outfit', sans-serif; font-weight: 600;
  letter-spacing: 2px; 
  background: linear-gradient(135deg, rgba(74, 158, 255, 0.2), rgba(184, 122, 255, 0.2));
  border: 1px solid rgba(255,255,255,0.3);
  box-shadow: 0 8px 32px rgba(74, 158, 255, 0.2), inset 0 1px 0 rgba(255,255,255,0.2);
}
#start-btn:hover { 
  transform: scale(1.05) translateY(-2px); 
  background: linear-gradient(135deg, rgba(74, 158, 255, 0.4), rgba(184, 122, 255, 0.4));
  border-color: rgba(255,255,255,0.5);
  box-shadow: 0 12px 40px rgba(74, 158, 255, 0.4), inset 0 1px 0 rgba(255,255,255,0.4); 
}
#start-btn:disabled { opacity: 0.5; cursor: wait; transform: none; box-shadow: none; }

/* HUD */
#hud { 
  position: fixed; top: 24px; right: 24px; 
  padding: 20px 24px; font-size: 14px; line-height: 1.8; z-index: 10; 
  display: flex; flex-direction: column; gap: 12px;
  min-width: 240px; border-radius: 24px;
}
.hud-item { display: flex; align-items: center; gap: 10px; font-weight: 400; color: rgba(255,255,255,0.8);}
.hud-icon { font-size: 18px; filter: drop-shadow(0 0 8px rgba(255,255,255,0.2)); }
.hud-value { font-family: "SF Mono", Menlo, monospace; font-weight: 600; margin-left: auto; color: #4a9eff; text-shadow: 0 0 10px rgba(74,158,255,0.3);}

.progress-bar {
  flex: 1; height: 6px; background: rgba(0,0,0,0.3); border-radius: 3px;
  overflow: hidden; margin: 0 8px; position: relative;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.5);
}
.progress-fill {
  height: 100%; background: linear-gradient(90deg, #4a9eff, #7adeff); width: 0%; transition: width 0.1s ease-out;
  box-shadow: 0 0 10px #4a9eff;
}
#pinch-bar { background: linear-gradient(90deg, #b87aff, #e0aaff); box-shadow: 0 0 10px #b87aff;}

/* Note Display */
#note-display { 
  position: fixed; top: 50%; left: 50%;
  transform: translate(-50%, -50%); font-size: 260px; font-weight: 200;
  color: rgba(255, 255, 255, 0.1); pointer-events: none; z-index: 5; letter-spacing: -12px;
  text-shadow: 0 0 60px rgba(74, 158, 255, 0.15);
}

/* Premium Controls Bar */
#controls { 
  position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%);
  padding: 16px 32px; 
  display: flex; gap: 24px; align-items: center; z-index: 10;
  font-size: 15px; font-weight: 500;
}
#controls label { 
  display: flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; 
  color: rgba(255, 255, 255, 0.85);
  transition: color 0.2s;
  white-space: nowrap;
}
#controls label:hover { color: #fff; }

/* Premium Select Menus */
#controls select { 
  appearance: none; -webkit-appearance: none;
  background: rgba(255, 255, 255, 0.05); 
  color: #fff; 
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 10px 36px 10px 16px; 
  border-radius: 20px; font-size: 14px; font-family: 'Outfit';
  font-weight: 500;
  outline: none; cursor: pointer;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  /* Custom Arrow SVG */
  background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23FFFFFF%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 10px auto;
}
#controls select:hover, #controls select:focus { 
  background-color: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.3);
  box-shadow: 0 4px 16px rgba(74, 158, 255, 0.2);
}
#controls select option { background: #1a1a1a; color: #fff; }

/* Premium Toggle Switches */
.toggle-group { 
  display: flex; gap: 20px; 
  border-left: 1px solid rgba(255,255,255,0.1); 
  border-right: 1px solid rgba(255,255,255,0.1); 
  padding: 0 24px;
}

#controls input[type="checkbox"] {
  appearance: none; -webkit-appearance: none;
  width: 44px; height: 24px;
  background: rgba(255,255,255,0.1);
  border-radius: 12px;
  position: relative;
  cursor: pointer;
  outline: none;
  border: 1px solid rgba(255,255,255,0.1);
  transition: all 0.3s ease;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.3);
}
#controls input[type="checkbox"]::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 18px; height: 18px;
  background: #fff;
  border-radius: 50%;
  transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
#controls input[type="checkbox"]:checked {
  background: #4a9eff;
  border-color: #4a9eff;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.1), 0 0 12px rgba(74, 158, 255, 0.4);
}
#controls input[type="checkbox"]:checked::after {
  transform: translateX(20px);
}

/* Portrait Warning */
#portrait-warning {
  position: fixed; inset: 0; background: #050505; color: #fff;
  display: none; flex-direction: column; align-items: center; justify-content: center;
  gap: 24px; z-index: 100; padding: 40px; text-align: center;
}
#portrait-warning .icon { font-size: 72px; animation: rotate-hint 2s ease-in-out infinite; color: #4a9eff; filter: drop-shadow(0 0 12px rgba(74,158,255,0.4));}
@keyframes rotate-hint { 0%, 100% { transform: rotate(-90deg); } 50% { transform: rotate(0deg); } }

@media (max-width: 1100px) {
  #controls { padding: 12px 20px; gap: 16px; font-size: 13px; border-radius: 24px; flex-wrap: wrap; justify-content: center; width: 92%; bottom: 20px;}
  #controls select { padding: 8px 30px 8px 12px; font-size: 13px; }
  .toggle-group { padding: 0 12px; gap: 12px; }
  #hud { min-width: 200px; padding: 16px; top: 16px; right: 16px;}
  h1 { font-size: 48px; }
  #note-display { font-size: 180px; }
}
@media (orientation: portrait) and (max-width: 900px) {
  #portrait-warning { display: flex; }
}

#tap-btn {
  display: none; padding: 10px 20px; font-size: 15px; font-weight: 600; font-family: 'Outfit';
  background: linear-gradient(135deg, #4a9eff, #b87aff); color: #fff; border: none; border-radius: 20px;
  cursor: pointer; transition: all 0.2s; box-shadow: 0 4px 12px rgba(74,158,255,0.4);
  white-space: nowrap;
}
#tap-btn:active { transform: scale(0.9); }
#tap-btn.visible { display: block; }
