/**
 * RDHGates Quiz - 스타일시트
 * 
 * 문제 풀이 UI 스타일링
 */

/* 컨테이너 - 양옆 마진 없이 중앙 정렬 */
.ptg-quiz-container,
#ptg-quiz-container {
  max-width: 900px !important;
  width: 100% !important;
  margin: 0 !important;
  padding: 10px !important;
  box-sizing: border-box !important;
  overflow-x: hidden !important;
  position: relative !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
}

.ptg-quiz-header {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 12px !important;
  margin-top: 5px !important;
  margin-bottom: 18px !important;
  padding: 12px 14px !important;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%) !important;
  border: 1px solid #e5e7eb !important;
  border-radius: 12px !important;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06) !important;
}

.ptg-quiz-header h1 {
  position: relative !important;
  margin: 0 !important;
  font-size: 18px !important;
  font-weight: 700 !important;
  color: #0f172a !important;
  letter-spacing: -0.01em !important;
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
}

.ptg-quiz-tooltip-bubble {
  position: absolute;
  top: 100%;
  left: 10px;
  margin-top: 10px;
  background-color: #333;
  color: #fff;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  z-index: 1000;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  animation: ptg-tooltip-bounce 0.8s infinite alternate ease-in-out;
  pointer-events: none;
}

.ptg-quiz-tooltip-bubble::after {
  content: "";
  position: absolute;
  bottom: 100%;
  left: 20px;
  border-width: 6px;
  border-style: solid;
  border-color: transparent transparent #333 transparent;
}

@keyframes ptg-tooltip-bounce {
  from {
    transform: translateY(0);
  }

  to {
    transform: translateY(-5px);
  }
}

.ptg-quiz-header-right {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  flex-shrink: 0 !important;
  margin-left: auto !important;
  /* Force right alignment */
}

/* Unified Header Button Style (Study 1100과 통일) */
.ptg-quiz-dashboard-link,
.ptg-quiz-tip-link,
.rdhgates-time-tip-btn,
.rdhgates-btn-giveup-inline,
.ptg-quiz-toggle-btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  /* Slate-300 */
  border-radius: 8px !important;
  padding: 0 12px !important;
  height: 40px !important;
  /* Fixed Uniform Height */
  font-size: 13px !important;
  font-weight: 600 !important;
  color: #334155 !important;
  /* Slate-700 */
  text-decoration: none !important;
  white-space: nowrap !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05) !important;
  transition: all 0.2s ease !important;
  cursor: pointer !important;
  box-sizing: border-box !important;
  margin: 0 !important;
  gap: 8px !important;
}

/* Specific fixes for Checkbox Label */
.ptg-quiz-toggle-btn {
  background: #f8fafc !important;
  padding-right: 10px !important;
}

.ptg-quiz-toggle-btn input {
  margin: 0 !important;
  order: 2 !important;
  /* Put checkbox on the right */
  cursor: pointer !important;
}

.ptg-quiz-toggle-btn span {
  order: 1 !important;
  /* Put label on the left */
}

/* Active state for toggles */
.ptg-quiz-toggle-btn:has(input:checked) {
  background: #eff6ff !important;
  border-color: #3b82f6 !important;
  color: #1e40af !important;
}

.ptg-quiz-toggle-btn input {
  margin: 0 !important;
  order: 2 !important;
  /* Put checkbox on the right */
  cursor: pointer !important;
}

.ptg-quiz-toggle-btn span {
  order: 1 !important;
  /* Put label on the left */
}

/* Hover State */
.ptg-quiz-dashboard-link:hover,
.ptg-quiz-tip-link:hover,
.rdhgates-time-tip-btn:hover,
.rdhgates-btn-giveup-inline:hover,
.ptg-quiz-toggle-btn:hover {
  background: #f1f5f9 !important;
  /* Slate-100 */
  border-color: #94a3b8 !important;
  /* Slate-400 */
  transform: translateY(-1px) !important;
  text-decoration: none !important;
  color: #0f172a !important;
  /* Slate-900 */
}

/* Mobile Layout for Quiz Header */
@media (max-width: 768px) {

  /* Study Selection Header */
  .ptg-quiz-header {
    flex-direction: column !important;
    align-items: stretch !important;
    padding: 16px !important;
    height: auto !important;
    gap: 16px !important;
  }

  .ptg-quiz-header h1 {
    margin: 0 0 4px 0 !important;
    justify-content: center !important;
    width: 100% !important;
    text-align: center !important;
  }

  .ptg-quiz-header-right {
    width: 100% !important;
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    /* Force 2 columns */
    gap: 8px !important;
    margin-top: 0 !important;
  }

  /* Ensure last button takes full width if alone in its row */
  .ptg-quiz-header-right>*:last-child:nth-child(odd) {
    grid-column: 1 / -1 !important;
  }

  /* Buttons inside grid */
  .ptg-quiz-dashboard-link,
  .ptg-quiz-tip-link,
  .ptg-quiz-toggle-btn {
    width: 100% !important;
    min-width: 0 !important;
    /* Critical for Grid */
    font-size: 13px !important;
    padding: 0 10px !important;
    height: 42px !important;
    justify-content: center !important;
    box-sizing: border-box !important;
  }

  .ptg-header-btn .btn-text {
    display: inline !important;
    /* Ensure text is visible */
  }
}

@media (max-width: 480px) {

  .ptg-quiz-dashboard-link,
  .ptg-quiz-tip-link,
  .ptg-quiz-toggle-btn {
    font-size: 12px !important;
    padding: 0 6px !important;
  }

  .ptg-header-btn .btn-text {
    display: inline !important;
    /* Keep text visible even on small screens */
  }
}

/* 활성 필터 표시 영역 */
.ptg-quiz-active-filters {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  flex-wrap: wrap !important;
  order: 3 !important;
  /* 기본적으로 세 번째 위치 (데스크톱에서는 첫 번째 줄) */
}

.ptg-quiz-filter-badge {
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  padding: 6px 12px !important;
  background: #f1f5f9 !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 20px !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  color: #4a5568 !important;
  line-height: 1 !important;
  white-space: nowrap !important;
}

.ptg-quiz-filter-badge-icon {
  font-size: 14px !important;
  line-height: 1 !important;
}

.ptg-quiz-filter-badge-label {
  font-size: 13px !important;
  line-height: 1 !important;
}

.ptg-quiz-filter-badge-close {
  background: none !important;
  border: none !important;
  color: #64748b !important;
  font-size: 18px !important;
  line-height: 1 !important;
  cursor: pointer !important;
  padding: 0 !important;
  margin: 0 !important;
  margin-left: 4px !important;
  width: 18px !important;
  height: 18px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  border-radius: 50% !important;
  transition: all 0.2s ease !important;
  opacity: 0.8 !important;
}

.ptg-quiz-filter-badge-close:hover {
  opacity: 1 !important;
  background: #e2e8f0 !important;
  transform: scale(1.1) !important;
}

.ptg-header-btn {
  display: inline-flex;
  align-items: center;
  padding: 9px 18px;
  background: #f5f6f8;
  color: #1f2937;
  font-size: 14px;
  font-weight: 600;
  border-radius: 999px;
  text-decoration: none !important;
  border: 1px solid #e5e7eb;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
  white-space: nowrap;
}

.ptg-header-btn:hover {
  background: #e9ecf1;
  color: #111827;
}

.ptg-quiz-dashboard-link,
.ptg-quiz-tip-link {
  display: inline-flex !important;
  align-items: center !important;
  padding: 9px 18px !important;
  background: #f5f6f8 !important;
  color: #1f2937 !important;
  font-size: 14px !important;
  font-weight: 600 !important;
  border-radius: 999px !important;
  text-decoration: none !important;
  border: 1px solid #e5e7eb !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  font-family: inherit !important;
  white-space: nowrap !important;
}

.ptg-quiz-dashboard-link:hover,
.ptg-quiz-tip-link:hover {
  background: #e9ecf1 !important;
  color: #111827 !important;
}

/* 도구바 */
.ptg-quiz-toolbar {
  display: none;
  /* 시작 전에는 숨김 - 조회 후 표시 */
  justify-content: flex-start;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
  /* 사용자 요청: 최소 여백 */
  padding: 0;
  /* 사용자 요청: 배경이 투명하므로 패딩 제거 */
  background: transparent;
  /* 배경색 제거 */
  min-height: 50px;
  /* 드로잉 툴바(약 46px) 수용 */
  border-radius: 4px;
  position: relative;
  z-index: 20000 !important;
  /* 드로잉 오버레이보다 높게 설정, 모바일 메뉴보다 낮게 */
}

/* 퀴즈 툴바 내 모든 버튼의 테마 border 제거 (최우선 적용) */
.ptg-quiz-toolbar button,
.ptg-quiz-toolbar button[type="button"],
.ptg-quiz-toolbar [type="button"] {
  border: none !important;
  outline: none !important;
}

.ptg-quiz-toolbar button:hover,
.ptg-quiz-toolbar button:focus,
.ptg-quiz-toolbar button:active,
.ptg-quiz-toolbar button:focus-visible {
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
}

/* 드로잉 툴바 (왼쪽) */
.ptg-drawing-toolbar {
  flex-shrink: 0;
  /* 크기 고정 */
}

.ptg-toolbar-icons {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
  /* 크기 고정 */
  margin-left: auto;
  /* 항상 오른쪽에 고정 */
  overflow: visible !important;
  /* 오버플로우 방지 */
  flex-wrap: nowrap !important;
  /* 줄바꿈 방지 */
  min-width: fit-content;
  /* 버튼이 모두 들어갈 수 있도록 */
}

/* 테마 CSS button border 완전히 덮어쓰기 */
button.ptg-btn-icon,
.ptg-quiz-toolbar button.ptg-btn-icon,
.ptg-quiz-toolbar .ptg-toolbar-icons button,
button[type="button"].ptg-btn-icon,
[type="button"].ptg-btn-icon,
.ptg-btn-icon {
  background: transparent;
  border: none !important;
  padding: 8px;
  cursor: pointer;
  font-size: 20px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 8px;
  color: #333;
  outline: none !important;
  position: relative;
  transform: scale(1);
  box-shadow: none !important;
}

/* 모든 상태에서 border 제거 */
button.ptg-btn-icon:hover,
button.ptg-btn-icon:focus,
button.ptg-btn-icon:active,
button.ptg-btn-icon:focus-visible,
.ptg-quiz-toolbar button:hover,
.ptg-quiz-toolbar button:focus,
.ptg-quiz-toolbar button:active,
.ptg-quiz-toolbar .ptg-btn-icon:hover,
.ptg-quiz-toolbar .ptg-btn-icon:focus,
.ptg-quiz-toolbar .ptg-btn-icon:active {
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
}

/* 모든 버튼 hover 시에만 색상 변화 (active 상태가 아닐 때) */
.ptg-btn-icon:not(.active):hover {
  color: #d63638;
  background-color: #fcd5d5;
  transform: scale(1.05);
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
}

/* 북마크 활성화 상태 - 심플한 금색 배경 */
/* 북마크 활성화 상태 - Blue Outline */
.ptg-quiz-toolbar .ptg-toolbar-icons .ptg-btn-bookmark.active,
.ptg-btn-icon.ptg-btn-bookmark.active {
  color: #4a90e2 !important;
  background-color: transparent !important;
  border: 2px solid #4a90e2 !important;
}

.ptg-quiz-toolbar .ptg-toolbar-icons .ptg-btn-bookmark.active:hover,
.ptg-btn-icon.ptg-btn-bookmark.active:hover {
  background-color: rgba(74, 144, 226, 0.05) !important;
  border-color: #357abd !important;
  color: #357abd !important;
}

/* 복습 활성화 상태 - 심플한 주황색 배경 */
/* 복습 활성화 상태 - Blue Outline */
.ptg-quiz-toolbar .ptg-toolbar-icons .ptg-btn-review.active,
.ptg-btn-icon.ptg-btn-review.active {
  color: #4a90e2 !important;
  background-color: transparent !important;
  border: 2px solid #4a90e2 !important;
}

.ptg-quiz-toolbar .ptg-toolbar-icons .ptg-btn-review.active:hover,
.ptg-btn-icon.ptg-btn-review.active:hover {
  background-color: rgba(74, 144, 226, 0.05) !important;
  border-color: #357abd !important;
  color: #357abd !important;
}

/* 메모 활성화 상태 - 심플한 파란색 배경 */
/* 메모 활성화 상태 - Blue Outline */
.ptg-quiz-toolbar .ptg-toolbar-icons .ptg-btn-notes.active,
.ptg-btn-icon.ptg-btn-notes.active {
  color: #4a90e2 !important;
  background-color: transparent !important;
  border: 2px solid #4a90e2 !important;
}

.ptg-quiz-toolbar .ptg-toolbar-icons .ptg-btn-notes.active:hover,
.ptg-btn-icon.ptg-btn-notes.active:hover {
  background-color: rgba(74, 144, 226, 0.05) !important;
  border-color: #357abd !important;
  color: #357abd !important;
}

/* 암기카드 활성화 상태 - 심플한 보라색 배경 */
/* 암기카드 활성화 상태 - Blue Outline */
.ptg-quiz-toolbar .ptg-toolbar-icons .ptg-btn-flashcard.active,
.ptg-btn-icon.ptg-btn-flashcard.active {
  color: #4a90e2 !important;
  background-color: transparent !important;
  border: 2px solid #4a90e2 !important;
}

.ptg-quiz-toolbar .ptg-toolbar-icons .ptg-btn-flashcard.active:hover,
.ptg-btn-icon.ptg-btn-flashcard.active:hover {
  background-color: rgba(74, 144, 226, 0.05) !important;
  border-color: #357abd !important;
  color: #357abd !important;
}

/* 드로잉 활성화 상태 - 심플한 초록색 배경 */
/* 드로잉 활성화 상태 - Blue Outline */
.ptg-quiz-toolbar .ptg-toolbar-icons .ptg-btn-drawing.active,
.ptg-btn-icon.ptg-btn-drawing.active {
  color: #4a90e2 !important;
  background-color: transparent !important;
  border: 2px solid #4a90e2 !important;
}

.ptg-quiz-toolbar .ptg-toolbar-icons .ptg-btn-drawing.active:hover,
.ptg-btn-icon.ptg-btn-drawing.active:hover {
  background-color: rgba(74, 144, 226, 0.05) !important;
  border-color: #357abd !important;
  color: #357abd !important;
}

/* 포커스 상태 - active 상태가 아닐 때는 outline 제거 */
.ptg-btn-icon:not(.active):focus,
.ptg-btn-icon:not(.active):focus-visible {
  outline: none !important;
  outline-offset: 0 !important;
  color: #333;
  background-color: transparent;
  border: none !important;
  box-shadow: none !important;
}

.ptg-btn-icon:not(.active):focus:hover,
.ptg-btn-icon:not(.active):focus-visible:hover {
  color: #d63638;
  background-color: #ffe5e5;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
}

/* active 상태와 포커스 상태가 함께 있을 때 - outline 제거 */
.ptg-btn-icon.active:focus,
.ptg-btn-icon.active:focus-visible {
  outline: none !important;
  outline-offset: 0 !important;
  border: none !important;
}

.ptg-btn-icon.active:focus:hover,
.ptg-btn-icon.active:focus-visible:hover {
  outline: none !important;
  border: none !important;
}

/* 클릭 시 색상 변화 방지 (:active 의사 클래스 제거) */
.ptg-btn-icon:active:not(.active):not(:focus) {
  color: inherit;
  background-color: transparent;
}

/* 타이머 (답안 제출 버튼 우측) */
.ptg-quiz-timer {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: #fff3cd;
  border: 1px solid #ffc107;
  border-radius: 4px;
  flex-shrink: 0;
  /* 크기 고정 */
  margin-left: auto;
  /* 우측 정렬 */
  flex-wrap: nowrap;
  /* 줄바꿈 방지 */
}

.ptg-timer-label {
  font-weight: 500;
  font-size: 14px;
  color: #856404;
  white-space: nowrap;
}

.ptg-timer-display {
  font-size: 14px;
  font-weight: 600;
  font-family: monospace;
  color: #856404;
  min-width: 50px;
  /* 최소 너비 보장 */
  text-align: center;
}

/* 필터 섹션 (rdhgates-engine과 동일) */
.rdhgates-filter-section {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 10px 15px;
  /* 패딩도 조금 줄임 */
  margin-bottom: 4px;
  /* 사용자 요청: 최소 여백 */
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  /* 간격 줄임 */
  align-items: flex-end;
}

.rdhgates-filter-row {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1;
  min-width: 150px;
}

.rdhgates-filter-row label {
  display: none !important;
}

.rdhgates-filter-input {
  padding: 10px 12px;
  padding-right: 30px;
  /* Space for custom arrow */
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
  background-color: white;
  transition: border-color 0.2s;

  /* iOS/iPad Fix: Reset native appearance */
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  height: 42px;
  /* Explicit height for consistency */

  /* Custom Arrow (Robust) */
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23333333'%3e%3cpath d='M7 10l5 5 5-5z'/%3e%3c/svg%3e") !important;
  background-repeat: no-repeat !important;
  background-position: calc(100% - 10px) center !important;
  background-size: 16px 16px !important;
}

.rdhgates-filter-input:focus {
  outline: none;
  border-color: #4a90e2;
  box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

.rdhgates-filter-actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
}

/* 버튼 (rdhgates-engine과 동일) */
.rdhgates-btn {
  padding: 12px 24px;
  border: none;
  border-radius: 4px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.rdhgates-btn-primary {
  background: #4a90e2;
  color: white;
}

.rdhgates-btn-primary:hover {
  background: #357abd;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(74, 144, 226, 0.3);
}

.rdhgates-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* 진행 상태 (rdhgates-engine과 동일) */
.rdhgates-progress-section {
  margin-top: 0;
  margin-bottom: 4px !important;
  /* 사용자 요청: 최소 여백 */
}

.rdhgates-progress-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-size: 16px;
  font-weight: 600;
}

.rdhgates-progress-right {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  gap: 12px;
}

.rdhgates-time-tip-btn {
  background: none;
  border: none;
  color: #4a90e2;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
  transition: color 0.2s;
  white-space: nowrap;
  display: inline-block !important;
  flex-shrink: 0;
}

.rdhgates-time-tip-btn:hover {
  color: #357abd;
}

.rdhgates-btn-giveup-inline {
  background: #dc3545;
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 16px;
  transition: all 0.2s;
  white-space: nowrap;
  display: inline-block !important;
  flex-shrink: 0;
}

.rdhgates-btn-giveup-inline:hover {
  background: #c82333;
}

.rdhgates-timer {
  color: #4a90e2;
  font-family: "Courier New", monospace;
  white-space: nowrap;
  display: inline-block !important;
}

.rdhgates-progress-bar {
  height: 8px;
  background: #e9ecef;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 1px !important;
}

.rdhgates-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #4a90e2, #357abd);
  transition: width 0.3s ease;
  width: 0%;
}

/* 시간관리 tip 모달 (rdhgates-engine과 동일) */
.rdhgates-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 999999 !important;
}

.rdhgates-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(2px);
}

.rdhgates-modal-content {
  position: relative;
  max-width: 800px;
  max-height: 90vh;
  margin: 5vh auto;
  background: white;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.rdhgates-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 25px;
  border-bottom: 1px solid #e9ecef;
  background: #f8f9fa;
}

.rdhgates-modal-header h3 {
  margin: 0;
  color: #333;
  font-size: 20px;
  font-weight: 700;
}

.rdhgates-modal-close {
  background: none;
  border: none;
  font-size: 32px;
  color: #666;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  line-height: 28px;
  text-align: center;
  transition: color 0.2s;
}

.rdhgates-modal-close:hover {
  color: #dc3545;
}

.rdhgates-modal-body {
  padding: 25px;
  overflow-y: auto;
  flex: 1;
}

.rdhgates-modal-body p {
  margin-bottom: 15px;
  line-height: 1.7;
  color: #333;
}

.rdhgates-time-table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  font-size: 14px;
}

.rdhgates-time-table thead {
  background: #4a90e2;
  color: white;
}

.rdhgates-time-table th,
.rdhgates-time-table td {
  padding: 12px;
  text-align: left;
  border: 1px solid #dee2e6;
}

.rdhgates-time-table tbody tr:nth-child(even) {
  background: #f8f9fa;
}

.rdhgates-time-table tbody tr:hover {
  background: #e9ecef;
}

.rdhgates-tip-summary {
  margin-top: 25px;
  padding: 20px;
  background: #f8f9fa;
  border-radius: 6px;
  border-left: 4px solid #4a90e2;
  font-size: 14px;
}

.rdhgates-tip-summary h4 {
  margin: 0 0 15px 0;
  color: #4a90e2;
  font-size: 18px;
}

.rdhgates-tip-summary ul {
  margin: 15px 0;
  padding-left: 25px;
}

.rdhgates-tip-summary li {
  margin-bottom: 10px;
  line-height: 1.7;
  color: #333;
}

.rdhgates-tip-summary p {
  margin-top: 15px;
  margin-bottom: 0;
  font-weight: 600;
  color: #333;
}

/* 문제 카드 영역 */
.ptg-quiz-card-wrapper {
  position: relative;
  margin-top: 20px !important;
  margin-bottom: 30px !important;
  display: none;
  /* 시작 전에는 숨김 - 조회 후 표시 */
}

.ptg-quiz-card {
  background: #fff;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  padding: 30px;
  min-height: 200px;
  /* 기출 문제 학습과 동일한 스타일 */
  margin-bottom: 20px !important;
  position: relative;
  /* 드로잉 오버레이를 위한 기준점 */
}

/* 로딩 페이지가 표시될 때 카드 하단 border 숨김 (JavaScript에서 클래스 추가) */
.ptg-quiz-card.loading-active {
  border-bottom: none !important;
}

/* 로딩 페이지가 표시될 때 카드 자체의 하단 border도 완전히 제거 */
.ptg-quiz-card:has(.ptg-quiz-loading[style*="flex"]) {
  border-bottom: none !important;
}

/* 로딩 페이지 자체의 하단 border 및 가상 요소 제거 */
.ptg-quiz-loading::after,
.ptg-quiz-loading::before {
  display: none !important;
  content: none !important;
}

/* 로딩 페이지가 표시될 때 카드 border 조정 */
.ptg-quiz-card .ptg-quiz-loading {
  margin-bottom: 0 !important;
  padding-bottom: 20px !important;
}

.ptg-question-content {
  font-size: 16px;
  line-height: 1.6;
  color: #333;
  margin: 0;
  margin-bottom: 8px;
  white-space: pre-wrap;
  /* 줄바꿈 보존 */
  /* 기출 문제 학습과 동일 */
  /* 문제 번호 앞 공백 제거 */
  text-indent: 0;
}

/* 문제 번호 앞 공백 완전 제거 */
.ptg-question-content::before {
  content: "";
  display: none;
}

/* 문제 번호 스타일 - 앞 공백 없음 */
.ptg-question-content .ptg-question-number {
  margin-left: 0;
  padding-left: 0;
  display: inline;
}

/* 문제 번호 앞의 모든 공백 제거 */
.ptg-question-content strong.ptg-question-number {
  margin-left: 0 !important;
  padding-left: 0 !important;
}

.ptg-explanation-content {
  line-height: 1.6;
  white-space: pre-wrap;
  /* 줄바꿈 보존 */
}

/* 선택지 영역 (카드 안에 포함) - 기출 문제 학습 형식 */
.ptg-quiz-card .ptg-quiz-choices {
  margin-top: 0px !important;
  margin-bottom: 0px !important;
  /* 질문 바로 아래에 연속해서 표시 */
}

.ptg-quiz-loading {
  text-align: center;
  padding: 20px 15px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100px;
  background: #ffffff;
  border-radius: 8px;
  border: none !important;
  border-bottom: none !important;
  box-shadow: none !important;
  margin-bottom: 0 !important;
  padding-bottom: 20px !important;
  position: relative;
  overflow: hidden;
}

/* 로딩 페이지 하단의 모든 border 및 선 제거 */
.ptg-quiz-loading::after {
  display: none !important;
  content: none !important;
}

/* 로딩 중에는 프로그레스바 숨김 */
.ptg-quiz-loading~.rdhgates-progress-section,
.ptg-quiz-loading~* .rdhgates-progress-section,
.ptg-quiz-card:has(.ptg-quiz-loading[style*="flex"])~.rdhgates-progress-section {
  display: none !important;
}

/* 로딩 페이지 하단의 긴 막대 제거 (프로그레스바 또는 border) */
.ptg-quiz-loading+.rdhgates-progress-bar,
.ptg-quiz-loading+* .rdhgates-progress-bar,
.ptg-quiz-card:has(.ptg-quiz-loading) .rdhgates-progress-bar {
  display: none !important;
  height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  border: none !important;
}

.ptg-loading-logo {
  margin-bottom: 12px;
}

.ptg-logo-text {
  font-size: 24px;
  font-weight: 700;
  color: #3b82f6;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: logoFadeIn 0.6s ease-in;
}



/* 드로잉 활성화 시 전체 페이지 스크롤 차단 */
body.drawing-active,
html.drawing-active {
  overflow: hidden !important;
  position: fixed !important;
  width: 100% !important;
  height: 100% !important;
  overscroll-behavior: none !important;
}

/* 드로잉 활성화 시 컨테이너 스크롤 차단 */
.ptg-quiz-container.drawing-active,
#ptg-quiz-container.drawing-active,
.ptg-quiz-card-wrapper.drawing-active {
  overflow: hidden !important;
  overscroll-behavior: none !important;
}

/* 드로잉 오버레이 - 카드 내부에 absolute로 배치하여 카드 크기와 자동 일치 */
.ptg-drawing-overlay {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100% !important;
  height: 100% !important;
  background: transparent;
  z-index: 100;
  /* 툴바(z-index: 1000)보다 낮게 설정 */
  pointer-events: none;
  /* 기본적으로 모든 이벤트 통과 */
  overflow: hidden !important;
  /* 스크롤바 방지 */
  overscroll-behavior: none !important;
  /* 스크롤 체이닝 방지 */
}

.ptg-drawing-overlay.active {
  pointer-events: none;
  /* 오버레이 자체는 이벤트 통과 */
  overflow: hidden !important;
  /* 스크롤바 방지 */
  overscroll-behavior: none !important;
  /* 스크롤 체이닝 방지 */
}

.ptg-drawing-overlay #ptg-drawing-canvas {
  pointer-events: auto !important;
  /* 캔버스만 이벤트 수신 */
  z-index: 101;
  /* 툴바(z-index: 1000)보다 낮게 */
  overflow: hidden !important;
  /* 스크롤바 방지 */
}

#ptg-drawing-canvas {
  display: block;
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath fill='%23333' d='M20.71 4.63l-1.34-1.34c-.39-.39-1.02-.39-1.41 0L9 12.25 11.75 15l8.96-8.96c.39-.39.39-1.02 0-1.41zM7 14a3 3 0 0 0-3 3c0 1.31-1.16 2-2 2 .92 1.22 2.49 2 4 2a4 4 0 0 0 4-4c0-1.31-.84-2.42-2-2.83z'/%3E%3C/svg%3E") 0 24,
    crosshair;
  pointer-events: auto;
  z-index: 101;
  /* 툴바보다 낮게 */
  overflow: hidden !important;
  /* 스크롤바 방지 */
}

.ptg-drawing-toolbar {
  display: flex;
  gap: 6px;
  background: #ffffff;
  padding: 6px 10px;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  border: 1px solid #e0e0e0;
  align-items: center;
  flex-shrink: 0;
  /* 크기 고정 */
  z-index: 2;
  /* 타이머보다 위에 표시 */
  position: relative;
  /* z-index 적용을 위해 */
}

.ptg-btn-draw {
  background: transparent;
  border: 1px solid #d0d0d0;
  padding: 6px;
  cursor: pointer;
  border-radius: 4px;
  font-size: 16px;
  color: #333;
  transition: all 0.2s;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.ptg-btn-draw:hover {
  background-color: #ffe5e5 !important;
  border-color: #d0d0d0;
  color: #d38485;
}

.ptg-btn-draw:active {
  background-color: #ffe5e5 !important;
  transform: scale(0.98);
}

.ptg-btn-draw.active {
  background-color: #ffe5e5 !important;
  border-color: #d38485;
  color: #d38485;
}

.ptg-btn-draw.active:hover {
  background-color: #ffe5e5 !important;
  border-color: #d38485;
  color: #d38485;
}

.ptg-pen-controls {
  position: relative;
  display: inline-block;
}

.ptg-pen-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  background: #ffffff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  padding: 12px;
  min-width: 180px;
  z-index: 10001;
}

.ptg-pen-menu-section {
  margin-bottom: 12px;
}

.ptg-pen-menu-section:last-child {
  margin-bottom: 0;
}

.ptg-pen-menu-label {
  font-size: 12px;
  font-weight: 600;
  color: #666;
  margin-bottom: 8px;
}

.ptg-pen-color-options {
  display: flex;
  gap: 8px;
  align-items: center;
}

.ptg-pen-color-btn {
  width: 32px;
  height: 32px;
  border: 2px solid #ddd;
  border-radius: 4px;
  cursor: pointer;
  padding: 0;
  background: transparent;
  transition: all 0.2s;
  position: relative;
}

.ptg-pen-color-btn:hover {
  border-color: #999;
  transform: scale(1.1);
}

.ptg-pen-color-btn.active {
  border-color: #333;
  border-width: 3px;
  box-shadow: 0 0 0 2px rgba(51, 51, 51, 0.2);
}

.ptg-pen-color-btn.active::after {
  content: "✓";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #fff;
  font-size: 14px;
  font-weight: bold;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.ptg-pen-width-slider-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
}

.ptg-pen-width-slider {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: #e0e0e0;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}

.ptg-pen-width-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #d38485;
  cursor: pointer;
  border: 2px solid #fff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  transition: all 0.2s;
}

.ptg-pen-width-slider::-webkit-slider-thumb:hover {
  background: #c06a6b;
  transform: scale(1.1);
}

.ptg-pen-width-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #d38485;
  cursor: pointer;
  border: 2px solid #fff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  transition: all 0.2s;
}

.ptg-pen-width-slider::-moz-range-thumb:hover {
  background: #c06a6b;
  transform: scale(1.1);
}

.ptg-pen-width-slider::-moz-range-track {
  height: 6px;
  border-radius: 3px;
  background: #e0e0e0;
}

#ptg-pen-width-value {
  font-weight: 600;
  color: #d38485;
  min-width: 30px;
  display: inline-block;
  text-align: right;
}

.ptg-pen-alpha-slider-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
}

.ptg-pen-alpha-slider {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: #e0e0e0;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}

.ptg-pen-alpha-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #d38485;
  cursor: pointer;
  border: 2px solid #fff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  transition: all 0.2s;
}

.ptg-pen-alpha-slider::-webkit-slider-thumb:hover {
  background: #c06a6b;
  transform: scale(1.1);
}

.ptg-pen-alpha-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #d38485;
  cursor: pointer;
  border: 2px solid #fff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  transition: all 0.2s;
}

.ptg-pen-alpha-slider::-moz-range-thumb:hover {
  background: #c06a6b;
  transform: scale(1.1);
}

.ptg-pen-alpha-slider::-moz-range-track {
  height: 6px;
  border-radius: 3px;
  background: #e0e0e0;
}

#ptg-pen-alpha-value {
  font-weight: 600;
  color: #d38485;
  min-width: 30px;
  display: inline-block;
  text-align: right;
}

.ptg-btn-close-drawing {
  background: #f5f5f5;
  color: #666;
  border: 1px solid #d0d0d0;
  padding: 6px;
  cursor: pointer;
  border-radius: 4px;
  font-size: 16px;
  transition: all 0.2s;
  margin-left: 4px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.ptg-btn-close-drawing:hover {
  background-color: #ffe5e5 !important;
  border-color: #d0d0d0;
  color: #d38485;
}

/* 선택지 영역 - 공통 퀴즈 UI 컴포넌트 스타일 사용 */
/* 공통 컴포넌트가 .ptg-quiz-ui-* 클래스를 사용하므로, 기존 클래스도 동일한 스타일 적용 */
.ptg-quiz-choices,
.ptg-quiz-ui-options-container {
  margin-bottom: 0 !important;
  margin-top: 0 !important;
  width: 100% !important;
  display: block !important;
  flex-direction: column !important;
  flex-wrap: nowrap !important;
  border: 2px solid #e9ecef;
  border-radius: 6px;
  padding: 10px 12px;
  background: white;
  box-sizing: border-box;
  /* 기출 문제 학습과 동일 - 질문 바로 아래에 연속해서 표시 */
}

.ptg-quiz-choices>*,
.ptg-quiz-ui-options-container>* {
  display: block !important;
  width: 100% !important;
  float: none !important;
  clear: both !important;
  flex: none !important;
  flex-basis: auto !important;
}

.ptg-option-label,
.ptg-quiz-ui-option-label {
  display: flex !important;
  flex-direction: row !important;
  align-items: flex-start;
  padding: 4px 8px !important;
  margin-bottom: 0 !important;
  border: none !important;
  border-radius: 0 !important;
  cursor: pointer;
  transition: all 0.2s;
  background: transparent !important;
  width: 100% !important;
  box-sizing: border-box;
  min-height: auto;
  user-select: none;
  clear: both;
}

.ptg-option-label:hover,
.ptg-quiz-ui-option-label:hover {
  background: #f8f9ff !important;
}

.ptg-option-label input[type="radio"],
.ptg-radio-input,
.ptg-quiz-ui-option-label input[type="radio"],
.ptg-quiz-ui-radio-input {
  margin-right: 8px !important;
  margin-top: 2px !important;
  cursor: pointer !important;
  flex-shrink: 0 !important;
  width: 20px !important;
  height: 20px !important;
  min-width: 20px !important;
  min-height: 20px !important;
  max-width: 20px !important;
  max-height: 20px !important;
  position: relative !important;
  z-index: 10 !important;
  pointer-events: auto !important;
  opacity: 1 !important;
  visibility: visible !important;
  display: inline-block !important;
  -webkit-appearance: radio !important;
  -moz-appearance: radio !important;
  appearance: radio !important;
}

.ptg-option-label input[type="radio"]:checked+.ptg-option-text,
.ptg-quiz-ui-option-label input[type="radio"]:checked+.ptg-quiz-ui-option-text {
  font-weight: 600;
  color: #4a90e2;
}

.ptg-option-text,
.ptg-quiz-ui-option-text {
  flex: 1;
  line-height: 1.3;
  color: #333 !important;
  white-space: pre-line !important;
  /* 줄바꿈 유지 */
  word-wrap: break-word !important;
  overflow-wrap: break-word !important;
  display: block !important;
  width: calc(100% - 40px) !important;
  visibility: visible !important;
  opacity: 1 !important;
  font-size: 16px !important;
}

/* 정답/오답 표시 */
.ptg-option-label.ptg-correct-answer,
.ptg-choice-item.correct,
.ptg-quiz-ui-option-label.ptg-quiz-ui-correct-answer {
  background: #d4edda !important;
}

.ptg-option-label.ptg-incorrect-answer,
.ptg-choice-item.incorrect,
.ptg-quiz-ui-option-label.ptg-quiz-ui-incorrect-answer {
  background: #f8d7da !important;
}

/* 주관식 답안 입력 */
.ptg-text-answer {
  width: 100%;
  padding: 12px;
  border: 2px solid #e9ecef;
  border-radius: 6px;
  font-size: 16px;
}

/* 액션 버튼 */
.ptg-quiz-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 20px;
  margin-bottom: 20px;
  position: relative;
  display: none;
  /* 시작 전에는 숨김 - 조회 후 표시 */
  flex-wrap: nowrap;
  overflow-x: visible;
  /* 양쪽 끝이 잘리지 않도록 */
  padding: 0;
  width: 100%;
  box-sizing: border-box;
}

.ptg-quiz-actions .ptg-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 94px;
  margin: 0;
  white-space: nowrap;
  flex-shrink: 0;
  padding: 9px 18px !important;
  font-size: 14px !important;
  font-weight: 600 !important;
  background: #f5f6f8 !important;
  color: #1f2937 !important;
  border-radius: 999px !important;
  text-decoration: none !important;
  border: 1px solid #e5e7eb !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  font-family: inherit !important;
}

.ptg-quiz-actions .ptg-btn:hover {
  background: #e9ecf1 !important;
  color: #111827 !important;
}

.ptg-btn-primary {
  background: #ff6b9d;
  color: white;
  border: 1px solid #ff4d8a;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.ptg-btn-primary:hover {
  background: #ff4d8a;
  border-color: #ff4d8a;
}

.ptg-btn-primary:disabled {
  background: #ccc;
  border-color: #ccc;
  cursor: not-allowed;
  opacity: 0.6;
}

/* 정답 확인 버튼 스타일 통일 (다른 버튼들과 동일) */

/* 해설 영역 */
.ptg-quiz-explanation {
  background: #f0f7fc;
  border-left: 4px solid #0073aa;
  padding: 16px;
  border-radius: 4px;
  margin-top: 24px;
  margin-bottom: 0;
  /* 카드 안에 포함되므로 하단 마진 제거 */
}

.ptg-quiz-explanation h3 {
  margin-top: 0;
  color: #0073aa;
  font-size: 17px;
}

.ptg-explanation-content {
  line-height: 1.6;
}

/* 메모 패널 */
.ptg-notes-panel {
  margin-top: 0;
  /* 툴바 아래 바로 위치하므로 상단 마진 제거 (툴바의 margin-bottom 활용) */
  margin-bottom: 24px;
  /* 카드와의 간격 */
  background: #fff;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  overflow: hidden;
}

.ptg-notes-title {
  margin: 0;
  font-size: 12px;
  font-weight: 500;
  color: #333;
  line-height: 1.2;
}

.ptg-btn-close-notes {
  background: transparent;
  border: none;
  border-radius: 2px;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  font-size: 12px;
  color: #666;
  line-height: 1;
  transition: all 0.2s;
}

.ptg-btn-close-notes:hover {
  background: #e0e0e0;
  color: #333;
}

.ptg-btn-close-notes:focus {
  outline: 1px solid #0073aa;
  outline-offset: 1px;
}

.ptg-notes-content {
  padding: 16px;
}

.ptg-notes-textarea {
  width: 100%;
  min-height: 68px;
  /* 2 lines: (14px * 1.5 * 2) + 24px padding + 2px border */
  padding: 12px;
  border: 1px solid #c3c4c7;
  border-radius: 4px;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.5;
  resize: vertical;
  box-sizing: border-box;
  transition: border-color 0.2s;
}

.ptg-notes-textarea:focus {
  outline: none;
  border-color: #0073aa;
  box-shadow: 0 0 0 1px #0073aa;
}

.ptg-notes-textarea::placeholder {
  color: #999;
}

/* 800px 이하에서도 한 줄 유지 */
@media (max-width: 900px) {

  .ptg-quiz-container,
  #ptg-quiz-container {
    max-width: 100% !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    left: 0 !important;
    transform: none !important;
  }

  /* 모바일에서 헤더 스타일 */
  .ptg-quiz-header {
    padding: 12px 10px !important;
    gap: 8px !important;
    flex-wrap: wrap !important;
  }

  .ptg-quiz-header h1 {
    font-size: 16px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    flex: 0 0 auto !important;
  }

  .ptg-quiz-header-right {
    gap: 8px !important;
    flex: 0 0 auto !important;
  }

  /* 모바일에서 활성 필터 배너를 두 번째 줄로 이동 */
  .ptg-quiz-active-filters {
    width: 100% !important;
    order: 3 !important;
    margin-top: 8px !important;
    flex-basis: 100% !important;
    padding-top: 8px !important;
    border-top: 1px solid #e5e7eb !important;
  }

  .ptg-quiz-dashboard-link,
  .ptg-quiz-tip-link {
    font-size: 12px !important;
    padding: 5px 10px !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
  }

  .ptg-quiz-card {
    padding: 16px;
    margin-top: 20px;
    margin-bottom: 20px;
  }

  /* 모바일에서 드로잉 기능 완전히 숨김 */
  .ptg-btn-drawing,
  .ptg-drawing-toolbar {
    display: none !important;
  }

  .ptg-drawing-toolbar {
    flex-wrap: wrap;
    bottom: 10px;
    padding: 8px 10px;
    gap: 4px;
  }

  .ptg-btn-draw {
    font-size: 16px;
    padding: 6px;
    width: 32px;
    height: 32px;
  }

  .ptg-btn-close-drawing {
    padding: 6px;
    font-size: 16px;
    width: 32px;
    height: 32px;
  }

  /* 모바일에서 답안 제출 버튼 영역 레이아웃 조정 */
  .ptg-quiz-actions {
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
  }

  /* 모바일에서 타이머 스타일 조정 */
  .ptg-quiz-timer {
    padding: 12px 24px;
    margin-left: 0;
    /* 모바일에서는 왼쪽 정렬 */
    width: 100%;
    /* 모바일에서는 전체 너비 */
    justify-content: center;
    /* 중앙 정렬 */
    margin-top: 0;
    /* 버튼과의 간격은 gap으로 처리 */
  }

  .ptg-timer-label {
    font-size: 16px !important;
    font-weight: 500 !important;
  }

  .ptg-timer-display {
    font-size: 16px !important;
    font-weight: 600 !important;
    min-width: 50px !important;
  }

  .ptg-btn-giveup-inline {
    font-size: 14px !important;
    padding: 5px 12px !important;
    margin-left: 8px !important;
  }

  /* 모바일에서 버튼 크기 조정 */
  .ptg-quiz-actions .ptg-btn {
    min-width: auto;
    flex: 0 0 auto;
    max-width: none;
    width: auto;
    padding: 6px 10px;
    font-size: 13px;
  }

  .ptg-quiz-header {
    padding: 12px 10px !important;
    gap: 8px !important;
    flex-wrap: wrap !important;
  }

  .ptg-quiz-header-right {
    gap: 8px !important;
    flex: 0 0 auto !important;
  }

  .ptg-quiz-header h1 {
    font-size: 16px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    flex: 0 0 auto !important;
  }

  /* 모바일에서 활성 필터 배너를 두 번째 줄로 이동 */
  .ptg-quiz-active-filters {
    width: 100% !important;
    order: 3 !important;
    margin-top: 8px !important;
    flex-basis: 100% !important;
    padding-top: 8px !important;
    border-top: 1px solid #e5e7eb !important;
  }

  .ptg-quiz-dashboard-link,
  .ptg-quiz-tip-link {
    font-size: 12px !important;
    padding: 5px 10px !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
  }
}

/* 접근성 */
.ptg-btn-icon:focus-visible {
  outline: none !important;
  outline-offset: 0 !important;
  border: none !important;
}

.ptg-btn:focus-visible,
.ptg-choice-item:focus-visible {
  outline: 2px solid #0073aa;
  outline-offset: 2px;
}

/* 암기카드 모달 스타일 */
.ptg-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10000;
  display: none;
  overflow-y: auto;
  padding: 20px;
  box-sizing: border-box;
}

.ptg-modal[style*="display: flex"],
.ptg-modal[style*="display:block"],
.ptg-modal.show {
  display: flex !important;
  align-items: center;
  justify-content: center;
}

/* 모달 컨텐츠 화면 정중앙 정렬 */
.ptg-modal-content {
  position: relative;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  width: 90%;
  max-width: 600px;
  max-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
  animation: ptg-modal-fade-in 0.3s ease;
  z-index: 10001;
  /* 화면 정중앙 정렬 보장 - flex 컨테이너 내에서 자동 중앙 정렬 */
  margin: auto;
  overflow-y: auto;
}

@keyframes ptg-modal-fade-in {
  from {
    opacity: 0;
    transform: scale(0.95);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

.ptg-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid #e5e7eb;
  background: linear-gradient(135deg, #4a90e2 0%, #357abd 100%);
  color: #fff;
  border-top-left-radius: 12px;
  border-top-right-radius: 12px;
}

.ptg-modal-header h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  color: #fff;
}

.ptg-modal-close {
  background: #fff;
  border: none;
  color: #1d3f7c;
  font-size: 28px;
  line-height: 1;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.ptg-modal-close:hover {
  background: #f0f4ff;
  transform: scale(1.1);
}

.ptg-modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.ptg-modal-body textarea {
  width: 100%;
  min-height: 150px;
  padding: 12px;
  border: 1px solid #cbd5e0;
  border-radius: 6px;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.6;
  resize: vertical;
  box-sizing: border-box;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.ptg-modal-body textarea:focus {
  outline: none;
  border-color: #4a90e2;
  box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

.ptg-modal-body .form-group {
  margin-bottom: 16px;
}

.ptg-modal-body .form-group:last-child {
  margin-bottom: 0;
}

.ptg-modal-body .form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: #333;
  font-size: 14px;
}

.ptg-modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 24px;
  border-top: 1px solid #e5e7eb;
  background: #f9fafb;
  border-bottom-left-radius: 12px;
  border-bottom-right-radius: 12px;
}

.ptg-flashcard-status {
  flex: 1;
  font-size: 14px;
  color: #666;
}

@media (max-width: 768px) {
  .ptg-modal-content {
    width: 95%;
    max-height: 85vh;
  }

  .ptg-modal-header,
  .ptg-modal-body,
  .ptg-modal-footer {
    padding: 16px;
  }
}

/* 완료 화면 (결과 요약) */
.ptg-quiz-result-section {
  background: white;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  padding: 40px;
  text-align: center;
  margin-top: 20px;
}

.ptg-quiz-result-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  align-items: center;
  margin-top: 20px;
}

/* 학습 완료 화면 버튼 스타일 (다시 시작, 학습현황으로 바로가기) */
#ptg-quiz-restart-btn,
#ptg-quiz-dashboard-btn {
  background: white;
  border: 1px solid #e5e7eb;
  color: #333;
  padding: 10px 20px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

#ptg-quiz-restart-btn:hover,
#ptg-quiz-dashboard-btn:hover {
  background: #f8f9fa;
  border-color: #d1d5db;
  color: #1f2937;
}

.ptg-quiz-result-section h2 {
  color: #333;
  margin-bottom: 30px;
  font-size: 28px;
  font-weight: 700;
}

.ptg-quiz-result-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.ptg-quiz-stat-item {
  padding: 20px;
  background: #f8f9fa;
  border-radius: 6px;
  transition: all 0.2s ease;
}

/* 틀린 문제 박스 hover 스타일 */
.ptg-quiz-stat-incorrect {
  cursor: pointer;
}

.ptg-quiz-stat-incorrect:hover {
  background: #fff3cd !important;
  border: 2px solid #ffc107;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.ptg-quiz-stat-label {
  display: block;
  font-size: 14px;
  color: #666;
  margin-bottom: 8px;
}

.ptg-quiz-stat-value {
  display: block;
  font-size: 32px;
  font-weight: 700;
  color: #4a90e2;
}

/* 모바일 반응형 */
@media (max-width: 768px) {
  .ptg-quiz-result-section {
    padding: 30px 20px;
  }

  .ptg-quiz-result-section h2 {
    font-size: 24px;
    margin-bottom: 20px;
  }

  .ptg-quiz-result-stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 25px;
  }

  .ptg-quiz-stat-item {
    padding: 15px;
  }

  /* 모바일에서도 틀린 문제 박스 클릭 가능 표시 */
  .ptg-quiz-stat-incorrect {
    cursor: pointer;
  }

  .ptg-quiz-stat-incorrect:active {
    background: #fff3cd !important;
    transform: scale(0.98);
  }

  .ptg-quiz-stat-label {
    font-size: 13px;
    margin-bottom: 6px;
  }

  .ptg-quiz-stat-value {
    font-size: 24px;
  }

  .ptg-quiz-result-actions {
    flex-direction: column;
    gap: 10px;
  }

  .ptg-quiz-result-actions .ptg-btn {
    width: 100%;
  }
}

/* 실전 모의 학습Tip 모달 */
.ptg-quiz-tip-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ptg-quiz-tip-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(2px);
}

.ptg-quiz-tip-modal-content {
  position: relative;
  width: min(900px, calc(100% - 40px));
  max-width: 900px;
  max-height: 90vh;
  background: white;
  border-radius: 16px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: ptg-quiz-tip-modal-fade-in 0.3s ease;
  padding: 0;
}

@keyframes ptg-quiz-tip-modal-fade-in {
  from {
    opacity: 0;
    transform: scale(0.95);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

.ptg-quiz-tip-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 24px 32px;
  background: linear-gradient(135deg, #4a90e2 0%, #357abd 100%);
  color: white;
  border-bottom: 1px solid rgba(255, 255, 255, 0.25);
  width: 100%;
  box-sizing: border-box;
  border-top-left-radius: inherit;
  border-top-right-radius: inherit;
  min-height: 72px;
}

.ptg-quiz-tip-modal-header h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  color: white;
}

.ptg-quiz-tip-modal-close,
.ptg-study-tip-close {
  background: #ffffff;
  border: none;
  outline: none;
  color: #1d3f7c;
  font-size: 26px;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  line-height: 1;
  padding: 0;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
  -webkit-appearance: none;
  appearance: none;
}

.ptg-quiz-tip-modal-header .ptg-quiz-tip-modal-close,
.ptg-quiz-tip-modal-header .ptg-study-tip-close {
  border: none !important;
  background: #ffffff !important;
  border-radius: 999px !important;
  width: 44px !important;
  height: 44px !important;
  padding: 0 !important;
}

.ptg-quiz-tip-modal-close span,
.ptg-study-tip-close span {
  pointer-events: none;
}

.ptg-quiz-tip-modal-close:hover,
.ptg-study-tip-close:hover {
  background: #f0f4ff;
  color: #0f2a57;
  transform: scale(1.05);
}

.ptg-quiz-tip-modal-close:focus-visible,
.ptg-study-tip-close:focus-visible {
  outline: 3px solid rgba(255, 255, 255, 0.85);
  outline-offset: 2px;
}

.ptg-quiz-tip-modal-body {
  padding: 30px;
  overflow-y: auto;
  flex: 1;
}

.ptg-quiz-tip-section {
  margin-bottom: 30px;
}

.ptg-quiz-tip-section:last-child {
  margin-bottom: 0;
}

.ptg-quiz-tip-section h3 {
  margin: 0 0 15px 0;
  font-size: 20px;
  font-weight: 700;
  color: #333;
  border-bottom: 2px solid #4a90e2;
  padding-bottom: 8px;
}

.ptg-quiz-tip-section ul {
  margin: 10px 0;
  padding-left: 20px;
}

.ptg-quiz-tip-section li {
  margin: 8px 0;
  line-height: 1.6;
  color: #555;
}

.ptg-quiz-tip-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-top: 15px;
}

.ptg-quiz-tip-card {
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  padding: 20px;
  transition: all 0.3s ease;
}

.ptg-quiz-tip-card:hover {
  box-shadow: 0 4px 12px rgba(74, 144, 226, 0.15);
  transform: translateY(-2px);
}

.ptg-quiz-tip-card h4 {
  margin: 0 0 16px 0;
  font-size: 20px;
  font-weight: 700;
  color: #4a90e2;
  line-height: 1.3;
}

.ptg-quiz-tip-card ul {
  margin: 0;
  padding-left: 0;
  list-style: none;
}

.ptg-quiz-tip-card ul h5 {
  margin: 0 0 8px 0;
  font-size: 16px;
  font-weight: 600;
  color: #333;
  line-height: 1.4;
  padding-top: 16px;
}

.ptg-quiz-tip-card ul h5:first-child {
  padding-top: 0;
}

.ptg-quiz-tip-card li {
  margin: 0 0 12px 0;
  font-size: 14px;
  color: #666;
  line-height: 1.6;
  padding-left: 0;
}

.ptg-quiz-tip-count {
  font-size: 24px;
  font-weight: 700;
  color: #333;
  margin: 10px 0;
}

.ptg-quiz-tip-card code {
  display: block;
  margin-top: 15px;
  padding: 8px 12px;
  background: #e9ecef;
  border-radius: 4px;
  font-size: 12px;
  color: #495057;
  word-break: break-all;
}

.ptg-quiz-tip-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
  margin-top: 15px;
}

.ptg-quiz-tip-option {
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 6px;
  padding: 15px;
}

.ptg-quiz-tip-option strong {
  display: block;
  font-size: 16px;
  color: #4a90e2;
  margin-bottom: 8px;
}

.ptg-quiz-tip-option p {
  margin: 5px 0;
  font-size: 14px;
  color: #666;
  line-height: 1.5;
}

.ptg-quiz-tip-option code {
  display: block;
  margin-top: 10px;
  padding: 6px 10px;
  background: #e9ecef;
  border-radius: 4px;
  font-size: 12px;
  color: #495057;
  word-break: break-all;
}

.ptg-quiz-tip-note {
  font-size: 13px;
  color: #dc3545;
  font-weight: 600;
  margin: 10px 0;
  padding: 8px 12px;
  background: #fff3cd;
  border-left: 3px solid #ffc107;
  border-radius: 4px;
}

.ptg-quiz-tip-examples {
  margin-top: 15px;
}

.ptg-quiz-tip-example {
  background: #f8f9fa;
  border-left: 4px solid #4a90e2;
  padding: 15px;
  margin-bottom: 12px;
  border-radius: 4px;
}

.ptg-quiz-tip-example strong {
  display: block;
  font-size: 15px;
  color: #333;
  margin-bottom: 8px;
}

.ptg-quiz-tip-example code {
  display: block;
  padding: 10px;
  background: #e9ecef;
  border-radius: 4px;
  font-size: 13px;
  color: #495057;
  word-break: break-all;
  font-family: "Courier New", monospace;
}

/* 모바일 반응형 */
@media (max-width: 768px) {
  .ptg-quiz-tip-link {
    font-size: 15px;
  }

  .ptg-quiz-tip-modal-content {
    width: 95%;
    max-height: 95vh;
  }

  .ptg-quiz-tip-modal-header {
    padding: 15px 20px;
  }

  .ptg-quiz-tip-modal-header h2 {
    font-size: 20px;
  }

  .ptg-quiz-tip-modal-body {
    padding: 20px;
  }

  .ptg-quiz-tip-section h3 {
    font-size: 18px;
  }

  .ptg-quiz-tip-grid {
    grid-template-columns: 1fr;
  }

  .ptg-quiz-tip-options {
    grid-template-columns: 1fr;
  }

  /* Hide Drawing Tool on Mobile (Phones only, show on Tablets 768px+) */
  @media (max-width: 767px) {

    .ptg-btn-drawing,
    .ptg-toolbar-icons .ptg-btn-drawing,
    .ptg-quiz-toolbar .ptg-btn-drawing,
    button.ptg-btn-drawing {
      display: none !important;
      visibility: hidden !important;
      width: 0 !important;
      height: 0 !important;
      padding: 0 !important;
      margin: 0 !important;
      opacity: 0 !important;
      pointer-events: none !important;
    }
  }
}

/* ==========================================================================
   Improved Toolbar Styling (Pure Icon Style - No Feedback)
   ========================================================================== */

/* Remove default styles and boxy effects */
.ptg-toolbar-icons button.ptg-btn-icon,
.ptg-quiz-toolbar button.ptg-btn-icon {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  margin: 0 4px !important;
  width: 30px !important;
  height: 30px !important;
  min-width: unset !important;
  border-radius: 4px !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  transition: none;
}

/* Icon Sizing - Always Original */
.ptg-toolbar-icons button.ptg-btn-icon img,
.ptg-toolbar-icons button.ptg-btn-icon svg,
.ptg-quiz-toolbar button.ptg-btn-icon img,
.ptg-quiz-toolbar button.ptg-btn-icon svg {
  width: 20px !important;
  height: 20px !important;
  filter: none !important;
  /* Show original icon color always */
}

/* Hover State - No Change */
.ptg-toolbar-icons button.ptg-btn-icon:hover,
.ptg-quiz-toolbar button.ptg-btn-icon:hover {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  transform: none !important;
  opacity: 1 !important;
}

.ptg-toolbar-icons button.ptg-btn-icon:hover img,
.ptg-toolbar-icons button.ptg-btn-icon:hover svg,
.ptg-quiz-toolbar button.ptg-btn-icon:hover img,
.ptg-quiz-toolbar button.ptg-btn-icon:hover svg {
  filter: none !important;
}

/* Active State - Show Blue Border (Ported from Study) */
/* Active State - Show Blue Border (Universal Fix) */
.ptg-toolbar-icons button.ptg-btn-icon.active,
.ptg-quiz-toolbar button.ptg-btn-icon.active {
  color: #4a90e2 !important;
  background-color: transparent !important;
  border: 2px solid #4a90e2 !important;
  border-radius: 4px !important;
  position: relative !important;
  /* Ensure z-index works */
  z-index: 10 !important;
  /* Bring to front */
  box-shadow: 0 0 0 1px rgba(74, 144, 226, 0.1) !important;
  /* Subtle glow boost */
}

.ptg-toolbar-icons button.ptg-btn-icon.active:hover,
.ptg-quiz-toolbar button.ptg-btn-icon.active:hover {
  background-color: rgba(74, 144, 226, 0.05) !important;
  border-color: #357abd !important;
  color: #357abd !important;
}

/* Active Icon - Turn Blue using Filter */
.ptg-toolbar-icons button.ptg-btn-icon.active img,
.ptg-toolbar-icons button.ptg-btn-icon.active svg,
.ptg-quiz-toolbar button.ptg-btn-icon.active img,
.ptg-quiz-toolbar button.ptg-btn-icon.active svg {
  filter: invert(48%) sepia(79%) saturate(2476%) hue-rotate(190deg) brightness(118%) contrast(119%) !important;
  opacity: 1 !important;
}

/* 검색 토글 버튼 */
#ptg-quiz-search-toggle {
  margin-left: 8px;
  /* Changed from margin-right */
  background: transparent;
  border: none !important;
  /* Removed border */
  color: #666;
  width: 42px;
  height: 42px;
  display: inline-flex !important;
  /* 멤버십과 상관없이 항상 표시 */
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.2s;
  visibility: visible !important;
  /* 멤버십과 상관없이 항상 표시 */
  opacity: 1 !important;
  /* 멤버십과 상관없이 항상 표시 */
}

/* Dashicons 스타일 보장 */
#ptg-quiz-search-toggle .dashicons {
  font-family: dashicons !important;
  font-size: 20px !important;
  line-height: 1 !important;
  display: inline-block !important;
  width: 20px !important;
  height: 20px !important;
  text-align: center !important;
  vertical-align: middle !important;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

#ptg-quiz-search-toggle:hover {
  background: #f1f5f9;
  color: #333;
}

#ptg-quiz-search-toggle.active {
  background: #e2e8f0;
  color: #4a90e2;
}

/* 검색 컨테이너 */
.rdhgates-search-container {
  margin-top: 10px !important;
  padding: 15px !important;
  background: #f8fafc !important;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  display: flex;
  gap: 10px;
  align-items: center;
  animation: slideDown 0.2s ease-out;
}

/* 검색 입력창 화살표 제거 */
.rdhgates-search-container input {
  background-image: none !important;
  padding-right: 12px !important;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 펜 메뉴 z-index 수정 */
.ptg-pen-menu {
  z-index: 10000 !important;
}

/* 모바일 검색창 세로 정렬 */
@media (max-width: 768px) {
  .rdhgates-search-container {
    flex-direction: column;
    align-items: stretch;
  }

  .rdhgates-search-container input {
    width: 100%;
    margin-bottom: 5px;
  }
}

/* Fix Pen Menu Interaction - Z-Index Hierarchy */
/* Fix Pen Menu Interaction - Z-Index Hierarchy */
.ptg-quiz-toolbar {
  position: relative;
  z-index: 20000 !important;
  /* Ensure toolbar is above everything */
}

.ptg-pen-menu {
  z-index: 20001 !important;
  /* Ensure menu is above toolbar */
}

.ptg-quiz-card {
  width: 100% !important;
  /* Responsive width */
  max-width: 500px !important;
  min-width: auto !important;
  /* Remove fixed min-width */
  box-sizing: border-box !important;
  /* Better for responsive */
  margin: 0 auto;
  position: relative;
  /* Create positioning context for overlay */
  z-index: 1;
  /* Lower than toolbar */
  background: #fff;
  padding: 30px;
  /* Keep existing padding */
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.ptg-drawing-overlay {
  position: absolute;
  /* Force absolute positioning */
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1000;
  /* Inside card context */
  pointer-events: none;
  /* Allow clicks to pass through overlay wrapper */
}

/* Ensure canvas captures drawing events but doesn't block if not drawing */
#ptg-drawing-canvas {
  pointer-events: auto;
}

/* Quiz Card Wrapper */
.ptg-quiz-card-wrapper {
  display: flex;
  justify-content: center;
  width: 100%;
  position: relative;
  z-index: 1;
}

/* Ensure content inside fits */
.ptg-quiz-question,
.ptg-quiz-choices,
.ptg-quiz-explanation {
  width: 100%;
  box-sizing: border-box;
}


/* Edit Mode Styles */
.ptg-edit-textarea {
  width: 100%;
  min-height: 150px;
  padding: 10px;
  border: 2px solid #e2e8f0;
  border-radius: 6px;
  font-family: inherit;
  font-size: 1rem;
  resize: vertical;
  box-sizing: border-box;
  margin-bottom: 10px;
  line-height: 1.6;

  /* Hardening for interaction */
  position: relative;
  z-index: 9999;
  pointer-events: auto !important;
  user-select: text !important;
  -webkit-user-select: text !important;
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  background-color: #ffffff !important;
  color: #000000 !important;
}

.ptg-edit-textarea:focus {
  outline: none;
  border-color: #3182ce;
  box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.1);
}

.ptg-edit-explanation {
  min-height: 120px;
  background-color: #f0fff4;
  border-color: #c6f6d5;
}


.ptg-edit-explanation:focus {
  border-color: #38a169;
  box-shadow: 0 0 0 3px rgba(56, 161, 105, 0.1);
}

/* Hide choices when in edit mode */
.ptg-quiz-editing #ptg-quiz-choices {
  display: none !important;
}


/* Smooth expansion for edit mode */
.ptg-edit-textarea {
  overflow-y: hidden;
}

/* Filter Checkboxes */
.rdhgates-filter-checkboxes {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 0 8px;
  height: 42px;
  /* Match input height */
}

/* Specificity override: .rdhgates-filter-row label has display: none !important */
.rdhgates-filter-row label.ptg-checkbox-label {
  display: flex !important;
  align-items: center;
  gap: 6px;
  font-size: 14px !important;
  color: #4a5568 !important;
  cursor: pointer;
  user-select: none;
  margin: 0 !important;
  width: auto !important;
}

.ptg-checkbox-label input[type="checkbox"] {
  width: 14px;
  height: 14px;
  margin: 0;
  cursor: pointer;
  accent-color: #4a90e2;
}

.ptg-checkbox-label:hover {
  color: #2d3748 !important;
}

/* Header Layout Override for independent checkboxes */
.ptg-quiz-header {
  justify-content: flex-start !important;
  /* Changed from space-between to allow grouping on right */
}

.ptg-quiz-header h1 {
  margin-right: auto !important;
  /* Push everything else to right */
}

/* Checkboxes style in header */
.header-checkboxes {
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
  margin-right: 15px !important;
  border-right: 1px solid #e2e8f0;
  /* Optional separator */
  padding-right: 15px !important;
}

/* Mobile responsiveness for filters */
@media (max-width: 600px) {
  .rdhgates-filter-checkboxes {
    width: 100%;
    justify-content: flex-start;
    padding: 8px 0;
    height: auto;
  }

  /* Mobile Header Layout Adjustment */
  .ptg-quiz-header {
    flex-wrap: wrap !important;
    padding-bottom: 12px !important;
    align-items: center !important;
  }

  .ptg-quiz-header h1 {
    margin-right: auto !important;
    margin-bottom: 0 !important;
    width: auto !important;
    /* Let it shrink if needed */
    font-size: 16px !important;
    /* Slightly smaller on mobile to fit */
    order: 1 !important;
  }

  .ptg-quiz-header-right {
    order: 2 !important;
    /* Links remain on row 1 right */
    gap: 8px !important;
  }

  /* Move checkboxes to 2nd row and center align */
  .header-checkboxes {
    width: 100% !important;
    order: 3 !important;
    margin-right: 0 !important;
    margin-top: 10px !important;
    padding-right: 0 !important;
    padding-top: 10px !important;
    border-right: none !important;
    border-top: 1px solid #f1f5f9;
    justify-content: center !important;
    /* Center alignment requested */
    white-space: nowrap !important;
  }

  .ptg-checkbox-label {
    font-size: 14px !important;
  }

  /* Hide active filters area on mobile */
  #ptg-quiz-active-filters {
    display: none !important;
  }
}

/* Loading Overlay Styles (Global for Quiz) */
.ptg-loading {
  position: fixed !important;
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%, -50%) !important;
  width: auto !important;
  height: auto !important;
  min-width: 300px;
  background-color: white !important;
  z-index: 99999 !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: center !important;
  align-items: center !important;
  padding: 30px !important;
  border-radius: 12px !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15) !important;
  font-size: 16px !important;
  font-weight: 700 !important;
  color: #4a5568 !important;
}

/* [FIX] Mock Exam 모드에서 정답 확인 버튼 깜빡임 방지 (강제 숨김) */
/* Global Exam Mode Class */
.ptg-mode-mock-exam #ptg-btn-check-answer,
.is-exam-mode #ptg-btn-check-answer,
.ptg-mode-mock-exam .ptg-explanation-box,
.is-exam-mode .ptg-explanation-box,
.is-exam-mode .ptg-check-answer-btn {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
  opacity: 0 !important;
  height: 0 !important;
  width: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
}

/* ==========================================================================
   OMR Question Grid (Quick Navigation)
   ========================================================================== */

/* Overlay Modal */
.ptg-omr-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  z-index: 99999;
  display: none;
  /* Toggled by JS */
  justify-content: center;
  align-items: center;
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.ptg-omr-modal.active {
  opacity: 1;
}

/* Modal Content Container */
.ptg-omr-content {
  background: #fff;
  width: 90%;
  max-width: 800px;
  max-height: 85vh;
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: ptgSlideUp 0.3s ease-out;
}

@keyframes ptgSlideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Header */
.ptg-omr-header {
  padding: 15px 20px;
  border-bottom: 1px solid #eee;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f8f9fa;
}

.ptg-omr-title {
  font-size: 18px;
  font-weight: 700;
  color: #333;
  margin: 0;
}

.ptg-omr-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #999;
  padding: 0 5px;
  line-height: 1;
  transition: color 0.2s;
}

.ptg-omr-close:hover {
  color: #333;
}

/* Legend (Status Guide) */
.ptg-omr-legend {
  padding: 10px 20px;
  background: #fff;
  display: flex;
  gap: 15px;
  justify-content: center;
  border-bottom: 1px solid #f0f0f0;
  flex-wrap: wrap;
  font-size: 13px;
  color: #666;
}

.ptg-legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
}

.ptg-legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  display: inline-block;
}

.ptg-legend-dot.default {
  background: #fff;
  border: 1px solid #e0e0e0;
}

.ptg-legend-dot.answered {
  background: #e3f2fd;
  border: 1px solid #90caf9;
}

.ptg-legend-dot.current {
  border: 2px solid #2ecc71;
  background: #fff;
}

.ptg-legend-dot.bookmarked {
  background: #fff;
  border: 1px solid #e0e0e0;
  position: relative;
}

.ptg-legend-dot.bookmarked::after {
  content: '';
  position: absolute;
  top: 2px;
  right: 2px;
  width: 4px;
  height: 4px;
  background: #f1c40f;
  border-radius: 50%;
}

.ptg-legend-dot.wrong {
  background: #ffebee;
  border: 1px solid #ef9a9a;
}

/* Grid Scroll Area */
.ptg-omr-body {
  padding: 20px;
  overflow-y: auto;
  background: #fcfcfc;
}

/* The Grid */
.ptg-omr-grid {
  display: grid;
  gap: 10px;
  /* Responsive Grid: min 45px width per item */
  grid-template-columns: repeat(auto-fill, minmax(45px, 1fr));
}

/* Grid Buttons */
.ptg-omr-btn {
  width: 100%;
  aspect-ratio: 1;
  border: 1px solid #e0e0e0;
  background: #fff;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 500;
  color: #555;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: all 0.2s ease;
  position: relative;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.ptg-omr-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  border-color: #bdc3c7;
}

/* States */
.ptg-omr-btn.answered {
  background: #e3f2fd;
  color: #1976d2;
  border-color: #90caf9;
  font-weight: 700;
}

.ptg-omr-btn.current {
  border: 2px solid #2ecc71;
  color: #2ecc71;
  background: #fff;
  font-weight: 800;
  box-shadow: 0 0 0 2px rgba(46, 204, 113, 0.2);
}

.ptg-omr-btn.bookmarked::after {
  content: '';
  position: absolute;
  top: 4px;
  right: 4px;
  width: 6px;
  height: 6px;
  background: #f1c40f;
  border-radius: 50%;
}

.ptg-omr-btn.wrong {
  background: #ffebee;
  color: #d32f2f;
  border-color: #ef9a9a;
}




/* Flashcard Modal Specifics */
#ptg-quiz-flashcard-modal {
  z-index: 22000 !important;
  /* Ensure it's above the toolbar (20000) */
}

#ptg-quiz-flashcard-modal .ptg-modal-content {
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  border: 1px solid #e2e8f0;
  max-height: calc(100vh - 160px) !important;
  /* Adjust for top padding */
}


/* Progress Bar Styles (Similar to Study 1100) */
.ptg-quiz-subject-item {
  /* Existing overrides */
  flex-direction: column !important;
  justify-content: center !important;
  align-items: stretch !important;
  position: relative !important;
  overflow: hidden !important;
  padding-bottom: 12px !important;
  /* Space for bar */
}

.ptg-quiz-subject-content {
  display: flex;
  justify-content: space-between;
  /* Space between name and percent */
  align-items: center;
  gap: 8px;
  width: 100%;
  position: relative;
  z-index: 2;
  padding: 0 4px;
  /* Slight padding */
}

.ptg-quiz-subject-percent {
  font-size: 0.85em;
  color: #4a90e2;
  /* Blue to match theme */
  font-weight: 700;
  opacity: 1;
  /* Always visible (default 0 or empty is fine, but 1 confirms visibility) */
  transition: opacity 0.3s ease;
  white-space: nowrap;
}

.ptg-quiz-subject-progress-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: rgba(74, 144, 226, 0.1);
}

.ptg-quiz-subject-progress-fill {
  height: 100%;
  background: #4a90e2;
  width: 0%;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Hotfix: Force remove underline from specific buttons */
#rdhgates-time-tip-btn,
#rdhgates-giveup-btn {
  text-decoration: none !important;
  border-bottom-width: 1px !important;
}

#rdhgates-time-tip-btn *,
#rdhgates-giveup-btn * {
  text-decoration: none !important;
}