/* Companion Receipt Quiz Engine Styles (Strict <=3 Accent Families) */
.cq-shell {
  width: 100%;
  max-width: 800px;
  margin: 0 auto 2rem;
  box-sizing: border-box;
  color: #1F1619;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

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

.cq-stage[hidden] {
  display: none !important;
}

.cq-card {
  background: #FFFDF9;
  border: 1px solid #E6D9CE;
  border-radius: 20px;
  padding: 1.35rem 1.45rem;
  box-shadow: 0 12px 32px rgba(31, 22, 25, 0.06);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.cq-card.is-fading {
  opacity: 0.55;
  transform: translateY(3px);
}

.cq-meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.cq-badge-pill {
  display: inline-flex;
  align-items: center;
  background: #F9E6E8;
  color: #A82E48;
  border: 1px solid #E6D9CE;
  border-radius: 999px;
  padding: 0.28rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 700;
}

.cq-step-pill {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.82rem;
  font-weight: 600;
  color: #5E4B52;
  background: #FBF6EE;
  padding: 0.26rem 0.68rem;
  border-radius: 999px;
  border: 1px solid #E6D9CE;
}

.cq-progress {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 5px;
  margin-bottom: 1.05rem;
}

.cq-seg {
  height: 6px;
  border-radius: 999px;
  background: #F4ECE1;
  transition: background-color 0.22s ease;
}

.cq-seg.is-done {
  background: #D49B4B;
}

.cq-seg.is-active {
  background: #C83E5B;
}

.cq-scene-head {
  margin-bottom: 1rem;
}

.cq-scene-label {
  display: inline-block;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.78rem;
  font-weight: 600;
  color: #A82E48;
  letter-spacing: 0.05em;
  margin-bottom: 0.35rem;
}

.cq-prompt {
  margin: 0;
  font-family: 'Fraunces', Georgia, serif;
  font-size: clamp(1.16rem, 2.4vw, 1.44rem);
  font-weight: 600;
  line-height: 1.38;
  color: #1F1619;
  text-align: left;
}

.cq-options {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.62rem;
}

.cq-option {
  width: 100%;
  min-height: 52px;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.8rem 0.95rem;
  background: #FBF6EE;
  border: 1.5px solid #E6D9CE;
  border-radius: 14px;
  color: #1F1619;
  text-align: left;
  font-family: inherit;
  font-size: 0.94rem;
  line-height: 1.46;
  cursor: pointer;
  transition: background-color 0.16s ease, border-color 0.16s ease, transform 0.14s ease;
}

.cq-option:hover:not(:disabled) {
  background: #F9E6E8;
  border-color: #C83E5B;
}

.cq-option:active:not(:disabled) {
  transform: scale(0.988);
}

.cq-option.is-selected {
  background: #F9E6E8;
  border-color: #C83E5B;
  box-shadow: 0 0 0 1px #C83E5B;
}

.cq-option:focus-visible,
.cq-back-btn:focus-visible,
.cq-btn:focus-visible {
  outline: 2px solid #C83E5B;
  outline-offset: 2px;
}

.cq-opt-key {
  flex: 0 0 26px;
  height: 26px;
  margin-top: 1px;
  border-radius: 8px;
  background: #FFFDF9;
  border: 1px solid #E6D9CE;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.8rem;
  font-weight: 600;
  color: #5E4B52;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.cq-option.is-selected .cq-opt-key {
  background: #C83E5B;
  border-color: #C83E5B;
  color: #FFFDF9;
}

.cq-opt-text {
  flex: 1 1 auto;
  font-weight: 500;
  color: #1F1619;
}

.cq-nav-row {
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px dashed #E6D9CE;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
}

.cq-back-btn {
  min-height: 44px;
  padding: 0.5rem 0.95rem;
  border-radius: 10px;
  border: 1px solid #E6D9CE;
  background: #FFFDF9;
  color: #1F1619;
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
}

.cq-back-btn:hover:not(:disabled) {
  background: #FBF6EE;
  border-color: #2B1E22;
}

.cq-back-btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.cq-hint {
  font-size: 0.8rem;
  color: #5E4B52;
}

/* Print animation */
.cq-print-wrap {
  max-width: 460px;
  margin: 1.5rem auto;
  padding: 1.25rem;
}

.cq-print-slot {
  height: 12px;
  border-radius: 999px;
  background: #2B1E22;
}

.cq-print-slip {
  margin: -4px 12px 0;
  background: #FFFDF9;
  border: 1px solid #E6D9CE;
  border-top: none;
  padding: 1.4rem 1.2rem;
  box-shadow: 0 12px 28px rgba(31, 22, 25, 0.08);
  animation: cqPrintIn 0.68s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes cqPrintIn {
  0% { opacity: 0.25; transform: translateY(-24px); }
  100% { opacity: 1; transform: translateY(0); }
}

.cq-print-tag {
  display: block;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.78rem;
  font-weight: 600;
  color: #C83E5B;
  margin-bottom: 0.35rem;
}

.cq-print-msg {
  margin: 0;
  font-family: 'Fraunces', Georgia, serif;
  font-size: 1.12rem;
  color: #1F1619;
}

/* Result Layout */
.cq-res-stack {
  display: flex;
  flex-direction: column;
  gap: 1.3rem;
  animation: cqPrintIn 0.42s ease-out;
}

.cq-hero-card {
  background: #FFFDF9;
  border: 1.5px solid #E6D9CE;
  border-radius: 20px;
  padding: 1.45rem;
  box-shadow: 0 12px 30px rgba(31, 22, 25, 0.06);
}

.cq-eyebrow {
  display: inline-block;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.78rem;
  font-weight: 600;
  color: #A82E48;
  background: #F9E6E8;
  padding: 0.24rem 0.68rem;
  border-radius: 999px;
  margin-bottom: 0.45rem;
}

.cq-res-title {
  margin: 0 0 0.35rem;
  font-family: 'Fraunces', Georgia, serif;
  font-size: clamp(1.48rem, 3.2vw, 1.98rem);
  font-weight: 700;
  line-height: 1.22;
  color: #1F1619;
}

.cq-res-tagline {
  margin: 0.65rem 0;
  font-family: 'Fraunces', Georgia, serif;
  font-style: italic;
  font-size: 1.04rem;
  line-height: 1.46;
  color: #2B1E22;
  padding-left: 0.85rem;
  border-left: 3px solid #C83E5B;
}

.cq-res-summary {
  margin: 0 0 1.1rem;
  font-size: 0.95rem;
  line-height: 1.62;
  color: #1F1619;
  text-align: left;
}

.cq-btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.cq-btn {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.62rem 1.08rem;
  border-radius: 12px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: background-color 0.16s ease, border-color 0.16s ease, transform 0.14s ease;
}

.cq-btn:active {
  transform: scale(0.985);
}

.cq-btn-primary {
  background: #C83E5B;
  color: #FFFDF9;
  border-color: #C83E5B;
}

.cq-btn-primary:hover {
  background: #A82E48;
  border-color: #A82E48;
  color: #FFFDF9;
}

.cq-btn-secondary {
  background: #FBF6EE;
  color: #1F1619;
  border-color: #2B1E22;
}

.cq-btn-secondary:hover {
  background: #F9E6E8;
  border-color: #C83E5B;
}

.cq-btn-soft {
  background: #FFFDF9;
  color: #1F1619;
  border-color: #E6D9CE;
}

.cq-btn-soft:hover {
  background: #FBF6EE;
  border-color: #D49B4B;
}

.cq-res-grid {
  display: grid;
  grid-template-columns: 1.12fr 0.88fr;
  gap: 1.25rem;
  align-items: start;
}

/* Serrated Receipt Paper */
.cq-receipt-box {
  filter: drop-shadow(0 10px 24px rgba(31, 22, 25, 0.08));
}

.cq-teeth-top,
.cq-teeth-bottom {
  height: 12px;
  width: 100%;
  background-repeat: repeat-x;
  background-size: 20px 12px;
}

.cq-teeth-top {
  background-image: linear-gradient(135deg, transparent 33.33%, #FFFDF9 33.33%, #FFFDF9 66.67%, transparent 66.67%),
    linear-gradient(45deg, transparent 33.33%, #FFFDF9 33.33%, #FFFDF9 66.67%, transparent 66.67%);
}

.cq-teeth-bottom {
  background-image: linear-gradient(135deg, #FFFDF9 33.33%, transparent 33.33%, transparent 66.67%, #FFFDF9 66.67%),
    linear-gradient(45deg, #FFFDF9 33.33%, transparent 33.33%, transparent 66.67%, #FFFDF9 66.67%);
}

.cq-paper {
  background: #FFFDF9;
  border-left: 1px solid #E6D9CE;
  border-right: 1px solid #E6D9CE;
  padding: 1.15rem 1.25rem;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}

.cq-paper-head {
  border-bottom: 1.5px dashed #2B1E22;
  padding-bottom: 0.75rem;
  margin-bottom: 0.75rem;
}

.cq-paper-title {
  margin: 0 0 0.25rem;
  font-family: 'Fraunces', Georgia, serif;
  font-size: 1.14rem;
  font-weight: 700;
  color: #1F1619;
}

.cq-paper-meta {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.4rem;
  font-size: 0.78rem;
  color: #5E4B52;
}

.cq-dim-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding-bottom: 0.85rem;
  border-bottom: 1.5px dashed #2B1E22;
}

.cq-dim-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  font-size: 0.82rem;
}

.cq-dim-code {
  color: #5E4B52;
  font-size: 0.78rem;
}

.cq-dim-name {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 600;
  color: #1F1619;
  flex: 1 1 auto;
}

.cq-dim-pct {
  font-weight: 700;
  color: #1F1619;
}

.cq-dim-track {
  height: 7px;
  border-radius: 999px;
  background: #F4ECE1;
  overflow: hidden;
  margin-top: 0.22rem;
}

.cq-dim-fill {
  height: 100%;
  border-radius: 999px;
  background: #2B1E22;
}

.cq-dim-fill.is-top1 {
  background: #C83E5B;
}

.cq-dim-fill.is-top2 {
  background: #D49B4B;
}

.cq-lists-sec {
  padding: 0.8rem 0;
  border-bottom: 1.5px dashed #E6D9CE;
  font-family: 'Plus Jakarta Sans', sans-serif;
}

.cq-sec-head {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.78rem;
  font-weight: 600;
  margin: 0 0 0.4rem;
}

.cq-sec-head.is-sage {
  color: #4E7A66;
}

.cq-sec-head.is-crimson {
  color: #A82E48;
}

.cq-bullets {
  margin: 0 0 0.75rem;
  padding-left: 1.1rem;
  font-size: 0.85rem;
  line-height: 1.48;
  color: #1F1619;
}

.cq-bullets:last-child {
  margin-bottom: 0;
}

.cq-bullets li {
  margin-bottom: 0.28rem;
}

.cq-note-box {
  margin: 0.75rem 0 0.6rem;
  padding: 0.55rem 0.7rem;
  background: #FBF6EE;
  border: 1px solid #E6D9CE;
  border-radius: 8px;
  font-size: 0.78rem;
  color: #5E4B52;
}

.cq-barcode {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  margin-top: 0.55rem;
}

.cq-barcode svg {
  width: 100%;
  max-width: 220px;
  height: 34px;
}

.cq-barcode span {
  font-size: 0.78rem;
  font-weight: 600;
  color: #1F1619;
}

/* Story Export Column */
.cq-side-col {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.cq-panel {
  background: #FFFDF9;
  border: 1px solid #E6D9CE;
  border-radius: 18px;
  padding: 1.2rem;
  box-shadow: 0 8px 22px rgba(31, 22, 25, 0.05);
}

.cq-panel-title {
  margin: 0 0 0.3rem;
  font-family: 'Fraunces', Georgia, serif;
  font-size: 1.14rem;
  font-weight: 600;
  color: #1F1619;
}

.cq-panel-sub {
  margin: 0 0 0.85rem;
  font-size: 0.85rem;
  line-height: 1.48;
  color: #5E4B52;
}

.cq-canvas-wrap {
  width: 100%;
  max-width: 250px;
  margin: 0 auto 0.9rem;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid #E6D9CE;
  background: #FBF6EE;
}

.cq-canvas-wrap canvas {
  width: 100%;
  height: auto;
  aspect-ratio: 9 / 16;
  display: block;
}

.cq-copy-note {
  font-size: 0.82rem;
  font-weight: 600;
  color: #4E7A66;
  min-height: 1.2em;
  margin: 0.35rem 0 0;
}

@media (max-width: 760px) {
  .cq-res-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .cq-card,
  .cq-hero-card,
  .cq-panel {
    padding: 1.05rem 1rem;
    border-radius: 16px;
  }

  .cq-option {
    padding: 0.72rem 0.82rem;
    font-size: 0.9rem;
  }

  .cq-btn {
    width: 100%;
  }
}
