/* 全景虛擬舞台劇場 · 樣式 */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0a0a14;
  --panel: rgba(18, 18, 32, 0.85);
  --panel-border: rgba(120, 120, 200, 0.25);
  --accent: #7c5cff;
  --accent-2: #ff5c8a;
  --text: #e8e8f4;
  --text-dim: #9090a8;
  --good: #5cff9c;
  --warn: #ffc55c;
  --bad: #ff5c5c;
}

html, body {
  height: 100%;
  width: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, "PingFang TC", "Microsoft JhengHei", "Helvetica Neue", Arial, sans-serif;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

#app { position: relative; width: 100vw; height: 100vh; }

#scene {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
}
#scene:active { cursor: grabbing; }

/* 頂部資訊列 */
#topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  padding: 14px 20px;
  background: linear-gradient(180deg, rgba(10, 10, 20, 0.85) 0%, rgba(10, 10, 20, 0) 100%);
  display: flex;
  justify-content: space-between;
  align-items: center;
  pointer-events: none;
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand .logo {
  font-size: 32px;
  filter: drop-shadow(0 0 8px var(--accent));
}
.brand h1 {
  font-size: 18px;
  font-weight: 600;
  background: linear-gradient(135deg, #fff 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.brand p {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 2px;
}

.status {
  pointer-events: auto;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.status.loading { color: var(--warn); border-color: var(--warn); }
.status.ready { color: var(--good); border-color: var(--good); }
.status.error { color: var(--bad); border-color: var(--bad); }

/* 左側面板 */
#sidebar {
  position: absolute;
  top: 80px;
  left: 16px;
  bottom: 16px;
  width: 280px;
  z-index: 5;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--accent) transparent;
}
#sidebar::-webkit-scrollbar { width: 6px; }
#sidebar::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 3px; }

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 12px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.panel h2 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text);
}

.hint {
  font-size: 11px;
  color: var(--text-dim);
  margin-bottom: 10px;
  line-height: 1.4;
}

.presets {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 10px;
}

.preset {
  background: rgba(124, 92, 255, 0.1);
  border: 1px solid rgba(124, 92, 255, 0.3);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}
.preset:hover {
  background: rgba(124, 92, 255, 0.25);
  border-color: var(--accent);
  transform: translateY(-1px);
}
.preset.active {
  background: var(--accent);
  color: white;
}

.upload {
  display: block;
  cursor: pointer;
  background: rgba(255, 92, 138, 0.08);
  border: 1.5px dashed rgba(255, 92, 138, 0.4);
  border-radius: 10px;
  padding: 12px;
  text-align: center;
  font-size: 12px;
  color: var(--text);
  transition: all 0.2s;
}
.upload:hover {
  background: rgba(255, 92, 138, 0.18);
  border-color: var(--accent-2);
}
.upload input { display: none; }

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
}
.action {
  background: rgba(92, 255, 156, 0.08);
  border: 1px solid rgba(92, 255, 156, 0.3);
  color: var(--text);
  padding: 10px 4px;
  border-radius: 8px;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}
.action:hover {
  background: rgba(92, 255, 156, 0.2);
  border-color: var(--good);
  transform: translateY(-1px);
}
.action.active {
  background: var(--good);
  color: #0a0a14;
  font-weight: 600;
}

.row {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}
.row button {
  flex: 1;
  background: rgba(124, 92, 255, 0.15);
  border: 1px solid rgba(124, 92, 255, 0.4);
  color: var(--text);
  padding: 8px;
  border-radius: 8px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}
.row button:hover {
  background: var(--accent);
  border-color: var(--accent);
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
  width: 100%;
}
.check input { accent-color: var(--accent); }

.slider-row {
  margin-bottom: 10px;
}
.slider-row label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  margin-bottom: 4px;
  color: var(--text-dim);
}
.slider-row label::after {
  content: attr(data-value);
  color: var(--accent);
  font-weight: 600;
}
input[type="range"] {
  width: 100%;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  box-shadow: 0 0 8px var(--accent);
}

/* HUD 操作提示 */
#hud {
  position: absolute;
  bottom: 16px;
  right: 16px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 11px;
  color: var(--text-dim);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 5;
}
.hud-row { margin: 3px 0; }
kbd {
  display: inline-block;
  padding: 1px 6px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  font-family: ui-monospace, monospace;
  font-size: 10px;
  color: var(--text);
  margin-right: 4px;
}

/* 載入動畫 */
#loader {
  position: absolute;
  inset: 0;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  z-index: 100;
  transition: opacity 0.6s;
}
#loader.hidden { opacity: 0; pointer-events: none; }

.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(124, 92, 255, 0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

#loaderText {
  font-size: 13px;
  color: var(--text-dim);
}

/* 響應式 */
@media (max-width: 720px) {
  #sidebar {
    width: calc(100vw - 32px);
    max-height: 40vh;
    top: auto;
    bottom: 16px;
  }
  .brand p { display: none; }
  .brand h1 { font-size: 14px; }
  #topbar { padding: 10px 14px; }
}
