#hgq-root {
  --stage-bg: #0d1410;
  --stage-card: #131d17;
  --stage-opt: #15211a;
  --stage-text: #f4efe6;
  --stage-muted: #b0c0b5;
  --stage-gold: #dfb152;
  --stage-gold-hi: #ecc36c;
  --stage-gold-ink: #0b110e;
  --stage-border: rgba(223, 177, 82, 0.24);
  --res-bg: #0d1410;
  --res-glow: rgba(223, 177, 82, 0.16);
  --res-accent: #dfb152;
  --res-accent-soft: rgba(223, 177, 82, 0.14);

  position: relative;
  border-radius: 18px;
  border: 1px solid var(--stage-border);
  background:
    radial-gradient(ellipse 75% 360px at 50% 0%, rgba(223, 177, 82, 0.12), rgba(45, 125, 82, 0.08) 52%, transparent 78%),
    var(--stage-bg);
  color: var(--stage-text);
  overflow: hidden;
  box-shadow: 0 22px 56px rgba(0, 0, 0, 0.5);
  transition: background 0.45s ease, border-color 0.45s ease;
}

#hgq-root[data-active-view="result"] {
  background:
    radial-gradient(ellipse 80% 380px at 50% 0%, var(--res-glow), transparent 76%),
    var(--res-bg);
  border-color: var(--res-accent-soft);
}

#hgq-root [hidden] {
  display: none !important;
}

.hgq-view {
  padding: 28px 24px 32px;
}

/* ---------- STATE 1: COVER ---------- */
.hgq-cover {
  min-height: 350px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  max-width: 580px;
  margin-inline: auto;
}

.hgq-crest {
  width: 56px;
  height: 56px;
  margin-bottom: 16px;
  color: var(--stage-gold);
}

.hgq-eyebrow {
  font-family: var(--font-mono, monospace);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--stage-gold);
  margin-bottom: 12px;
}

.hgq-cover-title {
  font-family: var(--font-display, Georgia, serif);
  font-size: clamp(26px, 4.2vw, 38px);
  font-weight: 700;
  line-height: 1.16;
  color: var(--stage-text);
  margin-bottom: 12px;
}

.hgq-cover-sub {
  font-size: 16px;
  line-height: 1.58;
  color: var(--stage-muted);
  max-width: 46ch;
  margin: 0 0 22px;
}

.hgq-gold-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 30px;
  border-radius: 12px;
  border: 1px solid var(--stage-gold);
  background: var(--stage-gold);
  color: var(--stage-gold-ink);
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.16s ease, transform 0.14s ease, box-shadow 0.16s ease;
  box-shadow: 0 8px 24px rgba(223, 177, 82, 0.22);
}

.hgq-gold-cta:hover {
  background: var(--stage-gold-hi);
  color: var(--stage-gold-ink);
  transform: translateY(-1px);
  box-shadow: 0 12px 28px rgba(223, 177, 82, 0.3);
}

.hgq-cover-meta {
  margin-top: 16px;
  font-size: 13px;
  color: var(--stage-muted);
  letter-spacing: 0.02em;
}

/* ---------- STATE 2: 14-QUESTION EDITORIAL FLOW ---------- */
.hgq-quiz-wrap {
  max-width: 620px;
  margin-inline: auto;
}

.hgq-quiz-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.hgq-counter {
  font-family: var(--font-mono, monospace);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--stage-gold);
}

.hgq-sound-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.04);
  color: var(--stage-muted);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.hgq-sound-btn:hover {
  color: var(--stage-text);
  border-color: var(--stage-border);
}

.hgq-progress-track {
  width: 100%;
  height: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
  margin-bottom: 26px;
}

.hgq-progress-fill {
  height: 100%;
  width: 7.14%;
  background: var(--stage-gold);
  border-radius: 999px;
  transition: width 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.hgq-q-stage {
  transition: opacity 0.2s ease, transform 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}

.hgq-q-stage.is-leaving {
  opacity: 0;
  transform: translateY(-6px);
}

.hgq-q-stage.is-entering {
  opacity: 0;
  transform: translateY(8px);
}

.hgq-scene-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  color: var(--stage-gold);
}

.hgq-scene-icon {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.hgq-scene-tag {
  font-family: var(--font-mono, monospace);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--stage-gold);
}

.hgq-q-prompt {
  font-family: var(--font-display, Georgia, serif);
  font-size: clamp(20px, 3vw, 25px);
  font-weight: 600;
  line-height: 1.38;
  color: var(--stage-text);
  margin-bottom: 22px;
}

.hgq-options {
  display: flex;
  flex-direction: column;
  gap: 11px;
  margin-bottom: 20px;
}

.hgq-opt-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 58px;
  padding: 14px 18px;
  border-radius: 12px;
  border: 1px solid rgba(223, 177, 82, 0.22);
  background: var(--stage-opt);
  color: var(--stage-text);
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.42;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease, transform 0.12s ease, box-shadow 0.15s ease;
}

.hgq-opt-btn:hover {
  background: #1c2c23;
  border-color: var(--stage-gold);
  transform: translateY(-1px);
}

.hgq-opt-key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid rgba(223, 177, 82, 0.36);
  background: rgba(223, 177, 82, 0.08);
  color: var(--stage-gold);
  font-family: var(--font-mono, monospace);
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.hgq-opt-btn.is-selected {
  background: rgba(223, 177, 82, 0.16);
  border-color: var(--stage-gold-hi);
  box-shadow: 0 0 0 1px rgba(223, 177, 82, 0.45);
}

.hgq-opt-btn.is-selected .hgq-opt-key {
  background: var(--stage-gold);
  border-color: var(--stage-gold);
  color: var(--stage-gold-ink);
}

.hgq-quiz-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 36px;
}

.hgq-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: transparent;
  color: var(--stage-text);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.hgq-back-btn:hover {
  border-color: var(--stage-gold);
  background: rgba(255, 255, 255, 0.05);
}

.hgq-hint-text {
  font-size: 12px;
  color: var(--stage-muted);
  margin-left: auto;
}

/* ---------- STATE 3: WAX SEAL CLIMAX ---------- */
.hgq-seal-view {
  min-height: 440px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  max-width: 480px;
  margin-inline: auto;
}

.hgq-seal-title {
  font-family: var(--font-display, Georgia, serif);
  font-size: clamp(24px, 4vw, 32px);
  font-weight: 700;
  line-height: 1.2;
  color: var(--stage-text);
  margin-bottom: 10px;
}

.hgq-seal-sub {
  font-size: 15px;
  color: var(--stage-muted);
  margin: 0 0 32px;
}

.hgq-seal-btn {
  position: relative;
  width: 156px;
  height: 156px;
  border-radius: 50%;
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.25s ease;
}

.hgq-seal-btn:hover {
  transform: scale(1.04);
}

.hgq-seal-pulse {
  position: absolute;
  inset: -12px;
  border-radius: 50%;
  border: 1px solid rgba(223, 177, 82, 0.45);
  animation: hgqPulse 2.4s ease-out infinite;
  pointer-events: none;
}

.hgq-seal-btn.is-breaking {
  animation: hgqSealBreak 0.65s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.hgq-seal-label {
  margin-top: 24px;
  font-family: var(--font-mono, monospace);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--stage-gold);
}

@keyframes hgqPulse {
  0% { transform: scale(0.95); opacity: 0.75; }
  70% { transform: scale(1.16); opacity: 0; }
  100% { transform: scale(1.16); opacity: 0; }
}

@keyframes hgqSealBreak {
  0% { transform: scale(1); opacity: 1; }
  35% { transform: scale(1.12) rotate(-6deg); opacity: 1; filter: brightness(1.35); }
  100% { transform: scale(1.45) rotate(8deg); opacity: 0; }
}

/* ---------- STATE 4: EDITORIAL RESULT POSTER ---------- */
.hgq-result-wrap {
  max-width: 620px;
  margin-inline: auto;
  animation: hgqRevealIn 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

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

.hgq-shared-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  margin-bottom: 24px;
  border-radius: 12px;
  border: 1px solid var(--res-accent-soft);
  background: rgba(255, 255, 255, 0.04);
  font-size: 13px;
  color: var(--stage-text);
}

.hgq-poster {
  text-align: center;
  padding: 8px 0 28px;
}

.hgq-poster-eyebrow {
  font-family: var(--font-mono, monospace);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--res-accent);
  margin-bottom: 10px;
}

.hgq-poster-district {
  font-family: var(--font-display, Georgia, serif);
  font-size: clamp(36px, 6.2vw, 54px);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: 0.03em;
  color: var(--stage-text);
  margin-bottom: 10px;
}

.hgq-poster-tag {
  font-size: 16px;
  color: var(--stage-muted);
  max-width: 48ch;
  margin: 0 auto 30px;
}

.hgq-metrics-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  max-width: 420px;
  margin: 0 auto 32px;
  padding: 18px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.hgq-metric-cell:first-child {
  border-right: 1px solid rgba(255, 255, 255, 0.12);
}

.hgq-metric-num {
  font-family: var(--font-display, Georgia, serif);
  font-size: clamp(30px, 5vw, 42px);
  font-weight: 700;
  line-height: 1.1;
  color: var(--res-accent);
  margin-bottom: 4px;
}

.hgq-metric-label {
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--stage-muted);
}

.hgq-bars {
  max-width: 460px;
  margin: 0 auto 30px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: left;
}

.hgq-bar-row {
  display: grid;
  grid-template-columns: 88px 1fr 44px;
  align-items: center;
  gap: 12px;
}

.hgq-bar-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--stage-muted);
}

.hgq-bar-track {
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}

.hgq-bar-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: var(--res-accent);
  transition: width 0.65s cubic-bezier(0.22, 1, 0.36, 1);
}

.hgq-bar-pct {
  font-family: var(--font-mono, monospace);
  font-size: 12px;
  font-weight: 600;
  color: var(--stage-text);
  text-align: right;
}

.hgq-traits-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  padding: 20px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  margin-bottom: 22px;
}

.hgq-trait-k {
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--stage-muted);
  margin-bottom: 5px;
}

.hgq-trait-v {
  font-size: 15px;
  font-weight: 700;
  color: var(--res-accent);
}

.hgq-narrative {
  font-size: 15px;
  line-height: 1.68;
  color: var(--stage-text);
  max-width: 54ch;
  margin: 0 auto 14px;
}

.hgq-subline {
  font-size: 13px;
  color: var(--stage-muted);
}

.hgq-subline strong {
  color: var(--res-accent);
}

/* ---------- ACTION DOCK ---------- */
.hgq-dock {
  padding-top: 22px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

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

.hgq-name-input {
  flex: 1;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.05);
  color: var(--stage-text);
  font: inherit;
  font-size: 14px;
}

.hgq-name-input::placeholder {
  color: var(--stage-muted);
}

.hgq-dock-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.hgq-dock-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.04);
  color: var(--stage-text);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.hgq-dock-btn:hover {
  border-color: var(--res-accent);
  background: rgba(255, 255, 255, 0.08);
  color: var(--stage-text);
}

.hgq-dock-primary {
  background: var(--res-accent);
  border-color: var(--res-accent);
  color: #0b110e;
  font-weight: 700;
}

.hgq-dock-primary:hover {
  filter: brightness(1.08);
  color: #0b110e;
}

.hgq-share-status {
  font-size: 13px;
  font-weight: 600;
  color: var(--res-accent);
  min-height: 18px;
}

@media (max-width: 640px) {
  .hgq-view {
    padding: 22px 16px 26px;
  }
  .hgq-cover {
    min-height: 310px;
  }
  .hgq-opt-btn {
    min-height: 52px;
    padding: 12px 14px;
    font-size: 14px;
  }
  .hgq-traits-strip {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .hgq-bar-row {
    grid-template-columns: 76px 1fr 40px;
    gap: 8px;
  }
  .hgq-dock-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .hgq-dock-btn,
  .hgq-gold-cta {
    width: 100%;
  }
}