:root {
  color-scheme: light;
  --bg: #f4f5f0;
  --panel: #ffffff;
  --text: #333333;
  --muted: #888888;
  --accent: #e05a2b;
  --accent-2: #d4a520;
  --border: #dde0d5;
  --tag-bg: #e8f5e1;
  --tag-text: #4a8c3f;
  --option-bg: #f9faf6;
  --option-hover: #f0f3ea;
  --option-selected: #e8f5e1;
  --option-selected-border: #7cb572;
  --progress-track: #e0e3d8;
  --progress-fill: #e05a2b;
  --card-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.6;
}

.container {
  width: min(780px, 96vw);
  margin: 0 auto;
  padding: 20px 0 60px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 20px 24px;
  margin-bottom: 16px;
  box-shadow: var(--card-shadow);
}

h1, h2, h3, p {
  margin: 0;
}

/* ===== HOME ===== */

.home-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

.home-subtitle {
  color: #555;
  line-height: 1.8;
  margin-bottom: 18px;
}

.home-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.badge {
  display: inline-block;
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 4px 10px;
  font-size: 12px;
  color: var(--tag-text);
  background: var(--tag-bg);
}

.btn {
  appearance: none;
  border: none;
  border-radius: 4px;
  padding: 10px 22px;
  font-size: 15px;
  cursor: pointer;
  transition: opacity 0.15s;
  font-weight: 600;
}

.btn:hover {
  opacity: 0.88;
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.btn-primary {
  color: #fff;
  background: var(--accent);
}

.btn-ghost {
  color: var(--text);
  border: 1px solid var(--border);
  background: var(--panel);
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.meta-note {
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.home-credit {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
  text-align: center;
  margin-top: 20px;
  padding: 0 16px;
}

.home-credit a {
  color: var(--accent);
  text-decoration: none;
}

.home-credit a:hover {
  text-decoration: underline;
}

/* ===== PROGRESS BAR (sticky) ===== */

.progress-bar-wrap {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 20px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.progress-track {
  flex: 1;
  height: 10px;
  border-radius: 99px;
  background: var(--progress-track);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--progress-fill);
  width: 0;
  transition: width 0.25s ease;
  border-radius: 99px;
}

.progress-label {
  font-size: 14px;
  color: var(--muted);
  min-width: 56px;
  text-align: right;
  white-space: nowrap;
}

/* ===== QUESTION CARD ===== */

.question-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 20px 24px;
  margin-bottom: 14px;
  box-shadow: var(--card-shadow);
  transition: border-color 0.2s;
}

.question-card.unanswered-highlight {
  border-color: #e05a2b;
  box-shadow: 0 0 0 2px rgba(224, 90, 43, 0.15);
}

.question-num {
  display: inline-block;
  background: var(--tag-bg);
  color: var(--tag-text);
  font-size: 12px;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 3px;
  margin-bottom: 10px;
}

.question-title {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.7;
  margin-bottom: 14px;
  color: var(--text);
}

.options-list {
  display: grid;
  gap: 8px;
}

.option-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 12px 14px;
  background: var(--option-bg);
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
  font-size: 14px;
  line-height: 1.5;
}

.option-item:hover {
  background: var(--option-hover);
}

.option-item.selected {
  background: var(--option-selected);
  border-color: var(--option-selected-border);
}

.option-radio {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid #bbb;
  flex-shrink: 0;
  margin-top: 2px;
  position: relative;
}

.option-item.selected .option-radio {
  border-color: var(--option-selected-border);
}

.option-item.selected .option-radio::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 8px;
  height: 8px;
  background: var(--option-selected-border);
  border-radius: 50%;
}

.option-label {
  font-weight: 600;
  color: var(--accent);
  margin-right: 4px;
}

/* ===== SUBMIT AREA ===== */

.submit-area {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 20px 24px;
  margin-bottom: 16px;
  text-align: center;
  box-shadow: var(--card-shadow);
}

.submit-hint {
  color: var(--muted);
  font-size: 13px;
  margin-top: 10px;
}

.submit-warning {
  color: #c0392b;
  font-size: 13px;
  margin-top: 8px;
}

/* ===== RESULT PAGE - HERO (双栏布局) ===== */

.result-hero {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 20px;
  margin-bottom: 16px;
}

.result-hero-left {
  display: flex;
}

.result-hero-card {
  background: var(--tag-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px 16px;
  text-align: center;
  width: 100%;
  box-shadow: var(--card-shadow);
}

.hero-card-label {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
}

.hero-card-name {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 2px;
}

.hero-card-code {
  font-size: 15px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 1px;
  margin-bottom: 14px;
}

.hero-card-img {
  display: block;
  width: 180px;
  height: auto;
  margin: 0 auto 14px;
  border-radius: 8px;
}

.hero-card-tagline {
  font-size: 13px;
  color: var(--accent);
  line-height: 1.6;
  font-weight: 600;
}

.result-hero-right {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 24px;
  box-shadow: var(--card-shadow);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.hero-right-label {
  font-size: 13px;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 8px;
}

.hero-right-title {
  font-size: clamp(22px, 3.5vw, 32px);
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
}

.hero-right-desc {
  color: #555;
  line-height: 1.7;
  margin-top: 10px;
}

/* keep old .result-match for hero-right */
.result-match {
  display: inline-block;
  border: 1px solid var(--option-selected-border);
  border-radius: 3px;
  padding: 4px 12px;
  font-size: 13px;
  color: var(--tag-text);
  background: var(--tag-bg);
  margin-bottom: 10px;
  align-self: flex-start;
}

.section-card {
  margin-top: 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel);
  padding: 16px 20px;
  box-shadow: var(--card-shadow);
}

.section-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--tag-text);
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.result-roast,
.result-tagline,
.result-scenes,
.result-quote {
  color: #444;
  line-height: 1.75;
  margin-bottom: 4px;
}

.dimension-grid {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.dimension-row {
  display: grid;
  grid-template-columns: 90px 1fr 36px;
  align-items: center;
  gap: 8px;
}

.dimension-name {
  color: #555;
  font-size: 13px;
}

.dimension-track {
  height: 10px;
  border-radius: 99px;
  background: var(--progress-track);
  overflow: hidden;
}

.dimension-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: 99px;
}

.dimension-value {
  text-align: right;
  color: var(--muted);
  font-size: 12px;
}

.disclaimer {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
  margin-top: 14px;
}

/* ===== SHARE & COPY BUTTONS ===== */

.btn-share {
  color: #fff;
  background: linear-gradient(135deg, #e05a2b, #d4a520);
  font-weight: 600;
}

.btn-copy {
  color: var(--accent);
  border: 1px solid var(--accent);
  background: var(--panel);
  font-weight: 600;
}

/* ===== TOAST ===== */

.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(30, 30, 30, 0.88);
  color: #fff;
  padding: 10px 24px;
  border-radius: 20px;
  font-size: 14px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s, transform 0.25s;
  z-index: 9999;
  white-space: nowrap;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ===== SHARE CARD (hidden off-screen, used for html2canvas) ===== */

.share-card {
  position: absolute;
  left: -9999px;
  top: -9999px;
  width: 420px;
  opacity: 0;
  pointer-events: none;
}

.share-card.rendering {
  opacity: 1;
}

.share-card-inner {
  background: linear-gradient(160deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  border-radius: 16px;
  padding: 28px 24px 20px;
  color: #e8e8e8;
  font-family: "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", Arial, sans-serif;
}

.share-header {
  margin-bottom: 8px;
}

.share-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.share-code {
  font-size: 13px;
  font-weight: 700;
  color: #e05a2b;
  background: rgba(224, 90, 43, 0.15);
  padding: 3px 10px;
  border-radius: 4px;
  letter-spacing: 1px;
}

.share-match-tag {
  font-size: 12px;
  color: #7cb572;
  border: 1px solid rgba(124, 181, 114, 0.4);
  padding: 2px 8px;
  border-radius: 3px;
}

.share-name {
  font-size: 26px;
  font-weight: 700;
  color: #fff;
  margin: 0 0 8px;
  line-height: 1.3;
}

.share-card-img {
  display: block;
  width: 160px;
  height: auto;
  margin: 10px auto 12px;
  border-radius: 8px;
}

.share-desc {
  font-size: 14px;
  color: #bbb;
  line-height: 1.7;
  margin: 0;
}

.share-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
  margin: 14px 0;
}

.share-roast {
  font-size: 13px;
  color: #d4a520;
  line-height: 1.7;
  margin: 0;
}

.share-tagline {
  font-size: 15px;
  font-weight: 600;
  color: #e8e8e8;
  line-height: 1.7;
  margin: 0 0 6px;
}

.share-scenes {
  font-size: 13px;
  color: #aaa;
  line-height: 1.7;
  margin: 0 0 4px;
}

.share-quote {
  font-size: 13px;
  color: #aaa;
  line-height: 1.7;
  margin: 0;
  font-style: italic;
}

/* share card dimension bars */

.share-dim-grid {
  display: grid;
  gap: 6px;
}

.share-dim-row {
  display: grid;
  grid-template-columns: 72px 1fr 30px;
  align-items: center;
  gap: 6px;
}

.share-dim-name {
  font-size: 12px;
  color: #bbb;
}

.share-dim-track {
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 99px;
  overflow: hidden;
}

.share-dim-fill {
  height: 100%;
  background: linear-gradient(90deg, #e05a2b, #d4a520);
  border-radius: 99px;
}

.share-dim-val {
  font-size: 11px;
  color: #999;
  text-align: right;
}

.share-footer {
  margin-top: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.share-footer-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.share-footer-text {
  font-size: 13px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.6);
  letter-spacing: 1px;
}

.share-footer-sub {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.35);
}

.share-footer-hint {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.45);
  margin-top: 4px;
}

.share-qr {
  flex-shrink: 0;
  width: 72px;
  height: 72px;
  border-radius: 6px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
  padding: 4px;
}

.share-qr img,
.share-qr canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

/* ===== SHARE OVERLAY / MODAL ===== */

.share-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0, 0, 0, 0.6);
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.share-overlay.active {
  display: flex;
}

.share-modal {
  background: var(--panel);
  border-radius: 12px;
  padding: 20px;
  max-width: 480px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  text-align: center;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
}

.share-modal-tip {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 14px;
}

.share-modal-body {
  margin-bottom: 16px;
}

.share-preview-img {
  width: 100%;
  border-radius: 8px;
  display: block;
}

.share-modal-close {
  margin: 0 auto;
}

@media (max-width: 640px) {
  .container {
    padding: 12px 0 40px;
  }
  .card, .question-card, .section-card, .submit-area, .progress-bar-wrap {
    border-radius: 0;
    border-left: none;
    border-right: none;
  }
  .result-hero {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .result-hero-card,
  .result-hero-right {
    border-radius: 0;
    border-left: none;
    border-right: none;
  }
  .hero-card-img {
    width: 160px;
  }
  .dimension-row {
    grid-template-columns: 78px 1fr 32px;
  }
}
