:root {
  --bg: #0f1115;
  --panel: #171a21;
  --text: #e9eef5;
  --muted: #a6b0bf;
  --accent: #4f8cff;
  --danger: #ff6464;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  line-height: 1.4;
  font-size: clamp(14px, 1.6vh, 18px);
}

#app {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.toolbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  background: rgba(15,17,21,0.9);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid #232835;
}
.input-group { display: flex; gap: 12px; flex-wrap: wrap; }
.file-label { display: inline-flex; align-items: center; gap: 8px; padding: 8px 10px; background: var(--panel); border: 1px solid #232835; border-radius: 8px; }
.file-label input { cursor: pointer; }
.check { display: inline-flex; align-items: center; gap: 8px; margin-right: 12px; color: var(--muted); }
.primary { background: var(--accent); color: white; border: none; padding: 10px 14px; border-radius: 8px; cursor: pointer; }
.primary:hover { filter: brightness(1.05); }

.content {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
  padding: 16px;
}

.preview { background: var(--panel); border: 1px solid #232835; border-radius: 12px; display: flex; flex-direction: column; }
.preview-toolbar { display: flex; gap: 8px; align-items: center; padding: 10px; border-bottom: 1px solid #232835; }
.canvas-wrap { flex: 1; display: flex; align-items: center; justify-content: center; padding: 12px; }
#previewCanvas { display: block; width: 100%; height: auto; max-height: 70vh; background: #0a0c10; border-radius: 8px; border: 1px dashed #2a3142; }

.controls { background: var(--panel); border: 1px solid #232835; border-radius: 12px; padding: 12px; }
.controls h2, .output h2 { margin: 8px 0 12px; }
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.grid.four { grid-template-columns: repeat(4, 1fr); }
.controls label { display: grid; gap: 4px; color: var(--muted); }
.controls label.check { display: inline-flex; align-items: center; gap: 8px; margin-right: 12px; }
.controls input[type="number"] { width: 100%; padding: 8px; border-radius: 8px; border: 1px solid #2a3142; background: #0e1117; color: var(--text); }
.buttons { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.buttons button { padding: 8px 10px; border-radius: 8px; border: 1px solid #2a3142; background: #0e1117; color: var(--text); cursor: pointer; }
.buttons button:hover { border-color: var(--accent); }
.hint { color: var(--muted); font-size: 0.9em; }

.output { padding: 0 16px 24px; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.card { background: var(--panel); border: 1px solid #232835; border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; border-bottom: 1px solid #232835; }
.card img { width: 100%; height: auto; display: block; background: #0a0c10; }
.card .actions { display: flex; gap: 8px; padding: 8px; }
.danger { background: var(--danger); color: white; border: none; }

@media (max-width: 1100px) {
  .content { grid-template-columns: 1fr; }
  #previewCanvas { max-height: 50vh; }
}


