* { box-sizing: border-box; }

:root {
  --panel: rgba(14, 22, 43, 0.88);
  --panel-2: rgba(16, 26, 48, 0.94);
  --line: rgba(255,255,255,0.08);
  --line-2: rgba(255,255,255,0.05);
  --text: #eef4ff;
  --muted: #93a4c9;
  --accent: #4da3ff;
  --accent-2: #7c5cff;
  --success: #2fc58d;
  --editor-bg: #0d1117;
  --shadow: 0 20px 50px rgba(0,0,0,0.35);
  --radius: 24px;
  --font-code: Consolas, "Courier New", monospace;
}

html, body {
  margin: 0;
  width: 100%;
  height: 100%;
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(77,163,255,0.18), transparent 28%),
    radial-gradient(circle at bottom right, rgba(124,92,255,0.18), transparent 28%),
    linear-gradient(135deg, #09101f 0%, #101a34 45%, #101826 100%);
  overflow: hidden;
}

.app {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  padding: 16px;
  gap: 14px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 22px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255,255,255,0.05);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.logo {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: grid;
  place-items: center;
  font-size: 22px;
  font-weight: 800;
  flex-shrink: 0;
}

.brand h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.2;
}

.brand p {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.top-nav {
  display: flex;
  gap: 10px;
  align-items: center;
}

.nav-btn {
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.04);
  color: #dbeafe;
  padding: 10px 16px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  transition: 0.2s ease;
}

.nav-btn:hover {
  background: rgba(77,163,255,0.12);
}

.nav-btn.active {
  background: linear-gradient(135deg, #4da3ff, #7c5cff);
  border-color: transparent;
  color: #fff;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.hint {
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--line);
  font-size: 13px;
  color: var(--muted);
}

.btn {
  border: none;
  border-radius: 14px;
  padding: 11px 16px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: 0.25s ease;
  color: white;
  white-space: nowrap;
}

.btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.05);
}

.btn-run { background: linear-gradient(135deg, #2fc58d, #169c6b); }
.btn-reset { background: linear-gradient(135deg, #44506f, #303955); }
.btn-demo { background: linear-gradient(135deg, #4da3ff, #7c5cff); }
.btn-save { background: linear-gradient(135deg, #f59e0b, #d97706); }
.btn-export { background: linear-gradient(135deg, #8b5cf6, #6d28d9); }

.page-container {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.page {
  display: none;
  flex: 1;
  min-height: 0;
}

.page.active {
  display: flex;
}

.workspace {
  flex: 1;
  display: flex;
  gap: 0;
  min-height: 0;
  overflow: hidden;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  background: rgba(255,255,255,0.03);
}

.left-panel {
  width: 56%;
  min-width: 320px;
  max-width: calc(100% - 320px);
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--panel);
}

.divider {
  width: 10px;
  cursor: col-resize;
  position: relative;
  background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.06), rgba(255,255,255,0.02));
  flex-shrink: 0;
}

.divider::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 4px;
  height: 70px;
  transform: translate(-50%, -50%);
  border-radius: 999px;
  background: rgba(255,255,255,0.18);
}

.right-panel {
  flex: 1;
  min-width: 320px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--panel-2);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,0.03);
  gap: 12px;
}

.panel-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 700;
}

.panel-title small,
.panel-tip {
  color: var(--muted);
  font-size: 12px;
}

.dots { display: flex; gap: 6px; }
.dots span { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dots span:nth-child(1) { background: #ff5f57; }
.dots span:nth-child(2) { background: #febc2e; }
.dots span:nth-child(3) { background: #28c840; }

.tabs {
  display: flex;
  gap: 8px;
  padding: 10px 12px 0;
  background: rgba(255,255,255,0.02);
  flex-wrap: wrap;
  border-bottom: 1px solid var(--line-2);
}

.tab {
  padding: 10px 16px;
  border-radius: 14px 14px 0 0;
  border: 1px solid transparent;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
}

.tab.active {
  color: white;
  background: rgba(255,255,255,0.06);
  border-color: var(--line);
  border-bottom-color: transparent;
}

.editors {
  position: relative;
  flex: 1;
  min-height: 0;
  background: var(--editor-bg);
}

.editor-wrap {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
}

.editor-wrap.active { display: flex; }

.editor-label {
  padding: 10px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  color: #9db1d6;
  font-size: 13px;
  background: rgba(255,255,255,0.02);
}

.code-editor {
  position: relative;
  flex: 1;
  min-height: 0;
  background: var(--editor-bg);
  overflow: hidden;
}

.active-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 25.5px;
  background: rgba(77,163,255,0.10);
  border-top: 1px solid rgba(77,163,255,0.12);
  border-bottom: 1px solid rgba(77,163,255,0.12);
  pointer-events: none;
  z-index: 1;
  display: none;
}

.code-editor:focus-within .active-line {
  display: block;
}

.code-editor textarea {
  position: absolute;
  inset: 0;
  padding: 18px;
  border: none;
  outline: none;
  resize: none;
  background: transparent;
  color: #dce7ff;
  font-size: 15px;
  line-height: 1.7;
  font-family: var(--font-code);
  tab-size: 2;
  overflow: auto;
  white-space: pre;
  z-index: 2;
}

.suggest-box {
  position: absolute;
  min-width: 180px;
  max-width: 320px;
  max-height: 220px;
  overflow: auto;
  background: #111827;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.35);
  z-index: 50;
  display: none;
}

.suggest-item {
  padding: 8px 12px;
  font-size: 13px;
  color: #dbeafe;
  cursor: pointer;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

.suggest-item:last-child { border-bottom: none; }

.suggest-item.active,
.suggest-item:hover {
  background: rgba(77,163,255,0.18);
}

.preview-main {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.iframe-shell {
  flex: 1;
  min-height: 0;
  padding: 14px;
  background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01));
}

iframe {
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 18px;
  background: white;
}

.console {
  height: 180px;
  min-height: 120px;
  border-top: 1px solid var(--line);
  background: #0b1220;
  display: flex;
  flex-direction: column;
}

.console-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  font-size: 13px;
  color: #b8c7e6;
}

.mini-btn {
  padding: 6px 10px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.04);
  color: #d8e4ff;
  border-radius: 10px;
  cursor: pointer;
  font-size: 12px;
}

.console-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 10px 14px;
  font-family: var(--font-code);
  font-size: 13px;
  line-height: 1.7;
  color: #d9e5ff;
}

.console-item {
  padding: 6px 10px;
  border-radius: 10px;
  margin-bottom: 8px;
  border: 1px solid rgba(255,255,255,0.05);
  background: rgba(255,255,255,0.03);
  white-space: pre-wrap;
  word-break: break-word;
}

.console-item.error {
  background: rgba(255, 107, 129, 0.08);
  border-color: rgba(255, 107, 129, 0.2);
  color: #ffd5dd;
}

.console-item.log {
  background: rgba(77,163,255,0.08);
  border-color: rgba(77,163,255,0.2);
  color: #d8e9ff;
}

.statusbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
  background: rgba(255,255,255,0.03);
}

.status-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.badge {
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(90,169,255,0.12);
  border: 1px solid rgba(90,169,255,0.2);
  color: #bdd7ff;
}

.slides-layout {
  flex: 1;
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 0;
  min-height: 0;
  overflow: hidden;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  background: rgba(255,255,255,0.03);
}

.slides-sidebar {
  padding: 22px;
  border-right: 1px solid var(--line);
  background: var(--panel);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.slides-title {
  font-size: 22px;
  font-weight: 700;
  color: #eef4ff;
}

.slides-desc {
  font-size: 14px;
  line-height: 1.8;
  color: var(--muted);
}

.upload-box {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  border: 1px dashed rgba(255,255,255,0.18);
  border-radius: 18px;
  background: rgba(255,255,255,0.03);
  cursor: pointer;
  color: #dbeafe;
  font-weight: 700;
  text-align: center;
  padding: 20px;
  transition: 0.2s ease;
}

.upload-box:hover {
  background: rgba(77,163,255,0.08);
  border-color: rgba(77,163,255,0.35);
}

.upload-box input {
  display: none;
}

.slides-tip {
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
  color: #cdd9f5;
  font-size: 13px;
  line-height: 1.7;
  word-break: break-all;
}

.slides-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.slides-viewer {
  position: relative;
  min-height: 0;
  background: var(--panel-2);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.slides-empty {
  color: var(--muted);
  font-size: 18px;
}

.slides-viewer iframe,
.slides-viewer img,
.slides-viewer video {
  width: 100%;
  height: 100%;
  border: none;
  object-fit: contain;
  background: #fff;
}

.slides-unsupported {
  max-width: 680px;
  padding: 32px;
  border-radius: 20px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  color: #e5edff;
  line-height: 1.9;
  font-size: 15px;
}

@media (max-width: 1100px) {
  body {
    overflow: auto;
  }

  .app {
    height: auto;
    min-height: 100vh;
  }

  .workspace {
    flex-direction: column;
  }

  .left-panel,
  .right-panel {
    width: 100% !important;
    max-width: none;
    min-width: 0;
  }

  .divider {
    display: none;
  }

  .topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .toolbar {
    justify-content: flex-start;
  }

  .left-panel,
  .right-panel {
    min-height: 620px;
  }

  .slides-layout {
    grid-template-columns: 1fr;
  }

  .slides-sidebar {
    border-right: none;
    border-bottom: 1px solid var(--line);
  }
}

.note-widget {
  position: fixed;
  right: 18px;
  top: 90px;
  z-index: 9999;
  width: 360px;
  height: 420px;
  transition: 0.25s ease;
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
}

.note-widget.minimized {
  width: 120px;
  height: 48px;
}

.note-minibar {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(17, 24, 39, 0.92);
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 12px 30px rgba(0,0,0,0.35);
  color: #e5edff;
  backdrop-filter: blur(12px);
}

.note-widget.minimized .note-minibar {
  display: flex;
}

.note-window {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  border-radius: 18px;
  overflow: hidden;
  background: rgba(15, 23, 42, 0.96);
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 16px 40px rgba(0,0,0,0.35);
  backdrop-filter: blur(16px);
}

.note-widget.minimized .note-window {
  display: none;
}

.note-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: rgba(255,255,255,0.04);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  cursor: move;
}

.note-title {
  font-size: 14px;
  font-weight: 700;
  color: #eef4ff;
}

.note-actions,
.note-size-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.mini-icon-btn {
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.06);
  color: #dbeafe;
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
  transition: 0.2s ease;
}

.mini-icon-btn:hover {
  background: rgba(77,163,255,0.18);
}

.note-toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  background: rgba(255,255,255,0.02);
}

.note-tool-btn {
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.04);
  color: #dbeafe;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
}

.note-tool-btn:hover {
  background: rgba(77,163,255,0.18);
}

.note-body {
  flex: 1;
  min-height: 0;
  padding: 0;
}

.note-body textarea {
  width: 100%;
  height: 100%;
  border: none;
  outline: none;
  resize: none;
  background: transparent;
  color: #eef4ff;
  padding: 14px;
  font-size: 14px;
  line-height: 1.8;
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
}

.note-body textarea::placeholder {
  color: #8fa4c9;
}

.note-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-top: 1px solid rgba(255,255,255,0.06);
  background: rgba(255,255,255,0.03);
  font-size: 12px;
  color: #9fb2d8;
}