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

html {
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  background: #1a1a1a;
  color: #e0e0e0;
  height: 100vh;
  overflow: hidden;
}

body:has(.app-layout.theme-liblib) {
  background: linear-gradient(180deg, #f8fbff 0%, #eef5ff 100%);
  color: #1f2937;
}

body:has(.app-layout.theme-jimeng) {
  background: #050608;
  color: #e8f3ff;
}

.app-layout {
  display: flex;
  height: 100vh;
  min-height: 0;
}

.sidebar {
  width: 240px;
  background: #2a2a2a;
  padding: 20px;
  box-shadow: 2px 0 8px rgba(0,0,0,0.3);
  transition: width 0.3s ease;
  display: flex;
  flex-direction: column;
  height: 100vh;
  min-height: 0;
  overflow: hidden;
}

.sidebar.collapsed {
  width: 70px;
  padding: 20px 10px;
}

.sidebar-header {
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 1px solid #444;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sidebar-header h2 {
  font-size: 20px;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  transition: opacity 0.3s ease;
}

.sidebar.collapsed .sidebar-header h2 {
  opacity: 0;
  width: 0;
}

.toggle-btn {
  background: transparent;
  border: none;
  color: #999;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  transition: color 0.2s;
}

.toggle-btn:hover {
  color: #fff;
}

.toggle-btn i {
  width: 20px;
  height: 20px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-bottom: 12px;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid #444;
  flex-shrink: 0;
}

.sidebar-lock-btn {
  background: rgba(255, 255, 255, 0.04);
  color: #cbd5e1;
  transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.sidebar-split-btn {
  margin-bottom: 10px;
  background: rgba(255, 255, 255, 0.04);
  color: #cbd5e1;
  transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.sidebar-split-btn:hover {
  background: rgba(24, 144, 255, 0.12);
  color: #ffffff;
}

.sidebar-split-btn[data-enabled="true"] {
  background: linear-gradient(180deg, rgba(24, 144, 255, 0.92), rgba(37, 99, 235, 0.92));
  color: #ffffff;
  box-shadow: 0 12px 28px rgba(24, 144, 255, 0.24);
}

.sidebar-lock-btn:hover {
  background: rgba(24, 144, 255, 0.12);
  color: #ffffff;
}

.sidebar-lock-btn[data-locked="true"] {
  background: linear-gradient(180deg, rgba(24, 144, 255, 0.92), rgba(37, 99, 235, 0.92));
  color: #ffffff;
  box-shadow: 0 12px 28px rgba(24, 144, 255, 0.24);
}

.sidebar-lock-btn i {
  width: 24px;
  height: 24px;
}

.sidebar-lock-btn span {
  white-space: nowrap;
}

.nav-btn {
  padding: 12px 20px;
  border: none;
  background: transparent;
  color: #999;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
  text-align: left;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-btn i {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.sidebar.collapsed .nav-btn i {
  width: 38px;
  height: 38px;
}

.nav-btn span {
  white-space: nowrap;
  overflow: hidden;
  transition: opacity 0.3s ease;
}

.sidebar.collapsed .nav-btn {
  padding: 12px;
  justify-content: center;
}

.sidebar.collapsed .nav-btn span {
  display: none;
}

.sidebar.collapsed .sidebar-lock-btn {
  padding: 12px;
}

.sidebar.collapsed .sidebar-lock-btn span {
  display: none;
}

.sidebar-lock-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
}

.split-page-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 20px minmax(0, 1fr);
  gap: 0;
  flex: 1;
  min-height: 0;
  height: 100%;
  padding: 10px;
}

.split-page-layout[hidden] {
  display: none;
}

.split-page-panel {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-radius: 0;
  border: none;
  background: transparent;
  overflow: hidden;
}

.split-resize-divider {
  position: relative;
  min-width: 20px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: col-resize;
}

.split-resize-divider::before {
  content: '';
  position: absolute;
  top: 10px;
  bottom: 10px;
  left: 50%;
  width: 1px;
  transform: translateX(-50%);
  background: rgba(148, 163, 184, 0.18);
}

.split-resize-handle {
  position: relative;
  z-index: 1;
  width: 8px;
  height: 120px;
  border: none;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.28);
  box-shadow: 0 0 0 1px rgba(148, 163, 184, 0.14);
  cursor: col-resize;
  padding: 0;
}

.split-resize-handle:hover,
.split-resize-divider.dragging .split-resize-handle {
  background: rgba(96, 165, 250, 0.72);
  box-shadow: 0 0 0 1px rgba(96, 165, 250, 0.24);
}

.split-page-panel-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
  background: rgba(15, 23, 42, 0.38);
}

.split-page-panel-label {
  color: #94a3b8;
  font-size: 12px;
}

.split-page-selector-shell {
  min-width: 140px;
}

.split-page-selector {
  width: 100%;
  height: 30px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.88);
  color: #f8fafc;
  padding: 0 10px;
  font-size: 12px;
  outline: none;
}

.split-page-selector:focus {
  border-color: rgba(59, 130, 246, 0.82);
}

.split-page-selector:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.split-page-panel-body {
  flex: 1;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  padding: 0;
}

.split-page-scroll-shell {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.48) rgba(255, 255, 255, 0.04);
}

.split-page-scroll-shell::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.split-page-scroll-shell::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.03);
  border-radius: 999px;
}

.split-page-scroll-shell::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(148, 163, 184, 0.55), rgba(100, 116, 139, 0.72));
  border-radius: 999px;
  border: 2px solid rgba(9, 10, 14, 0.88);
}

.split-page-scroll-shell::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, rgba(96, 165, 250, 0.78), rgba(59, 130, 246, 0.88));
}

.split-page-scroll-shell::-webkit-scrollbar-corner {
  background: transparent;
}

.split-view-active {
  padding: 0;
}

.split-page-panel-body .platform-tabs,
.split-page-panel-body .action-guide,
.split-page-panel-body .preset-page-head,
.split-page-panel-body .page-header-block {
  display: none !important;
}

.content.split-view-active {
  border-radius: 0;
  padding: 0;
  overflow: hidden;
}

.content.split-view-active > #pageMount {
  display: none !important;
}

.content.split-view-active > #splitPageLayout {
  flex: 1;
  min-height: 0;
}

.main-area:has(.content.split-view-active) {
  padding: 0;
  overflow: hidden;
}

.split-page-scroll-shell .page,
.split-page-scroll-shell .page.active,
.split-page-scroll-shell .page-shell {
  width: 100%;
  height: auto;
  min-height: 0;
  max-width: none;
  margin: 0;
  padding: 0;
  gap: 0;
}

.split-page-scroll-shell > .page,
.split-page-scroll-shell > .page.active {
  display: flex;
  flex-direction: column;
  flex: 0 0 auto;
  min-height: max-content;
}

.split-page-scroll-shell > .page > .page-shell {
  flex: 0 0 auto;
}

.split-page-scroll-shell #presets,
.split-page-scroll-shell #favorites,
.split-page-scroll-shell #platform {
  margin: 0;
  padding: 0;
  height: auto;
}

.split-page-scroll-shell .platform-frames {
  height: 100%;
  margin: 0;
}

.split-page-scroll-shell .platform-frames > div:last-child,
.split-page-scroll-shell .preset-grid {
  min-height: 100%;
}

.split-page-scroll-shell #favorites .page-shell {
  display: block;
  min-height: auto;
}

.split-page-scroll-shell .preset-grid,
.split-page-scroll-shell .platform-config {
  margin: 0;
}

.sidebar-lock-modal[hidden] {
  display: none;
}

.sidebar-lock-modal-mask {
  position: absolute;
  inset: 0;
  background: rgba(3, 6, 13, 0.62);
  backdrop-filter: blur(6px);
}

.sidebar-lock-panel {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(420px, calc(100vw - 32px));
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(17, 24, 39, 0.98), rgba(11, 16, 28, 0.98));
  border: 1px solid rgba(148, 163, 184, 0.16);
  box-shadow: 0 28px 64px rgba(0, 0, 0, 0.42);
  padding: 22px;
}

.sidebar-lock-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.sidebar-lock-panel-head h3 {
  color: #f8fafc;
  font-size: 20px;
  margin-bottom: 6px;
}

.sidebar-lock-panel-head p {
  color: #94a3b8;
  font-size: 13px;
  line-height: 1.6;
}

.sidebar-lock-close {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  color: #cbd5e1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.sidebar-lock-close i {
  width: 18px;
  height: 18px;
}

.sidebar-lock-form {
  display: grid;
  gap: 14px;
}

.sidebar-lock-field {
  display: grid;
  gap: 8px;
}

.sidebar-lock-field span {
  color: #e2e8f0;
  font-size: 13px;
}

.sidebar-lock-field input {
  width: 100%;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.78);
  color: #f8fafc;
  padding: 12px 14px;
  outline: none;
}

.sidebar-lock-field input:focus {
  border-color: rgba(24, 144, 255, 0.88);
  box-shadow: 0 0 0 3px rgba(24, 144, 255, 0.16);
}

.sidebar-lock-status {
  min-height: 20px;
  font-size: 13px;
  color: #94a3b8;
}

.sidebar-lock-status.error {
  color: #fca5a5;
}

.sidebar-lock-status.success {
  color: #86efac;
}

.sidebar-lock-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.sidebar-lock-primary-btn,
.sidebar-lock-secondary-btn {
  min-width: 108px;
  height: 40px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  padding: 0 16px;
}

.sidebar-lock-primary-btn {
  background: linear-gradient(180deg, rgba(24, 144, 255, 0.96), rgba(37, 99, 235, 0.96));
  color: #ffffff;
}

.sidebar-lock-secondary-btn {
  background: rgba(255, 255, 255, 0.08);
  color: #e2e8f0;
}

.nav-btn:hover {
  background: #333;
  color: #e0e0e0;
}

.nav-btn.active {
  background: #1890ff;
  color: white;
}

.main-area {
  flex: 1;
  padding: 20px;
  min-height: 0;
  overflow: hidden;
}

.app-layout.theme-liblib .main-area {
  background: transparent;
}

.app-layout.theme-jimeng .main-area {
  background: transparent;
}

.content {
  background: #2a2a2a;
  padding: 30px;
  border-radius: 8px;
  min-height: calc(100vh - 40px);
  overflow: visible;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.app-layout.theme-liblib .content {
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 16px 40px rgba(94, 129, 181, 0.12);
  backdrop-filter: blur(8px);
}

.app-layout.theme-jimeng .content {
  background: linear-gradient(180deg, rgba(9, 10, 14, 0.96), rgba(6, 7, 10, 0.98));
  box-shadow: 0 20px 44px rgba(0, 0, 0, 0.38);
  border: 1px solid rgba(45, 62, 102, 0.16);
}

#pageMount {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}

.page {
  display: none;
}

.page.active {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.page-shell {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.page-header-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.page-header-block h2 {
  font-size: 28px;
  color: #fff;
}

.app-layout.theme-liblib .page-header-block h2 {
  color: #0f172a;
}

.app-layout.theme-jimeng .page-header-block h2 {
  color: #f8fbff;
}

.page-header-block p {
  color: #999;
  font-size: 14px;
}

.app-layout.theme-liblib .page-header-block p,
.app-layout.theme-liblib .empty-state {
  color: #64748b;
}

.app-layout.theme-jimeng .page-header-block p,
.app-layout.theme-jimeng .empty-state {
  color: #8aa0c8;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #666;
  font-size: 16px;
}

.btn-secondary {
  background: white;
  color: #1890ff;
  padding: 8px 20px;
  border: 1px solid #1890ff;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-secondary:hover {
  background: #1890ff;
  color: white;
}

.app-layout.theme-liblib .config-item,
.app-layout.theme-liblib .preset-card,
.app-layout.theme-liblib .preset-status {
  background: #ffffff;
  border-color: #dbe7f5;
  box-shadow: 0 12px 28px rgba(94, 129, 181, 0.08);
}

.app-layout.theme-jimeng .config-item,
.app-layout.theme-jimeng .preset-card,
.app-layout.theme-jimeng .preset-status,
.app-layout.theme-jimeng .platform-settings-card {
  background: linear-gradient(180deg, rgba(16, 18, 24, 0.96), rgba(10, 11, 16, 0.98));
  border: 1px solid rgba(45, 62, 102, 0.14);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.24);
}
