/* PanQuiz — AI quiz generator landing (/creare-quiz/, IT twin of /en/ai-quiz-generator/)
   Requires: fonts.css, colors.css, typography.css, layout.css, style.css.
   Styles the pq-* functional block rendered by js/pdf-tool.js — CSS only,
   never restructure the block. */

/* ---------- Hero ---------- */
.aiq-hero { background: linear-gradient(180deg, #ffffff 0%, #edf1ff 100%); border-bottom: 1px solid rgba(14,21,82,.06); }
.aiq-hero .container { padding-top: 48px; padding-bottom: 72px; display: flex; flex-direction: column; align-items: center; }
.aiq-title { font-size: 46px; color: #0e1552; text-align: center; max-width: 900px; }
.aiq-sub { font-family: var(--font-subhead, 'Source Sans Pro', sans-serif); font-size: 20px; line-height: 1.55; color: #3c4257; text-align: center; max-width: 740px; margin: 16px 0 0; text-wrap: pretty; }
.aiq-hero-note { font-size: 14px; color: rgba(26,29,41,.6); margin: 20px 0 0; text-align: center; }

/* ---------- Tool card ---------- */
#pq-tool { width: 100%; max-width: 860px; margin-top: 34px; background: #fff; border-radius: 28px; box-shadow: 0 2px 18px rgba(14,21,82,.16); padding: 34px 38px 38px; position: relative; }
#pq-tool [hidden] { display: none !important; }
#pq-tool p { margin: 0; }

/* ---------- Idle (input form) ---------- */
#pq-state-idle { display: flex; flex-direction: column; gap: 22px; }
#pq-state-idle label { font-family: var(--font-ui, 'Plus Jakarta Sans', sans-serif); font-weight: 700; font-size: 16px; color: #0e1552; }
#pq-state-idle label[for="pq-file"] { display: block; margin-bottom: 12px; }
.pq-input-toggle { display: flex; align-self: center; gap: 4px; padding: 5px; background: rgba(14,21,82,.07); border-radius: 999px; }
.pq-input-toggle button { border: 0; background: transparent; color: #3c4257; border-radius: 999px; min-height: 44px; padding: 9px 26px; font-family: var(--font-ui, 'Plus Jakarta Sans', sans-serif); font-weight: 700; font-size: 15px; cursor: pointer; transition: background .2s ease, color .2s ease, box-shadow .2s ease; }
.pq-input-toggle button:hover { color: #0e1552; }
.pq-input-toggle button[aria-selected="true"] { background: #fff; color: var(--site-primary, #005aef); box-shadow: 0 1px 6px rgba(14,21,82,.16); }
.pq-input-toggle button:focus-visible { outline: 3px solid #0e1552; outline-offset: 2px; }
#pq-file { display: block; width: 100%; padding: 26px 22px; border: 2px dashed rgba(0,90,239,.4); border-radius: 18px; background: rgba(0,90,239,.045); font-family: var(--font-ui, 'Plus Jakarta Sans', sans-serif); font-size: 15px; color: #3c4257; cursor: pointer; transition: border-color .3s ease, background .3s ease; }
#pq-file:hover { border-color: var(--site-primary, #005aef); background: rgba(0,90,239,.08); }
#pq-file:focus-visible { outline: 3px solid var(--site-primary, #005aef); outline-offset: 3px; }
#pq-file::file-selector-button { border: 0; border-radius: 999px; background: var(--site-primary, #005aef); color: #fff; font-family: var(--font-ui, 'Plus Jakarta Sans', sans-serif); font-weight: 700; font-size: 14px; padding: 10px 20px; margin-right: 16px; cursor: pointer; transition: background .2s ease; }
#pq-file::file-selector-button:hover { background: #0047c0; }
#pq-topic { display: block; width: 100%; margin-top: 10px; padding: 13px 16px; border: 2px solid rgba(14,21,82,.16); border-radius: 12px; font-family: var(--font-ui, 'Plus Jakarta Sans', sans-serif); font-weight: 600; font-size: 16px; color: #0e1552; transition: border-color .2s ease; }
#pq-topic::placeholder { color: rgba(26,29,41,.45); font-weight: 500; }
#pq-topic:focus { border-color: var(--site-primary, #005aef); outline: none; }
#pq-text { display: block; width: 100%; margin-top: 10px; padding: 14px 16px; border: 2px solid rgba(14,21,82,.16); border-radius: 12px; font-family: var(--font-body, 'Open Sans', sans-serif); font-size: 15px; line-height: 1.55; color: #1a1d29; resize: vertical; min-height: 170px; transition: border-color .2s ease; }
#pq-text:focus { border-color: var(--site-primary, #005aef); outline: none; }
.pq-text-counter { display: block; text-align: right; margin-top: 6px; font-family: var(--font-ui, 'Plus Jakarta Sans', sans-serif); font-weight: 600; font-size: 12.5px; color: rgba(26,29,41,.55); }
#pq-state-idle p:has(#pq-grade) { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
#pq-grade { font-family: var(--font-ui, 'Plus Jakarta Sans', sans-serif); font-weight: 600; font-size: 15px; color: #0e1552; background: #fff; border: 2px solid rgba(14,21,82,.16); border-radius: 12px; padding: 10px 14px; min-height: 44px; cursor: pointer; transition: border-color .2s ease; }
#pq-grade:hover, #pq-grade:focus { border-color: var(--site-primary, #005aef); outline: none; }
#pq-turnstile:not(:empty) { display: flex; }
#pq-generate-btn { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 58px; border: 0; border-radius: 999px; background: var(--site-primary, #005aef); color: #fff; font-family: var(--font-ui, 'Plus Jakarta Sans', sans-serif); font-weight: 700; font-size: 19px; cursor: pointer; box-shadow: 0 5px 0 #0047c0; transition: transform .15s ease, box-shadow .15s ease, background .2s ease; }
#pq-generate-btn:hover { transform: translateY(-2px); box-shadow: 0 7px 0 #0047c0; }
#pq-generate-btn:active { transform: translateY(3px); box-shadow: 0 2px 0 #0047c0; }
#pq-generate-btn:focus-visible { outline: 3px solid #0e1552; outline-offset: 3px; }

/* ---------- Errors ---------- */
.pq-error { background: rgba(229,57,53,.08); border-radius: 12px; padding: 14px 18px; font-family: var(--font-ui, 'Plus Jakarta Sans', sans-serif); font-weight: 600; font-size: 14.5px; line-height: 1.5; color: var(--danger-pressed, #cd1e1a); }

/* ---------- Working ---------- */
#pq-state-working { display: flex; flex-direction: column; align-items: center; gap: 26px; padding: 48px 0 40px; text-align: center; }
.pq-spinner { width: 64px; height: 64px; border-radius: 50%; border: 7px solid; border-color: var(--answer-red, #e21b3c) var(--answer-blue, #1368ce) var(--answer-green, #26890c) var(--answer-gold, #d09f36); animation: aiqSpin 1.1s linear infinite; }
@keyframes aiqSpin { to { transform: rotate(360deg); } }
#pq-working-msg { font-family: var(--font-display, 'Raleway', sans-serif); font-weight: 700; font-size: 19px; color: #0e1552; animation: aiqBreath 1.6s ease-in-out infinite; }
@keyframes aiqBreath { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }

/* ---------- Error state ---------- */
#pq-state-error { display: flex; flex-direction: column; align-items: center; gap: 20px; padding: 32px 0 24px; text-align: center; }
#pq-retry-btn, #pq-restart-btn, .pq-play-again, .pq-card-prev, .pq-card-next { border: 2px solid rgba(14,21,82,.18); background: #fff; color: #0e1552; border-radius: 999px; min-height: 44px; padding: 9px 24px; font-family: var(--font-ui, 'Plus Jakarta Sans', sans-serif); font-weight: 700; font-size: 14.5px; cursor: pointer; transition: border-color .2s ease, color .2s ease, transform .15s ease; }
#pq-retry-btn:hover, #pq-restart-btn:hover, .pq-play-again:hover, .pq-card-prev:hover, .pq-card-next:hover { border-color: var(--site-primary, #005aef); color: var(--site-primary, #005aef); transform: translateY(-1px); }
#pq-retry-btn:focus-visible, #pq-restart-btn:focus-visible, .pq-play-again:focus-visible, .pq-card-prev:focus-visible, .pq-card-next:focus-visible { outline: 3px solid #0e1552; outline-offset: 2px; }
#pq-state-result > p:last-child { margin-top: 22px; text-align: center; }

/* ---------- Tabs ---------- */
.pq-tabs { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 26px; }
.pq-tabs button { border: 2px solid rgba(14,21,82,.15); background: #fff; color: #0e1552; border-radius: 999px; min-height: 44px; padding: 9px 20px; font-family: var(--font-ui, 'Plus Jakarta Sans', sans-serif); font-weight: 700; font-size: 14.5px; cursor: pointer; transition: background .2s ease, border-color .2s ease, color .2s ease; }
.pq-tabs button:hover { border-color: var(--site-primary, #005aef); color: var(--site-primary, #005aef); }
.pq-tabs button[aria-selected="true"] { background: var(--site-primary, #005aef); border-color: var(--site-primary, #005aef); color: #fff; }
.pq-tabs button:focus-visible { outline: 3px solid #0e1552; outline-offset: 2px; }
#pq-print-btn { margin-left: auto; }

/* ---------- Play view ---------- */
.pq-play-progress { font-family: var(--font-ui, 'Plus Jakarta Sans', sans-serif); font-weight: 700; font-size: 13px; letter-spacing: .07em; text-transform: uppercase; color: rgba(14,21,82,.55); margin: 0 0 10px; }
.pq-play-progressbar { height: 10px; border-radius: 999px; background: rgba(14,21,82,.08); overflow: hidden; margin-bottom: 24px; }
.pq-play-progressbar-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--site-primary, #005aef), #54ceff); transition: width .45s cubic-bezier(.55, 0, .1, 1); }
.pq-play-question { font-family: var(--font-display, 'Raleway', sans-serif); font-weight: 700; font-size: 24px; line-height: 1.35; color: #0e1552; margin: 0 0 22px; text-wrap: pretty; }
.pq-play-answers { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.pq-play-answer { display: flex; align-items: center; gap: 14px; min-height: 66px; border: 0; border-radius: 14px; padding: 14px 18px; color: #fff; font-family: var(--font-ui, 'Plus Jakarta Sans', sans-serif); font-weight: 600; font-size: 16px; line-height: 1.35; text-align: left; cursor: pointer; transition: transform .15s ease, box-shadow .15s ease, opacity .3s ease; }
.pq-play-answer:nth-child(1) { background: var(--answer-red, #e21b3c); }
.pq-play-answer:nth-child(2) { background: var(--answer-blue, #1368ce); }
.pq-play-answer:nth-child(3) { background: var(--answer-gold, #d09f36); }
.pq-play-answer:nth-child(4) { background: var(--answer-green, #26890c); }
.pq-play-answer:not(.is-disabled):hover { transform: translateY(-2px); box-shadow: 0 6px 14px rgba(14,21,82,.28); }
.pq-play-answer:focus-visible { outline: 3px solid #0e1552; outline-offset: 2px; }
.pq-play-answer-letter { width: 34px; height: 34px; flex: 0 0 auto; display: flex; align-items: center; justify-content: center; border-radius: 10px; background: rgba(255,255,255,.24); font-weight: 800; font-size: 16px; }
.pq-play-answer.is-disabled { cursor: default; }
.pq-play-answer.is-disabled:not(.is-correct) { opacity: .35; }
.pq-play-answer.is-correct { opacity: 1; box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--success, #7cb342); animation: aiqPop .45s ease; }
.pq-play-answer.is-wrong { animation: aiqShake .4s ease; }
@keyframes aiqPop { 0% { transform: scale(1); } 40% { transform: scale(1.045); } 100% { transform: scale(1); } }
@keyframes aiqShake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-6px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(4px); } }

/* ---------- Score summary ---------- */
.pq-summary { text-align: center; padding-top: 6px; }
.pq-summary-score { font-family: var(--font-display, 'Raleway', sans-serif); font-weight: 700; font-size: 25px; color: #0e1552; margin: 0; }
.pq-summary-score-num { display: block; font-size: 64px; font-weight: 800; line-height: 1.15; color: var(--site-primary, #005aef); font-variant-numeric: tabular-nums; }
.pq-summary-list { list-style: none; margin: 30px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; text-align: left; }
.pq-summary-item { border-radius: 14px; padding: 14px 18px; display: flex; flex-direction: column; gap: 4px; }
.pq-summary-item.is-correct { background: rgba(124,179,66,.13); }
.pq-summary-item.is-wrong { background: rgba(229,57,53,.09); }
.pq-summary-q { font-family: var(--font-ui, 'Plus Jakarta Sans', sans-serif); font-weight: 700; font-size: 15px; color: #0e1552; margin: 0; }
.pq-summary-a { font-size: 14.5px; line-height: 1.55; color: #3c4257; margin: 0; }
.pq-play-again { margin-top: 26px; background: var(--site-primary, #005aef); border-color: var(--site-primary, #005aef); color: #fff; }
.pq-play-again:hover { background: #0047c0; border-color: #0047c0; color: #fff; }

/* ---------- Flashcards ---------- */
.pq-flashcards { display: flex; flex-direction: column; align-items: center; gap: 18px; }
.pq-flashcard-counter { font-family: var(--font-ui, 'Plus Jakarta Sans', sans-serif); font-weight: 700; font-size: 13px; letter-spacing: .07em; text-transform: uppercase; color: rgba(14,21,82,.55); margin: 0; }
.pq-flashcard { width: 100%; min-height: 250px; border: 0; border-radius: 22px; background: var(--site-grad-hero, linear-gradient(45deg, #8089ff 0%, #54ceff 100%)); color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 34px 38px; text-align: center; cursor: pointer; box-shadow: 0 2px 18px rgba(14,21,82,.18); transition: background .3s ease, transform .15s ease, border-color .3s ease; }
.pq-flashcard:hover { transform: translateY(-2px); }
.pq-flashcard:focus-visible { outline: 3px solid #0e1552; outline-offset: 3px; }
.pq-flashcard.is-flipped { background: #fff; color: #0e1552; border: 3px solid var(--success, #7cb342); box-shadow: 0 2px 18px rgba(124,179,66,.25); }
.pq-flashcard-text { font-family: var(--font-display, 'Raleway', sans-serif); font-weight: 700; font-size: 22px; line-height: 1.4; margin: 0; text-wrap: pretty; }
.pq-flashcard-hint { font-family: var(--font-ui, 'Plus Jakarta Sans', sans-serif); font-weight: 600; font-size: 13px; opacity: .82; margin: 0; }
.pq-flashcard-nav { display: flex; gap: 12px; }

/* ---------- Answers & edit ---------- */
.pq-answerkey { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 16px; }
.pq-ak-item { border: 1px solid rgba(14,21,82,.1); border-radius: 16px; padding: 20px 22px; }
.pq-ak-question { font-family: var(--font-ui, 'Plus Jakarta Sans', sans-serif); font-weight: 700; font-size: 16px; line-height: 1.45; color: #0e1552; margin: 0 0 12px; }
.pq-ak-answers { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pq-ak-answer { font-size: 14.5px; line-height: 1.5; color: #3c4257; padding: 9px 13px; border-radius: 10px; background: rgba(14,21,82,.04); }
.pq-ak-answer.is-correct { background: rgba(124,179,66,.16); color: #33691e; font-weight: 700; }
.pq-ak-actions { display: flex; gap: 18px; margin-top: 14px; }
.pq-ak-edit, .pq-ak-delete { border: 0; background: none; padding: 0; min-height: 44px; font-family: var(--font-ui, 'Plus Jakarta Sans', sans-serif); font-weight: 700; font-size: 13.5px; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.pq-ak-edit { color: var(--site-primary, #005aef); }
.pq-ak-edit:hover { color: #0047c0; }
.pq-ak-delete { color: var(--danger-pressed, #cd1e1a); }
.pq-ak-delete:hover { color: var(--danger, #e53935); }
.pq-ed { display: flex; flex-direction: column; gap: 10px; }
.pq-ed-q, .pq-ed-a { width: 100%; font-family: var(--font-body, 'Open Sans', sans-serif); font-size: 14.5px; color: #1a1d29; padding: 10px 13px; border: 1.5px solid rgba(14,21,82,.18); border-radius: 10px; transition: border-color .2s ease; }
.pq-ed-q:focus, .pq-ed-a:focus { border-color: var(--site-primary, #005aef); outline: none; }
.pq-ed-row { display: flex; align-items: center; gap: 10px; }
.pq-ed-row input[type="radio"] { width: 18px; height: 18px; accent-color: var(--success, #7cb342); flex: 0 0 auto; cursor: pointer; }
.pq-ed-save { align-self: flex-start; border: 0; border-radius: 999px; min-height: 44px; padding: 9px 26px; background: var(--site-primary, #005aef); color: #fff; font-family: var(--font-ui, 'Plus Jakarta Sans', sans-serif); font-weight: 700; font-size: 14.5px; cursor: pointer; transition: background .2s ease; }
.pq-ed-save:hover { background: #0047c0; }

/* ---------- CTA bar ---------- */
.pq-cta-bar { margin-top: 30px; padding: 22px 24px; border-radius: 18px; background: linear-gradient(180deg, #f7f9ff 0%, #edf1ff 100%); border: 1px solid rgba(0,90,239,.12); display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.pq-cta { border: 0; border-radius: 999px; min-height: 48px; padding: 11px 24px; font-family: var(--font-ui, 'Plus Jakarta Sans', sans-serif); font-weight: 700; font-size: 15px; cursor: pointer; transition: transform .15s ease, box-shadow .15s ease, background .2s ease, color .2s ease; }
.pq-cta:hover { transform: translateY(-2px); box-shadow: 0 6px 14px rgba(14,21,82,.18); }
.pq-cta:focus-visible { outline: 3px solid #0e1552; outline-offset: 2px; }
.pq-cta[data-cta="live"] { background: var(--site-primary, #005aef); color: #fff; }
.pq-cta[data-cta="save"] { background: #0e1552; color: #fff; }
.pq-cta[data-cta="more"] { background: #fff; color: var(--site-primary, #005aef); border: 2px solid var(--site-primary, #005aef); }

/* ---------- Printable test preview + print area (engine injects print isolation) ---------- */
#pq-view-print .pq-print { background: #fff; border: 1px solid rgba(14,21,82,.14); border-radius: 12px; padding: 28px 32px; box-shadow: 0 2px 12px rgba(14,21,82,.08); }
#pq-view-print .pq-print, #pq-print-area .pq-print { color: #000; font-family: var(--font-body, 'Open Sans', sans-serif); font-size: 12pt; line-height: 1.5; }
#pq-view-print .pq-print-brand, #pq-print-area .pq-print-brand { font-family: var(--font-ui, 'Plus Jakarta Sans', sans-serif); font-weight: 700; font-size: 10pt; color: #000; }

/* ---------- Below-the-fold sections ---------- */
.aiq-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; margin-top: 48px; }
.aiq-step { background: #fff; border: 1px solid rgba(14,21,82,.1); border-radius: 20px; padding: 30px 28px; }
.aiq-step-num { width: 46px; height: 46px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-family: var(--font-display, 'Raleway', sans-serif); font-weight: 800; font-size: 23px; color: #fff; }
.aiq-step:nth-child(1) .aiq-step-num { background: var(--answer-red, #e21b3c); }
.aiq-step:nth-child(2) .aiq-step-num { background: var(--answer-blue, #1368ce); }
.aiq-step:nth-child(3) .aiq-step-num { background: var(--answer-green, #26890c); }
.aiq-step h3 { font-family: var(--font-display, 'Raleway', sans-serif); font-weight: 700; font-size: 20px; color: #0e1552; margin: 18px 0 8px; }
.aiq-step p { font-size: 15px; line-height: 1.65; color: #3c4257; margin: 0; text-wrap: pretty; }
.aiq-crosslinks { font-size: 15.5px; line-height: 1.65; color: #3c4257; text-align: center; margin: 40px 0 0; }
.aiq-crosslinks a { font-weight: 700; }

.aiq-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; margin-top: 44px; }
.aiq-item { background: #fff; border: 1px solid rgba(14,21,82,.1); border-radius: 16px; padding: 24px; }
.aiq-item p { font-size: 14.5px; line-height: 1.6; color: #3c4257; margin: 14px 0 0; text-wrap: pretty; }
.aiq-item strong { color: #0e1552; }

.teaser-cta { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 16px; margin-top: 34px; }
.teaser-note { font-size: 14px; color: rgba(26,29,41,.6); text-align: center; margin: 16px 0 0; }

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  .aiq-title { font-size: 34px; }
  .aiq-hero .container { padding-top: 36px; padding-bottom: 52px; }
  .aiq-sub { font-size: 17px; }
  #pq-tool { padding: 24px 20px 26px; border-radius: 22px; margin-top: 26px; }
  .pq-input-toggle button { padding: 9px 20px; }
  #pq-file { padding: 20px 16px; }
  .pq-tabs { gap: 8px; }
  #pq-print-btn { margin-left: 0; }
  .pq-play-question { font-size: 20px; }
  #pq-view-print .pq-print { padding: 20px 18px; }
  .aiq-steps { grid-template-columns: 1fr; gap: 20px; margin-top: 36px; }
  .aiq-grid { grid-template-columns: 1fr; margin-top: 36px; }
}
@media (max-width: 560px) {
  .pq-play-answers { grid-template-columns: 1fr; }
  .pq-ak-answers { grid-template-columns: 1fr; }
  .pq-flashcard { min-height: 210px; padding: 26px 22px; }
  .pq-flashcard-text { font-size: 19px; }
  .pq-summary-score-num { font-size: 52px; }
}
@media (max-width: 420px) {
  .aiq-title { font-size: 29px; }
}
@media (prefers-reduced-motion: reduce) {
  .pq-spinner { animation-duration: 2s; }
  #pq-working-msg, .pq-play-answer.is-wrong, .pq-play-answer.is-correct { animation: none; }
}
