@font-face {
    font-family: 'Pretendard';
    src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/pretendard@1.0/Pretendard-Thin.woff2') format('woff2');
    font-weight: 100;
    font-display: swap;
}

@font-face {
    font-family: 'Pretendard';
    src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/pretendard@1.0/Pretendard-ExtraLight.woff2') format('woff2');
    font-weight: 200;
    font-display: swap;
}

@font-face {
    font-family: 'Pretendard';
    src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/pretendard@1.0/Pretendard-Light.woff2') format('woff2');
    font-weight: 300;
    font-display: swap;
}

@font-face {
    font-family: 'Pretendard';
    src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/pretendard@1.0/Pretendard-Regular.woff2') format('woff2');
    font-weight: 400;
    font-display: swap;
}

@font-face {
    font-family: 'Pretendard';
    src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/pretendard@1.0/Pretendard-Medium.woff2') format('woff2');
    font-weight: 500;
    font-display: swap;
}

@font-face {
    font-family: 'Pretendard';
    src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/pretendard@1.0/Pretendard-SemiBold.woff2') format('woff2');
    font-weight: 600;
    font-display: swap;
}

@font-face {
    font-family: 'Pretendard';
    src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/pretendard@1.0/Pretendard-Bold.woff2') format('woff2');
    font-weight: 700;
    font-display: swap;
}

@font-face {
    font-family: 'Pretendard';
    src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/pretendard@1.0/Pretendard-ExtraBold.woff2') format('woff2');
    font-weight: 800;
    font-display: swap;
}

@font-face {
    font-family: 'Pretendard';
    src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/pretendard@1.0/Pretendard-Black.woff2') format('woff2');
    font-weight: 900;
    font-display: swap;
}

/* ===== Reset & Variables ===== */
:root {
  --hero-bg: linear-gradient(135deg, #0f0d2e 0%, #1a1145 40%, #2b1a6e 100%);
  --primary: #5c6bc0;
  --primary-hover: #7986cb;
  --accent: #6c63ff;
  --success: #00c853;
  --danger: #ff5252;
  --border: #e0e0e0;
  --text: #212121;
  --text-light: #757575;
  --bg: #f5f5f5;
  --card-bg: #ffffff;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(0,0,0,.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

body {
  color: var(--text);
  background: var(--bg);
  font-family: 'Pretendard';
  line-height: 1.6;
}

/* ===== Navbar ===== */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #0f0d2e;
  border-bottom: 1px solid rgba(255,255,255,.1);
}
.navbar-inner {
  max-width: 1020px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
}
.nav-title {
  color: #fff;
  font-size: 20px;
  font-weight: 300;
  letter-spacing: -.5px;
  text-decoration: none;
  cursor: pointer;
}
.nav-title strong { font-weight: 700; }
.nav-links {
  list-style: none;
  display: flex;
  gap: 20px;
}
.nav-links a {
  color: rgba(255,255,255,.75);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: color .2s;
}
.nav-links a:hover {
  color: #fff;
}

/* ===== Hero ===== */
.hero {
  background: var(--hero-bg);
  padding-bottom: 60px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.hero::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0; right: 0;
  height: 60px;
  background: var(--bg);
  border-radius: 50% 50% 0 0 / 100% 100% 0 0;
}
.hero-content {
  position: relative;
  z-index: 1;
  max-width: 640px;
  margin: 0 auto;
  padding: 0 24px;
}
.hero-heading {
  color: #fff;
  font-size: clamp(28px, 5vw, 44px);
  font-weight: 800;
  margin-top: 20px;
  margin-bottom: 10px;
  letter-spacing: -.5px;
}
.hero-sub {
  color: rgba(255,255,255,.7);
  font-size: 16px;
  margin-bottom: 32px;
}

/* ===== Dropzone ===== */
.dropzone {
  background: rgba(255,255,255,.08);
  border: 2px dashed rgba(255,255,255,.3);
  border-radius: var(--radius);
  padding: 36px 24px;
  cursor: pointer;
  transition: background .2s, border-color .2s, transform .15s;
}
.dropzone:hover,
.dropzone.dragover {
  background: rgba(255,255,255,.15);
  border-color: var(--accent);
  transform: translateY(-2px);
}
.dropzone-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
.dropzone input { display: none; }
.dropzone-icon {
  width: 48px; height: 48px;
  color: var(--accent);
}
.dropzone-text {
  font-size: 20px;
  font-weight: 700;
  color: #fff;
}
.dropzone-hint {
  font-size: 13px;
  color: rgba(255,255,255,.5);
}

/* ===== Thumbnail Gallery ===== */
.thumbnail-gallery {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 20px;
}
.thumbnail-list {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}
.thumbnail-item {
  position: relative;
  width: 80px;
  height: 80px;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid rgba(255,255,255,.3);
  cursor: default;
}
.thumbnail-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.thumbnail-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(0,0,0,.6);
  color: #fff;
  font-size: 12px;
  line-height: 20px;
  text-align: center;
  cursor: pointer;
  border: none;
  padding: 0;
}
.thumbnail-remove:hover {
  background: var(--danger);
}
.btn-add-more {
  width: 80px;
  height: 80px;
  border-radius: 8px;
  border: 2px dashed rgba(255,255,255,.3);
  background: rgba(255,255,255,.08);
  color: rgba(255,255,255,.7);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s, border-color .2s;
  padding: 0;
}
.btn-add-more:hover {
  background: rgba(255,255,255,.15);
  border-color: var(--accent);
  color: var(--accent);
}
.btn-start {
  margin-top: 20px;
  background: var(--accent);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  padding: 14px 40px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: background .2s, transform .15s;
}
.btn-start:hover {
  background: #5a52e0;
  transform: translateY(-2px);
}

/* ===== Hero Messages ===== */
.hero-msg {
  margin-top: 18px;
  font-size: 14px;
  color: rgba(255,255,255,.6);
  min-height: 22px;
}
.hero-err {
  margin-top: 8px;
  font-size: 14px;
  color: var(--danger);
  background: rgba(255,82,82,.12);
  display: inline-block;
  padding: 6px 16px;
  border-radius: 8px;
}

/* ===== Container ===== */
.container {
  max-width: 1020px;
  margin: 0 auto;
  padding: 0 24px 40px;
}

/* ===== Action Bar ===== */
.action-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 20px;
}

button {
  display: inline-flex;
  align-items: center;
  padding: 10px 20px;
  border-radius: 8px;
  border: none;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s;
  background: var(--primary);
  color: #fff;
}
button:hover:not(:disabled) {
  background: var(--primary-hover);
}
button:disabled {
  opacity: .45;
  cursor: not-allowed;
}
.btn-download {
  background: var(--success);
}
.btn-download:hover:not(:disabled) {
  background: #00e676;
}
.btn-reset {
  background: transparent;
  color: var(--text-light);
  border: 1px solid var(--border);
}
.btn-reset:hover:not(:disabled) {
  background: #eee;
}

/* ===== Progress ===== */
.progress-wrap {
  margin-bottom: 20px;
  text-align: center;
}
.progress-bar {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 30%;
  background: linear-gradient(90deg, var(--accent), var(--primary));
  border-radius: 3px;
  animation: progressPulse 1.8s ease-in-out infinite;
}
@keyframes progressPulse {
  0%   { width: 15%; opacity: .8; }
  50%  { width: 70%; opacity: 1; }
  100% { width: 15%; opacity: .8; }
}
.progress-text {
  margin-top: 8px;
  font-size: 13px;
  color: var(--text-light);
}

/* ===== Grid ===== */
.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  max-width: 520px;
  margin: 0 auto;
}


/* ===== Cards ===== */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: box-shadow .2s;
}
.card:hover { box-shadow: 0 4px 20px rgba(0,0,0,.1); }
.card-clickable { cursor: pointer; }
.card-clickable:hover .card-body img { opacity: .85; }

.card-title {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 14px;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: .5px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.badge {
  font-size: 11px;
  font-weight: 600;
  background: rgba(108,99,255,.1);
  color: var(--accent);
  padding: 2px 8px;
  border-radius: 20px;
  text-transform: none;
  letter-spacing: 0;
}

.card-body {
  padding: 16px;
  min-height: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.card-body img {
  max-width: 100%;
  max-height: 400px;
  height: auto;
  display: none;
  border-radius: 6px;
  transition: opacity .2s;
}
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: var(--text-light);
  font-size: 14px;
}
.empty svg { color: var(--border); }

.checker {
  background:
    linear-gradient(45deg, #eee 25%, transparent 25%),
    linear-gradient(-45deg, #eee 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #eee 75%),
    linear-gradient(-45deg, transparent 75%, #eee 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
}

/* ===== Footer ===== */
.footer {
  margin-top: 28px;
  text-align: center;
  color: var(--text-light);
  font-size: 13px;
}

/* ===== Modal ===== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal[hidden] { display: none; }
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.6);
}
.modal-content {
  position: relative;
  background: var(--card-bg);
  border-radius: var(--radius);
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 32px rgba(0,0,0,.25);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-title {
  font-weight: 700;
  font-size: 16px;
}
.modal-close {
  padding: 6px 12px;
  font-size: 13px;
  background: transparent;
  color: var(--text-light);
  border: 1px solid var(--border);
}
.modal-close:hover {
  background: #eee;
}
.modal-body {
  padding: 20px;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-body img {
  max-width: 80vw;
  max-height: 75vh;
  height: auto;
  border-radius: 6px;
}
.modal-header-actions {
  display: flex;
  gap: 8px;
}

/* ===== Before/After Comparison Slider ===== */
.compare-results {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.compare-section {
  width: 100%;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.compare-item-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  padding: 12px;
  border-top: 1px solid var(--border);
}
.compare-container {
  position: relative;
  overflow: hidden;
  cursor: ew-resize;
  user-select: none;
  -webkit-user-select: none;
  line-height: 0;
  width: 100%;
  height: 500px;
}
.compare-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}
.compare-result {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  clip-path: inset(0 0 0 50%);
  background: #ffffff;
}

/* ===== Compare Navigation ===== */
.compare-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 12px;
  border-top: 1px solid var(--border);
}
.compare-nav-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  cursor: pointer;
  transition: background .2s;
}
.compare-nav-btn:hover:not(:disabled) {
  background: var(--primary-hover);
}
.compare-nav-btn:disabled {
  opacity: .35;
  cursor: not-allowed;
}
.compare-nav-info {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-light);
  min-width: 60px;
  text-align: center;
}

/* ===== Download Wrap (below comparison) ===== */
.download-wrap {
  display: flex;
  justify-content: center;
  margin-top: 20px;
}
.compare-divider {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 3px;
  background: #fff;
  transform: translateX(-50%);
  box-shadow: 0 0 6px rgba(0,0,0,.4);
  z-index: 10;
}
.compare-handle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 40px;
  height: 40px;
  background: var(--accent);
  border: 2px solid #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,.3);
}
.compare-label {
  position: absolute;
  bottom: 12px;
  padding: 4px 12px;
  background: rgba(0,0,0,.55);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  border-radius: 20px;
  pointer-events: none;
  z-index: 5;
}
.compare-label-left { left: 12px; }
.compare-label-right { right: 12px; }
.compare-title { justify-content: center; }

/* ===== Page (SPA navigation) ===== */
.page[hidden] { display: none; }

/* ===== FAQ Section ===== */
.faq-section {
  padding: 48px 0 60px;
}
.faq-heading {
  text-align: center;
  font-size: clamp(24px, 4vw, 36px);
  font-weight: 800;
  margin-bottom: 36px;
  color: var(--text);
}
.faq-list {
  max-width: 700px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.faq-item {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.faq-question {
  padding: 18px 24px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
  color: var(--text);
  transition: background .2s;
}
.faq-question::-webkit-details-marker { display: none; }
.faq-question::before {
  content: '▸';
  display: inline-block;
  margin-right: 12px;
  transition: transform .2s;
}
.faq-item[open] .faq-question::before {
  transform: rotate(90deg);
}
.faq-question:hover {
  background: rgba(108,99,255,.05);
}
.faq-answer {
  padding: 0 24px 18px;
  font-size: 15px;
  line-height: 1.7;
  color: var(--text-light);
}

/* ===== Loading Popup Modal ===== */
.loading-modal {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
}
.loading-modal[hidden] { display: none; }
.loading-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.6);
}
.loading-modal-content {
  position: relative;
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 60px 56px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  box-shadow: 0 8px 32px rgba(0,0,0,.25);
  min-width: 420px;
  max-width: 560px;
  text-align: center;
}
.loading-preview {
  max-width: 100%;
  max-height: 200px;
  border-radius: 8px;
  object-fit: contain;
  border: 1px solid var(--border);
}
.loading-progress-text {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  min-height: 20px;
}
.loading-spinner {
  width: 72px;
  height: 72px;
  border: 5px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
.loading-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
}
.loading-message {
  font-size: 14px;
  color: var(--text-light);
  min-height: 22px;
  transition: opacity .3s;
}

/* ===== Download Toast ===== */
.download-toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 400;
  animation: toastSlideUp .3s ease;
}
@keyframes toastSlideUp {
  from { opacity: 0; transform: translateX(-50%) translateY(20px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.download-toast-content {
  display: flex;
  align-items: center;
  gap: 14px;
  background: #222;
  color: #fff;
  padding: 16px 28px;
  border-radius: 12px;
  box-shadow: 0 6px 24px rgba(0,0,0,.3);
  min-width: 260px;
  max-width: 420px;
}
.download-toast-icon {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.download-toast-spinner {
  width: 24px;
  height: 24px;
  border: 3px solid rgba(255,255,255,.25);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
.download-toast-check {
  font-size: 22px;
  line-height: 1;
}
.download-toast-title {
  font-size: 15px;
  font-weight: 700;
}
.download-toast-hint {
  font-size: 12px;
  color: rgba(255,255,255,.65);
  margin-top: 4px;
}