/* ============================================================
   Client site — warm, inviting, conversion-oriented.
   Mobile-first: base rules target phones, media queries widen.
   Design language: deep ink + amber/gold accents (traditional
   Chinese metaphysics feel) with generous whitespace so long
   AI reports stay readable.
   ============================================================ */

:root {
  --ink:        #16151a;
  --ink-soft:   #3b3946;
  --muted:      #6f6b7d;
  --line:       #e6e2ee;
  --bg:         #fdfcfa;
  --card:       #ffffff;

  --gold:       #b8893a;
  --gold-dark:  #9a7130;
  --gold-soft:  #f6efe2;
  --plum:       #6d4b6b;

  --ok:         #2f7a52;
  --ok-soft:    #e8f4ed;
  --warn:       #9a6414;
  --warn-soft:  #fdf3e0;
  --err:        #a3342f;
  --err-soft:   #fbeceb;

  --radius:     14px;
  --radius-sm:  9px;
  --shadow:     0 1px 2px rgba(22,21,26,.05), 0 8px 24px rgba(22,21,26,.06);
  --shadow-lg:  0 2px 6px rgba(22,21,26,.07), 0 20px 48px rgba(22,21,26,.10);
  --maxw:       1080px;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei",
               system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.75;
  color: var(--ink);
  background: var(--bg);
}

h1, h2, h3, h4 { line-height: 1.35; margin: 0 0 .6em; font-weight: 700; }
h1 { font-size: 1.7rem; letter-spacing: -.01em; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.1rem; }
p  { margin: 0 0 1em; }

a { color: var(--gold-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------------------------------------------------- layout */
.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 16px;
}

.main { padding: 24px 0 64px; }

/* ------------------------------------------------------- nav */
.nav {
  background: rgba(253,252,250,.92);
  backdrop-filter: saturate(160%) blur(8px);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 50;
}

.nav-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.brand {
  font-weight: 800;
  font-size: 1.12rem;
  color: var(--ink);
  letter-spacing: -.01em;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* The wordmark carries the brand, so it replaces the old round gradient mark
   and the site name text. Height drives the size; width follows the ratio.
   The image is 222x101, so 42px tall still leaves it sharp on a retina
   screen. */
.brand-logo {
  display: block;
  height: 42px;
  width: auto;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  flex-wrap: wrap;
}

.nav-links a {
  padding: 7px 11px;
  border-radius: 8px;
  color: var(--ink-soft);
  font-size: .93rem;
  font-weight: 500;
}

.nav-links a:hover { background: var(--gold-soft); text-decoration: none; }
.nav-links a.active { background: var(--gold-soft); color: var(--gold-dark); font-weight: 700; }

/* credit pill in the header — always visible, drives top-ups */
.pill-credits {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--gold-soft);
  border: 1px solid #eadfc6;
  color: var(--gold-dark);
  font-weight: 700;
  font-size: .9rem;
  white-space: nowrap;
}

.pill-credits small { font-weight: 500; opacity: .8; font-size: .8em; }

/* ------------------------------------------------------ cards */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}

.card-lg { padding: 24px; }
.card h2:first-child, .card h3:first-child { margin-top: 0; }

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.card-head h2, .card-head h3 { margin: 0; }

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

@media (min-width: 720px) {
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
}

/* ------------------------------------------------------- hero */
.hero {
  padding: 44px 0 30px;
  text-align: center;
}

.hero h1 {
  font-size: 2rem;
  margin-bottom: .4em;
  background: linear-gradient(120deg, var(--ink), var(--plum) 70%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero .lead {
  font-size: 1.08rem;
  color: var(--ink-soft);
  max-width: 620px;
  margin: 0 auto 1.4em;
}

.hero-cta { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

@media (min-width: 720px) {
  .hero { padding: 68px 0 44px; }
  .hero h1 { font-size: 2.7rem; }
  .hero .lead { font-size: 1.16rem; }
}

/* value props */
.props { display: grid; gap: 14px; grid-template-columns: 1fr; margin-top: 34px; }

@media (min-width: 720px) { .props { grid-template-columns: repeat(3, 1fr); } }

.prop {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  text-align: left;
}

.prop-ico {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: var(--gold-soft);
  display: grid;
  place-items: center;
  font-size: 1.15rem;
  margin-bottom: 10px;
}

.prop h3 { font-size: 1.02rem; margin-bottom: .35em; }
.prop p { color: var(--muted); font-size: .94rem; margin: 0; }

/* ---------------------------------------------------- buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 12px 20px;
  border-radius: 10px;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 700;
  font-size: .97rem;
  line-height: 1.2;
  cursor: pointer;
  text-decoration: none;
  transition: transform .06s ease, box-shadow .15s ease, background .15s ease;
  min-height: 46px;   /* comfortable tap target */
}

.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: linear-gradient(180deg, var(--gold), var(--gold-dark));
  color: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,.12), 0 6px 18px rgba(184,137,58,.28);
}

.btn-primary:hover { filter: brightness(1.06); }

.btn-secondary {
  background: #fff;
  border-color: var(--line);
  color: var(--ink);
}

.btn-secondary:hover { background: #faf8f4; border-color: #d9d3e4; }

.btn-ghost { background: transparent; color: var(--ink-soft); }
.btn-ghost:hover { background: var(--gold-soft); }

.btn-danger { background: var(--err); color: #fff; }

.btn-google {
  background: #fff;
  border-color: #d6d3cd;
  color: var(--ink);
  font-weight: 600;
}
.btn-google:hover { background: #f7f7f5; border-color: #c3bfb7; }

.g-mark { width: 18px; height: 18px; margin-right: 10px; vertical-align: -3px; }

.btn-block { width: 100%; }
.btn-sm { padding: 8px 13px; min-height: 38px; font-size: .89rem; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }

/* ------------------------------------------------------ forms */
.field { margin-bottom: 16px; }

.label {
  display: block;
  font-weight: 600;
  font-size: .93rem;
  margin-bottom: 6px;
  color: var(--ink-soft);
}

.hint { font-size: .85rem; color: var(--muted); margin-top: 5px; }

.input, .select, .textarea {
  width: 100%;
  padding: 12px 13px;
  font: inherit;
  font-size: 1rem;   /* >=16px stops iOS zoom-on-focus */
  color: var(--ink);
  background: #fff;
  border: 1px solid #d9d3e4;
  border-radius: var(--radius-sm);
  transition: border-color .15s, box-shadow .15s;
}

.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(184,137,58,.16);
}

.textarea { min-height: 128px; resize: vertical; line-height: 1.65; }

.field-err .input, .field-err .select, .field-err .textarea { border-color: var(--err); }
.err-text { color: var(--err); font-size: .86rem; margin-top: 5px; }

.row { display: grid; gap: 12px; grid-template-columns: 1fr; }

@media (min-width: 560px) {
  .row-2 { grid-template-columns: repeat(2, 1fr); }
  .row-3 { grid-template-columns: repeat(3, 1fr); }
  .row-4 { grid-template-columns: repeat(4, 1fr); }
}

/* radio / checkbox cards */
.choice-group { display: grid; gap: 10px; grid-template-columns: repeat(3, 1fr); }

.choice {
  position: relative;
  display: block;
  cursor: pointer;
}

.choice input { position: absolute; opacity: 0; pointer-events: none; }

.choice span {
  display: block;
  text-align: center;
  padding: 13px 8px;
  border: 1px solid #d9d3e4;
  border-radius: var(--radius-sm);
  background: #fff;
  font-weight: 600;
  font-size: .96rem;
  transition: all .13s;
}

.choice input:checked + span {
  border-color: var(--gold);
  background: var(--gold-soft);
  color: var(--gold-dark);
  box-shadow: 0 0 0 3px rgba(184,137,58,.14);
}

.choice input:focus-visible + span { box-shadow: 0 0 0 3px rgba(184,137,58,.3); }

.check-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  cursor: pointer;
  margin-bottom: 9px;
}

.check-row:hover { border-color: #d9d3e4; background: #fdfbf7; }
.check-row input { margin-top: 4px; width: 18px; height: 18px; flex: 0 0 auto; accent-color: var(--gold); }
.check-row.is-on { border-color: var(--gold); background: var(--gold-soft); }
.check-row-main { flex: 1; min-width: 0; }
.check-row-title { font-weight: 600; }
.check-row-sub { font-size: .86rem; color: var(--muted); }

/* ------------------------------------------------------ alerts */
.alert {
  padding: 13px 15px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: .94rem;
  border: 1px solid transparent;
}

.alert-ok   { background: var(--ok-soft);   color: var(--ok);   border-color: #cfe6da; }
.alert-warn { background: var(--warn-soft); color: var(--warn); border-color: #f2e2c4; }
.alert-err  { background: var(--err-soft);  color: var(--err);  border-color: #f2d4d2; }
.alert-info { background: #eef2fb;          color: #2f4a80;     border-color: #d5e0f5; }

/* ------------------------------------------------------ badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: .8rem;
  font-weight: 700;
  white-space: nowrap;
}

.badge-ready   { background: var(--ok-soft);   color: var(--ok); }
.badge-queued  { background: var(--warn-soft); color: var(--warn); }
.badge-running { background: #e9f0fb;          color: #2f4a80; }
.badge-error   { background: var(--err-soft);  color: var(--err); }
.badge-draft   { background: #f0eef4;          color: var(--muted); }
.badge-primary { background: var(--gold-soft); color: var(--gold-dark); }

/* spinner for in-progress states */
.spinner {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  vertical-align: -2px;
}

@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .spinner { animation-duration: 2.4s; }
  .btn { transition: none; }
}

/* progress bar for the generating state */
.progress {
  height: 7px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
  margin: 14px 0 6px;
}

.progress-bar {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--gold), var(--plum));
  background-size: 200% 100%;
  animation: slide 1.6s ease-in-out infinite;
}

@keyframes slide {
  0%   { transform: translateX(-70%); width: 45%; }
  50%  { transform: translateX(60%);  width: 65%; }
  100% { transform: translateX(-70%); width: 45%; }
}

/* -------------------------------------------------- auth pages */
.auth-shell {
  max-width: 430px;
  margin: 40px auto;
  padding: 0 16px;
}

.auth-shell .card { padding: 26px; }
.auth-title { text-align: center; margin-bottom: 6px; }
.auth-sub { text-align: center; color: var(--muted); font-size: .94rem; margin-bottom: 22px; }
.auth-foot { text-align: center; margin-top: 18px; font-size: .93rem; color: var(--muted); }

/* "or" rule between two sign-in methods. */
.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--muted);
  font-size: .85rem;
}
.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

/* --------------------------------------------------- wizard */
.steps {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 22px;
  justify-content: center;
  flex-wrap: wrap;
}

.step {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: .87rem;
  color: var(--muted);
}

.step-num {
  width: 25px; height: 25px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #f0eef4;
  color: var(--muted);
  font-weight: 700;
  font-size: .8rem;
  flex: 0 0 auto;
}

.step.is-now .step-num { background: var(--gold); color: #fff; }
.step.is-now { color: var(--ink); font-weight: 700; }
.step.is-done .step-num { background: var(--ok-soft); color: var(--ok); }
.step-bar { width: 22px; height: 2px; background: var(--line); }

/* --------------------------------------------- profile list */
.plist { display: grid; gap: 13px; grid-template-columns: 1fr; }

@media (min-width: 760px) { .plist { grid-template-columns: repeat(2, 1fr); } }

.pcard {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  padding: 17px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.pcard-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.pcard-title { font-weight: 700; font-size: 1.04rem; margin: 0; }
.pcard-meta { color: var(--muted); font-size: .87rem; }
.pcard-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; }

/* ------------------------------------------- report rendering */
.report {
  font-size: 1.02rem;
  line-height: 1.85;
}

.report h2 {
  font-size: 1.24rem;
  margin: 1.7em 0 .6em;
  padding-bottom: .3em;
  border-bottom: 2px solid var(--gold-soft);
  color: var(--plum);
}

.report h2:first-child { margin-top: 0; }
.report h3 { font-size: 1.08rem; margin: 1.4em 0 .5em; color: var(--gold-dark); }
.report h4 { font-size: 1rem; margin: 1.2em 0 .4em; }
.report ul { padding-left: 1.3em; margin: 0 0 1.1em; }
.report li { margin-bottom: .55em; }
.report strong { color: var(--plum); font-weight: 700; }
.report hr { border: 0; border-top: 1px solid var(--line); margin: 1.8em 0; }
.report code {
  background: #f4f2f7;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: .92em;
}

.report p:last-child { margin-bottom: 0; }

/* ------------------------------------------------ chart table */
.kv { width: 100%; border-collapse: collapse; font-size: .94rem; }
.kv th, .kv td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--line); }
.kv th { color: var(--muted); font-weight: 600; width: 38%; }
.kv tr:last-child th, .kv tr:last-child td { border-bottom: 0; }

.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* -------------------------------------------------- utilities */
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.center { text-align: center; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.mt-1 { margin-top: 10px; }
.mt-2 { margin-top: 20px; }
.mt-3 { margin-top: 30px; }
.stack > * + * { margin-top: 12px; }
.flex { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.flex-between { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.nowrap { white-space: nowrap; }

.empty {
  text-align: center;
  padding: 44px 20px;
  color: var(--muted);
}

.empty-ico { font-size: 2.4rem; margin-bottom: 10px; opacity: .55; }

/* ------------------------------------------------------ footer */
.foot {
  border-top: 1px solid var(--line);
  padding: 26px 0;
  text-align: center;
  color: var(--muted);
  font-size: .87rem;
}

.foot a { color: var(--muted); text-decoration: underline; }

/* screen-reader only */
.sr {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
