/* ========================================
   Think BIG — 上班族人格圖鑑
   Mobile-first, dark theme
   ======================================== */

:root {
  --bg: #0a0e1a;
  --bg2: #111827;
  --surface: #1a2035;
  --border: #2a3555;
  --accent: #4f8ef7;
  --accent2: #7c3aed;
  --gold: #f59e0b;
  --green: #10b981;
  --text: #f1f5f9;
  --text2: #94a3b8;
  --text3: #64748b;
  --radius: 16px;
  --radius-sm: 10px;
  --font: -apple-system, BlinkMacSystemFont, "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;

  /* character colors */
  --big: #4f8ef7;
  --kaka: #e879a8;
  --gin: #10b981;
  --jj: #a78bfa;
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
}

/* ---- PREVENT HORIZONTAL SCROLL ---- */
html, body { max-width: 100%; overflow-x: hidden; }

/* ---- TYPOGRAPHY ---- */
h1 { font-size: clamp(1.6rem, 6vw, 2.4rem); font-weight: 700; line-height: 1.2; }
h2 { font-size: clamp(1.3rem, 4.5vw, 1.8rem); font-weight: 800; line-height: 1.3; }
h3 { font-size: clamp(1rem, 3.5vw, 1.3rem); font-weight: 700; }
p, li { font-size: clamp(0.9rem, 3vw, 1rem); line-height: 1.7; color: var(--text2); }

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

/* ---- LAYOUT ---- */
.container {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 0 20px;
}

.page {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ---- BUTTONS ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 28px;
  border-radius: 50px;
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.96); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  box-shadow: 0 4px 20px rgba(79,142,247,0.4);
}
.btn-primary:hover { box-shadow: 0 6px 28px rgba(79,142,247,0.55); text-decoration: none; }

.btn-outline {
  background: transparent;
  border: 2px solid var(--border);
  color: var(--text);
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }

.btn-ghost {
  background: rgba(255,255,255,0.06);
  color: var(--text2);
}
.btn-ghost:hover { background: rgba(255,255,255,0.1); text-decoration: none; }

.btn-gold {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #000;
  box-shadow: 0 4px 20px rgba(245,158,11,0.35);
}

.btn-lg { padding: 18px 36px; font-size: 1.1rem; }
.btn-sm { padding: 10px 18px; font-size: 0.85rem; }
.btn-block { width: 100%; }

/* ---- QUIZ SCREENS ---- */
#quiz-app {
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  position: relative;
  overflow: hidden;
}

.screen {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 20px;
  opacity: 0;
  pointer-events: none;
  transform: translateX(60px);
  transition: opacity 0.35s ease, transform 0.35s ease;
  overflow-y: auto;
  overflow-x: hidden;
}

.screen.active {
  opacity: 1;
  pointer-events: all;
  transform: translateX(0);
  position: relative;
}

.screen.exit-left {
  opacity: 0;
  transform: translateX(-60px);
}

/* ---- LANDING SCREEN ---- */
#screen-landing {
  justify-content: center;
  text-align: center;
  background: radial-gradient(ellipse at 50% 0%, rgba(79,142,247,0.15) 0%, transparent 65%);
  padding-top: 60px;
  padding-bottom: 60px;
}

.landing-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(79,142,247,0.15);
  border: 1px solid rgba(79,142,247,0.3);
  border-radius: 50px;
  padding: 6px 14px;
  font-size: 0.8rem;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 20px;
}

.landing-title {
  font-size: clamp(2rem, 8vw, 3rem);
  font-weight: 700;
  line-height: 1.1;
  margin-bottom: 8px;
  background: linear-gradient(135deg, #fff 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.landing-sub {
  font-size: clamp(0.95rem, 3.5vw, 1.1rem);
  color: var(--text2);
  margin-bottom: 32px;
  max-width: 320px;
  margin-left: auto;
  margin-right: auto;
}

.landing-stats {
  display: flex;
  gap: 24px;
  justify-content: center;
  margin-bottom: 36px;
}

.stat-item {
  text-align: center;
}
.stat-num {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
}
.stat-label {
  font-size: 0.75rem;
  color: var(--text3);
}

.mascot-preview {
  width: 140px;
  height: 140px;
  background: var(--surface);
  border-radius: 50%;
  margin: 0 auto 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 80px;
  border: 3px solid var(--border);
  overflow: hidden;
}

.landing-notice {
  font-size: 0.75rem;
  color: var(--text3);
  margin-top: 14px;
}

/* ---- QUESTION SCREEN ---- */
.q-header {
  width: 100%;
  max-width: 480px;
  padding-top: 24px;
  padding-bottom: 16px;
}

.progress-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
}

.progress-bar {
  flex: 1;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  border-radius: 3px;
  transition: width 0.4s ease;
}

.progress-label {
  font-size: 0.75rem;
  color: var(--text3);
  white-space: nowrap;
}

.q-body {
  width: 100%;
  max-width: 480px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.q-number {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.q-text {
  font-size: clamp(1.05rem, 4vw, 1.25rem);
  font-weight: 700;
  color: var(--text);
  line-height: 1.45;
  margin-bottom: 28px;
}

.options-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.option-btn {
  width: 100%;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  text-align: left;
  font-family: var(--font);
  font-size: 0.95rem;
  color: var(--text);
  cursor: pointer;
  line-height: 1.5;
  transition: border-color 0.2s, background 0.2s, transform 0.15s;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  overflow: hidden;
}

.option-btn::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  opacity: 0;
  transition: opacity 0.2s;
}

.option-btn:hover {
  border-color: var(--accent);
  background: rgba(79,142,247,0.08);
}

.option-btn.selected {
  border-color: var(--accent);
  background: rgba(79,142,247,0.15);
}

.option-btn:active { transform: scale(0.98); }

.option-letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  background: var(--border);
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 800;
  margin-right: 10px;
  flex-shrink: 0;
  transition: background 0.2s, color 0.2s;
}

.option-btn.selected .option-letter {
  background: var(--accent);
  color: #fff;
}

.option-content {
  display: flex;
  align-items: flex-start;
  gap: 0;
}

.q-footer {
  width: 100%;
  max-width: 480px;
  padding: 20px 0 32px;
}

/* ---- RESULT SCREEN ---- */
.result-hero {
  width: 100%;
  max-width: 480px;
  text-align: center;
  padding-top: 40px;
  padding-bottom: 24px;
}

.result-badge {
  display: inline-block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 50px;
  padding: 6px 16px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text2);
  letter-spacing: 0.08em;
  margin-bottom: 16px;
}

.result-character {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  margin: 0 auto 20px;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 90px;
  border: 4px solid var(--border);
  overflow: hidden;
}

.result-type-name {
  font-size: clamp(1.5rem, 6vw, 2rem);
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}

.result-code {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text3);
  letter-spacing: 0.15em;
  margin-bottom: 14px;
}

.result-tagline {
  font-size: clamp(0.95rem, 3.5vw, 1.05rem);
  color: var(--text2);
  font-style: italic;
  margin-bottom: 24px;
  line-height: 1.5;
}

.result-card-wrap {
  width: 100%;
  max-width: 480px;
}

.info-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}

.info-card-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text3);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.info-card p {
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--text2);
}

.strengths-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
}

.strength-tag {
  background: rgba(79,142,247,0.12);
  border: 1px solid rgba(79,142,247,0.25);
  border-radius: 50px;
  padding: 5px 14px;
  font-size: 0.82rem;
  color: var(--accent);
  font-weight: 600;
}

.ai-partner-box {
  background: linear-gradient(135deg, rgba(79,142,247,0.08), rgba(124,58,237,0.08));
  border: 1px solid rgba(79,142,247,0.25);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
}

.ai-partner-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.ai-partner-text {
  font-size: 0.95rem;
  color: var(--text);
  line-height: 1.6;
}

.match-row {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.match-card {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  text-align: center;
}

.match-label {
  font-size: 0.7rem;
  color: var(--text3);
  margin-bottom: 4px;
}
.match-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
}
.match-icon { font-size: 1.2rem; margin-bottom: 4px; }

/* ---- SHARE SECTION ---- */
.share-section {
  width: 100%;
  max-width: 480px;
  padding: 20px 0 40px;
  text-align: center;
}

.share-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 16px;
}

.share-btns {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.share-canvas-preview {
  width: 100%;
  max-width: 320px;
  border-radius: 12px;
  margin: 0 auto 20px;
  display: block;
  border: 2px solid var(--border);
  cursor: pointer;
}

.share-hint {
  font-size: 0.78rem;
  color: var(--text3);
  margin-top: 10px;
}

.cta-enterprise {
  width: 100%;
  max-width: 480px;
  background: linear-gradient(135deg, rgba(79,142,247,0.1), rgba(124,58,237,0.1));
  border: 1px solid rgba(79,142,247,0.2);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  margin-bottom: 40px;
}

.cta-enterprise h3 {
  font-size: 1.1rem;
  margin-bottom: 8px;
}

.cta-enterprise p {
  font-size: 0.88rem;
  color: var(--text2);
  margin-bottom: 16px;
}

/* ---- CALCULATOR PAGE ---- */
.calc-page {
  min-height: 100vh;
  min-height: 100dvh;
  padding: 40px 20px 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.calc-header {
  text-align: center;
  max-width: 480px;
  width: 100%;
  margin-bottom: 32px;
}

.calc-tabs {
  display: flex;
  gap: 8px;
  background: var(--surface);
  padding: 6px;
  border-radius: 50px;
  width: 100%;
  max-width: 360px;
  margin: 24px auto;
}

.calc-tab {
  flex: 1;
  padding: 10px 0;
  border: none;
  border-radius: 50px;
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  background: transparent;
  color: var(--text3);
}

.calc-tab.active {
  background: var(--accent);
  color: #fff;
}

.calc-panel {
  display: none;
  width: 100%;
  max-width: 480px;
}

.calc-panel.active { display: block; }

.slider-group {
  margin-bottom: 24px;
}

.slider-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
}

.slider-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

.slider-value {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent);
}

input[type="range"] {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 3px;
  background: var(--border);
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(79,142,247,0.4);
}

input[type="range"]::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
}

.calc-result {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 20px;
  text-align: center;
  margin-bottom: 20px;
}

.calc-big-num {
  font-size: clamp(2.5rem, 10vw, 4rem);
  font-weight: 700;
  color: var(--text);
  line-height: 1;
  margin-bottom: 4px;
}

.calc-unit { font-size: 1rem; color: var(--text2); margin-bottom: 16px; }

.calc-convert {
  font-size: 0.88rem;
  color: var(--text2);
  line-height: 1.6;
  background: rgba(79,142,247,0.06);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 12px;
}

.boss-input-group {
  margin-bottom: 20px;
}

.boss-label {
  font-size: 0.85rem;
  color: var(--text2);
  margin-bottom: 6px;
  display: block;
}

.boss-input {
  width: 100%;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-family: var(--font);
  font-size: 1rem;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s;
}

.boss-input:focus { border-color: var(--accent); }

/* ---- TEAM PAGE ---- */
.team-page {
  min-height: 100vh;
  min-height: 100dvh;
  padding: 40px 20px 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.team-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  width: 100%;
  max-width: 480px;
  margin-bottom: 24px;
}

.team-member-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 12px;
  text-align: center;
}

.team-member-icon { font-size: 2rem; margin-bottom: 6px; }
.team-member-name { font-size: 0.8rem; color: var(--text2); margin-bottom: 4px; }
.team-member-type { font-size: 0.9rem; font-weight: 700; color: var(--text); }

.team-url-share {
  width: 100%;
  max-width: 480px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: 0.8rem;
  color: var(--text3);
  margin-bottom: 16px;
  word-break: break-all;
  user-select: all;
}

/* ---- STATIC RESULT PAGE (in /t/<slug>/) ---- */
.static-result-page {
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 20px 60px;
}

.back-nav {
  width: 100%;
  max-width: 480px;
  padding: 16px 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  color: var(--text3);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.back-nav:hover { color: var(--text2); }

/* ---- NAV BAR ---- */
.site-nav {
  width: 100%;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10,14,26,0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(42,53,85,0.6);
}

.nav-logo {
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--text);
  text-decoration: none;
}

.nav-logo span { color: var(--accent); }

.nav-links {
  display: flex;
  gap: 16px;
  align-items: center;
}

.nav-link {
  font-size: 0.8rem;
  color: var(--text2);
  text-decoration: none;
  transition: color 0.2s;
}
.nav-link:hover { color: var(--text); }

/* ---- FOOTER ---- */
.site-footer {
  width: 100%;
  padding: 32px 20px;
  text-align: center;
  border-top: 1px solid var(--border);
  margin-top: auto;
}

.footer-brand {
  font-size: 0.75rem;
  color: var(--text3);
  margin-bottom: 8px;
}

.footer-links {
  display: flex;
  gap: 16px;
  justify-content: center;
}

.footer-link {
  font-size: 0.75rem;
  color: var(--text2);
  text-decoration: none;
}
.footer-link:hover { color: var(--text); }

.footer-disclaimer {
  font-size: 0.72rem;
  color: var(--text3);
  margin-top: 12px;
  line-height: 1.5;
}

/* ---- ANIMATIONS ---- */
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes confetti {
  0% { transform: translateY(-20px) rotate(0deg); opacity: 1; }
  100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

.fade-in {
  animation: fadeIn 0.4s ease both;
}

.confetti-piece {
  position: fixed;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  animation: confetti 2s ease forwards;
  pointer-events: none;
  z-index: 999;
}

/* ---- CANVAS MODAL ---- */
.canvas-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}

.canvas-modal.open {
  opacity: 1;
  pointer-events: all;
}

.canvas-modal-inner {
  max-width: 400px;
  width: 100%;
}

.canvas-modal canvas {
  width: 100%;
  border-radius: 12px;
  display: block;
  margin-bottom: 16px;
}

.canvas-modal-hint {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text2);
  margin-bottom: 16px;
}

.canvas-modal-btns {
  display: flex;
  gap: 10px;
}

/* ---- LOADING ---- */
.loading-dots {
  display: flex;
  gap: 6px;
  justify-content: center;
  align-items: center;
  height: 32px;
}

.loading-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: bounce 1.2s ease infinite;
}

.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes bounce {
  0%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-10px); }
}

/* ---- CHARACTER COLORS ---- */
[data-char="BIG"] .result-character { border-color: var(--big); }
[data-char="BIG"] .result-type-name { color: var(--big); }
[data-char="KAKA"] .result-character { border-color: var(--kaka); }
[data-char="KAKA"] .result-type-name { color: var(--kaka); }
[data-char="GIN"] .result-character { border-color: var(--gin); }
[data-char="GIN"] .result-type-name { color: var(--gin); }
[data-char="JJ"] .result-character { border-color: var(--jj); }
[data-char="JJ"] .result-type-name { color: var(--jj); }

/* ---- RESPONSIVE ---- */
@media (min-width: 640px) {
  .container { padding: 0 32px; }
  .screen { padding: 0 32px; }
  .result-character { width: 200px; height: 200px; font-size: 110px; }
  .landing-title { font-size: 3.5rem; }
}
