:root {
  --glass: rgba(38, 38, 44, 0.62);
  --glass-strong: rgba(30, 30, 36, 0.82);
  --stroke: rgba(255, 255, 255, 0.16);
  --text: #fff;
  --text2: rgba(255, 255, 255, 0.62);
  --accent: #0a84ff;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #101014; color: var(--text); overflow: hidden;
  font-family: -apple-system, "SF Pro Display", "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", "Helvetica Neue", Arial, sans-serif; }
#stage, #stage canvas { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.hidden { display: none !important; }
.overlay { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 10; }
#landing { background: radial-gradient(ellipse at 50% 30%, rgba(20, 24, 36, 0.35), rgba(8, 8, 12, 0.75)); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); overflow-y: auto; align-items: flex-start; }
.card { width: min(860px, 100%); margin: auto; background: var(--glass); border: 1px solid var(--stroke); border-radius: 40px; padding: 32px 36px;
  backdrop-filter: blur(40px) saturate(1.4); -webkit-backdrop-filter: blur(40px) saturate(1.4); box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.25); }
.brand { display: flex; align-items: center; gap: 18px; margin-bottom: 18px; }
.logo { width: 72px; height: 46px; border-radius: 23px; background: linear-gradient(135deg, #a0c4ff, #5e5ce6); display: flex; align-items: center; justify-content: space-around; padding: 0 10px; box-shadow: 0 8px 24px rgba(94, 92, 230, 0.5); }
.logo span { width: 16px; height: 16px; border-radius: 50%; background: rgba(255, 255, 255, 0.85); }
h1 { margin: 0; font-size: 40px; letter-spacing: -0.5px; }
.sub { margin: 2px 0 0; color: var(--text2); font-size: 17px; }
h2 { font-size: 15px; font-weight: 600; color: var(--text2); text-transform: uppercase; letter-spacing: 1px; margin: 22px 0 12px; }
.env-row { display: flex; gap: 14px; overflow-x: auto; padding: 4px 2px 10px; scrollbar-width: thin; }
.env-tile { flex: 0 0 auto; background: none; border: 0; color: var(--text); display: flex; flex-direction: column; align-items: center; gap: 8px; cursor: pointer; padding: 0; font: inherit; font-size: 14px; }
.env-tile .thumb { width: 96px; height: 96px; border-radius: 50%; background: #333 center/cover; border: 3px solid transparent; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4); transition: transform .15s, border-color .15s; display: flex; align-items: center; justify-content: center; }
.env-tile .thumb.real { background: linear-gradient(#9aa7b4, #5d6a77); }
.env-tile .thumb svg { width: 44px; height: 44px; }
.env-tile:hover .thumb { transform: scale(1.06); }
.env-tile.selected .thumb { border-color: #fff; }
.hint { color: var(--text2); font-size: 14px; line-height: 1.6; margin: 8px 0 0; }
.hint.small { font-size: 13px; min-height: 1em; }
.modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 24px; }
.mode { border: 1px solid var(--stroke); background: rgba(255, 255, 255, 0.1); color: var(--text); border-radius: 26px; padding: 18px 14px; cursor: pointer; text-align: center; font: inherit; transition: background .15s, transform .1s; }
.mode strong { display: block; font-size: 19px; }
.mode small { display: block; color: var(--text2); margin-top: 4px; font-size: 13px; }
.mode:hover:not(:disabled) { background: rgba(255, 255, 255, 0.2); }
.mode:active:not(:disabled) { transform: scale(0.98); }
.mode.primary:not(:disabled) { background: var(--accent); border-color: transparent; }
.mode.primary:not(:disabled) small { color: rgba(255, 255, 255, 0.8); }
.mode:disabled { opacity: 0.4; cursor: not-allowed; }
details { margin-top: 22px; border-top: 1px solid var(--stroke); padding-top: 14px; }
summary { cursor: pointer; color: var(--text2); font-size: 15px; }
.help { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px 22px; margin-top: 12px; font-size: 14px; color: rgba(255, 255, 255, 0.85); }
.help ul { margin: 6px 0 0; padding-left: 18px; line-height: 1.7; }
#hud { position: fixed; top: 14px; right: 14px; display: flex; gap: 8px; z-index: 5; flex-wrap: wrap; justify-content: flex-end; max-width: calc(100% - 28px); }
#hud button { border: 1px solid var(--stroke); background: var(--glass); color: #fff; border-radius: 999px; padding: 9px 16px; font: inherit; font-size: 14px; cursor: pointer; backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); }
#hud button:hover { background: rgba(80, 80, 90, 0.75); }
#hud button.accent { background: var(--accent); border-color: transparent; }
#drop { position: fixed; inset: 0; z-index: 20; background: rgba(10, 132, 255, 0.18); border: 4px dashed rgba(255, 255, 255, 0.7); display: flex; align-items: center; justify-content: center; font-size: 28px; font-weight: 600; pointer-events: none; }
#loading { background: #101014; z-index: 30; }
.spinner { width: 44px; height: 44px; border-radius: 50%; border: 4px solid rgba(255, 255, 255, 0.2); border-top-color: #fff; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (max-width: 640px) {
  .card { padding: 22px 18px; border-radius: 28px; }
  h1 { font-size: 30px; }
  .modes { grid-template-columns: 1fr; }
  #hud button { padding: 7px 12px; font-size: 13px; }
}
