/**
 * PTGates Quiz - 스타일시트
 * 
 * 문제 풀이 UI 스타일링
 */

/* 컨테이너 */
.ptg-quiz-container {
    max-width: 960px;
    margin: 0 auto;
    padding: 20px;
}

/* 플러그인 헤더 */
.ptgates-header {
    background: linear-gradient(135deg, #4a90e2 0%, #357abd 100%);
    color: white;
    padding: 17px 30px;
    border-radius: 8px;
    margin-bottom: 5px;
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.3);
    overflow: hidden;
}

.ptgates-header-content {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    flex-wrap: nowrap !important;
    flex-direction: row !important;
    gap: 15px;
    white-space: nowrap !important;
    overflow: hidden;
    width: 100%;
    box-sizing: border-box;
}

.ptgates-header-title {
    margin: 0 !important;
    font-size: 24px;
    font-weight: 700;
    color: white;
    letter-spacing: -0.5px;
    white-space: nowrap !important;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1 1 auto !important;
    min-width: 0 !important;
    max-width: calc(100% - 100px) !important;
    display: block !important;
}

.ptg-quiz-tip-link {
    font-size: 15px;
    font-weight: 600;
    color: white;
    text-decoration: none;
    white-space: nowrap !important;
    transition: all 0.3s ease;
    line-height: 1;
    margin: 0 !important;
    padding: 0 !important;
    flex-shrink: 0 !important;
    flex-grow: 0 !important;
    flex-basis: auto !important;
    opacity: 0.9;
    display: inline-block !important;
}

.ptg-quiz-tip-link:hover {
    opacity: 1;
    text-decoration: underline;
}

.ptg-quiz-tip-link:active {
    opacity: 0.8;
}

/* 도구바 */
.ptg-quiz-toolbar {
    display: none; /* 시작 전에는 숨김 - 조회 후 표시 */
    justify-content: flex-start;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    padding: 8px;
    background: #f5f5f5;
    border-radius: 4px;
    position: relative;
    z-index: 1000; /* 드로잉 오버레이보다 높게 설정 */
}

/* 드로잉 툴바 (왼쪽) */
.ptg-drawing-toolbar {
    flex-shrink: 0; /* 크기 고정 */
}

.ptg-toolbar-icons {
    display: flex;
    gap: 8px;
    flex-shrink: 0; /* 크기 고정 */
    margin-left: auto; /* 항상 오른쪽에 고정 */
}

/* 암기카드와 노트 버튼 강제 숨김 (제거됨) */
.ptg-btn-flashcard,
.ptg-btn-notebook {
    display: none !important;
    visibility: hidden !important;
}

.ptg-btn-icon {
    background: transparent;
    border: none;
    padding: 8px;
    cursor: pointer;
    font-size: 20px;
    transition: color 0.2s, background-color 0.2s;
    border-radius: 4px;
    color: #333;
    outline: none;
}

/* 모든 버튼 hover 시에만 색상 변화 (active 상태가 아닐 때) */
.ptg-btn-icon:not(.active):hover {
    color: #d63638;
    background-color: #fcd5d5;
}

/* 선택 기능 (북마크, 복습 필요) - 선택 시 파란색 계통 + 진한 배경색 */
.ptg-btn-bookmark.active,
.ptg-btn-review.active {
    color: #0073aa;
    background-color: #b3d9e8;
}

.ptg-btn-bookmark.active:hover,
.ptg-btn-review.active:hover {
    color: #005a87;
    background-color: #99cce0;
}

/* 표시 기능 (메모, 드로잉) - 표시 시 파란색 계통 + 진한 배경색 */
.ptg-btn-notes.active,
.ptg-btn-drawing.active {
    color: #0073aa;
    background-color: #b3d9e8;
}

.ptg-btn-notes.active:hover,
.ptg-btn-drawing.active:hover {
    color: #005a87;
    background-color: #99cce0;
}

/* 포커스 상태 - active 상태가 아닐 때는 outline만, 배경색 없음 */
.ptg-btn-icon:not(.active):focus,
.ptg-btn-icon:not(.active):focus-visible {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
    color: #333;
    background-color: transparent;
}

.ptg-btn-icon:not(.active):focus:hover,
.ptg-btn-icon:not(.active):focus-visible:hover {
    color: #d63638;
    background-color: #ffe5e5;
}

/* active 상태와 포커스 상태가 함께 있을 때만 배경색 적용 */
.ptg-btn-icon.active:focus,
.ptg-btn-icon.active:focus-visible {
    outline: 2px solid #005a87;
    outline-offset: 2px;
    color: #005a87;
    background-color: #99cce0;
}

.ptg-btn-icon.active:focus:hover,
.ptg-btn-icon.active:focus-visible:hover {
    color: #005a87;
    background-color: #99cce0;
}

/* 클릭 시 색상 변화 방지 (: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;
}

/* 필터 섹션 (ptgates-engine과 동일) */
.ptgates-filter-section {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 30px;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: flex-end;
}

.ptgates-filter-row {
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex: 1;
    min-width: 150px;
}

.ptgates-filter-row label {
    display: none !important;
}

.ptgates-filter-input {
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background: white;
    transition: border-color 0.2s;
}

.ptgates-filter-input:focus {
    outline: none;
    border-color: #4a90e2;
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

/* 버튼 (ptgates-engine과 동일) */
.ptgates-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.ptgates-btn-primary {
    background: #4a90e2;
    color: white;
}

.ptgates-btn-primary:hover {
    background: #357abd;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(74, 144, 226, 0.3);
}

.ptgates-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* 진행 상태 (ptgates-engine과 동일) */
.ptgates-progress-section {
    margin-top: 0;
    margin-bottom: 30px;
}

.ptgates-progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-size: 16px;
    font-weight: 600;
}

.ptgates-progress-right {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    gap: 12px;
}

.ptgates-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;
}

.ptgates-time-tip-btn:hover {
    color: #357abd;
}

.ptgates-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;
}

.ptgates-btn-giveup-inline:hover {
    background: #c82333;
}

.ptgates-timer {
    color: #4a90e2;
    font-family: 'Courier New', monospace;
    white-space: nowrap;
    display: inline-block !important;
}

.ptgates-progress-bar {
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 15px;
}

.ptgates-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4a90e2, #357abd);
    transition: width 0.3s ease;
    width: 0%;
}

/* 시간관리 tip 모달 (ptgates-engine과 동일) */
.ptgates-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
}

.ptgates-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(2px);
}

.ptgates-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;
}

.ptgates-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid #e9ecef;
    background: #f8f9fa;
}

.ptgates-modal-header h3 {
    margin: 0;
    color: #333;
    font-size: 20px;
    font-weight: 700;
}

.ptgates-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;
}

.ptgates-modal-close:hover {
    color: #dc3545;
}

.ptgates-modal-body {
    padding: 25px;
    overflow-y: auto;
    flex: 1;
}

.ptgates-modal-body p {
    margin-bottom: 15px;
    line-height: 1.7;
    color: #333;
}

.ptgates-time-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    font-size: 14px;
}

.ptgates-time-table thead {
    background: #4a90e2;
    color: white;
}

.ptgates-time-table th,
.ptgates-time-table td {
    padding: 12px;
    text-align: left;
    border: 1px solid #dee2e6;
}

.ptgates-time-table tbody tr:nth-child(even) {
    background: #f8f9fa;
}

.ptgates-time-table tbody tr:hover {
    background: #e9ecef;
}

.ptgates-tip-summary {
    margin-top: 25px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 4px solid #4a90e2;
}

.ptgates-tip-summary h4 {
    margin: 0 0 15px 0;
    color: #4a90e2;
    font-size: 18px;
}

.ptgates-tip-summary ul {
    margin: 15px 0;
    padding-left: 25px;
}

.ptgates-tip-summary li {
    margin-bottom: 10px;
    line-height: 1.7;
    color: #333;
}

.ptgates-tip-summary p {
    margin-top: 15px;
    margin-bottom: 0;
    font-weight: 600;
    color: #333;
}

/* 문제 카드 영역 */
.ptg-quiz-card-wrapper {
    position: relative;
    margin-bottom: 20px;
    display: none; /* 시작 전에는 숨김 - 조회 후 표시 */
}

.ptg-quiz-card {
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 30px;
    min-height: 200px;
    /* 기출 문제 학습과 동일한 스타일 */
    margin-bottom: 20px;
}

.ptg-question-content {
    font-size: 16px;
    line-height: 1.4;
    color: #333;
    margin: 0;
    margin-bottom: 8px;
    /* 기출 문제 학습과 동일 */
}

/* 선택지 영역 (카드 안에 포함) - 기출 문제 학습 형식 */
.ptg-quiz-card .ptg-quiz-choices {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    /* 질문 바로 아래에 연속해서 표시 */
}

.ptg-quiz-loading {
    text-align: center;
    padding: 40px;
}

/* 드로잉 오버레이 */
.ptg-drawing-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: transparent;
    z-index: 100; /* 툴바(z-index: 1000)보다 낮게 설정 */
    pointer-events: none; /* 기본적으로 모든 이벤트 통과 */
}

.ptg-drawing-overlay.active {
    pointer-events: none; /* 오버레이 자체는 이벤트 통과 */
}

.ptg-drawing-overlay #ptg-drawing-canvas {
    pointer-events: auto !important; /* 캔버스만 이벤트 수신 */
    z-index: 101; /* 툴바(z-index: 1000)보다 낮게 */
}

#ptg-drawing-canvas {
    display: block;
    position: fixed;
    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; /* 툴바보다 낮게 */
}

.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: normal !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: flex-start;
    gap: 12px;
    margin-bottom: 24px;
    position: relative;
    display: none; /* 시작 전에는 숨김 - 조회 후 표시 */
}

.ptg-quiz-actions .ptg-btn {
    min-width: 150px;
    margin: 0;
}

.ptg-btn-primary {
    background: #ff6b9d;
    color: white;
    border: 1px solid #ff4d8a;
    border-radius: 6px;
    padding: 12px 24px;
    font-size: 16px;
    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;
}

.ptg-explanation-content {
    line-height: 1.6;
}

/* 메모 패널 */
.ptg-notes-panel {
    margin-top: 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: 150px;
    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: 800px) {
    .ptgates-header {
        padding: 17px 12px !important;
    }
    
    .ptgates-header-content {
        gap: 8px !important;
        overflow: hidden !important;
    }
    
    .ptgates-header-title {
        font-size: 24px !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        flex: 1 1 0% !important;
        min-width: 0 !important;
    }
    
    .ptg-quiz-tip-link {
        font-size: 15px !important;
        white-space: nowrap !important;
        flex-shrink: 0 !important;
    }
}

@media (max-width: 767px) {
    .ptg-quiz-container {
        padding: 12px;
    }
    
    /* 모바일에서 헤더 padding 줄이기 */
    .ptgates-header {
        padding: 17px 10px !important;
    }
    
    /* 모바일에서 헤더 제목과 링크를 같은 줄에 배치 */
    .ptgates-header-content {
        gap: 8px !important;
        overflow: hidden !important;
    }
    
    .ptgates-header-title {
        font-size: 18px !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        flex: 1 1 0% !important;
        min-width: 0 !important;
    }
    
    .ptg-quiz-tip-link {
        font-size: 15px !important;
        white-space: nowrap !important;
        flex-shrink: 0 !important;
    }
    
    .ptg-quiz-card {
        padding: 16px;
    }
    
    /* 모바일에서 드로잉 기능 완전히 숨김 */
    .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;
        font-weight: 500;
    }
    
    .ptg-timer-display {
        font-size: 16px;
        font-weight: 600;
        min-width: 50px;
    }
    
    .ptg-btn-giveup-inline {
        font-size: 14px;
        padding: 5px 12px;
        margin-left: 8px;
    }
    
    /* 모바일에서 버튼 크기 조정 */
    .ptg-quiz-actions .ptg-btn {
        min-width: 120px;
        flex: 1;
        max-width: 200px;
        width: 100%;
    }
}

/* 접근성 */
.ptg-btn-icon:focus-visible,
.ptg-btn:focus-visible,
.ptg-choice-item:focus-visible {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* 완료 화면 (결과 요약) */
.ptg-quiz-result-section {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 40px;
    text-align: center;
    margin-top: 20px;
}

.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;
}

.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-label {
        font-size: 13px;
        margin-bottom: 6px;
    }
    
    .ptg-quiz-stat-value {
        font-size: 24px;
    }
}

/* 실전 모의 학습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;
    max-width: 900px;
    max-height: 90vh;
    width: 90%;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: ptg-quiz-tip-modal-fade-in 0.3s ease;
}

@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;
    padding: 20px 30px;
    background: linear-gradient(135deg, #4a90e2 0%, #357abd 100%);
    color: white;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.ptg-quiz-tip-modal-header h2 {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    color: white;
}

.ptg-quiz-tip-modal-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 28px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    line-height: 1;
    padding: 0;
}

.ptg-quiz-tip-modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.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;
    }
}

