/* ==========================================================================
   AI HTML 可视化修图工具 - 首页样式
   设计语言：Linear — Midnight Precision Instrument
   纯黑画布 / 发丝线分层 / 单一荧光强调 / 字重≤590 / 紧凑密度
   ========================================================================== */

/* ---------- 设计变量 ---------- */
:root {
  color-scheme: dark;
  /* 表面层级 */
  --void: #08090a;
  --carbon: #0f1011;
  --obsidian: #161718;
  /* 边框 */
  --graphite: #23252a;
  --smoke: #383b3f;
  /* 文本 */
  --paper: #ffffff;
  --mist: #d0d6e0;
  --fog: #8a8f98;
  --ash: #62666d;
  /* 强调：唯一彩色 */
  --acid: #e4f222;
  --acid-dim: rgba(228, 242, 34, .12);
  /* 功能色 */
  --green: #27a644;
  --red: #eb5757;
  /* 形状 */
  --r-sm: 4px;
  --r-md: 6px;
  --r-lg: 12px;
  /* 字体 */
  --font-ui: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", Monaco, Consolas, monospace;
  --ease: cubic-bezier(.4, 0, .2, 1);
}

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

html, body { height: 100%; }

body {
  font-family: var(--font-ui);
  font-feature-settings: "cv01" on, "ss03" on, "zero" on;
  color: var(--mist);
  background: var(--void);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ---------- 布局骨架 ---------- */
.shell {
  flex: 1;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 0;
  width: 100%;
  max-width: 1200px;
  height: 100%;
  margin: 0 auto;
  padding: 0 24px;
  min-height: 0;
}

/* ---------- 顶部品牌条 ---------- */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 20px 0;
  border-bottom: 1px solid var(--graphite);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 6px;
  color: var(--fog);
  font-size: 12px;
  font-weight: 510;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.eyebrow::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 9999px;
  background: var(--acid);
}

.logo {
  font-size: clamp(20px, 2.4vw, 26px);
  line-height: 1.0;
  font-weight: 590;
  letter-spacing: -.022em;
  color: var(--paper);
}

.meta-list {
  display: flex;
  gap: 20px;
  color: var(--ash);
  font-size: 13px;
  flex-shrink: 0;
}

.meta-list div {
  display: flex;
  align-items: center;
  gap: 8px;
}

.meta-list div::before {
  content: "";
  width: 3px;
  height: 3px;
  border-radius: 9999px;
  background: var(--smoke);
}

.meta-list div:first-child::before { display: none; }

.meta-list strong {
  color: var(--fog);
  font-size: 13px;
  font-weight: 510;
}

/* ---------- 编辑主舞台 ---------- */
.card {
  display: flex;
  flex-direction: column;
  background: var(--carbon);
  border: 1px solid var(--graphite);
  border-top: none;
  border-radius: 0 0 var(--r-lg) var(--r-lg);
  padding: 16px;
  min-height: 0;
}

/* 卡片头 */
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
  flex-shrink: 0;
}

/* Tabs — 分段控件 */
.tabs {
  display: flex;
  gap: 1px;
  padding: 2px;
  border-radius: var(--r-md);
  background: var(--void);
  border: 1px solid var(--graphite);
}

.tab {
  padding: 7px 18px;
  font-size: 13px;
  font-weight: 510;
  color: var(--ash);
  cursor: pointer;
  border: none;
  border-radius: var(--r-sm);
  transition: color .15s, background .15s;
  background: transparent;
  font-family: inherit;
  white-space: nowrap;
}

.tab:hover { color: var(--fog); }

.tab.active {
  color: var(--mist);
  background: var(--obsidian);
  box-shadow: inset 0 0 0 1px var(--graphite);
}

.actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* 内容区 */
.tab-content { display: none; flex: 1; min-height: 0; }
.tab-content.active { display: flex; flex-direction: column; }

/* 代码编辑区 */
textarea {
  display: block;
  width: 100%;
  flex: 1;
  min-height: 0;
  background: var(--void);
  border: 1px solid var(--graphite);
  border-radius: var(--r-md);
  color: var(--mist);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  padding: 16px;
  resize: none;
  outline: none;
  transition: border-color .15s;
}

textarea:focus { border-color: var(--smoke); }
textarea::placeholder { color: var(--ash); }

/* 拖拽区 */
.drop-zone {
  flex: 1;
  min-height: 0;
  border: 1px dashed var(--graphite);
  border-radius: var(--r-md);
  padding: 32px;
  text-align: center;
  color: var(--ash);
  cursor: pointer;
  transition: border-color .15s, background .15s;
  background: var(--void);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.drop-zone::before {
  content: "";
  width: 40px;
  height: 40px;
  border-radius: var(--r-md);
  border: 1px solid var(--graphite);
  background-color: var(--carbon);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' fill='none' stroke='%2362666d' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 12V3m0 0L5.5 6.5M9 3l3.5 3.5'/%3E%3Cpath d='M2.5 12.5v2a2 2 0 0 0 2 2h9a2 2 0 0 0 2-2v-2'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  transition: border-color .15s;
}

.drop-zone:hover,
.drop-zone.dragover {
  border-color: var(--smoke);
  background: var(--carbon);
}

.drop-zone:hover::before,
.drop-zone.dragover::before { border-color: var(--smoke); }

.drop-zone p { font-size: 14px; color: var(--mist); font-weight: 510; }
.drop-zone small { font-size: 12px; color: var(--ash); }

.file-input { display: none; }

/* 状态行 */
.status {
  min-height: 18px;
  margin-top: 10px;
  color: var(--ash);
  font-size: 12px;
  flex-shrink: 0;
  transition: color .15s;
}

.status.ready { color: var(--green); }
.status.error { color: var(--red); }

/* ---------- 按钮 ---------- */
.btn {
  min-height: 34px;
  padding: 0 14px;
  border-radius: var(--r-md);
  font-size: 13px;
  font-weight: 510;
  cursor: pointer;
  border: none;
  font-family: inherit;
  transition: all .15s var(--ease);
  white-space: nowrap;
}

.btn:active { transform: scale(.97); }

/* 唯一荧光主操作 */
.btn-primary {
  background: var(--acid);
  color: var(--void);
}

.btn-primary:hover { background: #eef94d; }

.btn-primary:disabled {
  background: var(--obsidian);
  color: var(--ash);
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  background: transparent;
  color: var(--fog);
  border: 1px solid var(--graphite);
}

.btn-secondary:hover {
  color: var(--mist);
  border-color: var(--smoke);
  background: var(--obsidian);
}

.btn-small { min-height: 28px; padding: 0 10px; font-size: 12px; border-radius: var(--r-sm); }

/* ---------- 底部信息栏 ---------- */
.footer {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 0 16px;
  flex-shrink: 0;
}

.features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.feature {
  padding: 12px 14px;
  border: 1px solid var(--graphite);
  border-radius: var(--r-md);
  background: var(--carbon);
  color: var(--ash);
  font-size: 12px;
  line-height: 1.55;
  transition: border-color .15s;
}

.feature:hover { border-color: var(--smoke); }

.feature strong {
  display: block;
  margin-bottom: 3px;
  color: var(--fog);
  font-size: 12.5px;
  font-weight: 510;
}

/* Prompt 折叠 */
.prompt-card {
  border: 1px solid var(--graphite);
  border-radius: var(--r-md);
  background: var(--carbon);
  overflow: hidden;
}

.prompt-card summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  cursor: pointer;
  list-style: none;
  user-select: none;
  transition: background .15s;
}

.prompt-card summary::-webkit-details-marker { display: none; }

.prompt-card summary::before {
  content: "";
  width: 0;
  height: 0;
  border-left: 4px solid var(--ash);
  border-top: 3px solid transparent;
  border-bottom: 3px solid transparent;
  transition: transform .15s var(--ease);
  flex-shrink: 0;
}

.prompt-card[open] summary::before { transform: rotate(90deg); }
.prompt-card summary:hover { background: var(--obsidian); }

.prompt-title {
  color: var(--fog);
  font-size: 12.5px;
  font-weight: 510;
  flex-shrink: 0;
}

.prompt-desc {
  color: var(--ash);
  font-size: 12px;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.prompt-card summary .btn { margin-left: auto; }

.prompt-text {
  max-height: 120px;
  overflow: auto;
  margin: 0 14px 12px;
  padding: 12px;
  border: 1px solid var(--graphite);
  border-radius: var(--r-sm);
  background: var(--void);
  color: var(--fog);
  font-size: 12px;
  line-height: 1.7;
  white-space: pre-wrap;
}

/* 底部提示 */
.hint {
  text-align: center;
  color: var(--ash);
  font-size: 11px;
  padding-top: 4px;
}

.hint code {
  background: var(--obsidian);
  color: var(--fog);
  padding: 2px 5px;
  border-radius: var(--r-sm);
  font-size: 10.5px;
  font-family: var(--font-mono);
  border: 1px solid var(--graphite);
}

/* 滚动条 */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--graphite); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--smoke); }

/* 选区 */
::selection { background: var(--acid-dim); color: var(--paper); }

/* ---------- 响应式 ---------- */
@media (max-width: 860px) {
  .meta-list { display: none; }
}

@media (max-width: 720px) {
  body { overflow: auto; }
  .shell {
    grid-template-rows: auto auto auto;
    height: auto;
    min-height: 100%;
    padding: 0 14px;
  }
  .header { flex-direction: column; align-items: flex-start; gap: 10px; }
  .meta-list { display: flex; flex-wrap: wrap; gap: 10px; }
  .card { min-height: 400px; border-radius: 0 0 var(--r-lg) var(--r-lg); }
  .card-head { flex-direction: column; align-items: stretch; }
  .tabs { justify-content: center; }
  .tab { flex: 1; text-align: center; }
  .actions { justify-content: flex-end; }
  .tab-content { min-height: 220px; }
  textarea { resize: vertical; }
  .features { grid-template-columns: 1fr; }
  .prompt-desc { display: none; }
}
