:root {
  --bg: #f7faf8;
  --bg-2: #ffffff;
  --bg-3: #f1f5f3;
  --line: #e3ebe6;
  --line-2: #d3dfd6;
  --text: #0a1929;
  --muted: #5c6b78;
  --dim: #8a96a3;
  --green-50: #f0fdf4;
  --green-100: #dcfce7;
  --green-200: #bbf7d0;
  --green-400: #4ade80;
  --green-500: #22c55e;
  --green-600: #16a34a;
  --green-700: #15803d;
  --green-800: #166534;
  --accent: var(--green-600);
  --accent-2: var(--green-500);
  --accent-soft: var(--green-100);
  --accent-warm: #f59e0b;
  --warn: #d97706;
  --danger: #dc2626;
  --radius: 14px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.05), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow: 0 4px 12px rgba(15, 23, 42, 0.06), 0 2px 4px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 10px 30px rgba(15, 23, 42, 0.08), 0 4px 8px rgba(15, 23, 42, 0.04);
  --shadow-green: 0 8px 28px rgba(22, 163, 74, 0.18);
  --font: "Inter", "Sarabun", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", "Fira Code", ui-monospace, SFMono-Regular, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  overflow-x: hidden;
  background-image:
    radial-gradient(circle at 0% 0%, rgba(22, 163, 74, 0.06) 0%, transparent 50%),
    radial-gradient(circle at 100% 100%, rgba(34, 197, 94, 0.05) 0%, transparent 50%);
}
a { color: inherit; text-decoration: none; }
::selection { background: var(--accent); color: white; }

.bg-orn { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.bg-orb { position: absolute; border-radius: 50%; filter: blur(100px); opacity: 0.4; }
.bg-orb.o1 { width: 500px; height: 500px; background: var(--green-200); top: -160px; right: -120px; opacity: 0.5; }
.bg-orb.o2 { width: 420px; height: 420px; background: #d1fae5; bottom: -120px; left: -80px; opacity: 0.5; }
.bg-orb.o3 { width: 360px; height: 360px; background: #ecfccb; top: 40%; left: 50%; opacity: 0.3; transform: translate(-50%, -50%); }
.grid-bg {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: 0.4;
  background-image:
    linear-gradient(rgba(22, 163, 74, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(22, 163, 74, 0.04) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse at center, black 30%, transparent 70%);
}

.wrap { position: relative; z-index: 1; max-width: 1100px; margin: 0 auto; padding: 0 24px; }

#aacut-v2-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 9999;
  background: linear-gradient(90deg, var(--green-600), var(--green-500));
  color: white; text-align: center;
  padding: 8px 12px;
  font: 600 13px ui-monospace, monospace;
  letter-spacing: 0.05em;
  display: flex; justify-content: center; align-items: center; gap: 14px;
  box-shadow: 0 2px 8px rgba(22, 163, 74, 0.25);
}
.banner-link { color: white; text-decoration: underline; font-weight: 500; }
body { padding-top: 36px !important; }

.appbar {
  position: sticky; top: 36px; z-index: 50;
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  background: rgba(255, 255, 255, 0.85);
  border-bottom: 1px solid var(--line);
}
.appbar-in { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { display: flex; align-items: center; gap: 12px; }
.appbar-nav { display: flex; gap: 20px; align-items: center; font-size: 14px; }
.appbar-nav a { color: var(--muted); transition: color 0.2s; font-weight: 500; }
.appbar-nav a:hover { color: var(--accent); }

.hero { padding: 36px 0 24px; text-align: center; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 14px 6px 8px;
  background: var(--green-100);
  border: 1px solid var(--green-200);
  color: var(--green-700);
  border-radius: 999px;
  font-size: 13px;
  font-family: var(--mono);
  margin: 24px 0 20px;
}
.eyebrow .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--green-600);
  box-shadow: 0 0 8px var(--green-500);
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.5; transform: scale(1.3); } }
.hero h1 {
  font-size: clamp(36px, 5.4vw, 60px);
  line-height: 1.05;
  font-weight: 800;
  letter-spacing: -0.035em;
  margin: 0 0 16px;
  color: var(--text);
}
.hero h1 .grad {
  background: linear-gradient(120deg, var(--green-700) 0%, var(--green-500) 50%, var(--green-600) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero p { color: var(--muted); font-size: clamp(15px, 1.5vw, 18px); max-width: 600px; margin: 0 auto 32px; }
.hero p strong { color: var(--text); font-weight: 600; }

.steps-wrap {
  display: flex; align-items: center; justify-content: center;
  gap: 0; margin: 0 auto 32px; max-width: 720px;
  padding: 14px 20px;
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.step-indicator {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--mono); font-size: 13px; color: var(--dim);
  padding: 8px 16px; border-radius: 10px;
  transition: all 0.2s;
}
.step-indicator.active { color: var(--accent); background: var(--green-50); font-weight: 600; }
.step-indicator.done { color: var(--green-700); }
.step-indicator .num {
  display: inline-grid; place-items: center;
  width: 24px; height: 24px;
  border: 1.5px solid currentColor;
  border-radius: 50%; font-size: 11px; font-weight: 700;
}
.step-indicator.done .num { background: var(--green-600); border-color: var(--green-600); color: white; }
.step-indicator.active .num { background: var(--green-600); border-color: var(--green-600); color: white; }
.step-line { width: 32px; height: 1.5px; background: var(--line); flex-shrink: 0; }

.step-panel { display: block; }
.step-panel.hidden { display: none; }
.card {
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 32px;
  margin-bottom: 18px;
  transition: all 0.2s;
  box-shadow: var(--shadow-sm);
}
.card:hover { box-shadow: var(--shadow); }
.card h2 { margin: 0 0 8px; font-size: 22px; font-weight: 700; letter-spacing: -0.02em; color: var(--text); }
.card h3 { margin: 0 0 12px; font-size: 17px; font-weight: 600; color: var(--text); }
.muted { color: var(--muted); font-size: 14px; }
.form-hint { margin: -2px 0 12px; font-size: 12.5px; }

/* === DROP ZONE with beagle studio background === */
.drop-zone {
  position: relative;
  margin: 18px 0;
  padding: 0;
  border: 2px dashed var(--green-400);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all 0.3s ease;
  background: var(--bg-2);
  overflow: hidden;
  min-height: 380px;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
}
.drop-zone:focus-visible { outline: 3px solid var(--green-500); outline-offset: 4px; }
.drop-zone:hover, .drop-zone.dragover {
  border-color: var(--green-600);
  border-style: solid;
  transform: scale(1.005);
  box-shadow: var(--shadow-green);
}
.drop-zone-bg {
  position: absolute; inset: 0; z-index: 0;
  overflow: hidden;
  border-radius: calc(var(--radius-lg) - 2px);
  pointer-events: none;
}
.drop-zone-bg img {
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: center;
  opacity: 0.55;
  transition: all 0.4s ease;
}
.drop-zone:hover .drop-zone-bg img,
.drop-zone.dragover .drop-zone-bg img {
  opacity: 0.7;
  transform: scale(1.03);
}
.drop-zone-bg-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(180deg,
    rgba(255, 255, 255, 0.4) 0%,
    rgba(255, 255, 255, 0.6) 50%,
    rgba(255, 255, 255, 0.85) 100%);
  transition: all 0.3s;
}
.drop-zone:hover .drop-zone-bg-overlay,
.drop-zone.dragover .drop-zone-bg-overlay {
  background: linear-gradient(180deg,
    rgba(220, 252, 231, 0.4) 0%,
    rgba(220, 252, 231, 0.55) 50%,
    rgba(220, 252, 231, 0.75) 100%);
}
.drop-zone-content {
  position: relative; z-index: 1;
  text-align: center;
  padding: 40px 24px;
  pointer-events: none; /* let drop zone handle clicks */
}
.drop-zone-content > * { pointer-events: auto; }
.drop-zone-icon {
  font-size: 56px;
  margin-bottom: 12px;
  display: block;
  filter: drop-shadow(0 4px 8px rgba(22, 163, 74, 0.2));
  transition: transform 0.3s;
}
.drop-zone:hover .drop-zone-icon { transform: translateY(-4px) scale(1.05); }
.drop-zone-title {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text);
  letter-spacing: -0.02em;
}
.drop-zone-hint {
  font-size: 14px;
  color: var(--muted);
  font-weight: 500;
  margin: 4px 0 12px;
}
.drop-zone-browse {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 24px;
  background: linear-gradient(135deg, var(--green-600), var(--green-500));
  color: white;
  border: 1px solid var(--green-600);
  border-radius: 10px;
  font: 600 14px var(--font);
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: var(--shadow-green);
  pointer-events: auto;
}
.drop-zone-browse:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(22, 163, 74, 0.35);
  filter: brightness(1.05);
}
.drop-zone-multi {
  margin-top: 10px;
  font: 500 12px var(--mono);
  color: var(--green-700);
  letter-spacing: 0.05em;
  display: inline-block;
  padding: 3px 10px;
  background: var(--green-50);
  border: 1px solid var(--green-200);
  border-radius: 999px;
}
.file-input-hidden { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

/* === Option cards (subtitle checkbox) === */
.upload-options { margin: 18px 0 0; }
.option-card {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 20px;
  background: white;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}
.option-card:hover { border-color: var(--green-400); background: var(--green-50); }
.option-card input[type="checkbox"] {
  position: absolute; opacity: 0; pointer-events: none;
}
.option-card-check {
  flex-shrink: 0;
  width: 22px; height: 22px;
  border: 2px solid var(--line-2);
  border-radius: 6px;
  background: white;
  display: grid; place-items: center;
  transition: all 0.2s;
}
.option-card-check svg { opacity: 0; transition: opacity 0.2s; }
.option-card input[type="checkbox"]:checked + .option-card-check {
  background: var(--green-600);
  border-color: var(--green-600);
}
.option-card input[type="checkbox"]:checked + .option-card-check svg { opacity: 1; }
.option-card:has(input:checked) {
  border-color: var(--green-600);
  background: var(--green-50);
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.08);
}
.option-card-body { display: flex; align-items: center; gap: 14px; flex: 1; }
.option-card-icon {
  font-size: 28px;
  display: grid; place-items: center;
  width: 48px; height: 48px;
  background: var(--green-100);
  border-radius: 10px;
  flex-shrink: 0;
}
.option-card-title {
  font: 600 14.5px var(--font);
  color: var(--text);
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.option-card-desc {
  font: 500 12.5px var(--font);
  color: var(--muted);
  margin-top: 2px;
  line-height: 1.45;
}
.badge-subcut {
  display: inline-block;
  padding: 2px 8px;
  background: linear-gradient(135deg, var(--green-600), var(--green-500));
  color: white;
  border-radius: 999px;
  font: 600 9.5px var(--mono);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.badge-subcut-small {
  display: inline-block;
  padding: 2px 8px;
  background: var(--green-100);
  color: var(--green-700);
  border: 1px solid var(--green-200);
  border-radius: 999px;
  font: 600 10px var(--mono);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  vertical-align: middle;
  margin-left: 8px;
}

/* File list */
.selected-files { margin: 16px 0 0; }
.file-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-bottom: 6px;
  font-size: 14px;
  transition: all 0.2s;
}
.file-row:hover { border-color: var(--green-200); background: var(--green-50); }
.file-row .fname { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-row .fsize { color: var(--muted); font-family: var(--mono); font-size: 12.5px; }
.file-row .fdel {
  background: transparent; border: none; color: var(--muted);
  cursor: pointer; font-size: 16px; padding: 4px 8px; border-radius: 6px;
  transition: all 0.2s;
}
.file-row .fdel:hover { color: var(--danger); background: rgba(220, 38, 38, 0.08); }

.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 22px;
  border-radius: 10px;
  font: 600 14px var(--font);
  border: 1px solid var(--line);
  background: white;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.btn-primary {
  background: linear-gradient(135deg, var(--green-600), var(--green-500));
  color: white;
  border: 1px solid var(--green-600);
  box-shadow: var(--shadow-green);
}
.btn-primary:hover {
  box-shadow: 0 10px 32px rgba(22, 163, 74, 0.3);
  filter: brightness(1.05);
}
.btn-outline { background: transparent; border: 1px solid var(--line-2); color: var(--muted); }
.btn-outline:hover { border-color: var(--green-500); color: var(--green-700); background: var(--green-50); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.progress-bar { height: 8px; background: var(--bg-3); border-radius: 999px; overflow: hidden; margin: 12px 0; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--green-600), var(--green-500)); width: 0; transition: width 0.3s; border-radius: 999px; }
.progress-bar-lg { height: 14px; }
.progress-fill-animated {
  background: linear-gradient(90deg, var(--green-600), var(--green-500), var(--green-400));
  background-size: 200% 100%;
  animation: shimmer 2s linear infinite;
}
@keyframes shimmer { from { background-position: 0 0; } to { background-position: 200% 0; } }
.progress-text { font: 600 12px var(--mono); color: var(--muted); margin-top: 6px; }
.progress-value {
  font: 800 64px var(--mono);
  letter-spacing: -0.03em;
  background: linear-gradient(120deg, var(--green-700), var(--green-500));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  line-height: 1;
}
.sub-progress {
  font-size: 42px;
  background: linear-gradient(120deg, #6366f1, #8b5cf6);
  -webkit-background-clip: text;
  background-clip: text;
}
.processing-label { margin-top: 10px; color: var(--muted); font-size: 14px; font-family: var(--mono); }

.mode-selector {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin: 12px 0 8px;
}
.mode-card {
  padding: 14px 16px;
  background: white;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
}
.mode-card:hover { border-color: var(--green-400); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.mode-card.selected {
  border-color: var(--green-600);
  background: var(--green-50);
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.1);
}
.mode-card .mkey { font: 600 10px var(--mono); color: var(--accent); text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 4px; }
.mode-card .mlabel { font: 600 14px var(--font); color: var(--text); }
.mode-card .mdesc { font-size: 12px; color: var(--muted); margin-top: 4px; line-height: 1.4; }
.mode-description {
  padding: 12px 14px;
  background: var(--green-50);
  border-radius: 8px;
  border-left: 3px solid var(--green-600);
  margin-top: 8px;
  font-size: 13px;
}

.template-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
  margin: 12px 0 16px;
}
.template-chip {
  padding: 10px 14px;
  background: white;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}
.template-chip:hover { border-color: var(--green-500); }
.template-chip.selected {
  background: linear-gradient(135deg, var(--green-600), var(--green-500));
  color: white;
  border-color: transparent;
  box-shadow: var(--shadow-green);
}

.settings-summary {
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 20px;
  margin: 16px 0 8px;
}
.setting-list { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 4px; }
.setting-list li {
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 0;
  font-size: 13.5px;
  color: var(--muted);
  border-bottom: 1px dashed var(--line);
}
.setting-list li:last-child { border-bottom: none; }
.setting-list code {
  font: 500 12.5px var(--mono);
  color: var(--green-700);
  background: var(--green-100);
  padding: 2px 8px;
  border-radius: 6px;
}

.processing-log {
  max-height: 280px;
  overflow-y: auto;
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  font: 500 12.5px var(--mono);
  color: var(--muted);
  line-height: 1.6;
}
.log-line { padding: 3px 0; border-bottom: 1px dashed var(--line); }
.log-line:last-child { border-bottom: none; }
.log-time { color: var(--dim); margin-right: 8px; }

.output-files { display: grid; gap: 6px; margin-top: 12px; }
.output-file-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13.5px;
}
.output-file-row .fname { flex: 1; }
.output-file-row a { color: var(--green-700); font-weight: 600; }

.toast-container {
  position: fixed; bottom: 20px; right: 20px; z-index: 100;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  background: white;
  border: 1px solid var(--green-400);
  color: var(--text);
  padding: 12px 18px;
  border-radius: 10px;
  font: 500 13px var(--font);
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.3s ease;
}
.toast.error { border-color: var(--danger); }
.toast.success { border-color: var(--green-600); }
@keyframes slideIn { from { transform: translateX(120%); } to { transform: translateX(0); } }

.hidden { display: none !important; }

.footer {
  padding: 32px 0 24px;
  border-top: 1px solid var(--line);
  margin-top: 60px;
  text-align: center;
  color: var(--muted);
  font-size: 12.5px;
}
.footer a { color: var(--accent); font-weight: 600; }

@media (max-width: 700px) {
  .steps-wrap { flex-direction: column; gap: 8px; padding: 14px; }
  .step-line { width: 1.5px; height: 16px; }
  .card { padding: 22px; }
  .hero h1 { font-size: 36px; }
  .progress-value { font-size: 48px; }
  .sub-progress { font-size: 32px; }
  .drop-zone { min-height: 280px; }
  .drop-zone-title { font-size: 20px; }
  .appbar-nav { gap: 14px; font-size: 13px; }
  #aacut-v2-banner { flex-direction: column; gap: 4px; padding: 6px 10px; font-size: 11px; }
  .option-card-body { gap: 10px; }
  .option-card-icon { width: 40px; height: 40px; font-size: 24px; }
}
