/* 熊恩Sean AI 實戰教學系列工具：與 GMBAI、talk2deck 同一套視覺（Tailwind slate + indigo），以純 CSS 實作、不依賴 CDN。 */
:root {
  --slate-50: #f8fafc; --slate-100: #f1f5f9; --slate-200: #e2e8f0; --slate-300: #cbd5e1;
  --slate-400: #94a3b8; --slate-500: #64748b; --slate-600: #475569; --slate-700: #334155; --slate-800: #1e293b;
  --indigo-50: #eef2ff; --indigo-100: #e0e7ff; --indigo-200: #c7d2fe; --indigo-400: #818cf8;
  --indigo-500: #6366f1; --indigo-600: #4f46e5; --indigo-700: #4338ca;
  --green-500: #22c55e; --green-600: #16a34a; --green-50: #f0fdf4;
  --red-50: #fef2f2; --red-200: #fecaca; --red-600: #dc2626; --red-700: #b91c1c;
  --amber-50: #fffbeb; --amber-200: #fde68a; --amber-800: #92400e;
  --radius-card: 24px; --radius-box: 16px; --radius-btn: 12px;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / .05);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);
  font-family: ui-sans-serif, system-ui, -apple-system, "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  color: var(--slate-800);
  background: var(--slate-50);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--slate-50); line-height: 1.5; }
button, input, select { font: inherit; color: inherit; }
button, a, input, select, summary { -webkit-tap-highlight-color: transparent; }
button, a { touch-action: manipulation; }
button, summary, select, .check-option { cursor: pointer; }
button:disabled { cursor: not-allowed; }
a { color: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible { outline: 3px solid var(--indigo-200); outline-offset: 3px; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.icon-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
[hidden] { display: none !important; }

/* 版面 */
.page { min-height: 100vh; padding: 16px; display: flex; flex-direction: column; align-items: center; }
.container { width: 100%; max-width: 896px; display: flex; flex-direction: column; gap: 40px; }

/* Header：品牌識別 */
.hero { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 16px; padding-top: 16px; }
.hero-logo { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; border: 4px solid #fff; box-shadow: var(--shadow-lg); background: var(--indigo-100); margin-bottom: 8px; }
.series-pill { display: inline-block; font-size: 12px; font-weight: 900; letter-spacing: .1em; color: var(--indigo-700); background: var(--indigo-100); padding: 6px 16px; border-radius: 999px; }
.hero h1 { margin: 0; font-size: 30px; line-height: 1.25; font-weight: 800; letter-spacing: -.025em; color: var(--slate-800); }
.hero-sub { margin: 0 auto; max-width: 576px; font-size: 14px; line-height: 1.7; color: var(--slate-500); }
.connection-badge { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; color: var(--slate-500); background: #fff; border: 1px solid var(--slate-200); border-radius: 999px; padding: 6px 14px; box-shadow: var(--shadow-sm); }
.connection-badge .dot { width: 8px; height: 8px; border-radius: 50%; background: #f59e0b; }
.connection-badge.connected { color: var(--green-600); border-color: #bbf7d0; background: var(--green-50); }
.connection-badge.connected .dot { background: var(--green-500); }

/* 卡片 */
.card { background: #fff; border: 1px solid var(--slate-100); border-radius: var(--radius-card); box-shadow: var(--shadow-sm); padding: 24px; display: flex; flex-direction: column; gap: 20px; }
.card-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.step-pill { font-size: 11px; font-weight: 900; letter-spacing: .1em; color: var(--indigo-700); background: var(--indigo-100); padding: 4px 12px; border-radius: 999px; text-transform: uppercase; }
.tag-label { font-size: 11px; font-weight: 700; letter-spacing: .1em; color: var(--slate-400); text-transform: uppercase; }
.card-title { margin: 0; font-size: 20px; line-height: 1.4; font-weight: 800; color: var(--slate-800); }
.card-subtitle { margin: 4px 0 0; font-size: 14px; font-weight: 700; color: var(--indigo-600); }

/* 按鈕 */
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 20px; min-height: 48px; border-radius: var(--radius-btn); border: 1px solid transparent; font-size: 14px; font-weight: 700; white-space: nowrap; transition: background-color .2s, box-shadow .2s, transform .15s, color .2s; }
.button svg { width: 16px; height: 16px; }
.button:active:not(:disabled) { transform: scale(.95); }
.primary { background: var(--indigo-600); color: #fff; box-shadow: 0 10px 15px -3px var(--indigo-100), 0 4px 6px -4px var(--indigo-100); }
.primary:hover:not(:disabled) { background: var(--indigo-700); }
.primary:disabled { background: var(--slate-200); color: var(--slate-400); box-shadow: none; }
.danger { background: var(--red-50); color: var(--red-600); border-color: var(--red-200); }
.danger:hover { background: #fee2e2; color: var(--red-700); }
.text-button { background: none; border: 0; padding: 4px 0; color: var(--indigo-600); font-size: 13px; font-weight: 700; display: inline-flex; align-items: center; gap: 6px; transition: color .2s; }
.text-button:hover:not(:disabled) { color: var(--indigo-700); text-decoration: underline; text-underline-offset: 3px; }
.text-button:disabled { color: var(--slate-300); }
.text-button svg { width: 14px; height: 14px; }
.icon-button { display: grid; place-items: center; border: 0; border-radius: 10px; background: transparent; padding: 6px; color: var(--slate-400); transition: background-color .2s, color .2s; }
.icon-button:hover { background: var(--slate-100); color: var(--slate-700); }

/* STEP 1 表單 */
#scan-form { display: flex; flex-direction: column; gap: 16px; }
.url-row { display: flex; flex-direction: column; gap: 12px; }
.url-input-wrap { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; background: var(--slate-50); border: 1px solid var(--slate-200); border-radius: var(--radius-box); padding: 0 16px; transition: border-color .2s, box-shadow .2s, background-color .2s; }
.url-input-wrap:focus-within { background: #fff; border-color: var(--indigo-400); box-shadow: 0 0 0 4px var(--indigo-100); }
.url-input-wrap > svg { color: var(--slate-400); width: 18px; height: 18px; }
.url-input-wrap input { height: 52px; border: 0; background: transparent; color: var(--slate-700); width: 100%; min-width: 0; outline: none; font-size: 16px; }
.url-input-wrap input::placeholder { color: var(--slate-400); }
.url-input-wrap input:disabled { color: var(--slate-400); }
.url-list { display: flex; flex-direction: column; gap: 10px; }
.url-item { display: flex; align-items: center; gap: 8px; }
.url-item .remove-url { flex-shrink: 0; width: 40px; height: 40px; }
.url-item .remove-url:hover { background: var(--red-50); color: var(--red-600); }
.url-actions { display: flex; flex-direction: column; gap: 12px; }
.scan-buttons { display: flex; gap: 10px; }
.scan-buttons .scan-button { flex: 1; }
.secondary { background: #fff; color: var(--indigo-600); border: 2px dashed var(--indigo-200); }
.secondary:hover:not(:disabled) { background: var(--indigo-50); border-color: var(--indigo-400); }
.secondary:disabled { color: var(--slate-300); border-color: var(--slate-200); }
.mode-box { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; background: var(--indigo-50); border: 1px solid var(--indigo-100); border-radius: var(--radius-box); padding: 14px 16px; }
.check-option.mode-option { align-items: flex-start; }
.check-option.mode-option input { margin-top: 3px; }
.mode-option span { display: flex; flex-direction: column; gap: 2px; }
.mode-option strong { font-size: 15px; color: var(--indigo-700); }
.mode-option small { font-size: 13px; color: var(--slate-500); }
.scan-options { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; color: var(--slate-600); }
.check-option { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; }
.check-option input { width: 16px; height: 16px; margin: 0; accent-color: var(--indigo-600); cursor: pointer; }
.page-limit-label { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--slate-600); }
select { border: 1px solid var(--slate-200); color: var(--slate-700); border-radius: 10px; padding: 6px 10px; font-size: 14px; font-weight: 700; background: #fff; }
select:focus { border-color: var(--indigo-400); outline: none; box-shadow: 0 0 0 3px var(--indigo-100); }
.hint-box { display: flex; gap: 10px; align-items: flex-start; background: var(--slate-50); border: 1px solid var(--slate-200); border-radius: var(--radius-box); padding: 14px 16px; }
.hint-box svg { width: 18px; height: 18px; color: var(--indigo-500); margin-top: 1px; }
.hint-box p { margin: 0; font-size: 13px; line-height: 1.7; color: var(--slate-500); }

/* 狀態訊息與進度 */
.notice { border-radius: var(--radius-box); background: var(--indigo-50); border: 1px solid var(--indigo-100); color: var(--indigo-700); padding: 14px 16px; font-size: 14px; line-height: 1.7; white-space: pre-line; }
.notice.error { background: var(--red-50); border-color: var(--red-200); color: var(--red-700); }
.notice.warning { background: var(--amber-50); border-color: var(--amber-200); color: var(--amber-800); }
.progress-card { border: 1px solid var(--slate-200); background: var(--slate-50); border-radius: var(--radius-box); padding: 16px; }
.progress-head { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.progress-title { color: var(--slate-700); font-weight: 700; }
#progress-count { color: var(--indigo-600); font-weight: 700; font-variant-numeric: tabular-nums; }
progress { display: block; width: 100%; height: 8px; appearance: none; margin: 12px 0 10px; border: 0; border-radius: 999px; overflow: hidden; background: var(--slate-200); }
progress::-webkit-progress-bar { background: var(--slate-200); }
progress::-webkit-progress-value { background: var(--indigo-600); border-radius: 999px; }
progress::-moz-progress-bar { background: var(--indigo-600); }
.progress-card p { font-size: 12px; color: var(--slate-500); margin: 0; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }

/* STEP 2 照片 */
.collection-heading { display: flex; flex-direction: column; gap: 16px; }
.title-line { display: flex; align-items: center; gap: 10px; }
.count-badge { font-size: 12px; font-weight: 900; min-width: 28px; padding: 2px 10px; text-align: center; background: var(--indigo-100); color: var(--indigo-700); border-radius: 999px; font-variant-numeric: tabular-nums; }
.download-count { border-left: 1px solid rgb(255 255 255 / .35); padding-left: 10px; font-variant-numeric: tabular-nums; }
.primary:disabled .download-count { border-color: var(--slate-300); }
.results-toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; align-items: center; background: var(--slate-50); border: 1px solid var(--slate-200); border-radius: var(--radius-box); padding: 10px 14px; }
.selection-actions { display: flex; gap: 16px; align-items: center; }
.selected-info { font-size: 13px; color: var(--slate-500); font-weight: 700; }
.results-search { display: flex; align-items: center; gap: 8px; background: #fff; border: 1px solid var(--slate-200); border-radius: 10px; padding: 0 10px; color: var(--slate-400); flex: 1 1 180px; max-width: 260px; transition: border-color .2s, box-shadow .2s; }
.results-search:focus-within { border-color: var(--indigo-400); box-shadow: 0 0 0 3px var(--indigo-100); }
.results-search svg { width: 16px; height: 16px; }
.results-search input { background: transparent; border: 0; outline: none; font-size: 14px; color: var(--slate-700); width: 100%; min-width: 0; height: 38px; }
.results-search input::placeholder { color: var(--slate-400); }

.empty-state { border: 2px dashed var(--slate-200); background: var(--slate-50); border-radius: var(--radius-box); text-align: center; padding: 40px 20px; }
.empty-icon { display: inline-grid; place-items: center; width: 64px; height: 64px; border-radius: 20px; background: var(--indigo-100); color: var(--indigo-600); margin-bottom: 16px; }
.empty-icon svg { width: 30px; height: 30px; stroke-width: 1.8; }
.empty-state h3 { font-size: 16px; font-weight: 800; color: var(--slate-700); margin: 0 0 8px; }
.empty-state p { font-size: 14px; line-height: 1.7; color: var(--slate-500); margin: 0 auto; max-width: 360px; }
.empty-steps { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 20px; }
.empty-steps span { display: inline-flex; align-items: center; gap: 8px; background: #fff; border: 1px solid var(--slate-200); border-radius: 999px; padding: 6px 14px 6px 6px; font-size: 13px; font-weight: 700; color: var(--slate-600); }
.empty-steps b { width: 24px; height: 24px; border-radius: 50%; background: var(--indigo-600); color: #fff; font-size: 12px; display: inline-grid; place-items: center; }

.image-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.image-grid:empty { display: none; }
.image-card { background: #fff; border: 1px solid var(--slate-200); border-radius: var(--radius-box); overflow: hidden; position: relative; transition: border-color .2s, box-shadow .2s; }
.image-card:hover { box-shadow: 0 4px 6px -1px rgb(0 0 0 / .08), 0 2px 4px -2px rgb(0 0 0 / .06); }
.image-card.selected { border-color: var(--indigo-400); box-shadow: 0 0 0 2px var(--indigo-100); }
.image-card > label { position: absolute; z-index: 1; left: 10px; top: 10px; display: flex; padding: 5px; border-radius: 8px; background: rgb(255 255 255 / .92); box-shadow: var(--shadow-sm); cursor: pointer; }
.image-card input { width: 16px; height: 16px; margin: 0; accent-color: var(--indigo-600); cursor: pointer; }
.image-preview { display: grid; place-items: center; background: var(--slate-50); width: 100%; aspect-ratio: 1.12; border: 0; border-bottom: 1px solid var(--slate-100); padding: 14px; overflow: hidden; cursor: zoom-in; }
.image-preview img { width: 100%; height: 100%; object-fit: contain; transition: transform .3s; }
.image-preview:hover img { transform: scale(1.04); }
.preview-failed { color: var(--slate-400); font-size: 12px; line-height: 1.7; text-align: center; }
.preview-failed svg { width: 30px; height: 30px; display: block; margin: 0 auto 6px; color: var(--slate-300); }
.image-card-info { padding: 10px 12px 12px; }
.image-card-info h3 { font-size: 13px; color: var(--slate-700); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin: 0 0 6px; font-weight: 700; }
.image-meta { display: flex; justify-content: space-between; align-items: center; font-size: 11px; color: var(--slate-400); gap: 6px; }
.image-meta a { text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.image-meta a:hover { color: var(--indigo-600); text-decoration: underline; }
.image-kind { flex-shrink: 0; font-weight: 700; color: var(--indigo-600); background: var(--indigo-50); border-radius: 999px; padding: 1px 8px; }
.no-matches { padding: 40px 16px; text-align: center; font-size: 14px; color: var(--slate-500); }
.collection-footer { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 12px; font-size: 13px; color: var(--slate-500); }
.log-details { font-size: 13px; color: var(--slate-500); border: 1px solid var(--slate-200); background: var(--slate-50); padding: 12px 16px; border-radius: var(--radius-box); }
.log-details summary { font-weight: 700; color: var(--slate-600); }
.log-details ul { max-height: 200px; overflow: auto; margin: 10px 0 0; padding-left: 18px; line-height: 1.9; overflow-wrap: anywhere; }

.license-note { margin: -16px 0 0; text-align: center; font-size: 13px; color: var(--slate-400); }

/* Footer */
.site-footer { margin-top: 24px; padding: 40px 0 48px; border-top: 1px solid rgb(226 232 240 / .6); display: flex; flex-direction: column; align-items: center; gap: 24px; }
.footer-label { margin: 0; font-size: 14px; font-weight: 700; letter-spacing: .2em; text-transform: uppercase; color: var(--slate-400); }
.social-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 16px; }
.social-link { display: flex; align-items: center; gap: 10px; padding: 12px 24px; border-radius: var(--radius-box); background: #fff; border: 1px solid var(--slate-200); color: var(--slate-600); font-size: 14px; font-weight: 700; text-decoration: none; box-shadow: var(--shadow-sm); transition: color .3s, background-color .3s, border-color .3s; }
.social-link.ig:hover { color: #db2777; background: #fdf2f8; border-color: #fbcfe8; }
.social-link.fb:hover { color: #2563eb; background: #eff6ff; border-color: #bfdbfe; }
.social-link.threads:hover { color: #000; background: var(--slate-100); border-color: var(--slate-300); }
.social-link.line:hover { color: var(--green-600); background: var(--green-50); border-color: #bbf7d0; }
.copyright { margin: 16px 0 0; font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--slate-300); }

/* 預覽視窗與提示 */
dialog { padding: 24px; border: 1px solid var(--slate-100); border-radius: var(--radius-card); box-shadow: 0 25px 50px -12px rgb(0 0 0 / .25); background: #fff; color: var(--slate-800); max-width: min(900px, calc(100vw - 32px)); width: 100%; }
dialog::backdrop { background: rgb(15 23 42 / .45); backdrop-filter: blur(4px); }
.lightbox-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 14px; }
.lightbox-heading h2 { margin: 0; font-size: 16px; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lightbox-image-wrap { display: grid; place-items: center; min-height: 200px; background: var(--slate-50); border-radius: var(--radius-box); margin-bottom: 14px; }
.lightbox-image-wrap img { max-width: 100%; max-height: 70vh; object-fit: contain; }
#lightbox-source { font-size: 14px; font-weight: 700; color: var(--indigo-600); text-decoration: none; }
#lightbox-source:hover { text-decoration: underline; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--slate-800); color: #fff; font-size: 14px; font-weight: 700; border-radius: var(--radius-btn); padding: 12px 20px; box-shadow: var(--shadow-lg); z-index: 20; max-width: calc(100vw - 32px); text-align: center; }

/* 響應式：對應 Tailwind sm / md 斷點 */
@media (min-width: 640px) {
  .url-actions { flex-direction: row; justify-content: space-between; align-items: center; }
  .scan-buttons .scan-button { flex: none; min-width: 168px; }
  .collection-heading { flex-direction: row; align-items: center; justify-content: space-between; }
  .image-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
}
@media (min-width: 768px) {
  .page { padding: 32px; }
  .card { padding: 32px; }
  .hero h1 { font-size: 36px; }
  .hero-sub { font-size: 16px; }
  .card-title { font-size: 24px; }
  .image-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 420px) {
  .hero-sub br { display: none; }
  .social-link { padding: 10px 18px; }
  .results-search { max-width: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
