/* ===========================
   QuickDrop — 全域樣式
   =========================== */

/* ── 亮色預設 ── */
:root {
  color-scheme: light;
  --bg: #f8f4ea;
  --card: #fffdf7;
  --text: #2f2a24;
  --muted: #6f665c;
  --accent: #b98c5a;
  --accent-2: #8a6742;
  --border: #e9dfd0;
  --result-bg: #fffcf5;
  --result-border: #d9c8ad;
  --btn-bg: #efe4d3;
  --btn-hover: #e6d6bf;
  --progress-track: #e9dfd0;
  --progress-fill: #b98c5a;
}

/* ── 深色模式 ── */
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #1a1714;
    --card: #242020;
    --text: #f0ece4;
    --muted: #9c8e7e;
    --accent: #c9a06e;
    --accent-2: #b08850;
    --border: #3a3430;
    --result-bg: #2a2520;
    --result-border: #4a4038;
    --btn-bg: #3a3028;
    --btn-hover: #4a3e34;
    --progress-track: #3a3430;
    --progress-fill: #c9a06e;
  }
}

/* ── 手動深色模式切換 ── */
body.dark {
  color-scheme: dark;
  /* 不要用純黑（#000），用柔和的深棕灰，比較護眼不刺眼 */
  --bg: #1e1b17;
  --card: #2a2520;
  --text: #f0ece4;
  --muted: #9c8e7e;
  --accent: #c9a06e;
  --accent-2: #b08850;
  --border: #3a3430;
  --result-bg: #2a2520;
  --result-border: #4a4038;
  --btn-bg: #3a3028;
  --btn-hover: #4a3e34;
  --progress-track: #3a3430;
  --progress-fill: #c9a06e;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Noto Serif TC", "PingFang TC", serif;
  background: var(--bg);
  color: var(--text);
  transition: background 0.25s, color 0.25s;
}

/* ── 主容器 ── */
.container {
  max-width: 760px;
  /* 減少整頁上/下留白，避免底部空白過多 */
  margin: 24px auto;
  padding: 0 16px 18px;
}

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

.header-left { display: flex; flex-direction: column; }
.header-actions { display: flex; align-items: center; gap: 8px; }

h1 { margin: 0 0 6px; }
.subtitle { margin: 0; color: var(--muted); font-size: 14px; }

/* ── 圖示按鈕 ── */
.icon-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
  color: var(--muted);
  font-size: 16px;
  height: auto;
  width: auto;
  margin: 0;
  flex-shrink: 0;
  transition: background 0.2s, transform 0.15s;
}
.icon-btn:hover { background: var(--btn-hover); }
.icon-btn:active { transform: translateY(1px); }

/* ── 使用說明彈窗 ── */
.help-overlay {
  position: fixed;
  inset: 0;
  z-index: 2147483646;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(24, 20, 16, 0.45);
  backdrop-filter: blur(8px);
}
.help-overlay.open { display: flex; }
.help-modal {
  width: min(100%, 680px);
  max-height: min(92vh, 760px);
  overflow: auto;
  background:
    radial-gradient(circle at top right, rgba(181, 142, 94, .10), transparent 34%),
    radial-gradient(circle at left center, rgba(181, 142, 94, .06), transparent 24%),
    var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: 0 24px 80px rgba(0,0,0,.22);
  padding: 18px;
  transform-origin: 50% 58%;
  animation: help-pop .28s ease-out both;
}
.help-modal-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.help-modal-title {
  margin: 0;
  font-size: 18px;
}
.help-modal-desc {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}
.help-close {
  width: auto;
  min-width: 40px;
  padding: 0 12px;
  margin-top: 0;
}
.help-carousel {
  display: grid;
  gap: 14px;
}
.help-carousel-track {
  position: relative;
  height: 420px;               /* 固定高度，四頁按鈕位置不跳動 */
}
.help-slide {
  display: none;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  align-items: stretch;         /* 左右欄強制同高 */
}
.help-slide.active {
  display: grid;
}
.help-slide-hero,
.help-slide-visual,
.help-qr-card,
.help-qr-feature {
  background: var(--result-bg);
  border: 1px solid var(--result-border);
  border-radius: 18px;
}
.help-slide-hero {
  padding: 18px;
  display: grid;
  align-content: start;
  gap: 12px;
}
.help-slide-hero h3 {
  margin: 0;
  font-size: 22px;
}
.help-slide-hero p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}
.help-hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.help-hero-badges span,
.help-qr-feature,
.help-qr-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  padding: 6px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--accent-2);
  font-size: 12px;
  font-weight: 700;
}
.help-slide-visual {
  padding: 16px;
  display: grid;
  gap: 12px;
  align-content: center;
}
.help-slide-visual-overview {
  justify-items: center;
}
.help-qr-feature {
  margin-top: 4px;
  background: color-mix(in srgb, var(--accent-2) 12%, transparent);
  color: var(--text);
}
.help-steps-mini {
  display: grid;
  gap: 10px;
}
.help-step-mini {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px 12px;
  align-items: start;
  padding: 12px 14px;
  border-radius: 16px;
  background: var(--card);
  border: 1px solid var(--border);
}
.help-step-mini span {
  grid-row: span 2;
  width: 34px;
  height: 34px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  color: var(--accent-2);
  font-weight: 800;
}
.help-step-mini strong {
  font-size: 14px;
}
.help-step-mini small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}
.help-flow-mini {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}
.help-flow-mini .help-flow-node {
  min-height: 108px;
  padding: 12px 10px;
}
.help-flow-mini .help-flow-icon {
  width: 46px;
  height: 46px;
  font-size: 16px;
}
.help-qr-card {
  padding: 14px;
  display: grid;
  gap: 10px;
  justify-items: center;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 8%, transparent), transparent 72%), var(--result-bg);
}
.help-qr-sample {
  width: 160px;
  height: 160px;
  padding: 10px;
  border-radius: 18px;
  background: #fff;
  border: 1px solid var(--border);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
}
.help-qr-sample span {
  border-radius: 3px;
  background: #2a231d;
}
.help-qr-sample span:nth-child(3n) { background: #fff; }
.help-qr-sample span:nth-child(5n) { background: #2a231d; }
.help-group-tip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  padding: 6px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--accent-2);
  font-size: 12px;
  font-weight: 700;
}
.help-group-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.help-group-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  border-radius: 18px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 10%, transparent), transparent 70%), var(--card);
  border: 1px solid var(--border);
  box-shadow: 0 10px 22px rgba(0,0,0,.04);
}
.help-group-head {
  display: grid;
  gap: 4px;
}
.help-group-label {
  font-size: 12px;
  letter-spacing: .14em;
  color: var(--muted);
  text-transform: uppercase;
}
.help-group-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
}
.help-group-pair {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}
.help-group-plus {
  color: var(--muted);
  font-weight: 800;
  font-size: 18px;
}
.help-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 72px;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .04em;
  border: 1px solid transparent;
}
.pill-up,
.pill-out {
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  color: var(--accent-2);
  border-color: color-mix(in srgb, var(--accent) 18%, var(--border));
}
.pill-down,
.pill-inbox {
  background: color-mix(in srgb, var(--accent-2) 12%, transparent);
  color: var(--text);
  border-color: color-mix(in srgb, var(--accent-2) 18%, var(--border));
}
.help-group-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}
.help-qr-side {
  width: 100%;
  display: grid;
  gap: 12px;
  align-self: stretch;
}
.help-qr-side-head {
  display: grid;
  gap: 8px;
}
.help-qr-side-head h4,
.help-qr-card-title {
  margin: 0;
  font-size: 16px;
  line-height: 1.4;
}
.help-qr-chip,
.help-qr-badge,
.help-qr-card-pill {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 6px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--accent-2);
  font-size: 12px;
  font-weight: 800;
}
.help-qr-mini-card,
.help-qr-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(255,255,255,.96), rgba(251,247,240,.98)), var(--result-bg);
  border: 1px solid var(--result-border);
}
.help-qr-mini-card {
  justify-items: center;
}
.help-qr-art {
  width: 100%;
  aspect-ratio: 1;
  max-width: 190px;
  display: grid;
  gap: 0;
  padding: 12px;
  border-radius: 22px;
  background: linear-gradient(180deg, #ffffff 0%, #fffaf2 100%);
  border: 1px solid color-mix(in srgb, var(--border) 86%, #fff);
  box-shadow: inset 0 0 0 10px #fff;
}
.help-qr-art--small { max-width: 168px; }
.help-qr-art--large { max-width: 220px; }
.help-qr-art span {
  border-radius: 3px;
  background: #e7dfd6;
  transition: transform .18s ease, background .18s ease;
}
.help-qr-art span.on {
  background: #2a231d;
}
.help-qr-art span.off {
  background: #fbf7f0;
}
.help-qr-art:hover span.on { transform: scale(.98); }
.help-qr-mini-text,
.help-qr-card-copy p,
.help-qr-note {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
  text-align: center;
  margin: 0;
}

.help-qr-card-head {
  display: grid;
  gap: 8px;
}
.help-qr-card--compact {
  align-self: start;
}
.help-qr-display--compact {
  grid-template-columns: minmax(140px, 170px) 1fr;
}
.help-qr-card-copy {
  display: grid;
  gap: 8px;
  align-content: start;
}
.help-qr-card-copy p {
  text-align: left;
}
.help-qr-mini-text {
  text-align: left;
}
.help-qr-card-copy {
  display: grid;
  gap: 8px;
  align-content: start;
  justify-items: start;
}
.help-qr-display {
  display: grid;
  grid-template-columns: minmax(180px, 220px) 1fr;
  gap: 16px;
  align-items: center;
}
.help-slide--poster {
  grid-template-columns: minmax(108px, 0.42fr) minmax(0, 1.58fr);
  align-items: stretch;
}
.help-slide--poster .help-slide-visual {
  align-content: stretch;
  justify-content: stretch;
  overflow: hidden;
  min-height: 0;
}
.help-slide-visual--full {
  display: flex;
  align-items: stretch;
  justify-content: center;
  overflow: hidden;
  padding: 0;
  min-height: 0;
  height: 100%;               /* 撐滿 grid cell，跟左欄 hero 同高 */
}
.help-slide--poster .help-slide-hero {
  padding: 8px;
  gap: 6px;
}
.help-slide--poster .help-slide-hero h3 {
  font-size: 17px;
  line-height: 1.32;
}
.help-slide--poster .help-slide-hero p {
  font-size: 11px;
  line-height: 1.45;
}
.help-give-mini-card {
  display: grid;
  place-items: center;
  gap: 6px;
  width: 100%;
  padding: 10px 12px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255,255,255,.94), rgba(251,247,240,.98));
  box-shadow: 0 8px 18px rgba(0,0,0,.04);
  margin-bottom: 12px;
}
.help-give-mini-icon {
  font-size: 26px;
  line-height: 1;
}
.help-give-mini-text {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: .04em;
}
.help-guide-image {
  display: block;
  width: 100%;
  max-height: 250px;
  object-fit: contain;
  object-position: center top;
  border-radius: 16px;
  background: #fffaf2;
  border: 1px solid var(--border);
}
.help-guide-image--full {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: center center;
  border: 0;
  background: transparent;
  border-radius: 0;
  display: block;
}
@media (max-width: 760px) {
  .help-group-grid,
  .help-qr-display,
  .help-slide {
    grid-template-columns: 1fr;
  }
  .help-flow-mini {
    grid-template-columns: 1fr;
    justify-items: stretch;
  }
  .help-flow-arrow { transform: rotate(90deg); margin: -2px 0; }
  .help-group-card,
  .help-qr-mini-card,
  .help-qr-card,
  .help-guide-card { padding: 12px; }
  .help-qr-art--small,
  .help-qr-art--large { max-width: 100%; }
  .help-guide-image {
    max-height: 190px;
  }
  .help-guide-image--full {
    max-height: 300px;
  }
}
.help-carousel-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.help-dots {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.help-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  border: none;
  background: color-mix(in srgb, var(--accent) 24%, var(--border));
  padding: 0;
  margin: 0;
  cursor: pointer;
}
.help-dot.active {
  width: 28px;
  background: var(--accent);
}
.help-carousel-actions {
  display: flex;
  gap: 10px;
}
.help-carousel-actions button {
  width: auto;
  min-width: 96px;
  margin-top: 0;
}
@media (min-width: 761px) {
  .help-carousel-track,
  .help-slide {
    height: 420px;               /* 與桌面版固定高度一致 */
  }
  .help-slide-visual {
    align-content: start;
  }
}
@media (max-width: 760px) {
  .help-carousel-track {
    height: auto;               /* 手機版內容堆疊，高度自動撐開 */
    min-height: 420px;
  }
  .help-slide,
  .help-hero,
  .help-slide--poster { grid-template-columns: 1fr; }
  .help-slide {
    height: auto;               /* 手機版 slide 高度自適應 */
  }
  .help-flow-mini,
  .help-mini-route { grid-template-columns: 1fr; }
  .help-flow-arrow,
  .help-mini-route span:nth-child(2),
  .help-mini-route span:nth-child(4) {
    transform: rotate(90deg);
    margin: -2px 0;
  }
  .help-carousel-footer {
    justify-content: center;
  }
  .help-carousel-actions {
    width: 100%;
    justify-content: space-between;
  }
  .help-carousel-actions button {
    flex: 1;
  }
}
.help-hero {
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  gap: 14px;
  align-items: stretch;
  margin-bottom: 16px;
  padding: 16px;
  border-radius: 18px;
  border: 1px solid color-mix(in srgb, var(--accent) 18%, var(--border));
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 8%, transparent), transparent 70%);
}
.help-hero-copy {
  display: grid;
  align-content: start;
  gap: 8px;
}
.help-kicker {
  width: fit-content;
  padding: 5px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--accent-2);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .04em;
}
.help-hero-copy h3 {
  margin: 0;
  font-size: 18px;
}
.help-hero-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}
.help-hero-diagram {
  display: grid;
  gap: 10px;
  align-content: center;
}
.help-mini-route {
  display: grid;
  grid-template-columns: repeat(5, auto);
  gap: 8px;
  justify-content: center;
  align-items: center;
  padding: 12px;
  border-radius: 16px;
  background: var(--result-bg);
  border: 1px solid var(--result-border);
}
.help-mini-route span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  padding: 7px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 13%, transparent);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  animation: help-float 2.8s ease-in-out infinite;
}
.help-mini-route span:nth-child(2),
.help-mini-route span:nth-child(4) {
  min-width: auto;
  padding: 0;
  background: transparent;
  color: var(--accent-2);
  font-size: 16px;
  animation: help-arrow 1.6s ease-in-out infinite;
}
.help-mini-route-alt span {
  background: color-mix(in srgb, var(--accent-2) 13%, transparent);
}
.help-mini-route-alt span:nth-child(2),
.help-mini-route-alt span:nth-child(4) {
  color: var(--accent);
}
.help-section-head {
  display: grid;
  gap: 4px;
  margin-bottom: 10px;
}
.help-section-head h3 {
  margin: 0;
  font-size: 16px;
}
.help-section-head p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}
.help-flow {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 10px;
  align-items: stretch;
}
.help-flow-node {
  background: var(--result-bg);
  border: 1px solid var(--result-border);
  border-radius: 18px;
  padding: 14px 12px;
  display: grid;
  justify-items: center;
  text-align: center;
  gap: 6px;
  min-height: 132px;
}
.help-flow-icon {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--accent-2);
  font-size: 18px;
  font-weight: 800;
  letter-spacing: .03em;
}
.help-flow-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}
.help-flow-sub {
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
}
.help-flow-arrow {
  align-self: center;
  justify-self: center;
  color: var(--accent-2);
  font-size: 22px;
  font-weight: 700;
  opacity: .85;
}
.help-flow > * {
  animation: help-fade-up .42s ease-out both;
}
.help-flow > *:nth-child(1) { animation-delay: .03s; }
.help-flow > *:nth-child(2) { animation-delay: .09s; }
.help-flow > *:nth-child(3) { animation-delay: .15s; }
.help-flow > *:nth-child(4) { animation-delay: .21s; }
.help-flow > *:nth-child(5) { animation-delay: .27s; }
@media (prefers-reduced-motion: reduce) {
  .help-modal,
  .help-flow > *,
  .help-mini-route span {
    animation: none !important;
  }
}
@keyframes help-pop {
  from { opacity: 0; transform: scale(.96) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes help-fade-up {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes help-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2px); }
}
@keyframes help-arrow {
  0%, 100% { opacity: .55; transform: translateX(0); }
  50% { opacity: 1; transform: translateX(2px); }
}
@media (max-width: 760px) {
  .help-hero { grid-template-columns: 1fr; }
  .help-flow {
    grid-template-columns: 1fr;
  }
  .help-flow-arrow {
    transform: rotate(90deg);
    margin: -2px 0;
  }
}
.help-footer {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}
.help-footer .mini-note {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}
.help-footer-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}
.help-footer-actions button {
  width: auto;
  min-width: 96px;
  margin-top: 0;
}
.help-secondary {
  background: var(--btn-bg);
  color: var(--text);
}
.help-secondary:hover { background: var(--btn-hover); }

@media (max-width: 760px) {
  .help-grid { grid-template-columns: 1fr; }
}

/* ── Grid 雙欄 ── */
.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: stretch;
}

@media (max-width: 820px) {
  .grid { grid-template-columns: 1fr; }
  .container { margin: 20px auto; padding: 0 12px 20px; }
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  /* 讓卡片內所有元素依序排列，form 自佔所需空間、hint/result 永遠在底部對齊 */
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  transition: background 0.25s, border-color 0.25s;
}

/* form 是卡片裡的主力，往上靠，讓 hint / result 保持同樣的垂直節奏 */
.card form { flex-shrink: 0; }

.card > .hint {
  margin-top: 12px;
  /* hint 固定在卡片下方，不受 form 內容高度影響 */
  flex-shrink: 0;
}

.card h2 { margin: 0 0 10px; }
.card form { margin-top: 6px; }

/* 結果區不推到底，維持自然節奏，避免左右卡片節奏不一致 */
.card .result { margin-top: 12px; flex-shrink: 0; }

/* ── 拖曳上傳區（視覺上與 PIN 框對齊） ── */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 11px 12px;   /* 與 PIN input 的 padding 一致，讓高度相同 */
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  transition: border-color 0.2s, background 0.2s;
  cursor: pointer;
  /* 統一高度：min-height 配合 padding，讓與 PIN 框視覺同高 */
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.drop-zone.drag-over {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}
.drop-zone:hover { border-color: var(--accent); }
#fileInput { cursor: pointer; }

/* ── 按鈕群組 ── */
.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

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

.btnRow {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* ── QR 區塊 ── */
.qrWrap {
  margin-top: 12px;
  display: flex;
  gap: 12px;
  align-items: center;
}

.qr {
  width: 120px;
  height: 120px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
  display: grid;
  place-items: center;
}

/* ── 表單元素 ── */
.fieldLabel {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: var(--text);
  font-size: 14px;
}

.fieldHint {
  margin-top: 6px;
  color: var(--accent);
  font-size: 13px;
}

label { display: block; }

input {
  width: 100%;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid #d6c9b5;
  background: #fff;
  height: 44px;
  transition: border-color 0.2s, background 0.2s;
}

button {
  margin-top: 12px;
  width: 100%;
  border: 0;
  border-radius: 10px;
  padding: 11px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  height: 44px;
  transition: background 0.2s;
}
button:hover { background: var(--accent-2); }
button:disabled { opacity: .65; cursor: not-allowed; }

/* ── 提示文字 ── */
.hint {
  color: var(--muted);
  margin: 10px 0 0;
  font-size: 13px;
  /* 固定高度，避免左右卡片 hint 節奏不一致 */
  min-height: 36px;
  transition: color 0.25s;
}

/* ── 結果區 ── */
.result {
  margin-top: 12px;
  border: 1px dashed var(--result-border);
  border-radius: 10px;
  padding: 12px;
  background: var(--result-bg);
  min-height: 0;
  overflow: hidden;
  word-break: break-word;
  transition: background 0.25s, border-color 0.25s;
}

/* ── 密碼框 ── */
.codeBox {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  background: #fff;
  transition: background 0.25s;
}

.codeLabel {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 6px;
}

.codeValue {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 44px;
  letter-spacing: 6px;
  font-weight: 800;
  color: #3a2b1e;
}

.meta {
  margin-top: 12px;
  color: var(--text);
  line-height: 1.6;
  word-break: break-word;
  overflow-wrap: break-word;
}

.small {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.hidden { display: none; }
.placeholder {
  visibility: hidden;
  display: block;
  /* 只留一點點占位防跳動，避免把整頁撐出大空白 */
  min-height: 24px;
}

/* ── PIN 四格 ── */
.pinRow {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.pin {
  text-align: center;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 22px;
  letter-spacing: 1px;
  background: var(--card);
  color: var(--text);
  border: 1px solid #6a5a4a;
  outline: none;
}

.pin:focus {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--card) 85%, var(--accent) 15%);
}

code {
  background: var(--btn-bg);
  padding: 2px 6px;
  border-radius: 6px;
}

a { color: #6a4a2e; }
.btnLink { text-decoration: none; }
.btnLink button { width: 100%; }

/* ── 上傳進度條 ── */
#uploadProgress {
  margin-top: 10px;
  display: none;
}
#uploadProgress.show { display: block; }

.progress-track {
  height: 8px;
  background: var(--progress-track);
  border-radius: 99px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--progress-fill);
  border-radius: 99px;
  width: 0%;
  transition: width 0.2s;
}
.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
  margin-top: 5px;
}

/* ── 上傳進度條 ── */
.progress-wrap {
  display: none;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
}
.progress-wrap.show {
  display: flex;
}
.progress-bar {
  height: 10px;
  background: var(--border);
  border-radius: 5px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #2e9c99, #4ab8b5);
  border-radius: 5px;
  width: 0%;
  transition: width 0.2s ease;
}
.progress-info {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
}

/* ── 取消上傳按鈕 ── */
.btnCancel {
  margin-top: 6px;
  padding: 4px 14px;
  height: 28px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 6px;
  background: #8f5a5a;
  color: #fff;
  border: none;
  cursor: pointer;
  transition: background 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  min-width: 0;
  align-self: flex-start;
  flex-shrink: 0;
}
.btnCancel:hover { background: #a04040; }
.btnCancel:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── 期限倒數計時 ── */
.countdown {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  margin-top: 8px;
}
.countdown.warning { color: #c07030; }
.countdown.danger { color: #c03030; animation: pulse 1s infinite; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ── 頁籤切換（Chrome 風格）── */
.card-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 18px;
}
.tab {
  width: auto !important;
  padding: 8px 18px;
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  background: transparent !important;
  color: var(--muted) !important;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
  margin-bottom: -1px;
  position: relative;
}
.tab:hover { color: var(--text) !important; }
.tab.active {
  background: var(--card) !important;
  color: var(--text) !important;
  font-weight: 600;
  border-color: var(--border);
  border-bottom-color: var(--card);
}
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── 響應式：手機端 ── */
@media (max-width: 480px) {
  h1 { font-size: 22px; }
  .codeValue { font-size: 36px; letter-spacing: 4px; }
  .actions { grid-template-columns: 1fr; gap: 8px; }
  .qrWrap { flex-direction: column; align-items: flex-start; }
  .pinRow { gap: 8px; }
}
@media (min-width: 761px) {
  .help-carousel-track,
  .help-slide {
    height: 420px;               /* 與桌面版固定高度一致 */
  }
  .help-slide-visual {
    align-content: start;
  }
}
