/* ==========================================================================
   HSKMockTest.com/vi Exact Online Exam Room Styling
   ========================================================================== */

:root {
  --hsk-orange: #f97316;
  --hsk-orange-hover: #ea580c;
  --hsk-orange-light: #fff7ed;
  --hsk-orange-border: #fed7aa;
  --hsk-orange-dark: #c2410c;
  --hsk-blue: #0284c7;
  --hsk-blue-hover: #0369a1;
  --hsk-blue-light: #e0f2fe;
  --hsk-bg: #f3f4f6;
  --hsk-card-bg: #ffffff;
  --hsk-border: #e5e7eb;
  --hsk-text: #111827;
  --hsk-text-muted: #6b7280;
}

body.hsk-exam-page {
  background-color: var(--hsk-bg);
  color: var(--hsk-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  margin: 0;
  padding: 24px;
  min-height: 100vh;
  box-sizing: border-box;
}

.hsk-exam-outer-wrapper {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Top Header Card */
.hsk-exam-header-card {
  background: var(--hsk-card-bg);
  border: 1px solid var(--hsk-border);
  border-radius: 12px;
  padding: 20px 28px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.hsk-exam-header-titles {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.hsk-exam-main-title {
  font-size: 1.45rem;
  font-weight: 800;
  color: #111827;
  letter-spacing: -0.3px;
}

.hsk-exam-sub-title {
  font-size: 0.92rem;
  color: var(--hsk-text-muted);
  font-weight: 500;
}

.hsk-exam-exit-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--hsk-text-muted);
  background: #f9fafb;
  border: 1px solid var(--hsk-border);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.hsk-exam-exit-btn:hover {
  background: #f3f4f6;
  color: #111827;
}

/* Two-column Exam Layout */
.hsk-exam-layout-grid {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 24px;
  width: 100%;
  align-items: stretch;
  box-sizing: border-box;
}

/* Left Sidebar Navigation */
.hsk-exam-sidebar-card {
  background: var(--hsk-card-bg);
  border: 1px solid var(--hsk-border);
  border-radius: 12px;
  padding: 24px 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  text-align: center;
}

.hsk-sidebar-segment-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: #111827;
  margin-bottom: 8px;
}

.hsk-sidebar-timer {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--hsk-orange);
  letter-spacing: 1px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.hsk-sidebar-timer-label {
  font-size: 0.8rem;
  color: var(--hsk-text-muted);
  margin-top: 2px;
  margin-bottom: 24px;
}

.hsk-sidebar-sections {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.hsk-section-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--hsk-text-muted);
  position: relative;
  margin: 8px 0 4px 0;
}

.hsk-section-divider::before,
.hsk-section-divider::after {
  content: "";
  flex: 1;
  border-bottom: 1px solid #e5e7eb;
  margin: 0 8px;
}

.hsk-q-circles-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  justify-items: center;
}

.hsk-q-circle {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid #e5e7eb;
  background: #ffffff;
  color: var(--hsk-text-muted);
  font-size: 0.92rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.hsk-q-circle:hover {
  border-color: #cbd5e1;
  background: #f9fafb;
}

.hsk-q-circle.active {
  background: var(--hsk-orange);
  color: #ffffff;
  border-color: var(--hsk-orange);
  box-shadow: 0 2px 6px rgba(249, 115, 22, 0.35);
}

.hsk-q-circle.answered:not(.active) {
  background: var(--hsk-orange-light);
  color: var(--hsk-orange-dark);
  border-color: var(--hsk-orange-border);
}

.hsk-submit-segment-btn {
  margin-top: 28px;
  width: 100%;
  background: var(--hsk-orange);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 13px 16px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 3px 8px rgba(249, 115, 22, 0.25);
  transition: all 0.2s ease;
}

.hsk-submit-segment-btn:hover {
  background: var(--hsk-orange-hover);
  transform: translateY(-1px);
}

/* Right Question Card */
.hsk-exam-content-card {
  background: var(--hsk-card-bg);
  border: 1px solid var(--hsk-border);
  border-radius: 12px;
  padding: 32px 36px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  min-height: 540px;
  display: flex;
  flex-direction: column;
}

.hsk-q-top-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--hsk-orange-light);
  color: var(--hsk-orange-hover);
  border-radius: 9999px;
  padding: 4px 14px;
  font-size: 0.82rem;
  font-weight: 700;
  align-self: flex-start;
}

.hsk-q-sub-prompt {
  font-size: 1.15rem;
  font-weight: 800;
  color: #111827;
  margin-top: 14px;
  margin-bottom: 24px;
}

/* Question Center Presentation */
.hsk-q-center-presentation {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin-bottom: 30px;
  width: 100%;
}

.hsk-q-main-image {
  max-height: 290px;
  max-width: 100%;
  border-radius: 10px;
  object-fit: contain;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.hsk-audio-replay-bar {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 9999px;
  padding: 8px 20px;
  font-size: 0.9rem;
  font-weight: 700;
  color: #0369a1;
  cursor: pointer;
  transition: all 0.2s ease;
}

.hsk-audio-replay-bar:hover {
  background: #e0f2fe;
  border-color: #bae6fd;
}

.hsk-audio-replay-bar.secondary {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #475569;
}

.hsk-audio-replay-bar.secondary:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #1e293b;
}

.hsk-audio-btn-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.hsk-group-audio-indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 12px;
  padding: 10px 18px;
  margin-bottom: 12px;
  max-width: 580px;
  text-align: center;
}

.hsk-group-audio-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #2563eb;
  color: #ffffff;
  padding: 3px 12px;
  border-radius: 9999px;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.hsk-group-audio-desc {
  font-size: 0.85rem;
  color: #1e40af;
  line-height: 1.4;
}

/* Master Section Audio Player (Continuous Audio for YCT) */
.hsk-master-audio-card {
  background: #ffffff;
  border: 1.5px solid #bae6fd;
  border-radius: 14px;
  padding: 16px 22px;
  margin-bottom: 20px;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.08);
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: hskExamFadeIn 0.2s ease;
}

.hsk-master-audio-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.hsk-audio-badge-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
  font-weight: 800;
  color: #0369a1;
}

.hsk-audio-pulse-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #94a3b8;
  display: inline-block;
  transition: all 0.2s ease;
}

.hsk-audio-pulse-indicator.playing {
  background: #22c55e;
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.25);
  animation: hskPulseDot 1.5s infinite;
}

@@keyframes hskPulseDot {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.5); }
  70% { transform: scale(1.1); box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

.hsk-audio-time-counter {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.92rem;
  font-weight: 800;
  color: #334155;
  background: #f1f5f9;
  padding: 4px 12px;
  border-radius: 8px;
}

.hsk-master-audio-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.hsk-audio-play-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #0284c7;
  color: #ffffff;
  border: none;
  border-radius: 999px;
  padding: 9px 20px;
  font-size: 0.92rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.25);
}

.hsk-audio-play-btn:hover {
  background: #0369a1;
  transform: translateY(-1px);
}

.hsk-audio-skip-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 0.82rem;
  font-weight: 800;
  color: #475569;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.hsk-audio-skip-btn:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.hsk-audio-scrubber-container {
  flex: 1;
  display: flex;
  align-items: center;
}

.hsk-audio-scrubber {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  accent-color: #0284c7;
  cursor: pointer;
}

.hsk-audio-speed-select {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 0.84rem;
  font-weight: 700;
  color: #334155;
  cursor: pointer;
  outline: none;
}

.hsk-master-audio-footer {
  font-size: 0.83rem;
  color: #475569;
  line-height: 1.5;
  background: #f8fafc;
  border-radius: 8px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.hsk-q-continuous-hint {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 0.88rem;
  color: #0369a1;
  font-weight: 600;
  margin-bottom: 1.25rem;
}

.hsk-q-sentence-text {
  font-size: 1.35rem;
  font-weight: 700;
  color: #111827;
  text-align: center;
  line-height: 1.8;
}

/* Question Interaction Controls */
/* 1. True / False: Large Stacked Buttons (Exact screenshot match) */
.hsk-tf-buttons-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 220px;
  width: 100%;
  margin: 0 auto;
}

.hsk-tf-btn {
  width: 100%;
  height: 64px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  font-size: 1.8rem;
  font-weight: 800;
  color: #374151;
}

.hsk-tf-btn:hover {
  background: #f3f4f6;
  border-color: #d1d5db;
}

.hsk-tf-btn.selected {
  background: #fff7ed;
  border: 2px solid var(--hsk-orange);
  color: var(--hsk-orange-dark);
  box-shadow: 0 2px 6px rgba(249, 115, 22, 0.2);
}

/* 2. Image Choices & Matching (3 images or 5-6 images A-F) */
.hsk-img-choice-grid {
  display: grid;
  gap: 16px;
  width: 100%;
  margin: 0 auto;
}

.hsk-img-choice-grid.grid-3 {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  max-width: 720px;
}

.hsk-img-choice-grid.grid-6 {
  grid-template-columns: repeat(3, 1fr);
  max-width: 780px;
}

@media (max-width: 640px) {
  .hsk-img-choice-grid.grid-6 {
    grid-template-columns: repeat(2, 1fr);
  }
}

.hsk-img-opt-card {
  background: #ffffff;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  position: relative;
}

.hsk-img-opt-card:hover {
  border-color: #cbd5e1;
  background: #f8fafc;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.hsk-img-opt-card.selected {
  border-color: var(--hsk-orange);
  background: #fff7ed;
  box-shadow: 0 4px 14px rgba(249, 115, 22, 0.22);
  transform: translateY(-2px);
}

.hsk-img-opt-header {
  width: 100%;
  display: flex;
  justify-content: flex-start;
  align-items: center;
}

.hsk-img-opt-badge {
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: 50%;
  border: 2px solid #d1d5db;
  background: #f8fafc;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 800;
  color: #374151;
  transition: all 0.2s ease;
}

.hsk-img-opt-card.selected .hsk-img-opt-badge {
  border-color: var(--hsk-orange);
  background: var(--hsk-orange);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(249, 115, 22, 0.35);
}

.hsk-img-opt-img-wrap {
  width: 100%;
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 8px;
  background: #f8fafc;
}

.hsk-img-opt-img-wrap img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transition: transform 0.2s ease;
}

.hsk-img-opt-card:hover .hsk-img-opt-img-wrap img {
  transform: scale(1.03);
}

.hsk-img-opt-subtext {
  font-size: 1.05rem;
  font-weight: 700;
  color: #1e293b;
  text-align: center;
  line-height: 1.4;
  margin-top: 4px;
}

.hsk-img-opt-card.selected .hsk-img-opt-subtext {
  color: var(--hsk-orange-dark);
}

/* 3. Text Choice A, B, C, D */
.hsk-text-choice-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
}

.hsk-text-opt-item {
  display: flex;
  align-items: center;
  gap: 16px;
  background: #ffffff;
  border: 2px solid #e5e7eb;
  border-radius: 10px;
  padding: 14px 20px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.hsk-text-opt-item:hover {
  background: #f9fafb;
  border-color: #cbd5e1;
}

.hsk-text-opt-item.selected {
  border-color: var(--hsk-orange);
  background: #fff7ed;
  color: var(--hsk-orange-dark);
}

.hsk-opt-circle-badge {
  width: 34px;
  height: 34px;
  min-width: 34px;
  max-width: 34px;
  border-radius: 50%;
  border: 2px solid #d1d5db;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 800;
  flex-shrink: 0;
}

.hsk-text-opt-item.selected .hsk-opt-circle-badge {
  border-color: var(--hsk-orange);
  background: var(--hsk-orange);
  color: #ffffff;
}

.hsk-opt-text {
  flex: 1;
  word-break: break-word;
  line-height: 1.5;
}

.hsk-short-answer-container {
  max-width: 550px;
  margin: 1.5rem auto;
  text-align: center;
  width: 100%;
}

.hsk-short-answer-input {
  font-size: 1.25rem;
  font-weight: 700;
  text-align: center;
  width: 100%;
  max-width: 360px;
  padding: 12px 18px;
  border: 2px solid var(--hsk-orange);
  border-radius: 10px;
  outline: none;
  background: #ffffff;
  color: #111827;
  box-shadow: 0 2px 8px rgba(249, 115, 22, 0.12);
  transition: all 0.2s ease;
}

.hsk-short-answer-input:focus {
  border-color: var(--hsk-orange-dark);
  box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.2);
}

/* Bottom Pagination & Navigation Controls */
.hsk-q-nav-bar {
  margin-top: auto;
  padding-top: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.hsk-nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  font-size: 0.95rem;
  font-weight: 700;
  border-radius: 8px;
  border: 1px solid #d1d5db;
  background: #ffffff;
  color: #374151;
  cursor: pointer;
  transition: all 0.15s ease;
}

.hsk-nav-btn:hover:not(:disabled) {
  background: #f3f4f6;
  border-color: #9ca3af;
}

.hsk-nav-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

@media (max-width: 768px) {
  body.hsk-exam-page {
    padding: 10px;
  }

  .hsk-exam-outer-wrapper {
    width: 100%;
    gap: 12px;
  }

  .hsk-exam-header-card {
    padding: 12px 14px;
    border-radius: 12px;
    width: 100%;
    box-sizing: border-box;
  }

  .hsk-exam-main-title {
    font-size: 1.15rem;
    line-height: 1.3;
  }

  .hsk-exam-header-right-actions {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .hsk-exam-mobile-timer {
    display: inline-flex !important;
    align-items: center;
    background: #fff7ed;
    color: var(--hsk-orange);
    border: 1px solid var(--hsk-orange-border);
    font-size: 0.92rem;
    font-weight: 800;
    padding: 4px 10px;
    border-radius: 8px;
  }

  .hsk-exam-exit-btn {
    padding: 6px 12px;
    font-size: 0.85rem;
  }

  /* Full-width column layout on mobile: Question TOP (100% width), Sidebar/Nav BOTTOM (100% width) */
  .hsk-exam-layout-grid {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    box-sizing: border-box;
    gap: 14px;
  }

  .hsk-exam-content-card {
    order: 1; /* Question card at top for candidate focus */
    width: 100%;
    box-sizing: border-box;
    padding: 18px 14px;
    border-radius: 14px;
    min-height: auto;
  }

  .hsk-exam-sidebar-card {
    order: 2; /* Navigation list and segment submit at bottom */
    width: 100%;
    box-sizing: border-box;
    position: static;
    padding: 18px 14px;
    border-radius: 14px;
  }

  .hsk-q-circles-row {
    grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
    gap: 8px;
  }

  .hsk-tf-buttons-stack {
    max-width: 280px;
    width: 100%;
  }

  .hsk-tf-btn {
    height: 56px;
  }
}

/* ==========================================================================
   Custom Modern Exam Modal Dialog
   ========================================================================== */
.hsk-modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 1.5rem;
  animation: hskModalBgFade 0.2s ease;
}

.hsk-modal-card {
  background: #ffffff;
  border-radius: 24px;
  width: 100%;
  max-width: 460px;
  padding: 2.25rem 2rem;
  text-align: center;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  transform: scale(0.95);
  animation: hskModalCardPop 0.25s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes hskModalBgFade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes hskModalCardPop {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

.hsk-modal-icon-bubble {
  width: 68px;
  height: 68px;
  border-radius: 20px;
  background: #e0f2fe;
  color: #0284c7;
  font-size: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.25rem auto;
}

.hsk-modal-title {
  font-size: 1.35rem;
  font-weight: 900;
  color: #0f172a;
  margin: 0 0 0.75rem 0;
}

.hsk-modal-message {
  font-size: 0.98rem;
  color: #475569;
  line-height: 1.6;
  margin: 0 0 1.75rem 0;
  white-space: pre-line;
}

.hsk-modal-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.hsk-modal-btn-primary {
  flex: 1;
  background: #0284c7;
  color: #ffffff;
  border: none;
  font-size: 0.95rem;
  font-weight: 800;
  padding: 12px 20px;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.25);
  transition: all 0.15s ease;
}

.hsk-modal-btn-primary:hover {
  background: #0369a1;
  transform: translateY(-1px);
}

.hsk-modal-btn-secondary {
  flex: 1;
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
  font-size: 0.95rem;
  font-weight: 700;
  padding: 12px 20px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.hsk-modal-btn-secondary:hover {
  background: #e2e8f0;
  color: #1e293b;
}
