/* ── Design Tokens ── */
:root {
  --color-bg:           #FAF7F2;
  --color-surface:      #FFFFFF;
  --color-surface-alt:  #F0EBE3;
  --color-border:       #E2D9CE;
  --color-text:         #2C2825;
  --color-text-muted:   #8A7F74;
  --color-accent:       #C9A96E;
  --color-accent-hover: #B08D52;
  --color-ad-bg:        #F0EBE3;
  --color-ad-border:    #E2D9CE;

  --font-serif-en: 'Cormorant Garamond', Georgia, serif;
  --font-serif-cn: 'Noto Serif TC', 'Georgia', serif;
  --font-sans:     'Noto Sans TC', system-ui, sans-serif;

  --space-2:  8px;
  --space-3:  12px;
  --space-4:  16px;
  --space-5:  20px;
  --space-6:  24px;
  --space-8:  32px;
  --space-10: 40px;
  --space-14: 56px;

  --radius-sm: 4px;
  --radius:    10px;
  --radius-lg: 16px;
  --shadow:    0 4px 32px rgba(44,40,37,0.10);
  --shadow-sm: 0 2px 8px rgba(44,40,37,0.06);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.7;
  min-height: 100vh;
}
img { display: block; max-width: 100%; }
button { cursor: pointer; font-family: inherit; border: none; background: none; }

/* ── Layout ── */
.tool-layout {
  position: relative;
  max-width: 640px;
  width: 100%;
  margin: 0 auto;
  padding: var(--space-6) var(--space-4) var(--space-10);
}

/* ── Ad Slots ── */
.site-header, .site-footer { display: flex; justify-content: center; background: var(--color-bg); }
.ad-slot { display: flex; align-items: center; justify-content: center; overflow: hidden; position: relative; }
.ad-slot::before { content: attr(data-ad-slot) ' ad'; position: absolute; color: var(--color-text-muted); font-size: 0.7rem; }
.ad-slot.ad-loaded::before { display: none; }
.ad-slot--header  { width: 100%; min-height: 90px; max-width: 728px; margin: 10px auto; background: var(--color-ad-bg); border: 1px dashed var(--color-ad-border); }
.ad-slot--footer  { width: 100%; min-height: 90px; max-width: 728px; margin: 10px auto; background: var(--color-ad-bg); border: 1px dashed var(--color-ad-border); }
.ad-slot--sidebar { width: 100%; min-height: auto; max-width: 200px; display: block; background: transparent; border: none; overflow: visible; }

/* Sidebar */
.tool-sidebar { width: 100%; margin-top: var(--space-6); display: flex; justify-content: center; }
@media (min-width: 1025px) {
  .tool-sidebar { position: fixed; right: 20px; top: 50%; transform: translateY(-50%); width: 200px; margin-top: 0; display: block; z-index: 10; }
}
@media (max-width: 1024px) {
  .ad-slot--header, .ad-slot--footer { min-height: 50px; max-width: 320px; }
  .ad-slot--sidebar { max-width: 100%; }
}

/* ── Screens ── */
.screen { display: none; animation: fadeIn 0.35s ease-out; }
.screen.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* ── Cover ── */
.cover-inner {
  display: flex; flex-direction: column; align-items: center;
  text-align: center; padding: var(--space-10) var(--space-4);
}
.cover-eyebrow {
  font-family: var(--font-serif-en); font-size: 0.85rem; letter-spacing: 0.2em;
  color: var(--color-accent); text-transform: uppercase; margin-bottom: var(--space-3);
}
h1.cover-title {
  font-family: var(--font-serif-cn); font-size: clamp(2rem, 6vw, 3rem);
  font-weight: 700; line-height: 1.25; color: var(--color-text);
  margin-bottom: var(--space-5);
}
.cover-subtitle { font-size: 1rem; color: var(--color-text-muted); margin-bottom: var(--space-8); }
.cover-note { font-size: 0.8rem; color: var(--color-text-muted); margin-top: var(--space-3); letter-spacing: 0.05em; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: var(--space-2);
  padding: 12px 28px; border-radius: var(--radius);
  font-size: 0.95rem; font-weight: 600; transition: all 0.2s ease;
  font-family: var(--font-sans);
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }
.btn-icon { width: 17px; height: 17px; flex-shrink: 0; }
.btn-primary { background: var(--color-accent); color: #fff; box-shadow: 0 4px 16px rgba(201,169,110,0.35); }
.btn-primary:hover { background: var(--color-accent-hover); box-shadow: 0 6px 20px rgba(201,169,110,0.45); }
.btn-outline { background: transparent; color: var(--color-accent); border: 1.5px solid var(--color-accent); }
.btn-outline:hover { background: var(--color-accent); color: #fff; }
.btn-ghost { background: transparent; color: var(--color-text-muted); border: 1.5px solid var(--color-border); }
.btn-ghost:hover { border-color: var(--color-text-muted); color: var(--color-text); }

/* ── Progress ── */
.quiz-inner { padding: var(--space-4) 0; }
.progress-wrap { display: flex; align-items: center; gap: var(--space-3); margin-bottom: var(--space-5); }
.progress-bar { flex: 1; height: 3px; background: var(--color-border); border-radius: 99px; overflow: hidden; }
.progress-fill {
  height: 100%; background: var(--color-accent); border-radius: 99px;
  width: 0; transition: width 0.4s cubic-bezier(0.4,0,0.2,1);
}
.progress-label { font-size: 0.8rem; color: var(--color-text-muted); white-space: nowrap; letter-spacing: 0.05em; }

/* ── Question Illustration ── */
.question-illustration-wrap {
  width: 100%; border-radius: var(--radius-lg); overflow: hidden;
  border: 1px solid var(--color-border); box-shadow: var(--shadow-sm);
  margin-bottom: var(--space-5); background: var(--color-surface-alt);
}
.question-illustration {
  width: 100%; height: 220px; object-fit: cover; transition: opacity 0.3s ease;
}
.question-illustration.fade-out { opacity: 0; }
@media (max-width: 480px) { .question-illustration { height: 170px; } }

/* ── Question ── */
.question-text {
  font-family: var(--font-serif-cn); font-size: clamp(1.05rem, 3.5vw, 1.25rem);
  font-weight: 600; line-height: 1.55; color: var(--color-text);
  margin-bottom: var(--space-5);
}

/* ── Options ── */
.options-container { display: flex; flex-direction: column; gap: var(--space-3); }
.option-btn {
  width: 100%; text-align: left; padding: var(--space-4) var(--space-5);
  background: var(--color-surface); border: 1.5px solid var(--color-border);
  border-radius: var(--radius); font-size: 0.95rem; color: var(--color-text);
  transition: all 0.2s ease; line-height: 1.6;
}
.option-btn:hover {
  border-color: var(--color-accent); background: var(--color-surface-alt);
  transform: translateY(-2px); box-shadow: var(--shadow-sm);
}

/* ── Result ── */
.result-hero {
  position: relative; width: 100%; height: 55vh; min-height: 280px; max-height: 480px;
  border-radius: var(--radius-lg); overflow: hidden;
  box-shadow: 0 8px 40px rgba(44,40,37,0.15); margin-bottom: var(--space-6);
}
.result-img { width: 100%; height: 100%; object-fit: cover; }
.result-overlay {
  position: absolute; bottom: 0; left: 0; right: 0; height: 50%;
  background: linear-gradient(to top, rgba(44,40,37,0.55), transparent);
}
.result-body { padding: 0 var(--space-2); }
.result-en {
  font-family: var(--font-serif-en); font-size: 0.85rem; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--color-accent); margin-bottom: var(--space-2);
}
.result-name {
  font-family: var(--font-serif-cn); font-size: clamp(1.5rem, 5vw, 2.2rem);
  font-weight: 700; line-height: 1.25; color: var(--color-text); margin-bottom: var(--space-2);
}
.result-subtitle {
  font-family: var(--font-serif-cn); font-size: 1rem; color: var(--color-text-muted);
  font-style: italic; margin-bottom: var(--space-5); letter-spacing: 0.02em;
}
.result-notes {
  display: flex; flex-wrap: wrap; gap: var(--space-2); margin-bottom: var(--space-5);
}
.note-tag {
  padding: 4px 12px; background: var(--color-surface-alt); border: 1px solid var(--color-border);
  border-radius: 99px; font-size: 0.78rem; color: var(--color-text-muted); letter-spacing: 0.04em;
}
.note-label { font-size: 0.72rem; color: var(--color-accent); margin-right: 4px; font-weight: 600; }
.result-desc {
  font-size: 0.95rem; color: var(--color-text); line-height: 1.85;
  border-left: 2px solid var(--color-accent); padding-left: var(--space-4);
  margin-bottom: var(--space-6);
}
.result-actions { display: flex; gap: var(--space-3); flex-wrap: wrap; justify-content: center; margin-bottom: var(--space-4); }
.copy-toast {
  text-align: center; font-size: 0.82rem; color: var(--color-accent);
  height: 1.4rem; transition: opacity 0.3s;
}

/* ── Ad inner (sidebar) ── */
.ad-grid { display: flex; flex-direction: column; gap: 8px; }
.ad-img  { width: 100%; height: 100px; object-fit: cover; display: block; }
.ad-card { display: block; text-decoration: none; color: inherit; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-sm); overflow: hidden; transition: opacity 0.4s ease; }
.ad-label { padding: 4px 8px; display: flex; flex-direction: column; }
.ad-title { color: var(--color-text); font-weight: bold; font-size: 0.78rem; }
.ad-source { color: var(--color-text-muted); font-size: 0.65rem; }
.ad-sponsor-label { font-size: 0.72rem; color: var(--color-text-muted); margin-bottom: 8px; text-align: center; }
@media (max-width: 1024px) {
  .ad-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; max-width: 480px; margin: 0 auto; }
  .ad-img { height: 80px; }
}
