/* =========================================================
   MapMo 社群習慣心理測驗 v2 — Editorial Kraft Archive + 習慣特刊 Stylesheet
   ========================================================= */

:root {
  --parchment-bg: #DACBA8;
  --parchment-light: #EFE6D4;
  --parchment-card: #FFFDF8;
  --ink-black: #1E1B16;
  --ink-brown: #4A4035;
  --ink-muted: #786E60;
  --marker-yellow: #FFE45E;
  --terracotta: #D96846;
  --terracotta-deep: #B94F30;
  --terracotta-soft: #FCEEE7;
  --terracotta-border: #F2C9B6;
  --stone-bar: #CFC6B6;
  --stone-track: #F2EDE3;
  --font-tw: 'Noto Sans TC', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-en: 'Outfit', 'Noto Sans TC', sans-serif;
  --sketch-shadow: 4px 5px 0 #1E1B16;
  --ambient-shadow: 0 18px 42px rgba(45, 34, 18, 0.14);
}

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

.visually-hidden:where(:not(:focus-within, :active)) {
  position: absolute !important;
  clip-path: inset(50%) !important;
  overflow: hidden !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  border: 0 !important;
  white-space: nowrap !important;
}

:where(a:any-link, button, input, summary):focus-visible {
  outline: 3px solid var(--terracotta);
  outline-offset: 3px;
}

/* View Transitions — Directional SPA Navigation */
@keyframes slide-to-left {
  to { transform: translateX(-28%); opacity: 0; }
}
@keyframes slide-from-right {
  from { transform: translateX(28%); opacity: 0; }
}
@keyframes slide-to-right {
  to { transform: translateX(28%); opacity: 0; }
}
@keyframes slide-from-left {
  from { transform: translateX(-28%); opacity: 0; }
}

::view-transition-group(root) {
  animation: 0.34s cubic-bezier(0.22, 1, 0.36, 1) both;
}

html:active-view-transition-type(forward)::view-transition-old(root) {
  animation-name: slide-to-left;
}
html:active-view-transition-type(forward)::view-transition-new(root) {
  animation-name: slide-from-right;
}
html:active-view-transition-type(backward)::view-transition-old(root) {
  animation-name: slide-to-right;
}
html:active-view-transition-type(backward)::view-transition-new(root) {
  animation-name: slide-from-left;
}

@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(root) {
    animation: none !important;
  }
}

/* Page Canvas — Warm Aged Parchment */
html:has(body.quiz-page) {
  background-color: #D6C6A4;
}

body.quiz-page {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font-tw);
  color: var(--ink-black);
  background-color: #D6C6A4;
  background-image:
    radial-gradient(circle at 18% 12%, rgba(255, 248, 224, 0.42), transparent 48%),
    radial-gradient(circle at 86% 82%, rgba(188, 159, 114, 0.35), transparent 54%),
    linear-gradient(170deg, #E2D5B9 0%, #D6C6A4 52%, #CBB894 100%);
  background-attachment: scroll !important;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  overflow-x: hidden;
}

.kraft-paper-grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.35;
  background-image: radial-gradient(rgba(30, 27, 22, 0.045) 1px, transparent 0);
  background-size: 16px 16px;
}

@media (max-width: 767px), (pointer: coarse) {
  .kraft-paper-grain {
    display: none;
  }

  .navbar,
  .result-crowd-sync {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .navbar {
    background: rgba(239, 230, 212, 0.96);
  }
}

/* Navbar */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(239, 230, 212, 0.86);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1.5px solid rgba(30, 27, 22, 0.14);
}

.quiz-nav-standalone {
  max-width: 940px;
  margin: 0 auto;
  padding: 10px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.logo-box {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--ink-black);
}

.logo-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  overflow: hidden;
  border: none;
  background: transparent;
  box-shadow: none;
  flex-shrink: 0;
}

.logo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.logo-text-img {
  height: 22px;
  width: auto;
  display: block;
}

.quiz-nav-badge {
  font-size: 11.5px;
  font-weight: 800;
  background: var(--marker-yellow);
  color: var(--ink-black);
  border: 1.5px solid var(--ink-black);
  padding: 3px 10px;
  border-radius: 99px;
  box-shadow: 2px 2px 0 var(--ink-black);
  white-space: nowrap;
}

.nav-actions-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pill-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 13px;
  border-radius: 99px;
  background: #FFFDF8;
  border: 1.5px solid var(--ink-black);
  color: var(--ink-black);
  font-family: var(--font-tw);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 2px 2px 0 var(--ink-black);
  transition: transform 0.15s ease, background 0.15s ease;
  white-space: nowrap;
}

.pill-action-btn[hidden] {
  display: none !important;
}

@media (hover: hover) and (pointer: fine) {
  .pill-action-btn:hover {
    transform: translate(-1px, -1px);
    background: #FFF7D6;
  }
}

.pill-action-btn:active {
  transform: scale(0.97);
}

.pill-action-btn.active {
  background: var(--ink-black);
  color: #FFFDF8;
}

.pill-label-short {
  display: none;
}

/* Main Stage */
.quiz-main-wrapper {
  position: relative;
  z-index: 1;
  max-width: 780px;
  margin: 0 auto;
  padding: 22px 16px 64px;
}

.quiz-screen {
  display: none;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.quiz-screen.active {
  display: flex;
}

/* ─────────────────────────────────────────────────────────
   1. Start Screen — 探險手札與立體地圖首頁
   ───────────────────────────────────────────────────────── */
.journal-hero-stage {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.journal-title-cluster {
  text-align: center;
  width: 100%;
}

.journal-kicker-note {
  margin: 0 0 6px;
  font-size: clamp(0.95rem, 2.2vw, 1.15rem);
  font-weight: 800;
  color: var(--ink-brown);
  letter-spacing: 0.4px;
}

.journal-display-title {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.08;
  transform: rotate(-1.2deg);
}

.journal-display-title .title-line-top,
.journal-display-title .title-line-bottom {
  display: inline-block;
  font-size: clamp(2.1rem, 7vw, 3.6rem);
  font-weight: 900;
  color: var(--marker-yellow);
  -webkit-text-stroke: 2px var(--ink-black);
  paint-order: stroke fill;
  text-shadow:
    3px 4px 0 var(--ink-black),
    0 10px 22px rgba(30, 27, 22, 0.16);
  letter-spacing: 0.02em;
}

.journal-display-title .title-line-bottom {
  font-size: clamp(2.45rem, 8.2vw, 4.1rem);
  margin-top: 2px;
  transform: translateX(8px) rotate(1.5deg);
}

/* Central 3D Pop-up Journal (Frameless) */
.journal-diorama-frame {
  position: relative;
  width: 100%;
  max-width: 660px;
  margin: 4px auto 2px;
  border: none;
  background: transparent;
  box-shadow: none;
}

.journal-diorama-img {
  width: 100%;
  height: auto;
  aspect-ratio: 1080 / 806;
  object-fit: contain;
  display: block;
  border-radius: 18px;
}

/* Frameless CTA + 5-Persona Row */
.start-actions-stage {
  container-type: inline-size;
  width: 100%;
  max-width: 660px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(12px, 2svh, 18px);
}

.start-cta-row {
  width: 100%;
  display: flex;
  justify-content: center;
}

.start-btn-sketch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 30px;
  border-radius: 99px;
  background: var(--terracotta);
  color: #FFFFFF;
  border: 2px solid var(--ink-black);
  font-family: var(--font-tw);
  font-size: 16.5px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: var(--sketch-shadow);
  transition: transform 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

@media (hover: hover) and (pointer: fine) {
  .start-btn-sketch:hover {
    background: var(--terracotta-deep);
    transform: translate(-1px, -2px);
    box-shadow: 5px 7px 0 var(--ink-black);
  }
}

.start-btn-sketch:active {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 var(--ink-black);
}

/* 5-Persona Character Preview Strip */
.cast-preview-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
}

.cast-avatar-pill {
  background: #FFFDF8;
  border: 1.5px solid rgba(30, 27, 22, 0.22);
  border-radius: 12px;
  padding: 6px 4px 7px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
}

.cast-avatar-pill img {
  width: 100%;
  max-width: 72px;
  height: auto;
  aspect-ratio: 1024 / 689;
  object-fit: contain;
  display: block;
}

.cast-avatar-pill span {
  font-size: clamp(9.5px, 2.5vw, 11px);
  font-weight: 800;
  color: var(--ink-brown);
  line-height: 1.25;
  white-space: nowrap;
}

.start-qr-quick-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.sketch-chip-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 15px;
  border-radius: 99px;
  background: #FFFDF8;
  border: 1.5px solid var(--ink-black);
  color: var(--ink-black);
  font-family: var(--font-tw);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 2px 2px 0 var(--ink-black);
  transition: transform 0.15s ease;
}

.sketch-chip-btn.dark {
  background: var(--ink-black);
  color: #FFFDF8;
}

@media (hover: hover) and (pointer: fine) {
  .sketch-chip-btn:hover {
    transform: translateY(-1px);
  }
}

.sketch-chip-btn:active {
  transform: scale(0.97);
}

/* ─────────────────────────────────────────────────────────
   2. Question Card Screen — Colleague Clean Focus + Archive Feel
   ───────────────────────────────────────────────────────── */
.quiz-step-card {
  container-type: inline-size;
  width: 100%;
  max-width: 640px;
  margin-top: 12px;
  background: var(--parchment-card);
  border: 2px solid var(--ink-black);
  border-radius: clamp(1.1rem, 3.5cqi, 1.375rem);
  padding: clamp(1rem, 4cqi, 2.125rem);
  box-shadow: var(--sketch-shadow), var(--ambient-shadow);
}

.quiz-progress-bar-wrap {
  width: 100%;
  height: 6px;
  background: #EAE2D3;
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 12px;
}

.quiz-progress-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--terracotta);
  border-radius: 99px;
  transition: width 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.quiz-nav-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-muted);
  margin-bottom: 20px;
}

.quiz-step-indicator {
  font-family: var(--font-en);
  font-weight: 800;
}

.quiz-section-name-pill {
  font-weight: 800;
  color: var(--ink-brown);
}

/* Inline Section Transition Quote Box (matches Claude template) */
.quiz-section-quote-banner {
  background: var(--terracotta-soft);
  border: 1.5px solid var(--terracotta-border);
  border-radius: 14px;
  padding: 14px 18px;
  margin-bottom: 22px;
}

.quiz-section-quote-banner[hidden] {
  display: none !important;
}

.quote-banner-section {
  display: block;
  font-size: 12.5px;
  font-weight: 800;
  color: var(--terracotta-deep);
  margin-bottom: 4px;
}

.quote-banner-text {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink-black);
  line-height: 1.55;
  line-break: strict;
  word-break: normal;
}

.question-prompt-text {
  margin: 0 0 22px;
  font-size: clamp(1.2rem, 3.2vw, 1.45rem);
  font-weight: 900;
  color: var(--ink-black);
  line-height: 1.45;
  text-align: left;
  text-wrap: wrap;
  line-break: strict;
  word-break: normal;
  overflow-wrap: break-word;
}

.q-clause {
  display: inline;
}

.q-chunk {
  display: inline-block;
  max-width: 100%;
}

.question-prompt-note {
  display: block;
  margin-top: 6px;
  font-size: 0.78em;
  font-weight: 600;
  color: var(--ink-brown);
  line-height: 1.5;
}

@container (max-width: 500px) {
  .q-clause {
    display: block;
  }
}

.quiz-options-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.quiz-option-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 18px;
  min-height: 54px;
  border-radius: 14px;
  background: #FFFFFF;
  border: 1.5px solid #DED5C5;
  color: var(--ink-black);
  font-family: var(--font-tw);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease, transform 0.14s ease, box-shadow 0.16s ease;
}

@media (hover: hover) and (pointer: fine) {
  .quiz-option-btn:hover {
    border-color: var(--terracotta);
    background: #FFF8F4;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(217, 104, 70, 0.12);
  }
}

.quiz-option-btn:active {
  border-color: var(--terracotta);
  background: #FFF4EE;
  transform: scale(0.988);
}

.quiz-option-btn.selected-prev {
  border-color: var(--terracotta);
  background: #FFF4EE;
  box-shadow: 0 0 0 1px var(--terracotta);
}

.quiz-option-content {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  flex: 1;
}

.quiz-option-badge {
  font-family: var(--font-en);
  font-weight: 900;
  font-size: 14px;
  color: var(--terracotta);
  line-height: 1.55;
  flex-shrink: 0;
  min-width: 18px;
}

.quiz-option-text {
  font-size: 15.5px;
  font-weight: 600;
  line-height: 1.55;
  color: var(--ink-black);
  line-break: strict;
  word-break: normal;
}

.quiz-bottom-nav-row {
  margin-top: 22px;
  min-height: 32px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.quiz-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: none;
  padding: 6px 4px;
  color: var(--ink-muted);
  font-family: var(--font-tw);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: color 0.15s ease;
}

@media (hover: hover) and (pointer: fine) {
  .quiz-back-btn:hover {
    color: var(--ink-black);
  }
}

/* ─────────────────────────────────────────────────────────
   3. Analyzing Screen
   ───────────────────────────────────────────────────────── */
.quiz-analyzing-card {
  width: 100%;
  max-width: 520px;
  margin-top: 24px;
  background: var(--parchment-card);
  border: 2px solid var(--ink-black);
  border-radius: 22px;
  padding: 48px 28px;
  text-align: center;
  box-shadow: var(--sketch-shadow), var(--ambient-shadow);
}

.analyzing-spinner-ring {
  width: 78px;
  height: 78px;
  margin: 0 auto 20px;
  border-radius: 50%;
  border: 4px solid #EFE6D4;
  border-top-color: var(--terracotta);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: mapmo-spin 1s linear infinite;
}

.analyzing-logo-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  animation: mapmo-spin-reverse 1s linear infinite;
}

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

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

.analyzing-title {
  margin: 0 0 8px;
  font-size: 20px;
  font-weight: 900;
}

.analyzing-subtext {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-brown);
}

/* ─────────────────────────────────────────────────────────
   4. Result Screen — Zine Card + 5-Column Vertical Chart + MapMo
   ───────────────────────────────────────────────────────── */
.result-screen-container {
  width: 100%;
  max-width: 680px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.result-zine-card {
  container-type: inline-size;
  background: var(--parchment-card);
  border: 2px solid var(--ink-black);
  border-radius: clamp(1.25rem, 4cqi, 1.5rem);
  padding: clamp(1.05rem, 4cqi, 2rem);
  box-shadow: var(--sketch-shadow), var(--ambient-shadow);
  display: flex;
  flex-direction: column;
  gap: clamp(1rem, 3.5cqi, 1.375rem);
}

.result-zine-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 12px;
  border-bottom: 1.5px dashed rgba(30, 27, 22, 0.22);
}

.result-zine-brand {
  font-family: var(--font-en);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.7px;
  color: var(--ink-brown);
}

.result-zine-serial {
  font-family: var(--font-en);
  font-size: 12px;
  font-weight: 800;
  color: var(--ink-muted);
}

.result-hero-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  align-items: center;
  gap: 16px;
}

.result-issue-pill {
  display: inline-block;
  font-family: var(--font-en);
  font-size: 11.5px;
  font-weight: 900;
  letter-spacing: 0.6px;
  background: var(--marker-yellow);
  border: 1.5px solid var(--ink-black);
  color: var(--ink-black);
  padding: 3px 10px;
  border-radius: 99px;
  margin-bottom: 10px;
}

.result-persona-name {
  margin: 0 0 6px;
  font-size: clamp(1.85rem, 5vw, 2.4rem);
  font-weight: 900;
  color: var(--terracotta-deep);
  line-height: 1.15;
}

.result-persona-motto {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
  color: var(--ink-brown);
}

.result-char-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle, rgba(239, 230, 212, 0.85) 0%, rgba(255, 253, 248, 0) 74%);
  border-radius: 18px;
  padding: 6px;
}

.result-char-img {
  width: 100%;
  max-width: 240px;
  height: auto;
  aspect-ratio: 1024 / 689;
  object-fit: contain;
  display: block;
}

/* 2. Description & Secondary Shadow */
.result-description-box {
  background: #FAF5EB;
  border: 1.5px solid #E3D9C6;
  border-radius: 16px;
  padding: 16px 18px;
  text-align: center;
}

.result-description-text {
  margin: 0;
  font-size: 15.5px;
  font-weight: 600;
  line-height: 1.7;
  color: var(--ink-black);
  text-align: center;
}

.second-persona-shadow {
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: 11px;
  background: var(--terracotta-soft);
  border: 1.5px solid var(--terracotta-border);
  color: var(--terracotta-deep);
  font-size: 14px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 8px;
}

.second-persona-shadow[hidden] {
  display: none !important;
}

/* 3. 5-Column Vertical Similarity Chart (Matches Claude Spec) */
.spectrum-similarity-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.spectrum-header-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
}

.spectrum-header-row h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 900;
  color: var(--ink-black);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.spectrum-axis-hint {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-muted);
}

.spectrum-bars-list {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  align-items: end;
}

.spectrum-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
}

.spectrum-col-pct {
  font-family: var(--font-en);
  font-size: 13px;
  font-weight: 800;
  color: var(--ink-muted);
}

.spectrum-col.is-winner .spectrum-col-pct {
  color: var(--winner-color, var(--terracotta));
  font-weight: 900;
}

.spectrum-col-track {
  width: 100%;
  height: clamp(104px, 18vw, 138px);
  background: var(--stone-track);
  border-radius: 12px;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  padding: 2px;
  border: 1px solid rgba(30, 27, 22, 0.08);
}

.spectrum-col-fill {
  width: 100%;
  height: 0%;
  background: var(--stone-bar);
  border-radius: 9px;
  transition: height 0.65s cubic-bezier(0.22, 1, 0.36, 1);
}

.spectrum-col.is-winner .spectrum-col-fill {
  background: var(--winner-color, var(--terracotta));
}

.spectrum-col-label {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink-muted);
  line-height: 1.25;
}

.spectrum-col.is-winner .spectrum-col-label {
  color: var(--winner-color, var(--terracotta));
  font-weight: 900;
}

/* Zine Poster Collectible Block */
.result-poster-showcase {
  display: grid;
  grid-template-columns: 112px 1fr;
  gap: 16px;
  align-items: center;
  background: var(--parchment-light);
  border: 1.5px solid var(--ink-black);
  border-radius: 16px;
  padding: 14px;
}

.poster-thumb-wrap {
  border-radius: 10px;
  overflow: hidden;
  border: 1.5px solid var(--ink-black);
  box-shadow: 3px 3px 0 rgba(30, 27, 22, 0.85);
}

.poster-thumb-btn {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  margin: 0;
  border: none;
  background: transparent;
  cursor: pointer;
}

.poster-zoom-badge {
  position: absolute;
  right: 6px;
  bottom: 6px;
  background: rgba(30, 27, 22, 0.84);
  color: #FFFDF8;
  font-size: 10.5px;
  font-weight: 800;
  padding: 3px 7px;
  border-radius: 99px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  pointer-events: none;
}

.poster-thumb-img {
  width: 100%;
  height: auto;
  aspect-ratio: 723 / 1024;
  display: block;
  object-fit: cover;
}

.poster-eyebrow {
  display: block;
  font-family: var(--font-en);
  font-size: 10.5px;
  font-weight: 900;
  letter-spacing: 0.7px;
  color: var(--terracotta-deep);
  margin-bottom: 3px;
}

.poster-card-heading {
  margin: 0 0 6px;
  font-size: 15.5px;
  font-weight: 900;
  color: var(--ink-black);
}

.poster-card-desc {
  margin: 0 0 10px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink-brown);
}

.btn-download-poster-only {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 99px;
  background: #FFFDF8;
  border: 1.5px solid var(--ink-black);
  color: var(--ink-black);
  font-family: var(--font-tw);
  font-size: 12.5px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 2px 2px 0 var(--ink-black);
}

/* MapMo Introduction Bridge Card */
.mapmo-bridge-card {
  background: #FFF8EE;
  border: 1.5px dashed rgba(30, 27, 22, 0.35);
  border-radius: 18px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.q11-reflection-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--marker-yellow);
  border: 1.5px solid var(--ink-black);
  font-size: 13px;
  font-weight: 800;
  color: var(--ink-black);
}

.q11-reflection-pill[hidden] {
  display: none !important;
}

.mapmo-bridge-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.bridge-logo-img {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: transparent;
  flex-shrink: 0;
}

.mapmo-bridge-header h3 {
  margin: 0 0 4px;
  font-size: 16px;
  font-weight: 900;
}

.mapmo-bridge-header p {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--ink-brown);
}

.features-grid-stack {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(185px, 1fr));
  gap: 10px;
}

.feature-match-card {
  background: #FFFFFF;
  border: 1.5px solid #DED5C5;
  border-radius: 12px;
  padding: 12px 14px;
}

.feature-badge-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 5px;
}

.feature-name {
  font-size: 14px;
  font-weight: 900;
  color: var(--ink-black);
}

.feature-fit-pill {
  font-size: 11px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 99px;
}

.feature-fit-pill.primary {
  background: var(--terracotta-soft);
  color: var(--terracotta-deep);
}

.feature-fit-pill.secondary {
  background: #EFE6D4;
  color: var(--ink-brown);
}

.feature-desc {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--ink-brown);
}

/* Action Toolbar */
.result-action-toolbar {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.action-row-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.btn-result-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 16px;
  border-radius: 14px;
  font-family: var(--font-tw);
  font-size: 14.5px;
  font-weight: 900;
  cursor: pointer;
  border: 2px solid var(--ink-black);
  box-shadow: 3px 4px 0 var(--ink-black);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn-result-action.primary {
  background: var(--terracotta);
  color: #FFFFFF;
}

.btn-result-action.secondary {
  background: #FFFDF8;
  color: var(--ink-black);
}

.full-width-action {
  width: 100%;
}

@media (hover: hover) and (pointer: fine) {
  .btn-result-action:hover {
    transform: translate(-1px, -1px);
    box-shadow: 4px 5px 0 var(--ink-black);
  }
}

.btn-result-action:active {
  transform: translate(1px, 1px);
  box-shadow: 2px 2px 0 var(--ink-black);
}

/* ─────────────────────────────────────────────────────────
   5. Live Crowd Stats Cards
   ───────────────────────────────────────────────────────── */
.live-stats-card,
.result-crowd-card {
  width: 100%;
  max-width: 660px;
  background: rgba(255, 253, 248, 0.94);
  border: 2px solid var(--ink-black);
  border-radius: 20px;
  padding: 20px 22px;
  box-shadow: var(--sketch-shadow), var(--ambient-shadow);
}

.result-crowd-card {
  max-width: 680px;
}

.live-stats-header,
.result-crowd-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.live-stats-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.live-stats-title-group h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 900;
}

.live-dot-pulse {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #16A34A;
  box-shadow: 0 0 0 4px rgba(22, 163, 74, 0.18);
  display: inline-block;
  flex-shrink: 0;
}

.live-dot-pulse.offline {
  background: #EA580C;
  box-shadow: 0 0 0 4px rgba(234, 88, 12, 0.18);
}

.live-stats-bars {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.live-stat-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.live-stat-row.is-user-persona {
  background: var(--terracotta-soft);
  padding: 8px 10px;
  border-radius: 11px;
  border: 1.5px solid var(--terracotta-border);
}

.live-stat-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
}

.live-stat-name {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.live-stat-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

.live-stat-you-badge {
  font-size: 10.5px;
  font-weight: 900;
  background: var(--ink-black);
  color: #FFFFFF;
  padding: 1px 7px;
  border-radius: 99px;
}

.live-stat-num {
  font-family: var(--font-en), var(--font-tw);
  font-size: 12.5px;
  color: var(--ink-brown);
}

.live-stat-track {
  width: 100%;
  height: 8px;
  background: #EAE2D3;
  border-radius: 99px;
  overflow: hidden;
}

.live-stat-fill {
  height: 100%;
  border-radius: 99px;
  transition: width 0.55s cubic-bezier(0.16, 1, 0.3, 1);
}

.live-stats-footer {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1.5px dashed rgba(30, 27, 22, 0.16);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.live-stats-source-note {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-muted);
}

.live-stats-admin-link {
  background: var(--ink-black);
  color: #FFFFFF;
  border: none;
  border-radius: 99px;
  padding: 7px 14px;
  font-size: 12.5px;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.result-crowd-tag {
  font-size: 12.5px;
  font-weight: 900;
  color: var(--terracotta-deep);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.result-crowd-sync {
  font-size: 11.5px;
  font-weight: 800;
  color: #15803D;
  background: rgba(22, 163, 74, 0.12);
  padding: 3px 10px;
  border-radius: 99px;
}

.result-crowd-headline {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 800;
  line-height: 1.5;
}

/* ─────────────────────────────────────────────────────────
   6. Native <dialog> Modals (Standee / B&W QR / Admin Excel)
   ───────────────────────────────────────────────────────── */
dialog.native-modal-dialog {
  margin: auto;
  padding: 0;
  border: none;
  background: transparent;
  max-width: min(94vw, 840px);
  max-height: 92dvh;
  width: 100%;
  overflow: visible;
}

dialog.native-modal-dialog.tree-qr-dialog {
  max-width: min(94vw, 600px);
}

dialog.native-modal-dialog[open] {
  display: flex;
  align-items: center;
  justify-content: center;
}

dialog.native-modal-dialog:modal {
  overscroll-behavior: contain;
}

dialog.native-modal-dialog::backdrop {
  background: rgba(24, 20, 14, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  overflow: hidden;
  overscroll-behavior: contain;
}

.standee-modal-box {
  background: #FAF8F3;
  border: 2px solid var(--ink-black);
  border-radius: 26px;
  width: 100%;
  max-height: 90dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  box-shadow: var(--sketch-shadow), 0 28px 60px rgba(0, 0, 0, 0.35);
  padding: 0 28px 28px;
  position: relative;
}

.tree-qr-studio-box {
  background: #F6F2EA !important;
  max-width: 600px !important;
  padding: 0 26px 24px !important;
}

.modal-sticky-header {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #FAF8F3;
  padding: 16px 0 10px;
  margin-bottom: 10px;
  border-bottom: 1px solid rgba(30, 27, 22, 0.08);
}

.tree-qr-sticky-bar {
  background: #F6F2EA;
}

.modal-sticky-label {
  margin: 0;
  font-family: var(--font-en), var(--font-tw);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.4px;
  color: var(--ink-brown);
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.standee-modal-close {
  position: static;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(30, 27, 22, 0.08);
  border: 1.5px solid rgba(30, 27, 22, 0.16);
  font-size: 17px;
  color: var(--ink-black);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, background 0.2s ease;
}

@media (hover: hover) and (pointer: fine) {
  .standee-modal-close:hover {
    background: rgba(30, 27, 22, 0.16);
    transform: rotate(90deg);
  }
}

.standee-modal-close:active {
  background: rgba(30, 27, 22, 0.2);
  transform: scale(0.94);
}

/* QR Mode Tabs */
.qr-studio-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
  background: rgba(30, 27, 22, 0.07);
  border-radius: 99px;
  margin: 0 0 16px;
}

.qr-studio-tab {
  flex: 1;
  border: none;
  background: transparent;
  color: #5C5852;
  font-size: 13px;
  font-weight: 800;
  padding: 8px 12px;
  border-radius: 99px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
}

.qr-studio-tab.active {
  background: #FFFFFF;
  color: var(--ink-black);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

#treeQrPane[hidden],
.bw-qr-pane[hidden] {
  display: none !important;
}

/* 3D Tree QR Stage */
.tree-qr-stage-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.tree-qr-print-only-header {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 12px;
}

.standee-logo-img {
  width: 36px;
  height: 36px;
  object-fit: contain;
}

.standee-brand-text {
  font-family: var(--font-tw);
  font-size: 22px;
  font-weight: 900;
}

.tree-qr-canvas-container {
  width: 100%;
  max-width: 410px;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin: 0 auto 4px;
}

#treeQrInteractiveCanvas {
  width: 100%;
  height: 100%;
  display: block;
}

.tree-qr-hint-row {
  margin-bottom: 14px;
}

.tree-qr-toggle-pill {
  background: #FAF8F3;
  border: 1px solid #DCD6CA;
  color: #5C5852;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 16px;
  border-radius: 99px;
  cursor: pointer;
}

.tree-qr-url-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: 470px;
  margin-bottom: 10px;
}

.tree-qr-url-input {
  flex: 1;
  min-width: 0;
  height: 44px;
  background: #FCFBF8;
  border: 1.5px solid #B5B0A6;
  border-radius: 11px;
  padding: 0 14px;
  font-family: var(--font-en), var(--font-tw);
  font-size: 14px;
  font-weight: 600;
  color: #2C2A28;
}

.tree-qr-download-btn {
  width: 44px;
  height: 44px;
  border-radius: 11px;
  background: #9C6233;
  color: #FFFFFF;
  border: none;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.tree-qr-season-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: 470px;
  margin-bottom: 14px;
}

.tree-season-btn {
  flex: 1;
  height: 38px;
  border-radius: 10px;
  background: #FAF8F3;
  border: 1px solid #E5E0D5;
  color: #4A4742;
  font-family: var(--font-en), var(--font-tw);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.tree-season-btn.active {
  background: #DFD9CE;
  border-color: #CFC8BC;
  color: var(--ink-black);
}

.tree-sound-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: #FAF8F3;
  border: 1px solid #E5E0D5;
  color: #4A4742;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tree-qr-Palette-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 16px;
}

.tree-color-dot {
  position: relative;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2.5px solid transparent;
  cursor: pointer;
  padding: 0;
}

/* Lightbox / Mobile Image Share Dialog */
dialog.native-modal-dialog.media-preview-dialog {
  max-width: min(94vw, 540px);
}

.media-preview-box {
  text-align: center;
}

.media-preview-stage {
  background: #EFE6D4;
  border: 1.5px solid rgba(30, 27, 22, 0.18);
  border-radius: 16px;
  padding: 10px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.media-preview-img {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: 58dvh;
  height: auto;
  border-radius: 10px;
  object-fit: contain;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14);
}

.media-preview-tip {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-brown);
}

.media-preview-actions {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.media-preview-actions a {
  text-decoration: none;
}

.media-preview-actions [hidden] {
  display: none !important;
}

.tree-color-dot.active {
  transform: scale(1.18);
  border-color: #FFFFFF;
  box-shadow: 0 0 0 2px #7A746B;
}

.tree-qr-extra-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  max-width: 470px;
  padding-top: 10px;
  border-top: 1px dashed rgba(0, 0, 0, 0.12);
}

.tree-extra-btn {
  flex: 1;
  height: 38px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid #DED9CE;
  color: #4A4742;
  font-size: 12.5px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

/* Black & White Printable QR Studio */
.bw-qr-pane {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.bw-print-card {
  width: 100%;
  max-width: 440px;
  background: #FFFFFF;
  color: #000000;
  border: 2.5px solid #000000;
  border-radius: 18px;
  padding: 18px 18px;
  text-align: center;
}

.bw-print-header {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 900;
  margin-bottom: 4px;
}

.bw-print-brand {
  font-family: var(--font-en);
  font-size: 14.5px;
}

.bw-print-title {
  font-size: 18px;
  font-weight: 900;
  margin: 0 0 10px;
}

.bw-qr-frame {
  display: inline-flex;
  background: #FFFFFF;
  border: 2px solid #000000;
  padding: 10px;
  border-radius: 12px;
  margin-bottom: 10px;
}

#bwQrCanvas {
  width: min(195px, 52vw);
  height: auto;
  aspect-ratio: 1 / 1;
  display: block;
  image-rendering: pixelated;
}

.bw-print-caption {
  font-size: 12.5px;
  font-weight: 700;
  color: #222222;
  margin: 0 0 6px;
}

.bw-print-url {
  font-family: var(--font-en);
  font-size: 12px;
  font-weight: 700;
  word-break: break-all;
}

.bw-qr-controls {
  width: 100%;
  max-width: 470px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bw-input-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: left;
}

.bw-input-group label {
  font-size: 12px;
  font-weight: 800;
  color: #5C5852;
}

.bw-input-group .tree-qr-url-input {
  flex: none;
  width: 100%;
  height: 42px;
}

.bw-qr-actions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 4px;
}

.bw-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 11px 14px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.bw-action-btn.primary {
  background: #000000;
  color: #FFFFFF;
  border: 1.5px solid #000000;
}

.bw-action-btn.secondary {
  background: #FFFFFF;
  color: var(--ink-black);
  border: 1.5px solid var(--ink-black);
}

.bw-action-btn.full-span {
  grid-column: 1 / -1;
}

/* Admin Dashboard */
.admin-modal-box {
  max-width: 840px !important;
  background: #FAF8F3;
  text-align: left;
}

.admin-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding-right: 44px;
  margin-bottom: 18px;
}

.admin-eyebrow {
  display: block;
  font-family: var(--font-en);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.9px;
  color: var(--terracotta-deep);
  margin-bottom: 4px;
}

.admin-title {
  margin: 0;
  font-size: clamp(20px, 3vw, 24px);
  font-weight: 900;
}

.admin-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border-radius: 99px;
  background: #FFFFFF;
  border: 1.5px solid rgba(30, 27, 22, 0.14);
  font-size: 12px;
  font-weight: 800;
}

.admin-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.admin-kpi-card {
  background: #FFFFFF;
  border: 1.5px solid #E3D9C6;
  border-radius: 14px;
  padding: 13px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.admin-kpi-label {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--ink-muted);
}

.admin-kpi-value {
  font-family: var(--font-en), var(--font-tw);
  font-size: 22px;
  font-weight: 900;
}

.admin-kpi-value.compact {
  font-size: 16px;
}

.admin-actions-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.admin-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 16px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  border: 1.5px solid transparent;
}

.admin-btn.primary {
  background: #1D6F42;
  color: #FFFFFF;
}

.admin-btn.secondary {
  background: var(--ink-black);
  color: #FFFFFF;
}

.admin-btn.ghost {
  background: #FFFFFF;
  color: var(--ink-black);
  border-color: rgba(30, 27, 22, 0.22);
}

.admin-sheets-box {
  background: #FFFFFF;
  border: 1.5px dashed rgba(30, 27, 22, 0.24);
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 13px;
}

.admin-sheets-box summary {
  cursor: pointer;
  font-weight: 800;
}

.admin-sheets-inner {
  margin-top: 12px;
}

.admin-sheets-desc {
  margin: 0 0 10px;
  font-size: 12.5px;
  color: var(--ink-brown);
  line-height: 1.55;
}

.admin-section-block {
  margin-bottom: 18px;
}

.admin-sec-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.admin-sec-heading {
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 900;
  display: flex;
  align-items: center;
  gap: 7px;
}

.admin-sec-head-row .admin-sec-heading {
  margin-bottom: 0;
}

.admin-reset-link {
  background: none;
  border: none;
  color: #DC2626;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  text-decoration: underline;
  padding: 4px 6px;
}

.admin-table-wrap {
  width: 100%;
  overflow-x: auto;
  background: #FFFFFF;
  border: 1.5px solid #E3D9C6;
  border-radius: 14px;
}

.admin-table-wrap.tall {
  max-height: 260px;
  overflow-y: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 480px;
}

.admin-table th,
.admin-table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(30, 27, 22, 0.08);
  text-align: left;
  white-space: nowrap;
}

.admin-table td.wrap-cell {
  white-space: normal;
  min-width: 190px;
}

.admin-table th {
  position: sticky;
  top: 0;
  background: #F4EFE4;
  color: var(--ink-brown);
  font-size: 12px;
  font-weight: 800;
  z-index: 2;
}

/* Toast Notification */
.toast-notification {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(96px);
  background: var(--ink-black);
  color: #FFFFFF;
  padding: 12px 22px;
  border-radius: 99px;
  font-size: 14px;
  font-weight: 800;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
  z-index: 10000;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.28s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.toast-notification.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* Typographic Hierarchy Balance & Pretty Wrapping
   Note: Multi-clause CJK question prompts/options use semantic clause wrapping (.q-clause/.q-chunk)
   rather than text-wrap: balance/pretty to avoid splitting Chinese compound words evenly by pixel width. */
.journal-display-title,
.result-persona-name,
.poster-card-heading,
.admin-title {
  text-wrap: balance;
}

.result-description-text,
.poster-card-desc,
.feature-desc,
.media-preview-tip {
  text-wrap: pretty;
}

/* ─────────────────────────────────────────────────────────
   7. Responsive Breakpoints & Touch Targets
   ───────────────────────────────────────────────────────── */
@media (pointer: coarse) {
  .pill-action-btn,
  .sketch-chip-btn,
  .quiz-option-btn,
  .quiz-back-btn,
  .btn-download-poster-only,
  .btn-result-action,
  .standee-modal-close,
  .tree-qr-toggle-pill,
  .tree-season-btn,
  .tree-sound-btn,
  .tree-extra-btn,
  .qr-studio-tab,
  .bw-action-btn,
  .admin-btn {
    min-block-size: 44px;
  }
  .pill-action-btn,
  .standee-modal-close,
  .tree-sound-btn {
    min-inline-size: 44px;
  }
  .tree-sound-btn {
    height: 44px;
  }
  .tree-color-dot {
    width: 30px;
    height: 30px;
  }
  .tree-color-dot::after {
    content: "";
    position: absolute;
    inset: -7px;
  }
}

@media (max-width: 639px) {
  /* 頂部手機極簡化：隱藏一般訪客不需要的「後台」按鈕，專注體驗 */
  .quiz-nav-badge,
  .nav-admin-btn {
    display: none;
  }

  .pill-label-full {
    display: none;
  }

  .pill-label-short {
    display: inline;
  }

  .quiz-nav-standalone {
    padding: 7px 12px;
  }

  .logo-avatar {
    width: 30px;
    height: 30px;
  }

  .logo-text-img {
    height: 18px;
  }

  .pill-action-btn {
    padding: 6px 12px;
    font-size: 13px;
    justify-content: center;
  }

  .quiz-main-wrapper {
    padding: 10px 14px 44px;
  }

  /* Start Screen — 依比例自適應 320px 小螢幕 ～ 430px 大手機，並保證完整呈現手札地圖不裁切、滑動不縮放 */
  .journal-hero-stage {
    gap: clamp(10px, 1.8svh, 15px);
  }

  .journal-kicker-note {
    font-size: clamp(0.84rem, 0.78rem + 0.35vw, 0.94rem);
    margin-bottom: 2px;
  }

  .journal-display-title .title-line-top {
    font-size: clamp(1.65rem, 1.25rem + 2.5vw, 2.3rem);
  }

  .journal-display-title .title-line-bottom {
    font-size: clamp(1.9rem, 1.45rem + 2.8vw, 2.7rem);
  }

  .journal-diorama-frame {
    margin: 2px auto 0;
  }

  .journal-diorama-img {
    width: 100%;
    height: auto;
    aspect-ratio: 1080 / 806;
    object-fit: contain;
  }

  .start-actions-stage {
    gap: clamp(10px, 1.8svh, 14px);
  }

  .start-btn-sketch {
    width: 100%;
    padding: clamp(11px, 2svh, 14px) clamp(14px, 4cqi, 22px);
    font-size: clamp(0.94rem, 0.86rem + 0.45cqi, 1.05rem);
    min-block-size: 48px;
  }

  /* 5 大派系預覽使用容器單位 cqi 等比縮放，無論 320px 或 430px 皆維持 3 卡＋第 4 卡露頭暗示右滑 */
  .cast-preview-strip {
    container-type: inline-size;
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    scroll-snap-type: x proximity;
    gap: clamp(6px, 2cqi, 10px);
    padding: 2px 2px 4px;
  }

  .cast-preview-strip::-webkit-scrollbar {
    display: none;
  }

  .cast-avatar-pill {
    flex: 0 0 clamp(4.85rem, 25vw, 6.8rem);
    scroll-snap-align: start;
    padding: clamp(6px, 2vw, 9px) clamp(4px, 1.5vw, 7px);
  }

  @supports (width: 1cqi) {
    .cast-avatar-pill {
      flex: 0 0 clamp(4.85rem, 27cqi, 7rem);
      padding: clamp(6px, 2cqi, 9px) clamp(4px, 1.5cqi, 7px);
    }
  }

  .cast-avatar-pill img {
    max-width: 72%;
  }

  .cast-avatar-pill span {
    font-size: clamp(0.68rem, 0.56rem + 1cqi, 0.78rem);
  }

  .live-stats-card,
  .result-crowd-card {
    padding: clamp(0.95rem, 4vw, 1.25rem) clamp(0.9rem, 3.8vw, 1.15rem);
  }

  /* Question Screen — 等比自適應所有手機高度 */
  .quiz-step-card {
    margin-top: 2px;
    padding: clamp(0.95rem, 4cqi, 1.2rem) clamp(0.9rem, 4cqi, 1.15rem);
  }

  .quiz-progress-bar-wrap {
    margin-bottom: clamp(8px, 1.5svh, 12px);
  }

  .quiz-nav-top-row {
    margin-bottom: clamp(8px, 1.5svh, 12px);
  }

  .quiz-section-quote-banner {
    padding: clamp(8px, 1.5svh, 11px) clamp(10px, 3cqi, 14px);
    margin-bottom: clamp(10px, 1.8svh, 14px);
  }

  .quote-banner-section {
    font-size: 0.74rem;
    margin-bottom: 2px;
  }

  .quote-banner-text {
    font-size: clamp(0.82rem, 0.78rem + 0.3cqi, 0.92rem);
    line-height: 1.45;
  }

  .question-prompt-text {
    font-size: clamp(1.06rem, 0.92rem + 1.15cqi, 1.32rem);
    margin-bottom: clamp(10px, 2svh, 16px);
    line-height: 1.4;
  }

  .quiz-options-container {
    gap: clamp(7px, 1.4svh, 10px);
  }

  .quiz-option-btn {
    padding: clamp(10px, 1.8svh, 13px) clamp(12px, 3.5cqi, 15px);
    min-height: 48px;
  }

  .quiz-option-text {
    font-size: clamp(0.86rem, 0.8rem + 0.35cqi, 0.98rem);
    line-height: 1.45;
  }

  .quiz-bottom-nav-row {
    margin-top: clamp(10px, 1.8svh, 14px);
  }

  .quiz-back-btn {
    padding: 8px 10px 8px 4px;
  }

  /* Result Screen — 圖片與圖表改雙軸比例（使用 svh 避免手機工具列收合造成滑動縮放） */
  .result-zine-card {
    padding: clamp(1rem, 4.2cqi, 1.35rem) clamp(0.9rem, 4cqi, 1.2rem);
    gap: clamp(12px, 2.2svh, 18px);
  }

  .result-hero-grid {
    grid-template-columns: 1fr;
    text-align: center;
    gap: clamp(8px, 1.5svh, 12px);
  }

  .result-char-stage {
    padding: 2px;
  }

  .result-char-img {
    max-width: clamp(9.5rem, min(46vw, 25svh), 14rem);
    margin: 0 auto;
  }

  @supports (width: 1cqi) {
    .result-char-img {
      max-width: clamp(9.5rem, min(46cqi, 25svh), 14rem);
    }
  }

  .result-description-box {
    padding: clamp(11px, 3cqi, 15px);
  }

  .result-description-text {
    font-size: clamp(0.86rem, 0.8rem + 0.35cqi, 0.96rem);
    line-height: 1.62;
  }

  .spectrum-header-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
  }

  .spectrum-bars-list {
    gap: clamp(4px, 1.8cqi, 8px);
  }

  .spectrum-col-track {
    height: clamp(4.75rem, min(15svh, 24cqi), 8rem);
  }

  .spectrum-col-label {
    font-size: clamp(0.65rem, 0.58rem + 0.8cqi, 0.76rem);
    line-height: 1.2;
  }

  .result-poster-showcase {
    grid-template-columns: 1fr;
    text-align: center;
    padding: clamp(12px, 3.2cqi, 16px);
    gap: 12px;
  }

  .poster-thumb-wrap {
    max-width: clamp(9.5rem, min(46cqi, 27svh), 13rem);
    margin: 0 auto;
  }

  .btn-download-poster-only {
    justify-content: center;
    width: 100%;
    padding: 10px 14px;
  }

  .mapmo-bridge-card {
    padding: clamp(12px, 3.5cqi, 16px);
    gap: 11px;
  }

  .feature-match-card {
    padding: clamp(9px, 2.8cqi, 12px);
  }

  .action-row-buttons {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 8.5rem), 1fr));
    gap: 8px;
  }

  .btn-result-action {
    padding: 12px 12px;
    font-size: clamp(0.84rem, 0.8rem + 0.25cqi, 0.92rem);
  }

  /* Modals — Sticky Close + 響應式無溢位資料卡 */
  .standee-modal-box,
  .tree-qr-studio-box {
    padding: 0 16px 20px !important;
  }

  .modal-sticky-header {
    padding: 12px 0 8px;
    margin-bottom: 10px;
  }

  .qr-studio-tabs {
    margin: 0 0 14px;
  }

  .qr-studio-tab {
    font-size: 12px;
    padding: 8px;
  }

  .tree-qr-url-input {
    font-size: 12.5px;
    padding: 0 10px;
  }

  .bw-qr-actions-grid {
    grid-template-columns: 1fr;
  }

  .admin-header-row {
    padding-right: 0;
  }

  .admin-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-table-wrap {
    overflow-x: visible;
  }

  .admin-table-wrap.tall {
    max-height: 360px;
  }

  .admin-responsive-table {
    min-width: 0;
  }

  .admin-responsive-table,
  .admin-responsive-table thead,
  .admin-responsive-table tbody,
  .admin-responsive-table tr,
  .admin-responsive-table td {
    display: block;
    width: 100%;
  }

  .admin-responsive-table thead {
    display: none;
  }

  .admin-responsive-table tr {
    padding: 10px 12px;
    border-bottom: 2px solid #EFE6D4;
  }

  .admin-responsive-table tr:last-child {
    border-bottom: none;
  }

  .admin-responsive-table td {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    padding: 4px 0;
    border: none;
    white-space: normal;
    text-align: right;
  }

  .admin-responsive-table td::before {
    content: attr(data-label);
    font-weight: 800;
    color: var(--ink-muted);
    font-size: 11.5px;
    text-align: left;
    flex-shrink: 0;
  }

  .admin-responsive-table td[colspan] {
    display: block;
    text-align: center;
  }

  .admin-responsive-table td[colspan]::before {
    content: none;
  }

  .admin-responsive-table td.wrap-cell {
    min-width: 0;
  }
}

/* 手機橫放／極矮視窗突發防護 (例如 667×375 / 844×390)：問答區改 2 欄並排、首頁與彈窗等比收斂高度 */
@media (max-height: 540px) {
  .quiz-nav-badge,
  .nav-admin-btn {
    display: none;
  }

  .quiz-nav-standalone {
    padding: 5px 14px;
  }

  .quiz-main-wrapper {
    padding: 6px 14px 28px;
  }

  .journal-hero-stage {
    gap: 8px;
  }

  .journal-display-title .title-line-top {
    font-size: clamp(1.5rem, 1.2rem + 1.8vw, 2rem);
  }

  .journal-display-title .title-line-bottom {
    font-size: clamp(1.75rem, 1.4rem + 2.1vw, 2.3rem);
  }

  .journal-diorama-img {
    width: auto;
    max-width: 100%;
    height: clamp(6.5rem, 32svh, 9.5rem);
    aspect-ratio: 1080 / 806;
    object-fit: contain;
    margin: 0 auto;
  }

  .quiz-step-card {
    margin-top: 0;
    padding: 10px 15px;
  }

  .quiz-progress-bar-wrap {
    margin-bottom: 6px;
  }

  .quiz-nav-top-row {
    margin-bottom: 6px;
  }

  .quiz-section-quote-banner {
    padding: 6px 10px;
    margin-bottom: 8px;
  }

  .quote-banner-section {
    display: inline;
    margin-right: 6px;
    margin-bottom: 0;
  }

  .quote-banner-text {
    display: inline;
    font-size: clamp(0.78rem, 0.75rem + 0.25vw, 0.88rem);
  }

  .question-prompt-text {
    font-size: clamp(0.98rem, 0.9rem + 0.55vw, 1.18rem);
    margin-bottom: 8px;
  }

  .quiz-options-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr));
    gap: 7px;
  }

  .quiz-option-btn {
    padding: 8px 11px;
    min-height: 44px;
  }

  .quiz-bottom-nav-row {
    margin-top: 6px;
  }

  .media-preview-img {
    max-height: 52dvh;
  }

  .tree-qr-canvas-container {
    max-width: min(340px, 46dvh, 80vw);
  }
}

/* ─────────────────────────────────────────────────────────
   8. Print Stylesheet (@media print — supports native <dialog>)
   ───────────────────────────────────────────────────────── */
@media print {
  header.navbar,
  main.quiz-main-wrapper,
  dialog#adminModal,
  .toast-notification,
  .kraft-paper-grain,
  .qr-studio-tabs,
  .standee-modal-close,
  .tree-qr-hint-row,
  .tree-qr-url-row,
  .tree-qr-season-row,
  .tree-qr-Palette-row,
  .tree-qr-extra-actions,
  .bw-qr-controls {
    display: none !important;
  }

  dialog#standeeModal[open] {
    display: block !important;
    position: static !important;
    max-width: none !important;
    max-height: none !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #FFFFFF !important;
  }

  dialog#standeeModal::backdrop {
    display: none !important;
  }

  .standee-modal-box,
  .tree-qr-studio-box {
    border: none !important;
    box-shadow: none !important;
    max-height: none !important;
    overflow: visible !important;
    background: #FFFFFF !important;
    padding: 0 !important;
  }

  body.quiz-page:not(.print-bw-qr) #bwQrPane {
    display: none !important;
  }

  body.quiz-page:not(.print-bw-qr) #treeQrPane {
    display: block !important;
  }

  body.quiz-page:not(.print-bw-qr) .tree-qr-print-only-header {
    display: flex !important;
  }

  body.quiz-page:not(.print-bw-qr) #standeePrintPaper {
    width: 100%;
    padding: 32px;
    border: 3px solid #000000;
    border-radius: 16px;
    page-break-inside: avoid;
  }

  body.quiz-page.print-bw-qr #treeQrPane {
    display: none !important;
  }

  body.quiz-page.print-bw-qr #bwQrPane {
    display: flex !important;
  }

  body.quiz-page.print-bw-qr #bwPrintCard {
    width: min(520px, 92%);
    margin: 24px auto 0;
    padding: 40px 32px;
    background: #FFFFFF !important;
    color: #000000 !important;
    border: 3px solid #000000 !important;
    border-radius: 18px;
    box-shadow: none !important;
    page-break-inside: avoid;
  }
}
