@font-face {
  font-family: 'Lato-Bold';
  src: url('Lato-Bold.ttf') format('truetype');
  font-weight: bold;
  font-style: normal;
}

:root {
  color-scheme: light;
  --bg: #f6f4ee;
  --paper: #f6f4ee;
  --surface: #ffffff;
  --surface-soft: #eef3ee;
  --panel: #eef3ee;
  --ink: #17211b;
  --muted: #66736b;
  --line: #d8ded8;
  --primary: #28745a;
  --primary-dark: #19523f;
  --accent: #d99b3d;
  --danger: #b42318;
  --radius: 10px;
  --shadow: 0 8px 24px rgba(23, 33, 27, 0.06);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

/* Header */
.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 56px;
  padding: 0 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

.brand-wrap {
  display: flex;
  align-items: center;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--ink);
}

.brand-mark {
  width: 34px;
  height: 34px;
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.company-tag {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.8px;
  color: var(--primary);
}

.app-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
}

/* Header Nav */
.header-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.nav-link:hover {
  background: var(--surface-soft);
  color: var(--primary);
}

.nav-link.active {
  background: var(--primary);
  color: #ffffff;
}

/* Main Studio Layout */
.studio-shell {
  display: grid;
  grid-template-columns: 440px 1fr;
  gap: 20px;
  max-width: 1720px;
  margin: 0 auto;
  padding: 20px;
  min-height: calc(100vh - 56px);
}

@media (max-width: 1200px) {
  .studio-shell {
    grid-template-columns: 1fr;
  }
}

/* Control Drawer (Left) */
.control-drawer {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: calc(100vh - 96px);
  overflow-y: auto;
  padding-right: 4px;
}

.control-drawer::-webkit-scrollbar {
  width: 6px;
}

.control-drawer::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 4px;
}

/* Card Component */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
}

.card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--surface-soft);
}

.card-header .icon {
  font-size: 16px;
}

.card-header h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--primary);
}

.card-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.card-body.row {
  flex-direction: row;
  align-items: center;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.field.full {
  grid-column: span 2;
}

/* Form Controls */
.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.field label, .field-row label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

input[type="text"], input[type="number"], select, textarea {
  width: 100%;
  padding: 7px 10px;
  font-size: 13px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  outline: none;
  transition: border-color 0.2s ease;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
}

textarea {
  resize: vertical;
}

.color-picker-wrap {
  display: flex;
  gap: 8px;
  align-items: center;
}

input[type="color"] {
  width: 36px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
}

/* Checkbox */
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  cursor: pointer;
  user-select: none;
}

.checkbox-label.sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

.checkbox-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}

/* Slider Controls */
.slider-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.slider-info {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--ink);
  font-weight: 500;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--primary);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn.primary-sm {
  background: var(--primary);
  color: #ffffff;
}

.btn.primary-sm:hover {
  background: var(--primary-dark);
}

.btn.danger-sm {
  background: #ffebee;
  color: var(--danger);
  border-color: #ffcdd2;
}

.btn.danger-sm:hover {
  background: #ffcdd2;
}

.btn.soft-full {
  width: 100%;
  background: var(--surface-soft);
  color: var(--primary);
  border-color: var(--line);
  margin-top: 4px;
}

.btn.soft-full:hover {
  background: #d8e8e1;
}

.btn.primary-action {
  background: var(--primary);
  color: #ffffff;
  padding: 10px 18px;
}

.btn.primary-action:hover {
  background: var(--primary-dark);
}

.btn.accent-btn {
  background: var(--accent);
  color: #ffffff;
}

.btn.accent-btn:hover {
  filter: brightness(0.92);
}

.btn.soft-danger {
  background: #ffebee;
  color: var(--danger);
  border: 1px solid #ffcdd2;
}

.btn.soft-danger:hover {
  background: #ffcdd2;
}

.btn.success-action {
  background: #2e7d32;
  color: #ffffff;
  padding: 10px 20px;
}

.btn.success-action:hover {
  background: #1b5e20;
}

.btn-group {
  display: flex;
  gap: 6px;
}

/* Workspace (Right) */
.workspace {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.preview-stage-wrap {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: 580px;
}

.stage-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 18px;
  background: var(--surface-soft);
  border-bottom: 1px solid var(--line);
}

.stage-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
}

.canvas-stats {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface);
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid var(--line);
}

.canvas-viewport {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #1c2420;
  position: relative;
  overflow: hidden;
  padding: 20px;
}

#previewCanvas {
  max-width: 100%;
  max-height: 100%;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  border-radius: 4px;
  background: #ffffff;
}

.canvas-empty-hint {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: #8c9e94;
  text-align: center;
  max-width: 320px;
}

/* Queue Card */
.queue-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.queue-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.drop-action-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.drop-tip {
  font-size: 12px;
  color: var(--muted);
}

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

.drop-zone {
  min-height: 120px;
  max-height: 200px;
  overflow-y: auto;
  border: 2px dashed var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--surface-soft);
  transition: border-color 0.2s ease;
}

.drop-zone.drag-over {
  border-color: var(--primary);
  background: #e2ede8;
}

.empty-prompt {
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 13px;
}

/* File List Item */
.file-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.file-item:hover {
  border-color: var(--primary);
}

.file-item.selected {
  border-color: var(--primary);
  background: #eef7f3;
}

.file-name-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
}

.file-thumb {
  width: 32px;
  height: 32px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--line);
}

.file-name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 280px;
}

.file-ctrls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.toggle-text-btn {
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
}

.file-remove {
  color: var(--danger);
  background: none;
  border: none;
  font-weight: 700;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
}

.file-remove:hover {
  background: #ffebee;
}

.status-alert {
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
}

.status-alert.info {
  background: #e3f2fd;
  color: #1565c0;
}

.status-alert.success {
  background: #e8f5e9;
  color: #2e7d32;
}

.status-alert.error {
  background: #ffebee;
  color: #c62828;
}

.hidden {
  display: none !important;
}
