:root {
  --bg-deep: #08080C;
  --bg-panel: #0E0E14;
  --bg-panel-sub: #14141E;
  --neon-cyan: #00F0FF;
  --neon-pink: #FF003C;
  --neon-yellow: #FCEE0A;
  --text-primary: #ECECF0;
  --text-muted: #5C5C70;
  --font-hud: "Segoe UI", system-ui, sans-serif;
  --font-mono: "Consolas", monospace;
}

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

body.cyber-theme {
  height: 100vh;
  overflow: hidden;
  background-color: var(--bg-deep);
  color: var(--text-primary);
  font-family: var(--font-hud);
}

/* ==========================================================================
   整體 IDE 外框：頂部工具列 + 主體三欄 + 底部狀態列
   ========================================================================== */

.ide-shell {
  height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.ide-topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid rgba(0, 240, 255, 0.2);
}

.ide-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--neon-cyan);
  letter-spacing: 0.05em;
  margin-right: 8px;
}

.ide-topbar-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.ide-topbar-spacer {
  flex: 1;
}

.ide-footer {
  padding: 4px 16px;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--text-muted);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

/* ==========================================================================
   按鈕（共用）
   ========================================================================== */

.btn {
  border: none;
  font-family: var(--font-hud);
  font-weight: 600;
  padding: 8px 16px;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.15s;
}

.btn-small {
  padding: 6px 12px;
  font-size: 0.8rem;
}

.btn-block {
  width: 100%;
  margin-top: 10px;
}

.btn-install {
  background-color: var(--neon-cyan);
  color: #000;
}
.btn-install:hover {
  background-color: #fff;
}

.btn-secondary {
  background: transparent;
  border: 1px solid var(--text-muted);
  color: var(--text-muted);
}
.btn-secondary:not(:disabled):hover {
  border-color: var(--neon-cyan);
  color: var(--neon-cyan);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-offline { background: var(--text-muted); }
.status-online {
  background: var(--neon-yellow);
  box-shadow: 0 0 8px var(--neon-yellow);
}

/* ==========================================================================
   三欄主體佈局
   ========================================================================== */

.ide-main {
  display: grid;
  grid-template-columns: 200px 1fr 340px;
  gap: 1px;
  background: rgba(255, 255, 255, 0.06); /* 當作欄位間的分隔線 */
  overflow: hidden;
  min-height: 0;
}

.ide-panel {
  background: var(--bg-panel);
  padding: 14px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.ide-panel-label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--neon-cyan);
  letter-spacing: 0.1em;
  margin-bottom: 10px;
  flex-shrink: 0;
}

/* --- 左欄：檔案目錄 --- */

.ide-file-tree {
  overflow-y: auto;
}

.file-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: 4px;
  font-size: 0.85rem;
  cursor: pointer;
  color: var(--text-muted);
}

.file-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

.file-item.is-active {
  background: rgba(0, 240, 255, 0.12);
  color: var(--neon-cyan);
}

.file-item-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-item-delete {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.75rem;
  padding: 2px 6px;
  flex-shrink: 0;
}
.file-item-delete:hover {
  color: var(--neon-pink);
}

/* --- 中欄：程式碼編輯區 --- */

.ide-editor {
  min-width: 0;
}

.code-editor-mount--full {
  flex: 1;
  border: 1px solid rgba(0, 240, 255, 0.15);
  border-radius: 6px;
  overflow: hidden;
  min-height: 0;
}

.code-editor-mount--full .cm-editor {
  height: 100%;
}

/* --- 右欄：預覽 + 日誌，上下排列 --- */

.ide-right-column {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: rgba(255, 255, 255, 0.06);
  min-height: 0;
  overflow: hidden;
}

.ide-preview {
  flex: 1.2;
}

.ide-log {
  flex: 0.8;
}

/* 投影片畫布：預覽方塊用絕對定位放置在裡面，位置即是最終放映位置 */
.slide-canvas {
  position: relative;
  flex: 1;
  background: var(--bg-panel-sub);
  border: 1px solid rgba(0, 240, 255, 0.15);
  border-radius: 6px;
  overflow: hidden;
  min-height: 0;
}

.slide-preview-box {
  position: absolute;
  cursor: grab;
  border: 1px solid rgba(0, 240, 255, 0.4);
  overflow: hidden;
  background: #fff;
}

.slide-preview-box.is-dragging {
  cursor: grabbing;
  border-color: var(--neon-yellow);
  box-shadow: 0 0 12px rgba(252, 238, 10, 0.5);
}

.slide-preview-box iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* 除錯日誌區：純文字捲動列表 */
.log-output {
  flex: 1;
  overflow-y: auto;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.log-line {
  padding: 2px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  word-break: break-word;
}

.log-line--error {
  color: var(--neon-pink);
}

/* ==========================================================================
   放映模式
   ========================================================================== */

.presentation-overlay {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.presentation-stage {
  position: relative;
  aspect-ratio: 16 / 9;
  width: 100%;
  height: 100%;
  max-width: calc(100vh * 16 / 9);
  max-height: calc(100vw * 9 / 16);
  background: var(--bg-panel-sub);
  margin: auto;
}

.presentation-stage .slide-preview-box {
  cursor: default;
}

.presentation-indicator {
  position: fixed;
  bottom: 20px;
  right: 24px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.6);
}

.presentation-exit-btn {
  position: fixed;
  top: 20px;
  right: 24px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #fff;
  padding: 8px 14px;
  border-radius: 4px;
  cursor: pointer;
  font-family: var(--font-hud);
  font-size: 0.8rem;
}
.presentation-exit-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}
