/* ========================================
   SM Style Diagnosis v2 — "Celestial Oracle"
   SNS-viral dark theme with type-specific gradients
   ======================================== */

:root {
  --bg-deep: #06060f;
  --bg-primary: #0a0a1a;
  --bg-card: rgba(255,255,255,0.03);
  --bg-card-hover: rgba(255,255,255,0.06);
  --bg-glass: rgba(255,255,255,0.04);
  --text-primary: #222;
  --text-secondary: #666;
  --text-muted: #5a5a78;
  --accent: #a78bfa;
  --accent-dim: rgba(167,139,250,0.15);
  --border: rgba(255,255,255,0.06);
  --border-hover: rgba(255,255,255,0.12);
  --radius: 20px;
  --radius-sm: 14px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --type-primary: #a78bfa;
  --type-grad-start: #3b0764;
  --type-grad-end: #a78bfa;
  --type-glow: rgba(167,139,250,0.3);

  /* Type palette: DS -> DM order from the diagnosis map */
  --type-core-s-primary: #8f5aaf;
  --type-core-s-grad-start: #4b2a62;
  --type-core-s-grad-end: #b283cc;
  --type-core-s-glow: rgba(143,90,175,0.3);

  --type-care-s-primary: #5f5db8;
  --type-care-s-grad-start: #2b2a62;
  --type-care-s-grad-end: #8d8bd8;
  --type-care-s-glow: rgba(95,93,184,0.3);

  --type-action-s-primary: #5689c6;
  --type-action-s-grad-start: #27415f;
  --type-action-s-grad-end: #87b1d9;
  --type-action-s-glow: rgba(86,137,198,0.3);

  --type-switcher-primary: #63aea3;
  --type-switcher-grad-start: #2d514c;
  --type-switcher-grad-end: #91d1c8;
  --type-switcher-glow: rgba(99,174,163,0.3);

  --type-action-m-primary: #df9d3f;
  --type-action-m-grad-start: #64461c;
  --type-action-m-grad-end: #ebb96f;
  --type-action-m-glow: rgba(223,157,63,0.3);

  --type-service-m-primary: #e6653f;
  --type-service-m-grad-start: #672d1c;
  --type-service-m-grad-end: #ef9275;
  --type-service-m-glow: rgba(230,101,63,0.3);

  --type-core-m-primary: #d94d54;
  --type-core-m-grad-start: #622326;
  --type-core-m-grad-end: #e6848a;
  --type-core-m-glow: rgba(217,77,84,0.3);

  --type-mental-lead-primary: #d45d8a;
  --type-mental-lead-grad-start: #602a3d;
  --type-mental-lead-grad-end: #e58eae;
  --type-mental-lead-glow: rgba(212,93,138,0.3);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Noto Sans JP', sans-serif;
  background: var(--bg-deep);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  position: relative;
}

/* Subtle noise overlay */
.noise-overlay {
  position: fixed;
  inset: 0;
  z-index: 0;
  opacity: 0.025;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-size: 256px;
}

#app { position: relative; z-index: 1; }

.language-switcher {
  position: fixed;
  top: 12px;
  right: 14px;
  z-index: 10002;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(230, 226, 221, 0.95);
  border-radius: 999px;
  box-shadow: 0 10px 26px rgba(20, 20, 20, 0.08);
  backdrop-filter: blur(10px);
}

.language-switcher a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 28px;
  padding: 0 8px;
  color: #6a6d70;
  border-radius: 999px;
  font-family: 'Poppins', 'Noto Sans JP', sans-serif;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  letter-spacing: 0.04em;
  transition: color 0.2s var(--ease), background-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
  -webkit-tap-highlight-color: transparent;
}

.language-switcher a:hover {
  color: #33373A;
  background: rgba(30, 152, 165, 0.08);
}

.language-switcher a[aria-current="true"] {
  color: #fff;
  background: linear-gradient(135deg, #1E98A5, #E96B56);
  box-shadow: 0 4px 14px rgba(30, 152, 165, 0.22);
}

.container {
  max-width: 560px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ========================================
   SVG Icon Utility
   ======================================== */
.type-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
}
.type-icon svg {
  width: 100%;
  height: 100%;
}

.info-svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* ========================================
   Screens
   ======================================== */
.screen {
  display: none;
  min-height: 100vh;
  min-height: 100dvh;
}

.screen.active {
  display: flex;
  align-items: center;
  justify-content: center;
  animation: screenIn 0.6s var(--ease);
}

@keyframes screenIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

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

@keyframes scaleReveal {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes pulseGlow {
  0%, 100% { opacity: 0.6; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.05); }
}

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

@keyframes orbPulse {
  0%, 100% { transform: scale(1); opacity: 0.8; }
  50% { transform: scale(1.2); opacity: 0.4; }
}

/* ========================================
   Intro Screen
   ======================================== */
.intro-content {
  text-align: center;
  padding: 48px 0;
  animation: revealUp 0.8s var(--ease);
}

.intro-badge {
  display: inline-block;
  font-size: 0.65rem;
  letter-spacing: 0.25em;
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 6px 20px;
  border-radius: 100px;
  margin-bottom: 28px;
  font-weight: 700;
}

.intro-title {
  font-family: 'Zen Old Mincho', serif;
  font-size: 3rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.06em;
  line-height: 1.2;
  margin-bottom: 8px;
}

.title-accent {
  background: linear-gradient(135deg, var(--accent), #f0abfc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.intro-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 700;
  letter-spacing: 0.08em;
}

.intro-divider {
  width: 40px;
  height: 1px;
  background: var(--border-hover);
  margin: 32px auto;
}

.intro-description p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: 8px;
}

.intro-note {
  font-size: 0.78rem !important;
  color: var(--text-muted) !important;
}

.intro-info {
  display: flex;
  justify-content: center;
  gap: 28px;
  margin: 36px 0;
}

.info-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* How-to */
.intro-howto {
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 20px 24px;
  margin-bottom: 36px;
}

.howto-title {
  font-size: 0.7rem;
  color: var(--accent);
  letter-spacing: 0.15em;
  font-weight: 700;
  margin-bottom: 8px;
}

.howto-text {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 16px;
}

.likert-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.abc-preview {
  gap: 12px;
}

.abc-preview .preview-item {
  min-width: 88px;
}

.preview-item { text-align: center; }
.preview-num {
  display: block;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-primary);
}
.preview-label {
  font-size: 0.6rem;
  color: var(--text-muted);
}
.preview-dots {
  font-size: 1rem;
  color: var(--text-muted);
  letter-spacing: 0.3em;
}

/* Start button */
.btn-start {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 16px 44px;
  font-size: 0.95rem;
  font-weight: 500;
  color: #fff;
  background: linear-gradient(135deg, #7c3aed, #a78bfa);
  border: none;
  border-radius: 100px;
  cursor: pointer;
  transition: all 0.3s var(--ease);
  font-family: inherit;
  letter-spacing: 0.04em;
  box-shadow: 0 4px 24px rgba(124,58,237,0.35);
}

.btn-start:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 40px rgba(124,58,237,0.45);
}

.btn-start:active { transform: translateY(0); }

/* ========================================
   Quiz Screen
   ======================================== */
#quiz.active {
  align-items: flex-start;
  padding-top: 48px;
  padding-bottom: 48px;
}

.quiz-header { margin-bottom: 40px; }

.quiz-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.btn-back-question {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  min-height: 36px;
  color: var(--text-secondary);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s var(--ease);
  -webkit-tap-highlight-color: transparent;
}

.btn-back-question:hover:not(:disabled) {
  color: var(--text-primary);
  border-color: var(--border-hover);
  transform: translateY(-1px);
}

.btn-back-question:disabled {
  cursor: default;
  opacity: 0;
  pointer-events: none;
}

.progress-bar {
  width: 100%;
  height: 3px;
  background: rgba(255,255,255,0.06);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 10px;
}

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

.progress-text {
  text-align: right;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 700;
  letter-spacing: 0.1em;
  font-variant-numeric: tabular-nums;
}

.progress-sep { margin: 0 2px; opacity: 0.4; }

.quiz-body { animation: slideUp 0.35s var(--ease); }

.question-card { margin-bottom: 36px; }

.question-number {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 14px;
  letter-spacing: 0.15em;
}

.question-text {
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.8;
  color: var(--text-primary);
}

/* Likert Scale */
.likert-scale {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 14px;
}

.likert-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 76px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.25s var(--ease);
  font-family: inherit;
  color: var(--text-primary);
  padding: 8px 4px;
  -webkit-tap-highlight-color: transparent;
}

.likert-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
  transform: translateY(-3px);
}

.likert-btn:active { transform: translateY(0); }

.likert-btn.selected {
  border-color: var(--accent);
  background: var(--accent-dim);
  box-shadow: 0 0 20px rgba(167,139,250,0.15);
}

.likert-number {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 2px;
}

.likert-label {
  font-size: 0.5rem;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.2;
}

.likert-axis {
  display: flex;
  justify-content: space-between;
  font-size: 0.65rem;
  color: var(--text-muted);
  padding: 0 4px;
  opacity: 0.6;
}

/* A/B/C choices */
.choices {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.choice-btn {
  width: 100%;
  min-height: 72px;
  display: grid;
  grid-template-columns: 44px 1fr;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  color: var(--text-primary);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: all 0.25s var(--ease);
  -webkit-tap-highlight-color: transparent;
}

.choice-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
  transform: translateY(-2px);
}

.choice-btn:active {
  transform: translateY(0);
}

.choice-btn.selected {
  border-color: #FBFAF7;
  background: #FBFAF7;
}

.choice-key {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--accent);
  background: rgba(167,139,250,0.1);
  border: 1px solid rgba(167,139,250,0.18);
  font-weight: 700;
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}

.choice-label {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text-secondary);
}

/* ========================================
   Analyzing Screen — Orbital Animation
   ======================================== */
.analyzing-content { text-align: center; }

.analyzing-orb {
  position: relative;
  width: 80px;
  height: 80px;
  margin: 0 auto 32px;
}

.orb-core {
  position: absolute;
  inset: 28px;
  background: radial-gradient(circle, var(--accent), transparent);
  border-radius: 50%;
  animation: orbPulse 2s ease infinite;
}

.orb-ring {
  position: absolute;
  inset: 0;
  border: 1px solid var(--accent);
  border-radius: 50%;
  opacity: 0.3;
}

.orb-ring-1 { animation: orbSpin 3s linear infinite; border-style: dashed; }
.orb-ring-2 { inset: 8px; animation: orbSpin 5s linear infinite reverse; opacity: 0.2; }
.orb-ring-3 { inset: 16px; animation: orbSpin 2s linear infinite; border-width: 2px; opacity: 0.5; }

.analyzing-text {
  font-family: 'Zen Old Mincho', serif;
  font-size: 1.1rem;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.analyzing-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ========================================
   Result Screen
   ======================================== */
#result.active {
  align-items: flex-start;
  padding-top: 48px;
  padding-bottom: 80px;
}

.result-content { text-align: center; }

/* Share Card — the hero element for SNS screenshots */
.share-card {
  position: relative;
  border-radius: var(--radius);
  padding: 2px;
  margin-bottom: 28px;
  background: linear-gradient(160deg, var(--type-grad-start), var(--type-grad-end));
  animation: scaleReveal 0.6s var(--ease);
  overflow: hidden;
}

.share-card-bg {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 0%, var(--type-glow), transparent 70%);
  opacity: 0.5;
}

.share-card-inner {
  position: relative;
  background: linear-gradient(180deg, rgba(10,10,26,0.92), rgba(10,10,26,0.98));
  border-radius: calc(var(--radius) - 2px);
  padding: 40px 28px 28px;
}

.result-label {
  font-size: 0.6rem;
  color: var(--text-muted);
  letter-spacing: 0.3em;
  margin-bottom: 20px;
}

.result-type-icon {
  margin-bottom: 12px;
  display: flex;
  justify-content: center;
  filter: drop-shadow(0 0 16px var(--type-glow));
}

.result-type-name {
  font-family: 'Zen Old Mincho', serif;
  font-size: 2.4rem;
  font-weight: 700;
  color: var(--type-grad-end);
  margin-bottom: 4px;
  letter-spacing: 0.05em;
}

.result-type-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  margin-bottom: 16px;
}

.result-score-ring {
  display: inline-flex;
  align-items: baseline;
  gap: 2px;
  margin-bottom: 20px;
}

.score-number {
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--type-primary);
  font-variant-numeric: tabular-nums;
}

.score-unit {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 700;
}

.result-catchphrase {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.7;
  font-weight: 700;
  margin-bottom: 16px;
}

.result-secondary {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  padding: 8px 0;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}

.secondary-label {
  font-size: 0.6rem;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  margin-right: 4px;
}

.share-card-footer {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.share-card-brand {
  font-size: 0.55rem;
  color: var(--text-muted);
  letter-spacing: 0.3em;
  opacity: 0.6;
}

/* Composite type */
.result-composite {
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  margin-bottom: 20px;
  animation: revealUp 0.5s var(--ease) 0.2s both;
}

.composite-badge {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 6px;
}

.composite-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.diagnosis-note {
  background: rgba(255,255,255,0.025);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  margin: 8px 0 24px;
  color: var(--text-muted);
  font-size: 0.78rem;
  line-height: 1.8;
  text-align: left;
  animation: revealUp 0.5s var(--ease) var(--delay, 0s) both;
}

.result-inline-promo {
  margin: -4px 0 24px;
  padding: 22px 18px 18px;
  text-align: left;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(215, 226, 224, 0.95);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(31, 41, 55, 0.05);
  animation: revealUp 0.5s var(--ease) var(--delay, 0s) both;
}

.result-inline-promo-title {
  margin-bottom: 14px;
  color: #24867e;
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1.5;
}

.result-inline-promo-copy {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 18px;
}

.result-inline-promo-copy p {
  color: #33373a;
  font-size: 0.82rem;
  line-height: 1.85;
}

.result-inline-promo-cta {
  margin: 2px 0 12px;
  color: #7d2e8f;
  font-size: 0.84rem;
  font-weight: 700;
  line-height: 1.5;
  text-align: left;
}

.result-inline-promo-link {
  display: block;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(198, 168, 92, 0.42);
  background: rgba(18, 10, 30, 0.72);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.34);
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.result-inline-promo-link:hover {
  transform: translateY(-2px);
  border-color: rgba(244, 211, 118, 0.78);
  box-shadow: 0 22px 52px rgba(0, 0, 0, 0.42);
}

.result-inline-promo-link:focus-visible {
  outline: 3px solid rgba(244, 211, 118, 0.65);
  outline-offset: 3px;
}

.result-inline-promo-img {
  display: block;
  width: 100%;
  height: auto;
}

/* Reliability warning */
.reliability-warning {
  background: rgba(220,38,38,0.06);
  border: 1px solid rgba(220,38,38,0.15);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  margin-bottom: 20px;
  text-align: left;
}

.reliability-warning p:first-child {
  font-size: 0.8rem;
  font-weight: 700;
  color: #f87171;
  margin-bottom: 6px;
}

.reliability-detail {
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* Detail sections */
.result-details { text-align: left; }

.detail-section {
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 24px 20px;
  margin-bottom: 12px;
  animation: revealUp 0.5s var(--ease) var(--delay, 0s) both;
}

.detail-title {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 14px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.detail-list { list-style: none; }

.detail-text-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.detail-list li {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.7;
  padding: 3px 0 3px 14px;
  position: relative;
}

.detail-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 11px;
  width: 4px;
  height: 4px;
  background: var(--type-primary, var(--accent));
  border-radius: 50%;
  opacity: 0.7;
}

.detail-text {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

.compatibility-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.compat-tag {
  padding: 5px 14px;
  font-size: 0.78rem;
  color: var(--accent);
  background: var(--accent-dim);
  border: 1px solid rgba(167,139,250,0.15);
  border-radius: 100px;
}

/* Score Chart */
.score-chart {
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 24px 20px;
  margin-bottom: 32px;
  text-align: left;
  animation: revealUp 0.5s var(--ease) var(--delay, 0s) both;
}

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

.chart-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chart-row-top { font-weight: 700; }

.chart-row-viewed .chart-label {
  color: var(--text-primary);
}

.chart-label {
  width: 110px;
  font-size: 0.72rem;
  color: var(--text-secondary);
  text-align: right;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
}

.chart-label .type-icon { flex-shrink: 0; }

.chart-bar-bg {
  flex: 1;
  height: 6px;
  background: rgba(255,255,255,0.04);
  border-radius: 3px;
  overflow: hidden;
}

.chart-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 1.2s var(--ease);
  min-width: 2px;
  background: linear-gradient(90deg, var(--bar-color, var(--accent)), var(--bar-end, var(--accent)));
}

.chart-score {
  width: 28px;
  font-size: 0.7rem;
  color: var(--text-muted);
  text-align: left;
  font-variant-numeric: tabular-nums;
}

/* Type ranking */
.type-ranking {
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 24px 20px;
  margin-bottom: 28px;
  text-align: left;
  animation: revealUp 0.5s var(--ease) var(--delay, 0s) both;
}

.type-ranking-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.type-ranking-head .detail-title {
  margin-bottom: 0;
}

.ranking-total {
  font-size: 0.66rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.ranking-note {
  margin: 6px 0 16px;
  font-size: 0.68rem;
  color: var(--text-muted);
}

.ranking-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ranking-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ranking-rank {
  width: 20px;
  flex-shrink: 0;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.ranking-row:nth-child(1) .ranking-rank { color: #e8b341; }
.ranking-row:nth-child(2) .ranking-rank { color: #b9c2cc; }
.ranking-row:nth-child(3) .ranking-rank { color: #cf9b6b; }

.ranking-img {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  border-radius: 50%;
  object-fit: cover;
  background: rgba(255,255,255,0.06);
}

.ranking-name {
  width: 116px;
  flex-shrink: 0;
  font-size: 0.74rem;
  color: var(--text-secondary);
  line-height: 1.25;
}

.ranking-name .ranking-sub {
  display: block;
  margin-top: 2px;
  font-size: 0.6rem;
  color: var(--text-muted);
}

.ranking-bar-bg {
  flex: 1;
  height: 6px;
  background: rgba(255,255,255,0.04);
  border-radius: 3px;
  overflow: hidden;
}

.ranking-bar-fill {
  height: 100%;
  border-radius: 3px;
  min-width: 2px;
  transition: width 1.2s var(--ease);
  background: linear-gradient(90deg, var(--bar-color, var(--accent)), var(--bar-end, var(--accent)));
}

.ranking-pct {
  width: 38px;
  flex-shrink: 0;
  font-size: 0.72rem;
  color: var(--text-secondary);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.ranking-row-mine .ranking-name {
  color: var(--text-primary);
  font-weight: 700;
}

.ranking-row-mine .ranking-pct {
  color: var(--type-primary);
  font-weight: 700;
}

/* Type explorer */
.type-explorer {
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 24px 20px;
  margin-bottom: 28px;
  text-align: left;
  animation: revealUp 0.5s var(--ease) var(--delay, 0s) both;
}

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

.type-explorer-head .detail-title {
  margin-bottom: 0;
}

.type-explorer-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.type-chip {
  min-height: 56px;
  display: grid;
  grid-template-columns: 26px 1fr;
  align-items: center;
  gap: 8px;
  padding: 10px 11px;
  color: var(--text-secondary);
  background: rgba(255,255,255,0.025);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: all 0.25s var(--ease);
}

.type-chip:hover {
  color: var(--text-primary);
  border-color: var(--border-hover);
  background: var(--bg-card-hover);
}

.type-chip.active {
  color: var(--text-primary);
  border-color: var(--type-primary);
  background: var(--accent-dim);
}

.type-chip-name {
  display: block;
  font-size: 0.78rem;
  line-height: 1.2;
}

.type-chip-sub {
  display: block;
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 0.62rem;
  line-height: 1.2;
}

.btn-mini {
  flex-shrink: 0;
  padding: 7px 10px;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.68rem;
  transition: all 0.25s var(--ease);
}

.btn-mini:hover {
  color: var(--text-primary);
  border-color: var(--border-hover);
  background: var(--bg-card);
}

/* Response stats */
.response-stats {
  display: flex;
  justify-content: center;
  gap: 20px;
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-bottom: 28px;
  letter-spacing: 0.03em;
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

/* Retry Button */
.btn-retry {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 32px;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 100px;
  cursor: pointer;
  transition: all 0.3s var(--ease);
  font-family: inherit;
  letter-spacing: 0.03em;
}

.btn-retry:hover {
  border-color: var(--border-hover);
  color: var(--text-primary);
  background: var(--bg-card);
}

.btn-share {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, var(--type-grad-start, #7c3aed), var(--type-grad-end, #a78bfa));
}

.btn-share:hover {
  border-color: transparent;
  color: #fff;
  background: linear-gradient(135deg, var(--type-grad-start, #7c3aed), var(--type-grad-end, #a78bfa));
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 20;
  transform: translate(-50%, 12px);
  opacity: 0;
  padding: 10px 16px;
  color: var(--text-primary);
  background: rgba(10,10,26,0.92);
  border: 1px solid var(--border-hover);
  border-radius: 999px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.25);
  font-size: 0.78rem;
  transition: opacity 0.25s var(--ease), transform 0.25s var(--ease);
  pointer-events: none;
}

.toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 480px) {
  .container { padding: 0 18px; }

  .language-switcher {
    top: 10px;
    right: 10px;
  }

  .language-switcher a {
    min-width: 30px;
    height: 26px;
    padding: 0 7px;
    font-size: 0.62rem;
  }

  .intro-title { font-size: 2.4rem; }

  .intro-info { gap: 16px; }
  .info-item { font-size: 0.75rem; }

  .question-text { font-size: 1.05rem; }

  .likert-scale { gap: 6px; }
  .likert-btn { width: 54px; height: 70px; }
  .likert-number { font-size: 1.2rem; }

  .abc-preview {
    flex-direction: column;
    gap: 10px;
  }

  .abc-preview .preview-item {
    min-width: 0;
  }

  .choice-btn {
    grid-template-columns: 38px 1fr;
    gap: 12px;
    padding: 14px 15px;
  }

  .btn-back-question span {
    display: none;
  }

  .choice-key {
    width: 32px;
    height: 32px;
  }

  .choice-label {
    font-size: 0.88rem;
  }

  .result-type-name { font-size: 2rem; }

  .chart-label { width: 90px; font-size: 0.65rem; }

  .ranking-name { width: 88px; font-size: 0.68rem; }
  .ranking-pct { width: 32px; font-size: 0.66rem; }

  .share-card-inner { padding: 32px 20px 24px; }

  .type-explorer-grid {
    grid-template-columns: 1fr;
  }

  .type-explorer-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .result-actions {
    flex-direction: column;
  }

  .result-actions .btn-retry {
    justify-content: center;
    width: 100%;
  }
}

@media (max-width: 360px) {
  .likert-btn { width: 48px; height: 64px; border-radius: 10px; }
  .likert-number { font-size: 1.1rem; }
  .likert-label { font-size: 0.45rem; }
}

/* ===== Popup Banner (A/B test) ===== */
.popup-banner-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(8, 6, 16, 0.78);
  backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

.popup-banner-overlay.is-open {
  opacity: 1;
  visibility: visible;
}

.popup-banner-box {
  position: relative;
  width: min(92vw, 380px);
  max-height: 88vh;
  transform: translateY(18px) scale(0.98);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  border-radius: 16px;
  overflow: visible;
}

.popup-banner-overlay.is-open .popup-banner-box {
  transform: translateY(0) scale(1);
}

.popup-banner-link {
  display: block;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  -webkit-tap-highlight-color: transparent;
}

.popup-banner-img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 84vh;
  object-fit: contain;
}

.popup-banner-close {
  position: absolute;
  top: -14px;
  right: -14px;
  z-index: 2;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.85);
  background: rgba(20, 16, 32, 0.92);
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
  transition: transform 0.2s ease, background 0.2s ease;
}

.popup-banner-close:hover {
  transform: scale(1.08);
  background: rgba(40, 32, 60, 0.96);
}

@media (max-width: 360px) {
  .popup-banner-box { width: 94vw; }
  .popup-banner-close { top: -10px; right: -10px; width: 36px; height: 36px; }
}
