/* ============================================================
   PS 画面设计 · 智能工作台
   黑 + 藏蓝渐变 + 白色点缀 · 桌面端 MacBook 尺寸
   ============================================================ */

:root {
  /* 主题色：黑 / 藏蓝 / 白 */
  --black: #000000;
  --black-2: #050508;
  --navy-light: #1b3a6b;
  --navy: #0f2547;
  --navy-deep: #0a1830;
  --navy-darker: #060e1c;
  --blue-accent: #3b7dd8;
  --blue-glow: rgba(59, 125, 216, 0.45);

  --ink: #f5f7fa;
  --ink-2: #c4cdd9;
  --ink-3: #7b8798;

  --glass-bg: rgba(15, 25, 45, 0.55);
  --glass-border: rgba(255, 255, 255, 0.10);
  --glass-blur: blur(24px) saturate(150%);

  --r-lg: 18px;
  --r-md: 12px;
  --r-sm: 8px;

  --shadow-lg: 0 24px 60px -30px rgba(0, 0, 0, 0.9);
  --shadow-blue: 0 16px 40px -20px rgba(59, 125, 216, 0.5);

  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-mono: "SF Mono", "JetBrains Mono", "Menlo", "Monaco", "Consolas", monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  color: var(--ink);
  background: var(--black);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
button { font-family: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
textarea { font-family: inherit; }
h1, h2, h3, p { margin: 0; }

.hidden { display: none !important; }

/* ============================ 页面通用 ============================ */
.page { min-height: 100vh; width: 100%; }

/* ============================ 欢迎页 ============================ */
.page-welcome {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.welcome-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(100% 80% at 50% 0%, rgba(59, 125, 216, 0.28) 0%, transparent 55%),
    radial-gradient(120% 100% at 50% 120%, var(--navy-deep) 0%, var(--navy-darker) 45%, var(--black) 100%),
    linear-gradient(180deg, var(--navy) 0%, var(--black) 100%);
  z-index: 0;
}
.welcome-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(2px 2px at 20% 30%, rgba(255,255,255,0.5), transparent),
    radial-gradient(1.5px 1.5px at 70% 60%, rgba(255,255,255,0.35), transparent),
    radial-gradient(1px 1px at 40% 80%, rgba(255,255,255,0.3), transparent),
    radial-gradient(1.5px 1.5px at 85% 20%, rgba(255,255,255,0.4), transparent);
  opacity: 0.6;
}
.welcome-content {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 0 24px;
  animation: fadeUp 0.8s ease;
}
.welcome-badge {
  display: inline-block;
  padding: 6px 16px;
  border-radius: 999px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: var(--glass-blur);
  font-size: 12px;
  letter-spacing: 2px;
  color: var(--ink-2);
  margin-bottom: 28px;
}
.welcome-title {
  font-size: 72px;
  font-weight: 700;
  letter-spacing: -2px;
  background: linear-gradient(180deg, #ffffff 0%, #9fb4d4 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 16px;
}
.welcome-sub {
  font-size: 18px;
  color: var(--ink-2);
  margin-bottom: 36px;
}
.welcome-modes {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 48px;
}
.mode-chip {
  padding: 8px 18px;
  border-radius: 10px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: var(--glass-blur);
  font-size: 14px;
  color: var(--ink);
}
.mode-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--blue-accent);
  box-shadow: 0 0 10px var(--blue-glow);
}
.welcome-enter {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 16px 40px;
  border-radius: 14px;
  background: linear-gradient(180deg, var(--blue-accent) 0%, #2563b8 100%);
  color: #fff;
  font-size: 17px;
  font-weight: 600;
  box-shadow: var(--shadow-blue);
  transition: transform 0.2s, box-shadow 0.2s;
}
.welcome-enter:hover { transform: translateY(-2px); box-shadow: 0 22px 50px -18px var(--blue-glow); }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============================ 工作台 ============================ */
.page-workbench {
  background:
    radial-gradient(100% 60% at 50% 0%, rgba(59, 125, 216, 0.12) 0%, transparent 60%),
    linear-gradient(180deg, var(--navy-darker) 0%, var(--black) 100%);
  min-height: 100vh;
}
.wb-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 40px;
  border-bottom: 1px solid var(--glass-border);
  backdrop-filter: var(--glass-blur);
  position: sticky;
  top: 0;
  z-index: 10;
}
.wb-brand { display: flex; align-items: center; gap: 14px; }
.wb-logo {
  width: 42px; height: 42px;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--navy-light) 0%, var(--navy-deep) 100%);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px;
  border: 1px solid rgba(255,255,255,0.15);
}
.wb-title { font-size: 17px; font-weight: 600; }
.wb-sub { font-size: 12px; color: var(--ink-3); margin-top: 2px; }

/* 模式切换 */
.wb-mode-switch {
  display: flex;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 4px;
  backdrop-filter: var(--glass-blur);
}
.mode-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  border-radius: 9px;
  font-size: 14px;
  color: var(--ink-2);
  transition: all 0.2s;
}
.mode-btn.active {
  background: linear-gradient(180deg, var(--navy-light) 0%, var(--navy) 100%);
  color: #fff;
  box-shadow: 0 4px 14px -6px var(--blue-glow);
}
.mode-icon {
  width: 22px; height: 22px;
  border-radius: 5px;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
}
.mode-icon.ps { background: #31a8ff; color: #001e36; }
.mode-icon.ai { background: #ff9a00; color: #3d1c00; }

/* 主区域 */
.wb-main {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  padding: 28px 40px 40px;
  max-width: 1400px;
  margin: 0 auto;
}
.panel {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-lg);
  backdrop-filter: var(--glass-blur);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--glass-border);
}
.panel-head h2 { font-size: 16px; font-weight: 600; }
.hint { font-size: 12px; color: var(--blue-accent); }

/* 指令输入 */
.cmd-input {
  flex: 1;
  width: 100%;
  min-height: 190px;
  padding: 20px 22px;
  background: transparent;
  border: 0;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.7;
  resize: none;
  outline: none;
}
.cmd-input::placeholder { color: var(--ink-3); }
.input-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 22px;
  border-top: 1px solid var(--glass-border);
}
.char-count { margin-left: auto; font-size: 12px; color: var(--ink-3); }

.btn {
  padding: 10px 20px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.18s;
}
.btn-primary {
  background: linear-gradient(180deg, var(--blue-accent) 0%, #2563b8 100%);
  color: #fff;
  box-shadow: 0 6px 18px -8px var(--blue-glow);
}
.btn-primary:hover { transform: translateY(-1px); }
.btn-ghost {
  background: rgba(255,255,255,0.06);
  color: var(--ink-2);
  border: 1px solid var(--glass-border);
}
.btn-ghost:hover { background: rgba(255,255,255,0.12); }
.btn-small { padding: 7px 14px; font-size: 13px; background: rgba(255,255,255,0.08); color: var(--ink); border: 1px solid var(--glass-border); border-radius: 8px; }
.btn-small:hover { background: rgba(255,255,255,0.14); }

/* 快速示例 */
.quick-presets { padding: 0 22px 20px; }
.presets-label { font-size: 12px; color: var(--ink-3); margin-bottom: 10px; }
.preset-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(59, 125, 216, 0.12);
  border: 1px solid rgba(59, 125, 216, 0.25);
  font-size: 12px;
  color: var(--ink-2);
  transition: all 0.15s;
}
.chip:hover { background: rgba(59, 125, 216, 0.22); color: #fff; }

/* 脚本输出 */
.script-output {
  flex: 1;
  margin: 0;
  padding: 20px 22px;
  background: rgba(0, 0, 0, 0.35);
  color: #d6e0ee;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
  overflow: auto;
  min-height: 280px;
  max-height: 420px;
}
.output-actions { display: flex; gap: 8px; }

/* 运行指引 */
.run-guide {
  padding: 16px 22px;
  border-top: 1px solid var(--glass-border);
  background: rgba(59, 125, 216, 0.05);
}
.guide-title { font-size: 13px; font-weight: 600; margin-bottom: 8px; color: var(--blue-accent); }
.guide-steps { margin: 0; padding-left: 18px; font-size: 13px; color: var(--ink-2); line-height: 1.9; }
.guide-steps b { color: #fff; }

/* ============================ 版式模板 ============================ */
.template-section { padding: 0 22px 20px; }
.template-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}
.template-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 8px 6px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.04);
  transition: all 0.16s;
}
.template-card:hover { background: rgba(255, 255, 255, 0.09); }
.template-card.active {
  border-color: rgba(59, 125, 216, 0.65);
  background: rgba(59, 125, 216, 0.16);
  box-shadow: 0 0 0 1px rgba(59, 125, 216, 0.25) inset;
}
.template-card canvas {
  max-width: 100%;
  max-height: 76px;
  width: auto;
  height: auto;
  border-radius: 6px;
  display: block;
  background: #0b0d12;
}
.template-card .t-name { font-size: 11px; color: var(--ink-2); white-space: nowrap; }

/* ============================ 预览 / 脚本切换 ============================ */
.out-tabs { display: flex; gap: 4px; }
.out-tab {
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--ink-3);
  transition: all 0.16s;
}
.out-tab:hover { color: var(--ink-2); }
.out-tab.active {
  background: rgba(59, 125, 216, 0.18);
  color: #fff;
}

.preview-view { display: flex; flex-direction: column; flex: 1; }
.preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 22px;
  border-bottom: 1px solid var(--glass-border);
}
.preview-size { font-size: 12px; color: var(--ink-3); font-family: var(--font-mono); }
.preview-tools { display: flex; gap: 8px; }
.tool-chip {
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12px;
  color: var(--ink-3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.15s;
}
.tool-chip:hover { color: var(--ink-2); }
.tool-chip.active {
  color: #fff;
  border-color: rgba(59, 125, 216, 0.6);
  background: rgba(59, 125, 216, 0.16);
}

/* 画布舞台：棋盘格底 + 居中缩放 */
.preview-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 26px;
  min-height: 380px;
  max-height: 560px;
  background-color: rgba(0, 0, 0, 0.28);
  background-image:
    linear-gradient(45deg, rgba(255,255,255,0.035) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(255,255,255,0.035) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(255,255,255,0.035) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(255,255,255,0.035) 75%);
  background-size: 22px 22px;
  background-position: 0 0, 0 11px, 11px -11px, -11px 0;
  overflow: hidden;
}
#preview-canvas {
  max-width: 100%;
  max-height: 500px;
  height: auto;
  width: auto;
  border-radius: 6px;
  box-shadow: 0 26px 60px -26px rgba(0, 0, 0, 0.95), 0 0 0 1px rgba(255, 255, 255, 0.06);
  animation: previewIn 0.35s ease;
}
@keyframes previewIn {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

.export-bar,
.size-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  padding: 12px 22px;
  border-top: 1px solid var(--glass-border);
}
.export-label { font-size: 12px; color: var(--ink-3); }
.opt {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--ink-2);
  cursor: pointer;
  user-select: none;
}
.opt input { accent-color: var(--blue-accent); width: 13px; height: 13px; }
.size-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.size-chip {
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  color: var(--ink-2);
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.15s;
}
.size-chip:disabled { opacity: 0.55; cursor: default; border-color: rgba(59,125,216,0.5); color: #fff; }
.size-chip.active:not(:disabled) {
  background: rgba(59, 125, 216, 0.5);
  border-color: rgba(59, 125, 216, 0.75);
  color: #fff;
}

.script-view { display: flex; flex-direction: column; flex: 1; }
.script-view .script-output { max-height: none; min-height: 420px; }

/* ============================ 风格配色 ============================ */
.style-section { padding: 0 22px 18px; }
.style-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.style-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 11px;
  color: var(--ink-2);
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.15s;
}
.style-chip:hover { background: rgba(255, 255, 255, 0.07); }
.style-chip.active {
  border-color: rgba(59, 125, 216, 0.7);
  background: rgba(59, 125, 216, 0.18);
  color: #fff;
}
.sw {
  width: 12px; height: 12px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.25);
  background: linear-gradient(135deg, #f5f5f5 0 50%, #999 50% 100%);
  flex: 0 0 auto;
}

/* ============================ 批量套版 ============================ */
.batch-section { padding: 0 22px 20px; }
.batch-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 14px;
  border-radius: 10px;
  background: rgba(59, 125, 216, 0.1);
  border: 1px solid rgba(59, 125, 216, 0.25);
  color: #fff;
  transition: all 0.15s;
}
.batch-toggle:hover { background: rgba(59, 125, 216, 0.18); }
.batch-title { font-size: 13px; font-weight: 600; }
.batch-hint { font-size: 11px; color: var(--ink-3); }
.batch-arrow { margin-left: auto; font-size: 12px; color: var(--ink-3); transition: transform 0.18s; }
.batch-section.open .batch-arrow { transform: rotate(180deg); }
.batch-panel { margin-top: 10px; }
.batch-input {
  width: 100%;
  min-height: 92px;
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--glass-border);
  color: var(--ink);
  font-size: 13px;
  line-height: 1.7;
  resize: vertical;
  outline: none;
}
.batch-input::placeholder { color: var(--ink-3); }
.batch-actions { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.batch-count { font-size: 12px; color: var(--ink-3); margin-right: auto; }
.batch-thumbs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin-top: 12px;
  padding-bottom: 6px;
}
.batch-thumbs canvas {
  height: 84px;
  width: auto;
  flex: 0 0 auto;
  border-radius: 6px;
  box-shadow: 0 8px 20px -12px rgba(0, 0, 0, 0.8);
}

/* 响应式（窄屏降级） */
@media (max-width: 900px) {
  .wb-main { grid-template-columns: 1fr; padding: 20px; }
  .wb-header { padding: 16px 20px; }
  .welcome-title { font-size: 48px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
