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

:root {
  --bg: #ffffff;
  --bg-soft: #f8fafc;
  --card: #ffffff;
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --ghost: #94a3b8;
  --ghost-hover: #64748b;
  --text: #1e293b;
  --text-soft: #64748b;
  --border: #e2e8f0;
  --danger: #ef4444;
  --success: #22c55e;
  --radius: 14px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 40px 20px 60px;
}

/* 头部 */
header {
  text-align: center;
  margin-bottom: 32px;
}

header h1 {
  font-size: 2rem;
  margin-bottom: 8px;
}

.subtitle {
  color: var(--text-soft);
  font-size: 1rem;
}

/* 上传区 */
.drop-zone {
  background: var(--bg-soft);
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, transform 0.1s;
  outline: none;
}

.drop-zone:hover,
.drop-zone:focus-visible {
  border-color: var(--primary);
  background: #e0e7ff;
}

.drop-zone.is-dragover {
  border-color: var(--primary);
  background: #ddd6fe;
  transform: scale(1.01);
}

.drop-zone__icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
}

.drop-zone__text {
  font-size: 1.1rem;
  color: var(--text);
  margin-bottom: 4px;
}

.drop-zone__hint {
  font-size: 0.85rem;
  color: var(--text-soft);
}

/* 主面板 */
.panel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  background: var(--bg-soft);
  border-radius: var(--radius);
  padding: 24px;
  margin-top: 24px;
}

.panel__left h2,
.panel__right h2 {
  font-size: 1.1rem;
  margin-bottom: 16px;
  color: var(--text);
}

.preview-wrap {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  max-height: 420px;
  overflow: hidden;
}

.preview-wrap img {
  max-width: 100%;
  max-height: 400px;
  object-fit: contain;
  border-radius: 6px;
}

.img-info {
  margin-top: 12px;
  font-size: 0.85rem;
  color: var(--text-soft);
}

/* 控制项 */
.control {
  margin-bottom: 20px;
}

.control label {
  display: block;
  font-size: 0.95rem;
  margin-bottom: 10px;
  color: var(--text);
}

.control strong {
  color: var(--primary);
  font-size: 1.1rem;
}

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

.hint {
  margin-top: 8px;
  font-size: 0.8rem;
  color: var(--text-soft);
}

/* 按钮 */
.btn {
  display: inline-block;
  width: 100%;
  padding: 12px 20px;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, opacity 0.2s, transform 0.1s;
  font-family: inherit;
}

.btn:active {
  transform: translateY(1px);
}

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

.btn--primary:hover:not(:disabled) {
  background: var(--primary-hover);
}

.btn--ghost {
  background: transparent;
  color: var(--text-soft);
  border: 1px solid var(--border);
  margin-top: 12px;
}

.btn--ghost:hover {
  background: var(--bg-soft);
  color: var(--text);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* 进度条 */
.progress {
  margin-top: 20px;
}

.progress__bar {
  width: 100%;
  height: 10px;
  background: var(--bg-soft);
  border-radius: 6px;
  overflow: hidden;
}

.progress__fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary), #818cf8);
  border-radius: 6px;
  transition: width 0.15s ease;
}

.progress__text {
  margin-top: 8px;
  font-size: 0.85rem;
  color: var(--text-soft);
  text-align: center;
}

/* 状态消息 */
.status-msg {
  margin-top: 14px;
  font-size: 0.9rem;
  min-height: 1.4em;
}

.status-msg.is-error {
  color: var(--danger);
}

.status-msg.is-success {
  color: var(--success);
}

/* 工具类 */
.hidden {
  display: none !important;
}

/* 页脚 */
footer {
  text-align: center;
  margin-top: 40px;
  color: #64748b;
  font-size: 0.85rem;
}

/* 响应式 */
@media (max-width: 720px) {
  .panel {
    grid-template-columns: 1fr;
  }

  header h1 {
    font-size: 1.6rem;
  }

  .container {
    padding: 24px 14px 40px;
  }
}
