/* ===== 基础 ===== */
* { box-sizing: border-box; }

body {
  margin: 0;
  background: #eef2f7;
  color: #1f2937;
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}

/* ===== 整体布局：左侧面板 + 右侧预览 ===== */
.shell {
  display: grid;
  grid-template-columns: 370px 1fr;
  height: 100vh;
}

/* ===== 左侧控制面板 ===== */
aside {
  background: #fff;
  box-shadow: 4px 0 24px rgba(15, 23, 42, 0.06);
  padding: 20px;
  overflow: auto;
}

/* 面板滚动条 */
aside::-webkit-scrollbar {
  width: 10px;
}

aside::-webkit-scrollbar-track {
  background: transparent;
}

aside::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 5px;
  border: 2px solid #fff;
}

aside::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

h1 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 6px;
  font-size: 23px;
}

h1 .logo {
  flex-shrink: 0;
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.25);
}

.sub {
  margin: 0 0 16px;
  color: #64748b;
  line-height: 1.55;
  font-size: 13px;
}

section {
  border-top: 1px solid #e2e8f0;
  padding-top: 16px;
  margin-top: 16px;
}

h2 {
  font-size: 15px;
  margin: 0 0 12px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  margin: 0 0 11px;
}

/* 勾选类（横向排布） */
label.checkbox-field {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  margin: -4px 0 4px;
  cursor: pointer;
}

label.checkbox-field input[type="checkbox"] {
  width: auto;
  accent-color: #2563eb;
}

input:disabled {
  background: #f1f5f9;
  color: #94a3b8;
  cursor: not-allowed;
}

input,
select {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 9px;
  padding: 9px 10px;
  font: inherit;
  background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:hover,
select:hover {
  border-color: #94a3b8;
}

input:focus,
select:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* 位置读数 */
.pos {
  white-space: pre-line;
  background: #f1f5f9;
  border-radius: 9px;
  padding: 9px;
  font: 12px/1.5 Consolas, monospace;
  margin: 10px 0;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.05);
}

/* 按钮 */
.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

button {
  border: 0;
  border-radius: 9px;
  padding: 10px;
  margin-top: 8px;
  background: #dbeafe;
  color: #1d4ed8;
  font-weight: 700;
  cursor: pointer;
  width: 100%;
  transition: transform 0.12s ease, background-color 0.18s ease, box-shadow 0.18s ease;
  will-change: transform;
}

button:hover {
  background: #bfdbfe;
}

button:active {
  transform: scale(0.96);
}

button:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

button.primary {
  background: #2563eb;
  color: #fff;
}

button.primary:hover {
  background: #1d4ed8;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
}

#batch {
  background: #e9f7ef;
  color: #087443;
}

#batch:hover {
  background: #d1f2e2;
}

/* 文件列表 */
.file {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  background: #f8fafc;
  border-radius: 7px;
  margin: 4px 0;
  font-size: 11px;
  cursor: pointer;
  transition: background-color 0.15s ease, box-shadow 0.15s ease;
}

.file:hover {
  background: #eef2f7;
}

.file.active {
  background: #dbeafe;
  box-shadow: inset 0 0 0 1.5px #93c5fd;
}

.file span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file > span:first-child {
  flex: 1;
  min-width: 0;
}

/* 移除按钮：覆盖全局 button 样式，保持行内紧凑 */
.file-remove {
  border: 0;
  background: transparent;
  color: #94a3b8;
  font-size: 16px;
  font-weight: 400;
  line-height: 1;
  padding: 2px 6px;
  margin: 0;
  width: auto;
  border-radius: 4px;
  cursor: pointer;
  flex-shrink: 0;
  transition: color 0.15s ease, background-color 0.15s ease, transform 0.12s ease;
}

.file-remove:hover {
  color: #dc2626;
  background: #fee2e2;
}

.note {
  color: #94a3b8;
  font-size: 11px;
  line-height: 1.5;
}

/* 免责声明：柔和琥珀卡片，固定于面板底部 */
.disclaimer {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 20px;
  padding: 10px 12px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 9px;
}

.disclaimer svg {
  flex-shrink: 0;
  margin-top: 2px;
}

.disclaimer p {
  margin: 0;
  font-size: 11.5px;
  line-height: 1.65;
  color: #854d0e;
}

/* ===== 右侧预览区 ===== */
main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 20px;
}

.stage {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  border-radius: 16px;
  background-color: #cbd5e1;
  background-image:
    linear-gradient(45deg, #ffffff55 25%, transparent 25%),
    linear-gradient(-45deg, #ffffff55 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #ffffff55 75%),
    linear-gradient(-45deg, transparent 75%, #ffffff55 75%);
  background-size: 24px 24px;
  background-position: 0 0, 0 12px, 12px -12px, -12px 0;
  box-shadow: inset 0 0 48px rgba(15, 23, 42, 0.05);
  position: relative;
  overflow: hidden;
}

header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 12px;
}

header b {
  font-size: 16px;
}

header span {
  color: #64748b;
  font-size: 12px;
}

.stage canvas {
  max-height: 100%;
  max-width: 100%;
  height: auto;
  width: auto;
  border-radius: 7px;
  background: #111827;
  /* 1px 纯黑内描边（浅色模式），fallback + oklch */
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1), 0 18px 50px rgba(15, 23, 42, 0.28);
  box-shadow: 0 0 0 1px oklch(0 0 0 / 0.1), 0 18px 50px rgba(15, 23, 42, 0.28);
}

.stage #empty {
  position: absolute;
  color: #64748b;
}

/* ===== 减少动态偏好 ===== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
  }

  button:active {
    transform: none;
  }
}

/* ===== 窄屏适配 ===== */
@media (max-width: 850px) {
  .shell {
    grid-template-columns: 1fr;
    height: auto;
  }

  aside {
    border-right: 0;
    box-shadow: 0 4px 24px rgba(15, 23, 42, 0.06);
  }

  .stage {
    height: 75vh;
  }
}
