.quiz-hub-page {
  --qh-ink: #102033;
  --qh-text: #263446;
  --qh-muted: #627186;
  --qh-line: #d8e2ef;
  --qh-soft: #f6f8fb;
  --qh-blue: #2563eb;
  --qh-blue-soft: #eef5ff;
  --qh-green: #16875d;
  --qh-green-soft: #edfbf4;
  --qh-amber: #a16207;
  --qh-amber-soft: #fff8e6;
  --qh-red: #b42318;
  --qh-red-soft: #fff1f0;
  color: var(--qh-text);
  display: grid;
  gap: 16px;
}

.quiz-hub-page [hidden] {
  display: none !important;
}

.qh-console,
.qh-stage,
.qh-result,
.qh-empty {
  border: 1px solid var(--qh-line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 16px 36px rgba(16, 32, 51, 0.08);
}

.qh-console {
  display: grid;
  gap: 16px;
  padding: clamp(18px, 2.6vw, 30px);
}

.qh-title-area {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: end;
}

.qh-kicker {
  margin: 0 0 6px;
  color: var(--qh-blue);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.qh-title,
.qh-stage-title,
.qh-result h2 {
  margin: 0;
  color: var(--qh-ink);
  font-weight: 900;
  letter-spacing: 0;
  line-height: 1.16;
}

.qh-title {
  font-size: clamp(2rem, 3.5vw, 3.1rem);
}

.qh-stage-title,
.qh-result h2 {
  font-size: clamp(1.45rem, 2.2vw, 2rem);
}

.qh-lead {
  max-width: 760px;
  margin: 10px 0 0;
  color: var(--qh-muted);
  line-height: 1.75;
  font-weight: 700;
}

.qh-total {
  min-width: 160px;
  padding: 12px 14px;
  border: 1px solid #cddcf0;
  border-radius: 8px;
  background: var(--qh-soft);
}

.qh-total span,
.qh-field span {
  display: block;
  color: var(--qh-muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.qh-total strong {
  display: block;
  margin-top: 4px;
  color: var(--qh-ink);
  font-size: 1.55rem;
  line-height: 1;
  font-weight: 900;
}

.qh-quick-actions,
.qh-stage-actions,
.qh-result-actions,
.qh-answer-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.qh-filter-bar {
  display: grid;
  grid-template-columns: minmax(360px, 2.4fr) minmax(130px, 0.9fr) minmax(105px, 0.75fr) minmax(220px, 1.2fr) auto;
  gap: 10px;
  align-items: end;
}

.qh-field {
  min-width: 0;
}

.qh-field select,
.qh-field input {
  width: 100%;
  min-height: 44px;
  margin-top: 6px;
  padding: 8px 10px;
  border: 1px solid var(--qh-line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--qh-text);
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.qh-field select:focus,
.qh-field input:focus {
  border-color: #9bc2ff;
  box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.12);
  outline: none;
}

.qh-btn,
.qh-tool-btn {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-weight: 900;
  line-height: 1.15;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.qh-btn {
  padding: 10px 15px;
}

.qh-tool-btn {
  padding: 8px 11px;
  border-color: var(--qh-line);
  background: #ffffff;
  color: var(--qh-text);
  font-size: 0.88rem;
}

.qh-tool-btn:hover,
.qh-tool-btn:focus {
  border-color: #bcd4ff;
  color: var(--qh-blue);
}

.qh-btn:disabled,
.qh-tool-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
}

.qh-btn-primary {
  background: var(--qh-blue);
  border-color: var(--qh-blue);
  color: #ffffff;
  box-shadow: 0 10px 20px rgba(37, 99, 235, 0.18);
}

.qh-btn-primary:hover,
.qh-btn-primary:focus {
  background: #1d4ed8;
  border-color: #1d4ed8;
  color: #ffffff;
}

.qh-btn-secondary {
  background: var(--qh-green);
  border-color: var(--qh-green);
  color: #ffffff;
  box-shadow: 0 10px 20px rgba(22, 135, 93, 0.16);
}

.qh-btn-secondary:hover,
.qh-btn-secondary:focus {
  background: #116c4a;
  border-color: #116c4a;
  color: #ffffff;
}

.qh-btn-ghost {
  background: #ffffff;
  border-color: var(--qh-line);
  color: var(--qh-text);
}

.qh-btn-ghost:hover,
.qh-btn-ghost:focus {
  border-color: #bcd4ff;
  color: var(--qh-blue);
}

.qh-btn-badge {
  min-width: 24px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--qh-blue-soft);
  color: var(--qh-blue);
  font-size: 0.76rem;
}

.qh-start-btn {
  width: 100%;
}

.qh-status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  color: var(--qh-muted);
  font-size: 0.85rem;
  font-weight: 800;
}

.qh-stage {
  padding: clamp(14px, 2vw, 22px);
}

.qh-stage-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 360px);
  gap: 16px;
  align-items: end;
  margin-bottom: 14px;
}

.qh-progress-block {
  display: grid;
  gap: 7px;
}

.qh-progress-text {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--qh-muted);
  font-size: 0.86rem;
  font-weight: 900;
}

.qh-progress-text strong {
  color: var(--qh-green);
}

.qh-progress-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8eef7;
}

.qh-progress-track span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--qh-blue);
  transition: width 0.2s ease;
}

.qh-question-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(360px, 1.05fr);
  gap: 14px;
}

.qh-question-pane,
.qh-answer-pane {
  min-width: 0;
  border: 1px solid var(--qh-line);
  border-radius: 8px;
  background: #ffffff;
  padding: clamp(14px, 2vw, 20px);
}

.qh-answer-pane {
  background: var(--qh-soft);
}

.qh-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 14px;
}

.qh-meta-row span {
  display: inline-flex;
  align-items: center;
  min-height: 27px;
  padding: 4px 9px;
  border: 1px solid var(--qh-line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--qh-muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.qh-instruction {
  min-height: 26px;
  margin-bottom: 12px;
  padding-left: 12px;
  border-left: 4px solid #8cb8ff;
  color: var(--qh-text);
  font-weight: 800;
  line-height: 1.7;
}

.qh-note {
  margin-bottom: 10px;
  color: var(--qh-amber);
  font-size: 0.86rem;
  font-weight: 800;
}

.qh-sentence {
  margin: 0;
  color: var(--qh-ink);
  font-size: clamp(1.28rem, 2.1vw, 1.75rem);
  line-height: 1.5;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.qh-japanese {
  margin: 14px 0 0;
  color: var(--qh-green);
  line-height: 1.7;
  font-weight: 800;
}

.qh-question-pane .qh-tool-btn {
  margin-top: 14px;
}

.qh-audio-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
  margin-top: 14px;
}

.qh-audio-tools .qh-tool-btn {
  margin-top: 0;
}

.qh-rate-field {
  min-width: 160px;
  display: grid;
  gap: 6px;
}

.qh-rate-field span {
  color: var(--qh-muted);
  font-size: 0.76rem;
  font-weight: 900;
}

.qh-rate-field select {
  width: 100%;
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid var(--qh-line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--qh-text);
  font-weight: 900;
}

.qh-rate-field select:focus {
  border-color: #9bc2ff;
  box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.12);
  outline: none;
}

.qh-answer-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}

.qh-answer-top h3 {
  margin: 0;
  color: var(--qh-ink);
  font-size: 1rem;
  font-weight: 900;
}

.qh-answer-hint {
  margin: 4px 0 0;
  color: var(--qh-muted);
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1.5;
}

.qh-answer-status {
  margin-left: auto;
  padding: 5px 9px;
  border-radius: 999px;
  background: var(--qh-blue-soft);
  color: var(--qh-blue);
  font-size: 0.82rem;
  font-weight: 900;
  white-space: nowrap;
}

.qh-selected-box {
  min-height: 58px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  padding: 10px;
  border: 1px solid #cddcf0;
  border-radius: 8px;
  background: #ffffff;
}

.qh-placeholder {
  color: var(--qh-muted);
  font-weight: 800;
}

.qh-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 10px;
  border: 1px solid #cddcf0;
  border-radius: 8px;
  background: #ffffff;
  color: var(--qh-ink);
  font-weight: 900;
  line-height: 1.2;
}

.qh-chip-index {
  color: var(--qh-blue);
  font-size: 0.78rem;
}

.qh-choices {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  margin-top: 12px;
}

.qh-choice {
  width: 100%;
  min-height: 48px;
  padding: 9px 11px;
  border: 1px solid #cddcf0;
  border-radius: 8px;
  background: #ffffff;
  color: var(--qh-text);
  font-weight: 900;
  line-height: 1.25;
  text-align: center;
  overflow-wrap: anywhere;
  cursor: pointer;
}

.qh-choice:hover,
.qh-choice:focus {
  border-color: #9bc2ff;
  box-shadow: 0 0 0 0.16rem rgba(37, 99, 235, 0.1);
  outline: none;
}

.qh-choice.is-selected {
  border-color: var(--qh-blue);
  background: var(--qh-blue-soft);
  color: #1d4ed8;
}

.qh-choice:disabled {
  cursor: default;
  opacity: 0.78;
}

.qh-feedback {
  min-height: 52px;
  margin-top: 14px;
  padding: 12px;
  border-radius: 8px;
  background: #ffffff;
  border: 1px solid var(--qh-line);
  color: var(--qh-muted);
  line-height: 1.65;
  font-weight: 800;
}

.qh-feedback.is-correct {
  border-color: #b8e2ca;
  background: var(--qh-green-soft);
  color: #116c4a;
}

.qh-feedback.is-wrong {
  border-color: #fac7c3;
  background: var(--qh-red-soft);
  color: var(--qh-red);
}

.qh-feedback.is-info {
  border-color: #f0d794;
  background: var(--qh-amber-soft);
  color: var(--qh-amber);
}

.qh-stage-actions {
  margin-top: 12px;
  justify-content: flex-end;
}

.qh-result {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  padding: clamp(18px, 2.6vw, 30px);
}

.qh-result-score {
  margin-top: 8px;
  color: var(--qh-blue);
  font-size: clamp(2rem, 3.8vw, 3.4rem);
  font-weight: 900;
  line-height: 1;
}

.qh-result-main p:last-child {
  margin: 10px 0 0;
  color: var(--qh-muted);
  font-weight: 800;
}

.qh-result-actions {
  justify-content: flex-end;
}

.qh-result-next {
  grid-column: 1 / -1;
  padding: 12px 14px;
  border: 1px solid #cddcf0;
  border-radius: 8px;
  background: var(--qh-blue-soft);
}

.qh-result-next strong {
  display: block;
  color: var(--qh-ink);
  font-weight: 900;
}

.qh-result-next p {
  margin: 5px 0 0;
  color: var(--qh-muted);
  font-weight: 800;
}

.qh-result-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.qh-result-links a {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid #bcd4ff;
  border-radius: 8px;
  background: #ffffff;
  color: var(--qh-blue);
  font-weight: 900;
  text-decoration: none;
}

.qh-result-links a:hover,
.qh-result-links a:focus {
  border-color: var(--qh-blue);
  color: #1d4ed8;
}

.qh-result-list {
  grid-column: 1 / -1;
  display: grid;
  gap: 8px;
}

.qh-wrong-item {
  padding: 10px 12px;
  border: 1px solid var(--qh-line);
  border-radius: 8px;
  background: var(--qh-soft);
  color: var(--qh-text);
  font-weight: 800;
}

.qh-empty {
  padding: 20px;
}

.qh-empty-inner {
  min-height: 110px;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 7px;
  color: var(--qh-muted);
  text-align: center;
}

.qh-empty-inner i {
  color: var(--qh-blue);
  font-size: 1.6rem;
}

.qh-empty-inner strong {
  color: var(--qh-ink);
}

.qh-loading {
  opacity: 0.72;
  pointer-events: none;
}

@media (max-width: 1199.98px) {
  .qh-filter-bar {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .qh-field-lesson {
    grid-column: span 2;
  }

  .qh-start-btn {
    grid-column: span 3;
  }
}

@media (max-width: 991.98px) {
  .qh-title-area,
  .qh-stage-head,
  .qh-question-grid,
  .qh-result {
    grid-template-columns: 1fr;
  }

  .qh-result-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 767.98px) {
  .qh-filter-bar {
    grid-template-columns: 1fr;
  }

  .qh-field-lesson {
    grid-column: auto;
  }

  .qh-start-btn {
    grid-column: auto;
  }

  .qh-total {
    min-width: 0;
  }

  .qh-answer-top {
    align-items: flex-start;
    flex-direction: column;
  }

  .qh-choices {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 575.98px) {
  .qh-console,
  .qh-stage,
  .qh-result,
  .qh-empty {
    box-shadow: none;
  }

  .qh-btn,
  .qh-tool-btn,
  .qh-choice {
    width: 100%;
  }

  .qh-rate-field {
    width: 100%;
  }
}
