:root {
  --bg: #0f1115;
  --card: #191c22;
  --card-2: #22262e;
  --line: #2e333d;
  --text: #e8eaed;
  --muted: #9aa0aa;
  --accent: #7c9cff;
  --accent-2: #b58cff;
  --ok: #57c98a;
  --radius: 16px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang TC",
    "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(1200px 500px at 20% -10%, rgba(124,156,255,0.12), transparent),
    radial-gradient(1000px 500px at 90% 0%, rgba(181,140,255,0.10), transparent),
    var(--bg);
}

.site-header {
  text-align: center;
  padding: 34px 20px 10px;
}
.site-header h1 {
  margin: 0 0 6px;
  font-size: clamp(26px, 6vw, 38px);
  letter-spacing: 0.5px;
}
.tagline {
  margin: 0 auto;
  max-width: 520px;
  color: var(--muted);
  font-size: 15px;
}

main {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 16px 16px 40px;
  flex: 1;
}

.input-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}

.tabs {
  display: flex;
  gap: 6px;
  background: var(--card-2);
  border-radius: 12px;
  padding: 5px;
  margin-bottom: 16px;
}
.tab {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 10px;
  border-radius: 9px;
  font-size: 15px;
  cursor: pointer;
  transition: 0.15s;
}
.tab.active {
  background: var(--accent);
  color: #0b0e14;
  font-weight: 600;
}

.dropzone {
  display: block;
  border: 1.5px dashed var(--line);
  border-radius: 14px;
  padding: 34px 16px;
  text-align: center;
  cursor: pointer;
  transition: 0.15s;
  position: relative;
}
.dropzone.dragover { border-color: var(--accent); background: rgba(124,156,255,0.06); }
.dz-inner { display: flex; flex-direction: column; gap: 6px; align-items: center; }
.dz-icon { font-size: 40px; }
.dz-text { font-size: 16px; }
.dz-hint { font-size: 13px; color: var(--muted); }
.thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 10px;
  margin-top: 14px;
}
.thumb {
  position: relative;
  aspect-ratio: 1;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
}
.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.thumb-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 50%;
  background: rgba(15, 17, 21, 0.75);
  color: #fff;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
}
.thumb-add {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  aspect-ratio: 1;
  border-radius: 10px;
  border: 1.5px dashed var(--line);
  color: var(--muted);
  font-size: 22px;
  cursor: pointer;
}
.thumb-add span { font-size: 11px; }
.thumb-add:hover { border-color: var(--accent); color: var(--accent); }

.url-input, .analyze-btn {
  width: 100%;
  font-size: 16px;
  border-radius: 12px;
}
.url-input {
  padding: 14px;
  background: var(--card-2);
  border: 1px solid var(--line);
  color: var(--text);
}
.url-input:focus { outline: none; border-color: var(--accent); }
.url-hint { color: var(--muted); font-size: 13px; margin: 8px 2px 0; }

.analyze-btn {
  margin-top: 16px;
  padding: 15px;
  border: 0;
  font-weight: 700;
  color: #0b0e14;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  cursor: pointer;
  transition: 0.15s;
}
.analyze-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.analyze-btn:not(:disabled):active { transform: translateY(1px); }

.status {
  margin: 14px 2px 0;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}
.status.error { color: #ff8f8f; }

.result { margin-top: 22px; display: flex; flex-direction: column; gap: 16px; }

.block {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}
.block h2 {
  margin: 0 0 12px;
  font-size: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.block h2 .badge { font-size: 12px; color: var(--muted); font-weight: 400; }

.multi-banner {
  padding: 12px 18px;
  font-size: 14px;
  color: var(--accent);
  background: rgba(124,156,255,0.08);
  border-color: rgba(124,156,255,0.3);
}

.summary-block { background: linear-gradient(135deg, rgba(124,156,255,0.14), rgba(181,140,255,0.10)); }
.summary-text { font-size: 18px; margin: 0 0 12px; }
.keywords { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 13px;
}

.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 84px; }
.swatch .chip-color {
  width: 64px; height: 64px; border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.15);
}
.swatch .sw-hex { font-size: 12px; font-family: ui-monospace, monospace; }
.swatch .sw-usage { font-size: 11px; color: var(--muted); text-align: center; }

.kv { display: grid; grid-template-columns: 100px 1fr; gap: 8px 14px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

.prompt-block textarea {
  width: 100%;
  min-height: 150px;
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  padding: 14px;
  font-size: 15px;
  line-height: 1.7;
  resize: vertical;
}
.prompt-block textarea.code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 13px;
  line-height: 1.6;
  white-space: pre;
}
.copy-btn {
  margin-top: 10px;
  padding: 10px 16px;
  border: 1px solid var(--line);
  background: var(--card-2);
  color: var(--text);
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
}
.copy-btn.copied { border-color: var(--ok); color: var(--ok); }

details.raw { font-size: 13px; color: var(--muted); }
details.raw pre {
  background: var(--card-2);
  border-radius: 10px;
  padding: 14px;
  overflow-x: auto;
  font-size: 12px;
}

.site-footer {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  padding: 18px;
}

.spinner {
  display: inline-block;
  width: 15px; height: 15px;
  border: 2px solid var(--muted);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: -2px;
  margin-right: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 480px) {
  .kv { grid-template-columns: 84px 1fr; }
}
