:root {
  --bg: #111111;
  --bg-soft: #161a22;
  --surface: rgba(255, 255, 255, 0.05);
  --surface-strong: rgba(255, 255, 255, 0.08);
  --surface-light: #f6f3ee;
  --text: #f6f3ee;
  --text-muted: #b9b1a7;
  --text-dark: #161616;
  --line: rgba(255, 255, 255, 0.12);
  --line-dark: rgba(17, 17, 17, 0.08);
  --red: #ff4d4f;
  --yellow: #f7c948;
  --green: #40e0a0;
  --blue: #3b82f6;
  --radius-xl: 34px;
  --radius-lg: 26px;
  --radius-md: 18px;
  --shadow: 0 18px 80px rgba(0, 0, 0, 0.3);
  --max-width: 1200px;
}

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

html {
  scroll-behavior: smooth;
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-width: 320px;
  font-family: "Microsoft YaHei UI", "PingFang SC", "Noto Sans SC", sans-serif;
  background:
    radial-gradient(circle at 15% 20%, rgba(255, 77, 79, 0.18), transparent 24%),
    radial-gradient(circle at 85% 10%, rgba(59, 130, 246, 0.16), transparent 24%),
    linear-gradient(180deg, #0f1013 0%, #131720 55%, #0f1116 100%);
  color: var(--text);
  touch-action: manipulation;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.18;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 1), transparent 78%);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

img {
  display: block;
  max-width: 100%;
}

.page-shell {
  width: min(calc(100% - 28px), var(--max-width));
  margin: 0 auto;
  padding-bottom: 42px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 0 14px;
  backdrop-filter: blur(16px);
}

.topbar-compact {
  padding-top: 14px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--red), #ff8b5c);
  color: #fff;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.brand-copy {
  display: grid;
  gap: 2px;
}

.brand-copy strong {
  font-size: 0.96rem;
}

.brand-copy small {
  color: var(--text-muted);
  font-size: 0.76rem;
  letter-spacing: 0.08em;
}

.topbar-meta {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar--quiz {
  gap: 18px;
}

.topbar-meta--quiz {
  flex: 1 1 auto;
  justify-content: flex-end;
  min-width: 0;
}

.quiz-top-progress {
  flex: 1 1 240px;
  min-width: 160px;
  max-width: 320px;
  display: grid;
  gap: 6px;
}

.quiz-top-progress-head {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.quiz-top-progress strong {
  color: var(--text-muted);
  font-size: 0.98rem;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.quiz-top-progress-track {
  position: relative;
  overflow: hidden;
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.quiz-top-progress-value {
  box-shadow: 0 0 18px rgba(247, 201, 72, 0.18);
}

.hot-badge,
.ghost-button,
.theme-chip,
.secondary-button,
.primary-button {
  border-radius: 999px;
}

.hot-badge {
  display: inline-flex;
  align-items: center;
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--line);
  color: var(--yellow);
  font-size: 0.9rem;
}

.ghost-button,
.secondary-button,
.primary-button,
.theme-chip {
  border: 1px solid transparent;
  transition:
    transform 160ms ease,
    background 160ms ease,
    border-color 160ms ease,
    opacity 160ms ease;
}

.ghost-button {
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--line);
  color: var(--text);
}

.primary-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 20px;
}

.primary-button {
  background: linear-gradient(135deg, var(--red), #ff845f);
  color: #fff;
  box-shadow: 0 14px 34px rgba(255, 77, 79, 0.24);
}

.secondary-button {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--line);
  color: var(--text);
}

.ghost-button:hover,
.secondary-button:hover,
.primary-button:hover,
.theme-chip:hover {
  transform: translateY(-1px);
}

.primary-button:disabled,
.secondary-button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.hero-panel,
.question-card,
.quiz-header-card,
.analyzing-card,
.result-hero,
.result-section,
.poster-side-card,
.poster-preview-card,
.error-card,
.debug-card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.04));
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
}

.hero-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  gap: 24px;
  padding: clamp(28px, 5vw, 48px);
  margin-top: 18px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--yellow);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.84rem;
  font-weight: 700;
}

h1,
h2,
h3,
p {
  margin: 0;
}

.hero-copy h1,
.result-hero-copy h1,
.analyzing-card h1,
.error-card h1,
.debug-card h1 {
  font-size: clamp(2.8rem, 7vw, 4.8rem);
  line-height: 0.95;
  letter-spacing: -0.05em;
}

.hero-desc,
.long-copy,
.quote-card,
.mechanic-card p,
.relation-card p,
.match-card p,
.score-row p,
.dim-card p,
.error-card p,
.debug-card p {
  color: var(--text-muted);
  line-height: 1.7;
}

.hero-actions,
.hero-pill-group,
.quiz-footer,
.theme-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.hero-actions {
  margin-top: 28px;
  align-items: center;
}

.cross-link {
  display: inline-flex;
  margin-top: 16px;
  color: var(--yellow);
  font-size: 0.98rem;
}

.hero-meta {
  color: var(--text-muted);
  font-size: 0.96rem;
}

.hero-aside,
.mechanic-card,
.stack-card,
.metric-card,
.dim-card,
.match-card,
.relation-card,
.score-row {
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
}

.hero-aside {
  padding: 24px;
  display: grid;
  gap: 14px;
}

.plain-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 10px;
}

.compact-list {
  gap: 8px;
}

.section-block {
  margin-top: 34px;
}

.landing-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 26px;
}

.track-entry-card {
  padding: 24px;
  border-radius: var(--radius-xl);
  border: 1px solid var(--line);
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.08), transparent 38%),
    rgba(255, 255, 255, 0.04);
  display: grid;
  gap: 14px;
  box-shadow: var(--shadow);
}

.track-entry-card h2 {
  font-size: clamp(1.8rem, 4.2vw, 2.6rem);
  line-height: 1.05;
  letter-spacing: -0.04em;
}

.track-entry-card p {
  color: var(--text-muted);
  line-height: 1.7;
}

.track-tags {
  color: var(--yellow);
  font-size: 0.95rem;
}

.section-heading {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.section-heading h2 {
  font-size: clamp(1.6rem, 4.5vw, 2.8rem);
  line-height: 1.05;
  letter-spacing: -0.04em;
}

.persona-grid,
.mechanics-grid,
.result-grid,
.dim-grid,
.relation-grid,
.debug-grid {
  display: grid;
  gap: 16px;
}

.persona-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.persona-card,
.stack-card,
.relation-card {
  display: flex;
  align-items: center;
  gap: 14px;
}

.persona-card {
  padding: 16px;
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.08), transparent 35%),
    rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
}

.persona-card strong,
.stack-card strong,
.relation-card strong,
.dim-card strong,
.match-card strong,
.score-row strong {
  display: block;
}

.persona-card p {
  margin-top: 6px;
  color: var(--text-muted);
  line-height: 1.6;
}

.persona-card-avatar,
.persona-avatar,
.inline-avatar,
.relation-avatar,
.scanner-avatar {
  border-radius: 22px;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
}

.persona-card-avatar,
.inline-avatar,
.relation-avatar {
  width: 64px;
  height: 64px;
}

.scanner-avatar {
  width: 44px;
  height: 44px;
  border-radius: 16px;
}

.mechanics-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.mechanic-card {
  padding: 22px;
}

.mechanic-card strong {
  display: block;
  margin-bottom: 8px;
  font-size: 1.05rem;
}

.disclaimer-block {
  color: var(--text-muted);
  font-size: 0.96rem;
}

.rules-dialog {
  border: none;
  padding: 0;
  background: transparent;
}

.rules-dialog::backdrop {
  background: rgba(0, 0, 0, 0.58);
}

.rules-dialog-shell {
  width: min(92vw, 660px);
  border-radius: var(--radius-xl);
  background: #171b23;
  border: 1px solid var(--line);
  color: var(--text);
  padding: 24px;
}

.rules-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.quiz-main,
.result-main,
.poster-main,
.debug-main {
  display: grid;
  gap: 18px;
}

.quiz-main {
  gap: 14px;
}

.quiz-header-card,
.question-card,
.analyzing-card,
.poster-side-card,
.poster-preview-card,
.error-card,
.debug-card {
  padding: clamp(20px, 4vw, 30px);
}

.quiz-header-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.progress-bar-track,
.score-bar-track {
  position: relative;
  overflow: hidden;
  border-radius: 999px;
}

.progress-bar-track {
  height: 12px;
  background: rgba(255, 255, 255, 0.08);
}

.progress-bar-value,
.score-bar-value {
  height: 100%;
  border-radius: inherit;
}

.progress-bar-value {
  background: linear-gradient(90deg, var(--red), var(--yellow));
  width: 0;
  transition: width 220ms ease;
}

.toast-strip {
  padding: 12px 16px;
  border-radius: 18px;
  background: rgba(247, 201, 72, 0.12);
  border: 1px solid rgba(247, 201, 72, 0.25);
  color: var(--yellow);
  scroll-margin-top: 24px;
}

.toast-floating {
  position: fixed;
  left: 14px;
  right: 14px;
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 90;
  margin: 0 auto;
  max-width: min(520px, calc(100vw - 28px));
  box-shadow: 0 22px 54px rgba(0, 0, 0, 0.34);
}

.toast-strip.is-visible {
  box-shadow: 0 10px 24px rgba(247, 201, 72, 0.16);
}

.question-card {
  padding: clamp(18px, 3.4vw, 26px);
  min-height: 360px;
  display: grid;
  gap: 18px;
  align-content: start;
}

.question-index {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.question-title {
  font-size: clamp(1.6rem, 4vw, 2.5rem);
  line-height: 1.25;
}

.options-grid {
  display: grid;
  gap: 14px;
}

.option-card {
  width: 100%;
  padding: 18px;
  text-align: left;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 14px;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease,
    box-shadow 160ms ease,
    opacity 160ms ease;
}

.option-card.is-selected {
  border-color: rgba(255, 77, 79, 0.45);
  background: rgba(255, 77, 79, 0.12);
}

.option-card:active {
  transform: scale(0.985);
}

.option-key {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.08);
  font-weight: 800;
}

.option-copy {
  min-width: 0;
  display: grid;
  gap: 6px;
  align-content: center;
}

.option-text {
  align-self: center;
  line-height: 1.7;
}

.option-meta {
  color: var(--text-muted);
  font-size: 0.82rem;
  letter-spacing: 0.04em;
}

.options-grid--likert {
  gap: 18px;
}

.option-card--likert {
  min-height: 112px;
  padding: 22px 20px;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 16px;
  border-radius: 30px;
}

.option-card--likert .option-key {
  width: 54px;
  height: 54px;
  border-radius: 18px;
  font-size: 1.15rem;
}

.option-card--likert .option-text {
  font-size: 1.06rem;
  line-height: 1.75;
}

.option-card--agree {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--line);
}

.option-card--agree .option-key {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

.option-card--neutral {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--line);
}

.option-card--neutral .option-key {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

.option-card--reject {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--line);
  opacity: 1;
}

.option-card--reject .option-key {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

.option-card--likert.is-selected {
  transform: scale(1.01);
  box-shadow: 0 16px 38px rgba(0, 0, 0, 0.2);
}

.option-card--agree.is-selected {
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.05);
}

.option-card--neutral.is-selected {
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.05);
}

.option-card--reject.is-selected {
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.05);
}

.analyzing-main,
.error-main {
  min-height: calc(100vh - 120px);
  display: grid;
  place-items: center;
}

.analyzing-card {
  width: min(100%, 840px);
  display: grid;
  gap: 22px;
  text-align: center;
}

.analyzing-line {
  min-height: 28px;
  color: var(--text-muted);
}

.scanner-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.scanner-card {
  padding: 14px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
}

.j15-pulse-grid {
  display: grid;
  grid-template-columns: repeat(15, minmax(0, 1fr));
  align-items: end;
  gap: 8px;
  height: 120px;
}

.j15-pulse-grid span {
  display: block;
  min-height: 18px;
  height: var(--pulse-height, 46px);
  border-radius: 12px 12px 4px 4px;
  background: linear-gradient(180deg, rgba(64, 224, 160, 0.92), rgba(59, 130, 246, 0.75));
  transition: height 160ms ease;
}

.result-hero {
  padding: clamp(24px, 5vw, 36px);
  display: grid;
  grid-template-columns: minmax(0, calc(40% - 12px)) minmax(0, calc(60% - 12px));
  gap: 24px;
  align-items: stretch;
  position: relative;
  overflow: hidden;
}

.result-hero::after {
  content: "";
  position: absolute;
  inset: auto -60px -80px auto;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--hero-accent) 28%, transparent);
  filter: blur(24px);
}

.result-hero-copy {
  min-width: 0;
}

.hero-identity {
  display: grid;
  grid-template-rows: auto auto;
  gap: 16px;
  align-content: start;
  justify-items: stretch;
  width: 100%;
}

.identity-avatar-card {
  position: relative;
  width: 100%;
  padding: 12px;
  border-radius: 32px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background:
    radial-gradient(circle at top left, color-mix(in srgb, var(--hero-accent) 24%, transparent), transparent 52%),
    rgba(255, 255, 255, 0.06);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 18px 40px rgba(0, 0, 0, 0.18);
}

.identity-avatar {
  display: flex;
  justify-content: center;
  align-items: stretch;
  width: 100%;
}

.identity-avatar-frame {
  width: 100%;
  aspect-ratio: 1.28 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(14px, 2vw, 22px);
  box-sizing: border-box;
  border-radius: 26px;
  overflow: hidden;
  background:
      linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02)),
      rgba(0, 0, 0, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.identity-meta {
  text-align: right;
  width: 100%;
  min-height: 156px;
  padding: 20px 28px 18px;
  border-radius: 28px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background:
      linear-gradient(180deg, color-mix(in srgb, var(--hero-accent) 12%, transparent), transparent 65%),
      rgba(255, 255, 255, 0.05);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  display: grid;
  justify-items: end;
  align-content: center;
}

.match-number {
  display: block;
  font-size: clamp(2.6rem, 8vw, 4.8rem);
  font-weight: 800;
  line-height: 0.95;
  text-align: right;
}

.identity-meta small {
  display: block;
  color: var(--text-muted);
  font-size: 0.96rem;
}

.hero-avatar {
  width: 100%;
  height: 100%;
  border-radius: 26px;
  object-fit: contain;
  object-position: center;
  border: none;
  background: rgba(255, 255, 255, 0.04);
}

.result-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.result-section {
  padding: 22px;
}

.result-section h2 {
  margin-bottom: 14px;
  font-size: 1.15rem;
}

.wide-section {
  grid-column: 1 / -1;
}

.stack-card,
.metric-card,
.quote-card {
  padding: 18px;
}

.stack-card p,
.metric-card p {
  margin-top: 6px;
  color: var(--text-muted);
}

.metric-card strong {
  font-size: 2rem;
}

.quote-card {
  line-height: 1.7;
}

.chart-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.9fr);
  gap: 18px;
  margin-top: 22px;
}

.chart-card {
  padding: 18px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
}

.chart-card h3 {
  margin-bottom: 16px;
}

.radar-svg {
  width: 100%;
  height: auto;
}

.radar-ring {
  fill: none;
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 1.4;
}

.radar-axis {
  stroke: rgba(255, 255, 255, 0.12);
  stroke-width: 1.4;
}

.radar-label {
  fill: var(--text-muted);
  font-size: 14px;
  text-anchor: middle;
}

.radar-value {
  fill: color-mix(in srgb, var(--accent) 22%, transparent);
  stroke: var(--accent);
  stroke-width: 3;
}

.radar-marker {
  fill: var(--accent);
  stroke: #111111;
  stroke-width: 2;
}

.match-grid,
.score-grid {
  display: grid;
  gap: 12px;
}

.score-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 18px;
}

.match-card,
.dim-card,
.score-row,
.relation-card {
  padding: 16px;
}

.match-card span,
.dim-card span {
  display: inline-block;
  margin: 8px 0;
  color: var(--yellow);
  font-weight: 700;
}

.dim-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.emphasis-list {
  margin-top: 18px;
}

.score-row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.score-bar-track {
  height: 10px;
  background: rgba(255, 255, 255, 0.08);
  margin-bottom: 10px;
}

.score-bar-value {
  background: linear-gradient(90deg, var(--bar-color), color-mix(in srgb, var(--bar-color) 40%, white));
}

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

.clash-card {
  border-color: rgba(255, 77, 79, 0.2);
}

.share-line {
  margin-top: 12px;
  color: var(--yellow);
}

.poster-main {
  grid-template-columns: minmax(320px, 0.95fr) minmax(0, 1.05fr);
}

.poster-shell--focus {
  min-height: 100svh;
}

.poster-main--focus {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.poster-preview-card--focus {
  width: 100%;
  min-height: calc(100svh - 48px);
  display: grid;
  place-items: center;
  padding: 0;
  background: none;
  border: none;
  box-shadow: none;
}

.poster-preview--focus {
  width: min(100%, calc((100svh - 48px) * 0.625));
  max-width: 720px;
  max-height: calc(100svh - 24px);
  height: auto;
  border-radius: 34px;
  border: none;
  background: transparent;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.42);
}

.poster-side-card {
  display: grid;
  align-content: start;
  gap: 18px;
}

.poster-preview-card {
  display: grid;
  place-items: center;
  overflow: hidden;
}

.poster-preview {
  width: min(100%, 540px);
  border-radius: 28px;
  border: 1px solid var(--line);
  background: #111;
}

.theme-chip {
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--line);
  color: var(--text);
}

.theme-chip.is-active {
  border-color: rgba(255, 77, 79, 0.5);
  background: rgba(255, 77, 79, 0.12);
}

body[data-page="poster"] {
  background: #f3eee5;
}

body[data-page="poster"]::before {
  opacity: 0.03;
}

.text-input {
  width: 100%;
  min-height: 48px;
  padding: 0 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

.debug-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  margin-top: 18px;
}

.debug-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.debug-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 14px;
}

.debug-table th,
.debug-table td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 0.92rem;
}

@media (max-width: 960px) {
  .hero-panel,
  .chart-layout,
  .poster-main,
  .debug-grid,
  .landing-grid {
    grid-template-columns: 1fr;
  }

  .persona-grid,
  .mechanics-grid,
  .result-grid,
  .dim-grid,
  .relation-grid,
  .score-grid {
    grid-template-columns: 1fr;
  }

}

@media (max-width: 767px) {
  .result-hero {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .result-hero-copy h1 {
    font-size: clamp(2.3rem, 12vw, 3rem);
  }

  .hero-identity {
    justify-items: stretch;
    gap: 12px;
  }

  .identity-avatar-card {
    width: 100%;
    padding: 12px;
    border-radius: 26px;
  }

  .identity-avatar-frame {
    aspect-ratio: 1.52 / 1;
    padding: 0;
    border-radius: 20px;
  }

  .identity-meta {
    width: 100%;
    min-height: 128px;
    padding: 16px 18px;
    text-align: center;
    justify-items: center;
    align-content: center;
  }

  .match-number {
    font-size: clamp(4.2rem, 19vw, 5.4rem);
    text-align: center;
  }

  .identity-meta small,
  .hero-avatar {
    text-align: center;
  }

  .hero-avatar {
    border-radius: 20px;
  }

  .poster-main {
    gap: 14px;
  }

  .poster-main--focus {
    min-height: 100svh;
    padding: 0;
  }

  .poster-preview-card--focus {
    min-height: 100svh;
  }

  .poster-preview--focus {
    width: 100vw;
    max-width: 100vw;
    max-height: none;
    border-radius: 0;
    box-shadow: none;
  }

  .quiz-main {
    gap: 10px;
  }

  .question-card {
    padding: 16px;
    min-height: 0;
    gap: 16px;
  }

  .quiz-footer {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: stretch;
  }

  .quiz-footer .secondary-button,
  .quiz-footer .ghost-button,
  .quiz-footer .primary-button {
    flex: 1 1 calc((100% - 16px) / 3);
    min-width: 0;
    min-height: 38px;
    padding: 0 8px;
    text-align: center;
    white-space: nowrap;
    font-size: 0.9rem;
  }

  #quiz-prev,
  #quiz-next,
  #quiz-submit {
    order: 1;
  }

  #quiz-exit {
    order: 2;
    flex: 0 0 auto;
    min-width: 84px;
    min-height: 34px;
    margin-left: auto;
    padding: 0 16px;
    font-size: 0.86rem;
  }

  .poster-side-card,
  .poster-preview-card {
    padding: 18px;
  }

  .poster-side-card {
    gap: 14px;
  }

  .poster-side-card h1 {
    font-size: clamp(2rem, 9.2vw, 2.7rem);
    line-height: 1.04;
  }

  .poster-side-card .hero-desc {
    font-size: 0.98rem;
    line-height: 1.65;
  }

  .poster-side-card .theme-switch {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
  }

  .poster-side-card .hero-pill-group {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .poster-side-card .hero-pill-group .primary-button {
    grid-column: 1 / -1;
  }

  .poster-side-card .theme-chip,
  .poster-side-card .primary-button,
  .poster-side-card .secondary-button {
    width: 100%;
    justify-content: center;
    text-align: center;
  }

  .poster-side-card .theme-chip {
    padding: 10px 12px;
    font-size: 0.95rem;
  }

  .poster-preview {
    width: 100%;
    border-radius: 22px;
  }

  .toast-floating {
    left: 10px;
    right: 10px;
    bottom: max(14px, env(safe-area-inset-bottom));
    padding: 14px 16px;
    border-radius: 18px;
    font-size: 0.96rem;
  }

  .options-grid--likert {
    gap: 16px;
  }

  .option-card--likert {
    min-height: 104px;
    padding: 20px 18px;
    border-radius: 24px;
    grid-template-columns: 50px minmax(0, 1fr);
  }

  .option-card--likert .option-key {
    width: 50px;
    height: 50px;
    border-radius: 16px;
  }

  .option-card--likert .option-text {
    font-size: 1rem;
    line-height: 1.7;
  }
}

@media (max-width: 720px) {
  .page-shell {
    width: min(calc(100% - 20px), var(--max-width));
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-meta {
    width: 100%;
    justify-content: space-between;
  }

  .topbar--quiz {
    gap: 10px;
  }

  .topbar-meta--quiz {
    gap: 10px;
    align-items: flex-end;
  }

  .quiz-top-progress {
    flex: 1 1 0;
    min-width: 0;
    max-width: none;
  }

  .quiz-top-progress-track {
    height: 9px;
  }

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

  .j15-pulse-grid {
    gap: 5px;
  }

  .hero-copy h1,
  .analyzing-card h1,
  .error-card h1,
  .debug-card h1 {
    font-size: clamp(2.1rem, 10vw, 3rem);
  }

  .split-hero-panel .hero-copy h1 {
    font-size: clamp(1.9rem, 8.8vw, 2.5rem);
    line-height: 1.04;
    letter-spacing: -0.035em;
  }

  .split-hero-panel .hero-desc {
    font-size: 0.98rem;
    line-height: 1.78;
  }
}

@media (max-width: 480px) {
  .split-hero-panel {
    gap: 18px;
    padding: 22px 18px;
  }

  .split-hero-panel .hero-copy h1 {
    font-size: clamp(1.72rem, 8vw, 2.08rem);
    line-height: 1.08;
    letter-spacing: -0.025em;
  }

  .split-hero-panel .hero-desc {
    font-size: 0.94rem;
    line-height: 1.72;
  }

  .topbar--quiz .hot-badge {
    padding: 9px 14px;
    font-size: 0.86rem;
  }

  .quiz-top-progress strong {
    font-size: 0.9rem;
  }

  .quiz-top-progress-track {
    height: 8px;
  }

  .quiz-footer {
    gap: 8px;
  }

  .quiz-footer .secondary-button,
  .quiz-footer .ghost-button,
  .quiz-footer .primary-button {
    min-height: 36px;
    padding: 0 6px;
    font-size: 0.84rem;
  }

  #quiz-exit {
    min-width: 76px;
    min-height: 32px;
    padding: 0 14px;
    font-size: 0.8rem;
  }
}
