.hq-shell {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 16px 24px;
  color: var(--cg-ink);
  font-family: Inter, Arial, sans-serif;
}

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

.hq-statline,
.hq-actions,
.hq-hud,
.hq-below,
.hq-result-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hq-statline,
.hq-hud,
.hq-below {
  flex-wrap: wrap;
}

.hq-stat,
.hq-hud-card {
  min-width: 76px;
  padding: 8px 10px;
  border: 1px solid var(--cg-line);
  border-radius: 8px;
  background: var(--cg-panel);
  box-shadow: 0 8px 20px rgba(33, 43, 40, 0.08);
}

.hq-stat span,
.hq-hud-card span {
  display: block;
  color: var(--cg-muted);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.1;
  text-transform: uppercase;
}

.hq-stat strong,
.hq-hud-card strong {
  display: block;
  margin-top: 2px;
  color: var(--cg-ink);
  font-size: 19px;
  line-height: 1;
  white-space: nowrap;
}

.hq-hud {
  margin-bottom: 10px;
}

.hq-hud-card {
  flex: 1 1 90px;
  text-align: center;
}

.hq-hot {
  color: var(--cg-amber) !important;
}

.hq-btn,
.hq-close {
  min-width: 44px;
  min-height: 44px;
  border: 1px solid var(--cg-line);
  border-radius: 8px;
  background: var(--cg-panel);
  color: var(--cg-ink);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(33, 43, 40, 0.08);
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}

.hq-btn {
  padding: 0 14px;
}

.hq-btn:hover,
.hq-close:hover {
  transform: translateY(-1px);
  border-color: var(--cg-teal);
}

.hq-btn:focus-visible,
.hq-close:focus-visible,
.hq-stage:focus-visible,
.hq-opt:focus-visible,
.hq-slot:focus-visible,
.hq-seg-btn:focus-visible {
  outline: 3px solid rgba(49, 95, 157, 0.34);
  outline-offset: 3px;
}

.hq-primary {
  border-color: transparent;
  background: var(--cg-teal);
  color: #fff;
}

.hq-icon-btn {
  display: inline-grid;
  place-items: center;
  padding: 0;
}

.hq-icon-btn svg {
  width: 23px;
  height: 23px;
}

.hq-stage {
  position: relative;
  min-height: min(68vh, 590px);
  overflow: hidden;
  border: 1px solid #c7b789;
  border-radius: 8px;
  background: #efe2bd;
  background-image: radial-gradient(circle at 18% 18%, rgba(255, 255, 255, 0.38), transparent 22%), linear-gradient(135deg, rgba(124, 86, 35, 0.16), transparent 28%, rgba(18, 122, 137, 0.11) 72%, rgba(189, 60, 55, 0.08));
  box-shadow: var(--cg-shadow);
  touch-action: manipulation;
}

.hq-stage:before,
.hq-stage:after {
  content: "";
  position: absolute;
  inset: 10px;
  pointer-events: none;
  border: 1px solid rgba(95, 70, 35, 0.22);
  border-radius: 6px;
}

.hq-stage:after {
  inset: 18px;
  border-color: rgba(255, 255, 255, 0.22);
}

.hq-era-ancient {
  background-color: #ead9ae;
}

.hq-era-medieval {
  background-color: #e2d8bf;
}

.hq-era-early {
  background-color: #ead1bc;
}

.hq-era-modern {
  background-color: #dbe5df;
}

.hq-fx {
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: none;
}

.hq-ribbon {
  position: relative;
  z-index: 1;
  height: 132px;
  margin: 18px 20px 0;
}

.hq-ribbon-line {
  position: absolute;
  left: 3%;
  right: 3%;
  top: 58px;
  height: 22px;
  border-radius: 999px;
  background: linear-gradient(90deg, #8a5c25, #c47a17 50%, #315f9d);
  box-shadow: inset 0 3px 8px rgba(255, 255, 255, 0.36), 0 7px 16px rgba(61, 44, 21, 0.18);
}

.hq-tick {
  position: absolute;
  top: 35px;
  width: 23%;
  transform: translateX(-50%);
  text-align: center;
  color: rgba(30, 37, 40, 0.62);
}

.hq-tick:before {
  content: "";
  display: block;
  width: 12px;
  height: 42px;
  margin: 0 auto 4px;
  border-radius: 999px;
  background: #f6f7f2;
  box-shadow: inset 0 0 0 3px #8a5c25, 0 4px 8px rgba(61, 44, 21, 0.18);
}

.hq-tick b,
.hq-tick span {
  display: block;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 240ms ease, transform 240ms ease;
}

.hq-tick b {
  font-size: 12px;
  line-height: 1.1;
}

.hq-tick span {
  margin-top: 3px;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.15;
}

.hq-tick.hq-show b,
.hq-tick.hq-show span {
  opacity: 1;
  transform: translateY(0);
}

.hq-question {
  position: relative;
  z-index: 2;
  display: grid;
  gap: 5px;
  margin: 0 22px 10px;
  text-align: center;
}

.hq-question span {
  color: var(--cg-amber);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.hq-question strong {
  font-size: clamp(20px, 3.2vw, 29px);
  line-height: 1.08;
}

.hq-question em {
  color: var(--cg-muted);
  font-size: 14px;
  font-style: normal;
  font-weight: 700;
}

.hq-slots,
.hq-options {
  position: relative;
  z-index: 2;
  display: grid;
  gap: 8px;
  margin: 0 20px;
}

.hq-slots {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 10px;
}

.hq-slot {
  min-height: 58px;
  padding: 6px;
  border: 1px dashed rgba(95, 70, 35, 0.44);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.36);
  color: rgba(30, 37, 40, 0.68);
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.hq-slot[data-filled="1"] {
  border-style: solid;
  background: rgba(255, 255, 255, 0.72);
  color: var(--cg-ink);
  font-size: 12px;
  line-height: 1.15;
}

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

.hq-card,
.hq-choice {
  min-height: 74px;
  border: 1px solid rgba(95, 70, 35, 0.28);
  border-radius: 8px;
  background: rgba(255, 252, 241, 0.9);
  color: var(--cg-ink);
  font: inherit;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(61, 44, 21, 0.11);
  transition: transform 140ms ease, opacity 140ms ease, border-color 140ms ease;
}

.hq-card {
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 10px;
  text-align: left;
}

.hq-card span {
  color: var(--cg-blue);
  font-size: 12px;
  font-weight: 900;
}

.hq-card strong {
  font-size: 15px;
  line-height: 1.16;
}

.hq-choice {
  display: grid;
  place-items: center;
  padding: 10px;
  font-weight: 900;
  font-size: 18px;
}

.hq-truth {
  min-height: 92px;
  font-size: 24px;
}

.hq-card:hover,
.hq-choice:hover {
  transform: translateY(-2px);
  border-color: var(--cg-teal);
}

.hq-used {
  opacity: 0.5;
  transform: scale(0.98);
}

.hq-feedback {
  position: relative;
  z-index: 2;
  min-height: 22px;
  margin: 12px 22px 18px;
  color: #514734;
  font-size: 14px;
  font-weight: 800;
  text-align: center;
}

.hq-start,
.hq-result {
  position: absolute;
  left: 50%;
  z-index: 7;
  display: grid;
  gap: 8px;
  width: min(86%, 350px);
  padding: 16px;
  border: 1px solid rgba(95, 70, 35, 0.24);
  border-radius: 8px;
  background: rgba(255, 252, 241, 0.94);
  color: var(--cg-ink);
  text-align: center;
  box-shadow: var(--cg-shadow);
  transform: translateX(-50%);
  backdrop-filter: blur(8px);
}

.hq-start {
  bottom: 22px;
}

.hq-start strong,
.hq-result strong {
  font-size: 25px;
  line-height: 1.1;
}

.hq-start span,
.hq-result p,
.hq-result span {
  margin: 0;
  color: var(--cg-muted);
  font-size: 14px;
  line-height: 1.35;
}

.hq-start .hq-btn {
  justify-self: center;
  min-width: 150px;
}

.hq-result {
  top: 50%;
  transform: translate(-50%, -50%);
  animation: hq-pop 260ms cubic-bezier(0.16, 1, 0.3, 1);
}

.hq-result-actions .hq-btn {
  flex: 1 1 0;
}

.hq-good {
  animation: hq-good 360ms ease;
}

.hq-bad {
  animation: hq-shake 360ms ease;
}

@keyframes hq-pop {
  from { opacity: 0; transform: translate(-50%, -46%) scale(0.94); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

@keyframes hq-good {
  0% { box-shadow: var(--cg-shadow); }
  40% { box-shadow: 0 0 0 5px rgba(18, 122, 137, 0.26), var(--cg-shadow); }
  100% { box-shadow: var(--cg-shadow); }
}

@keyframes hq-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-7px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(3px); }
}

.hq-seg {
  display: flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--cg-line);
  border-radius: 10px;
  background: var(--cg-panel);
  box-shadow: 0 8px 20px rgba(33, 43, 40, 0.08);
}

.hq-seg-btn {
  min-width: 44px;
  min-height: 44px;
  padding: 0 14px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--cg-muted);
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.hq-seg-btn[aria-pressed="true"] {
  background: var(--cg-teal);
  color: #fff;
}

.hq-note {
  flex: 1 1 260px;
  color: var(--cg-muted);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
}

.hq-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(30, 37, 40, 0.32);
}

.hq-modal-card {
  position: relative;
  width: min(100%, 450px);
  padding: 22px;
  border: 1px solid var(--cg-line);
  border-radius: 8px;
  background: var(--cg-panel);
  color: var(--cg-ink);
  box-shadow: 0 24px 70px rgba(30, 37, 40, 0.22);
}

.hq-modal-card h2 {
  margin: 0 48px 12px 0;
  font-size: 24px;
  line-height: 1.1;
}

.hq-modal-card p {
  margin: 10px 0 0;
  color: var(--cg-muted);
  line-height: 1.45;
}

.hq-close {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 0;
  font-size: 24px;
  line-height: 1;
}

.hq-shell [hidden],
.hq-modal[hidden] {
  display: none !important;
}

@media (max-width: 560px) {
  .hq-shell {
    padding: 0 10px 18px;
  }

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

  .hq-statline,
  .hq-actions {
    justify-content: center;
  }

  .hq-stat {
    flex: 1 1 72px;
    text-align: center;
  }

  .hq-hud-card {
    min-width: 0;
    flex: 1 1 60px;
    padding: 7px 4px;
  }

  .hq-hud-card span {
    font-size: 9px;
  }

  .hq-hud-card strong {
    font-size: 15px;
  }

  .hq-stage {
    min-height: 604px;
  }

  .hq-ribbon {
    height: 116px;
    margin: 14px 12px 0;
  }

  .hq-tick span {
    display: none;
  }

  .hq-question {
    margin: 0 14px 8px;
  }

  .hq-question strong {
    font-size: 21px;
  }

  .hq-slots,
  .hq-options {
    margin-left: 12px;
    margin-right: 12px;
  }

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

  .hq-options {
    grid-template-columns: 1fr;
  }

  .hq-card,
  .hq-choice {
    min-height: 62px;
  }

  .hq-truth {
    min-height: 80px;
  }

  .hq-slot {
    min-height: 52px;
  }

  .hq-feedback {
    margin: 10px 14px 16px;
  }

  .hq-seg {
    flex: 1 1 100%;
  }

  .hq-seg-btn {
    flex: 1 1 0;
  }
}
