* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang TC", "Microsoft JhengHei", sans-serif;
  background: #f0f4f8;
  color: #1a202c;
  min-height: 100vh;
}

.hidden { display: none !important; }
.error { color: #c53030; font-size: 14px; margin-top: 8px; }

/* 密碼畫面 */
.lock {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}
.lock-card {
  background: #fff;
  border-radius: 16px;
  padding: 32px 24px;
  max-width: 360px;
  width: 100%;
  text-align: center;
  box-shadow: 0 10px 40px rgba(0,0,0,.08);
}
.lock-card h1 { font-size: 22px; margin-bottom: 6px; }
.lock-card p { color: #718096; margin-bottom: 20px; font-size: 14px; }
.lock-card input {
  width: 100%;
  padding: 14px;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  font-size: 16px;
  text-align: center;
  margin-bottom: 12px;
}
.lock-card input:focus { outline: none; border-color: #4299e1; }
.lock-card button {
  width: 100%;
  padding: 14px;
  background: #4299e1;
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
}

/* 主畫面 */
main {
  max-width: 520px;
  margin: 0 auto;
  padding: 16px 16px 48px;
}
header { text-align: center; padding: 16px 0 8px; }
header h1 { font-size: 26px; }
.subtitle { color: #718096; font-size: 13px; margin-top: 4px; }

.card {
  background: #fff;
  border-radius: 16px;
  padding: 18px 16px;
  margin-top: 14px;
  box-shadow: 0 4px 20px rgba(0,0,0,.05);
}
.card h2 { font-size: 16px; margin-bottom: 12px; }

.badge {
  background: #4299e1;
  color: #fff;
  border-radius: 999px;
  font-size: 12px;
  padding: 2px 9px;
  vertical-align: middle;
}

.modes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mode input { display: none; }
.mode-box {
  display: block;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px 10px;
  text-align: center;
  cursor: pointer;
  transition: all .15s;
}
.mode-box strong { display: block; font-size: 15px; margin-bottom: 6px; }
.mode-box small { color: #718096; font-size: 11px; line-height: 1.5; display: block; }
.mode input:checked + .mode-box {
  border-color: #4299e1;
  background: #ebf8ff;
}

.big-btn {
  width: 100%;
  padding: 15px;
  border: 2px solid #cbd5e0;
  background: #fff;
  border-radius: 14px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .15s;
}
.big-btn.primary {
  background: linear-gradient(135deg, #4299e1, #3182ce);
  color: #fff;
  border: none;
}
.big-btn:disabled { opacity: .45; cursor: not-allowed; }
.big-btn.download { display: block; text-align: center; text-decoration: none; margin-top: 14px; }
#resetBtn { margin-top: 10px; }
.hint { color: #a0aec0; font-size: 12px; margin-top: 8px; line-height: 1.5; }

#thumbs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 12px;
}
.thumb { position: relative; border-radius: 10px; overflow: hidden; aspect-ratio: 3/4; background: #edf2f7; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .num {
  position: absolute; top: 4px; left: 4px;
  background: rgba(0,0,0,.55); color: #fff;
  font-size: 11px; padding: 1px 7px; border-radius: 999px;
}
.thumb .del {
  position: absolute; top: 4px; right: 4px;
  width: 24px; height: 24px; line-height: 22px;
  background: rgba(229,62,62,.9); color: #fff;
  border: none; border-radius: 50%; font-size: 14px; cursor: pointer;
}

.progress {
  display: flex; align-items: center; gap: 10px;
  justify-content: center; margin-top: 14px;
  color: #4a5568; font-size: 14px;
}
.spinner {
  width: 20px; height: 20px;
  border: 3px solid #bee3f8; border-top-color: #3182ce;
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* 前後比對 */
.compare {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  margin-top: 12px;
  border: 1px solid #e2e8f0;
  touch-action: none;
}
.compare img { width: 100%; display: block; user-select: none; -webkit-user-select: none; pointer-events: none; }
.compare .after-wrap {
  position: absolute; inset: 0;
  overflow: hidden;
  width: 50%;
}
.compare .after-wrap img { position: absolute; top: 0; left: 0; width: calc(100% * var(--inv-w, 2)); max-width: none; }
.compare .handle {
  position: absolute; top: 0; bottom: 0;
  width: 3px; background: #fff;
  box-shadow: 0 0 6px rgba(0,0,0,.5);
  left: 50%;
}
.compare .tag {
  position: absolute; bottom: 8px;
  background: rgba(0,0,0,.55); color: #fff;
  font-size: 11px; padding: 3px 10px; border-radius: 999px;
  pointer-events: none;
}
.tag.l { left: 8px; } .tag.r { right: 8px; }

.page-title { margin-top: 20px; font-size: 13px; color: #4a5568; font-weight: 600; }
.ai-flag { color: #805ad5; font-weight: 400; }

footer { text-align: center; color: #a0aec0; font-size: 12px; padding-top: 28px; }
